]> git.puffer.fish Git - matthieu/frr.git/commitdiff
nhrp, zebra, lib: pass exact received neighbor state value to nhrp
authorPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 25 Aug 2021 09:40:41 +0000 (11:40 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 26 Aug 2021 07:19:42 +0000 (09:19 +0200)
As NHRP expects some notification of neighboring entries on GRE
interface, when a new interface notification is encountered, the
exact neighbor state flag is found. Previously, the flag passed
to the upper layer was forced to NDM_STATE which is REACHABLE,
as can be seen on below trace:

2021/08/25 10:58:39 NHRP: [QQ0NK-1H449] Netlink: new-neigh 102.1.1.1 dev gre1 lladdr 10.125.0.2 nud 0x2 cache used 1 type 5

When passing the real value, NHRP received an other value like STALE.

2021/08/25 11:28:44 NHRP: [QQ0NK-1H449] Netlink: new-neigh 102.1.1.1 dev gre1 lladdr 10.125.0.2 nud 0x4 cache used 0 type 5

This flag is important for NHRP, as it permits to monitor the link
layer of NHRP entries.

Fixes: d603c0774eba ("nhrp, zebra, lib: enforce usage of zapi_neigh_ip structure")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
lib/zclient.c
lib/zclient.h
nhrpd/nhrp_route.c
zebra/zapi_msg.c

index 5ca5849948cda3b507d044fe463dcdeb211d5d5f..a1e7194890fa69a9bdd4793fb5416567616c96c1 100644 (file)
@@ -4487,11 +4487,9 @@ static int zclient_neigh_ip_read_entry(struct stream *s, struct ipaddr *add)
        return -1;
 }
 
-int zclient_neigh_ip_encode(struct stream *s,
-                           uint16_t cmd,
-                           union sockunion *in,
-                           union sockunion *out,
-                           struct interface *ifp)
+int zclient_neigh_ip_encode(struct stream *s, uint16_t cmd, union sockunion *in,
+                           union sockunion *out, struct interface *ifp,
+                           int ndm_state)
 {
        int ret = 0;
 
@@ -4506,7 +4504,7 @@ int zclient_neigh_ip_encode(struct stream *s,
                stream_putc(s, AF_UNSPEC);
        stream_putl(s, ifp->ifindex);
        if (out)
-               stream_putl(s, ZEBRA_NEIGH_STATE_REACHABLE);
+               stream_putl(s, ndm_state);
        else
                stream_putl(s, ZEBRA_NEIGH_STATE_FAILED);
        return ret;
index a25c5800b720fe1742319b86d3859317232e9cc0..d24f06b778fae7e0aeb54909bfc88211c0eb4add 100644 (file)
@@ -867,11 +867,9 @@ struct zapi_neigh_ip {
        uint32_t ndm_state;
 };
 int zclient_neigh_ip_decode(struct stream *s, struct zapi_neigh_ip *api);
-int zclient_neigh_ip_encode(struct stream *s,
-                           uint16_t cmd,
-                           union sockunion *in,
-                           union sockunion *out,
-                           struct interface *ifp);
+int zclient_neigh_ip_encode(struct stream *s, uint16_t cmd, union sockunion *in,
+                           union sockunion *out, struct interface *ifp,
+                           int ndm_state);
 
 /*
  * We reserve the top 4 bits for l2-NHG, everything else
index ee8db277d9a9a69b24966831af3b53ebf6da5605..12a2fc2fa0d9cea3e0906d56c218a54c67451987 100644 (file)
@@ -452,7 +452,8 @@ void nhrp_send_zebra_nbr(union sockunion *in,
        stream_reset(s);
        zclient_neigh_ip_encode(s, out ? ZEBRA_NEIGH_IP_ADD :
                                ZEBRA_NEIGH_IP_DEL, in, out,
-                               ifp);
+                               ifp, out ? ZEBRA_NEIGH_STATE_REACHABLE
+                               : ZEBRA_NEIGH_STATE_FAILED);
        stream_putw_at(s, 0, stream_get_endp(s));
        zclient_send_message(zclient);
 }
index ddd6a74c0bbb0d8e66b8384ce907ef4c432b4d4d..6666b3525ec1a742ad8bc447ecd8eba0801b72af 100644 (file)
@@ -997,7 +997,8 @@ void zsend_nhrp_neighbor_notify(int cmd, struct interface *ifp,
                        continue;
 
                s = stream_new(ZEBRA_MAX_PACKET_SIZ);
-               zclient_neigh_ip_encode(s, cmd, &ip, link_layer_ipv4, ifp);
+               zclient_neigh_ip_encode(s, cmd, &ip, link_layer_ipv4, ifp,
+                                       ndm_state);
                stream_putw_at(s, 0, stream_get_endp(s));
                zserv_send_message(client, s);
        }