summaryrefslogtreecommitdiffstats
path: root/nhrpd/netlink_arp.c
diff options
context:
space:
mode:
Diffstat (limited to 'nhrpd/netlink_arp.c')
-rw-r--r--nhrpd/netlink_arp.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c
index 2e22f8e..be909c8 100644
--- a/nhrpd/netlink_arp.c
+++ b/nhrpd/netlink_arp.c
@@ -7,6 +7,10 @@
#include "config.h"
#endif
+#ifdef GNU_LINUX
+#include <linux/rtnetlink.h>
+#endif
+
#include <fcntl.h>
#include <net/if.h>
#include <netinet/if_ether.h>
@@ -150,6 +154,10 @@ int nhrp_neighbor_operation(ZAPI_CALLBACK_ARGS)
struct zapi_neigh_ip api = {};
zclient_neigh_ip_decode(zclient->ibuf, &api);
+
+ if (api.ip_len != IPV4_MAX_BYTELEN && api.ip_len != 0)
+ return 0;
+
if (api.ip_in.ipa_type == AF_UNSPEC)
return 0;
sockunion_family(&addr) = api.ip_in.ipa_type;
@@ -172,26 +180,30 @@ int nhrp_neighbor_operation(ZAPI_CALLBACK_ARGS)
return 0;
debugf(NHRP_DEBUG_KERNEL,
"Netlink: %s %pSU dev %s lladdr %pSU nud 0x%x cache used %u type %u",
- (cmd == ZEBRA_NHRP_NEIGH_GET)
- ? "who-has"
- : (cmd == ZEBRA_NHRP_NEIGH_ADDED) ? "new-neigh"
- : "del-neigh",
+ (cmd == ZEBRA_NEIGH_GET) ? "who-has"
+ : (cmd == ZEBRA_NEIGH_ADDED) ? "new-neigh"
+ : "del-neigh",
&addr, ifp->name, &lladdr, ndm_state, c->used, c->cur.type);
- if (cmd == ZEBRA_NHRP_NEIGH_GET) {
+ if (cmd == ZEBRA_NEIGH_GET) {
if (c->cur.type >= NHRP_CACHE_CACHED) {
nhrp_cache_set_used(c, 1);
debugf(NHRP_DEBUG_KERNEL,
"Netlink: update binding for %pSU dev %s from c %pSU peer.vc.nbma %pSU to lladdr %pSU",
&addr, ifp->name, &c->cur.remote_nbma_natoa,
&c->cur.peer->vc->remote.nbma, &lladdr);
+
+ if (lladdr.sa.sa_family == AF_UNSPEC)
+ /* nothing from zebra, so use nhrp peer */
+ lladdr = c->cur.peer->vc->remote.nbma;
+
/* In case of shortcuts, nbma is given by lladdr, not
* vc->remote.nbma.
*/
netlink_update_binding(ifp, &addr, &lladdr);
}
} else {
- state = (cmd == ZEBRA_NHRP_NEIGH_ADDED) ? ndm_state
- : ZEBRA_NEIGH_STATE_FAILED;
+ state = (cmd == ZEBRA_NEIGH_ADDED) ? ndm_state
+ : ZEBRA_NEIGH_STATE_FAILED;
nhrp_cache_set_used(c, state == ZEBRA_NEIGH_STATE_REACHABLE);
}
return 0;