diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index 32127999..5bbc96c3 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -2158,7 +2158,7 @@ int compare_aos(struct ao_key *a, struct ao_key *b) { if (a->local_id != b->local_id) return 1; - if (a->remote_id != b->local_id) + if (a->remote_id != b->remote_id) return 1; if (strcmp(a->cipher, b->cipher)) return 1; diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y index 927c4cae..f3cac939 100644 --- a/proto/bgp/config.Y +++ b/proto/bgp/config.Y @@ -257,13 +257,13 @@ ao_first_item: ao_item: REMOTE ID expr ';' {log("remote id %i", $3); BGP_CFG->ao_key->remote_id = $3; } - | CIPHER text ';' { char *c = lp_alloc(BGP_CFG->ao_lp, strlen($2)+1); - memcpy(c, $2, strlen($2)+1); + | CIPHER text ';' { char *c = lp_alloc(BGP_CFG->ao_lp, strlen($2)); + memcpy(c, $2, strlen($2)); BGP_CFG->ao_key->cipher = c; log("ciph[%s]", $2); } | MASTER KEY text ';' { - char *k = lp_alloc(BGP_CFG->ao_lp, strlen($3)+1); - memcpy(k, $3, strlen($3)+1); + char *k = lp_alloc(BGP_CFG->ao_lp, strlen($3)); + memcpy(k, $3, strlen($3)); BGP_CFG->ao_key->master_key = k; log("key[%s]", BGP_CFG->ao_key->master_key);} | DEPRECATED ';' { BGP_CFG->ao_key->required = -1; } diff --git a/sysdep/linux/sysio.h b/sysdep/linux/sysio.h index 04d93154..a2e43182 100644 --- a/sysdep/linux/sysio.h +++ b/sysdep/linux/sysio.h @@ -244,7 +244,7 @@ int get_current_key_id(int sock_fd) memset(&tmp, 0, sizeof(struct tcp_ao_info_opt_ext)); socklen_t len = sizeof(tmp); - if (getsockopt(sock_fd, IPPROTO_TCP, TCP_AO_INFO, &tmp, len)) + if (getsockopt(sock_fd, IPPROTO_TCP, TCP_AO_INFO, &tmp, &len)) { log("get current ao key failed %i", errno); return -1;