]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
fixup! tcp ao: key change works
authorKaterina Kubecova <katerina.kubecova@nic.cz>
Fri, 23 Feb 2024 09:19:34 +0000 (10:19 +0100)
committerKaterina Kubecova <katerina.kubecova@nic.cz>
Fri, 23 Feb 2024 09:19:34 +0000 (10:19 +0100)
proto/bgp/bgp.c
proto/bgp/config.Y
sysdep/linux/sysio.h

index 321279993cfa5e63b0d99a8814e6a140fef53b24..5bbc96c31dae52c3b096529761e59fda1ed4efb8 100644 (file)
@@ -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;
index 927c4cae2b40f9e9b947ca5f47e28c78a164d546..f3cac9391a1425519a739f01a39f8f520fa61f4a 100644 (file)
@@ -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; }
index 04d9315466d04b2e2ce46b85fda062205d29ee74..a2e4318246b4c14f96296d65d514072f1d8e8039 100644 (file)
@@ -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;