mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-09-07 22:15:19 +00:00
Trivial code cleanups
This commit is contained in:
parent
2b6bd8ca3a
commit
13c6cf8a74
@ -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,
|
||||
};
|
||||
|
||||
|
||||
|
@ -96,12 +96,12 @@ bfd_format_flags(u8 flags, char *buf)
|
||||
}
|
||||
|
||||
const u8 bfd_auth_type_to_hash_alg[] = {
|
||||
[BFD_AUTH_NONE] = ALG_UNDEFINED,
|
||||
[BFD_AUTH_SIMPLE] = ALG_UNDEFINED,
|
||||
[BFD_AUTH_KEYED_MD5] = ALG_MD5,
|
||||
[BFD_AUTH_METICULOUS_KEYED_MD5] = ALG_MD5,
|
||||
[BFD_AUTH_KEYED_SHA1] = ALG_SHA1,
|
||||
[BFD_AUTH_METICULOUS_KEYED_SHA1] = ALG_SHA1,
|
||||
[BFD_AUTH_NONE] = ALG_UNDEFINED,
|
||||
[BFD_AUTH_SIMPLE] = ALG_UNDEFINED,
|
||||
[BFD_AUTH_KEYED_MD5] = ALG_MD5,
|
||||
[BFD_AUTH_METICULOUS_KEYED_MD5] = ALG_MD5,
|
||||
[BFD_AUTH_KEYED_SHA1] = ALG_SHA1,
|
||||
[BFD_AUTH_METICULOUS_KEYED_SHA1] = ALG_SHA1,
|
||||
};
|
||||
|
||||
|
||||
@ -151,7 +151,7 @@ bfd_fill_authentication(struct bfd_proto *p, struct bfd_session *s, struct bfd_c
|
||||
uint hash_len = mac_type_length(pass->alg);
|
||||
|
||||
/* Increase CSN about one time per second */
|
||||
u32 new_time = (u64) current_time() >> 20;
|
||||
u32 new_time = (u64) current_time() >> 20;
|
||||
if ((new_time != s->tx_csn_time) || meticulous)
|
||||
{
|
||||
s->tx_csn++;
|
||||
@ -321,7 +321,7 @@ bfd_send_ctl(struct bfd_proto *p, struct bfd_session *s, int final)
|
||||
static int
|
||||
bfd_rx_hook(sock *sk, uint len)
|
||||
{
|
||||
struct bfd_proto *p = sk->data;
|
||||
struct bfd_proto *p = sk->data;
|
||||
struct bfd_ctl_packet *pkt = (struct bfd_ctl_packet *) sk->rbuf;
|
||||
const char *err_dsc = NULL;
|
||||
uint err_val = 0;
|
||||
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -172,7 +172,7 @@ ospf_add_flushed_to_lsrt(struct ospf_proto *p, struct ospf_neighbor *n)
|
||||
WALK_SLIST(en, p->lsal)
|
||||
if ((en->lsa.age == LSA_MAXAGE) && (en->lsa_body != NULL) &&
|
||||
lsa_flooding_allowed(en->lsa_type, en->domain, n->ifa) &&
|
||||
lsa_is_acceptable(en->lsa_type, n, p))
|
||||
lsa_is_acceptable(en->lsa_type, n, p))
|
||||
ospf_lsa_lsrt_up(en, n);
|
||||
|
||||
/* If we found any flushed LSA, we send them ASAP */
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user