0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Trivial code cleanups

This commit is contained in:
Ondrej Zajicek 2024-01-22 06:29:14 +01:00
parent 2b6bd8ca3a
commit 13c6cf8a74
5 changed files with 26 additions and 25 deletions

View File

@ -136,7 +136,7 @@ bfd_merge_options(const struct bfd_iface_config *cf, const struct bfd_options *o
.min_tx_int = opts->min_tx_int ?: cf->min_tx_int,
.idle_tx_int = opts->idle_tx_int ?: cf->idle_tx_int,
.multiplier = opts->multiplier ?: cf->multiplier,
.passive = opts->passive_set ? opts->passive : cf->passive
.passive = opts->passive_set ? opts->passive : cf->passive,
};
}
@ -231,7 +231,7 @@ bfd_session_control_tx_timer(struct bfd_session *s, int reset)
return;
stop:
stop:
tm_stop(s->tx_timer);
s->last_tx = 0;
}
@ -548,7 +548,7 @@ static struct bfd_iface_config bfd_default_iface = {
.min_rx_int = BFD_DEFAULT_MIN_RX_INT,
.min_tx_int = BFD_DEFAULT_MIN_TX_INT,
.idle_tx_int = BFD_DEFAULT_IDLE_TX_INT,
.multiplier = BFD_DEFAULT_MULTIPLIER
.multiplier = BFD_DEFAULT_MULTIPLIER,
};
static inline struct bfd_iface_config *
@ -800,7 +800,7 @@ static struct resclass bfd_request_class = {
bfd_request_free,
bfd_request_dump,
NULL,
NULL
NULL,
};

View File

@ -387,7 +387,7 @@ bfd_rx_hook(sock *sk, uint len)
u32 old_tx_int = s->des_min_tx_int;
u32 old_rx_int = s->rem_min_rx_int;
s->rem_id= ntohl(pkt->snd_id);
s->rem_id = ntohl(pkt->snd_id);
s->rem_state = bfd_pkt_get_state(pkt);
s->rem_diag = bfd_pkt_get_diag(pkt);
s->rem_demand_mode = pkt->flags & BFD_FLAG_DEMAND;
@ -438,7 +438,7 @@ bfd_open_rx_sk(struct bfd_proto *p, int multihop, int af)
sk_start(sk);
return sk;
err:
err:
sk_log_error(sk, p->p.name);
rfree(sk);
return NULL;
@ -470,7 +470,7 @@ bfd_open_rx_sk_bound(struct bfd_proto *p, ip_addr local, struct iface *ifa)
sk_start(sk);
return sk;
err:
err:
sk_log_error(sk, p->p.name);
rfree(sk);
return NULL;
@ -502,7 +502,7 @@ bfd_open_tx_sk(struct bfd_proto *p, ip_addr local, struct iface *ifa)
sk_start(sk);
return sk;
err:
err:
sk_log_error(sk, p->p.name);
rfree(sk);
return NULL;

View File

@ -1126,7 +1126,7 @@ static void
bgp_connect(struct bgp_proto *p) /* Enter Connect state and start establishing connection */
{
struct bgp_conn *conn = &p->outgoing_conn;
int hops = p->cf->multihop ? : 1;
int hops = p->cf->multihop ?: 1;
DBG("BGP: Connecting\n");
sock *s = sk_new(p->p.pool);
@ -1263,7 +1263,7 @@ bgp_incoming_connection(sock *sk, uint dummy UNUSED)
return 0;
}
hops = p->cf->multihop ? : 1;
hops = p->cf->multihop ?: 1;
if (sk_set_ttl(sk, p->cf->ttl_security ? 255 : hops) < 0)
goto err;
@ -2245,7 +2245,7 @@ bgp_reconfigure(struct proto *P, struct proto_config *CF)
return 1;
}
#define TABLE(cf, NAME) ((cf)->NAME ? (cf)->NAME->table : NULL )
#define TABLE(cf, NAME) ((cf)->NAME ? (cf)->NAME->table : NULL)
static int
bgp_channel_reconfigure(struct channel *C, struct channel_config *CC, int *import_changed, int *export_changed)
@ -2377,10 +2377,10 @@ bgp_store_error(struct bgp_proto *p, struct bgp_conn *c, u8 class, u32 code)
}
static char *bgp_state_names[] = { "Idle", "Connect", "Active", "OpenSent", "OpenConfirm", "Established", "Close" };
static char *bgp_err_classes[] = { "", "Error: ", "Socket: ", "Received: ", "BGP Error: ", "Automatic shutdown: ", ""};
static char *bgp_misc_errors[] = { "", "Neighbor lost", "Invalid next hop", "Kernel MD5 auth failed", "No listening socket", "Link down", "BFD session down", "Graceful restart"};
static char *bgp_auto_errors[] = { "", "Route limit exceeded"};
static char *bgp_gr_states[] = { "None", "Regular", "Long-lived"};
static char *bgp_err_classes[] = { "", "Error: ", "Socket: ", "Received: ", "BGP Error: ", "Automatic shutdown: ", "" };
static char *bgp_misc_errors[] = { "", "Neighbor lost", "Invalid next hop", "Kernel MD5 auth failed", "No listening socket", "Link down", "BFD session down", "Graceful restart" };
static char *bgp_auto_errors[] = { "", "Route limit exceeded" };
static char *bgp_gr_states[] = { "None", "Regular", "Long-lived" };
static const char *
bgp_last_errmsg(struct bgp_proto *p)

View File

@ -77,6 +77,7 @@
*/
#include <stdlib.h>
#include "rip.h"
@ -1358,7 +1359,7 @@ struct protocol proto_rip = {
.shutdown = rip_shutdown,
.reconfigure = rip_reconfigure,
.get_route_info = rip_get_route_info,
.get_attr = rip_get_attr
.get_attr = rip_get_attr,
};
void