diff options
author | Louis Scalbert <louis.scalbert@6wind.com> | 2024-01-11 11:25:36 +0100 |
---|---|---|
committer | Louis Scalbert <louis.scalbert@6wind.com> | 2024-01-24 10:05:29 +0100 |
commit | bdbea51c98171c0c41bf9e93ed29e6e20a75ae49 (patch) | |
tree | a6db2e095b518c8e839a68cec829ff0206c2182e /nhrpd | |
parent | lib,zebra: add zapi message to control noarp flag (diff) | |
download | frr-bdbea51c98171c0c41bf9e93ed29e6e20a75ae49.tar.xz frr-bdbea51c98171c0c41bf9e93ed29e6e20a75ae49.zip |
nhrpd: unset noarp flag using a zapi message
Unset the IFF_NOARP interface flag using a ZAPI message. It removes the
dependency to if.h headers.
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'nhrpd')
-rw-r--r-- | nhrpd/linux.c | 21 | ||||
-rw-r--r-- | nhrpd/nhrp_interface.c | 1 | ||||
-rw-r--r-- | nhrpd/nhrp_route.c | 6 | ||||
-rw-r--r-- | nhrpd/nhrpd.h | 1 |
4 files changed, 8 insertions, 21 deletions
diff --git a/nhrpd/linux.c b/nhrpd/linux.c index b25df9ff2..e4df0dd96 100644 --- a/nhrpd/linux.c +++ b/nhrpd/linux.c @@ -8,7 +8,6 @@ #include <fcntl.h> #include <errno.h> #include <linux/if_packet.h> -#include <sys/ioctl.h> #include "nhrp_protocol.h" #include "os.h" @@ -98,25 +97,6 @@ int os_recvmsg(uint8_t *buf, size_t *len, int *ifindex, uint8_t *addr, return 0; } -static int linux_configure_arp(const char *iface, int on) -{ - struct ifreq ifr; - - strlcpy(ifr.ifr_name, iface, IFNAMSIZ); - if (ioctl(nhrp_socket_fd, SIOCGIFFLAGS, &ifr)) - return -1; - - if (on) - ifr.ifr_flags &= ~IFF_NOARP; - else - ifr.ifr_flags |= IFF_NOARP; - - if (ioctl(nhrp_socket_fd, SIOCSIFFLAGS, &ifr)) - return -1; - - return 0; -} - static int linux_icmp_redirect_off(const char *iface) { char fname[PATH_MAX]; @@ -144,7 +124,6 @@ int os_configure_dmvpn(unsigned int ifindex, const char *ifname, int af) ret |= linux_icmp_redirect_off(ifname); break; } - ret |= linux_configure_arp(ifname, 1); return ret; } diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c index b82743f00..7d0ab9762 100644 --- a/nhrpd/nhrp_interface.c +++ b/nhrpd/nhrp_interface.c @@ -351,6 +351,7 @@ void nhrp_interface_update(struct interface *ifp) if (!if_ad->configured) { os_configure_dmvpn(ifp->ifindex, ifp->name, afi2family(afi)); + nhrp_interface_update_arp(ifp, true); nhrp_send_zebra_configure_arp(ifp, afi2family(afi)); if_ad->configured = 1; nhrp_interface_update_address(ifp, afi, 1); diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c index c05a8a3ba..fd9090bd6 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -452,6 +452,12 @@ int nhrp_send_zebra_gre_request(struct interface *ifp) return zclient_send_zebra_gre_request(zclient, ifp); } +void nhrp_interface_update_arp(struct interface *ifp, bool arp_enable) +{ + zclient_interface_set_arp(zclient, ifp, arp_enable); +} + + void nhrp_zebra_terminate(void) { zclient_register_neigh(zclient, VRF_DEFAULT, AFI_IP, false); diff --git a/nhrpd/nhrpd.h b/nhrpd/nhrpd.h index 1421f0fc3..50653c784 100644 --- a/nhrpd/nhrpd.h +++ b/nhrpd/nhrpd.h @@ -362,6 +362,7 @@ int sock_open_unix(const char *path); void nhrp_interface_init(void); void nhrp_interface_update(struct interface *ifp); +void nhrp_interface_update_arp(struct interface *ifp, bool arp_enable); void nhrp_interface_update_mtu(struct interface *ifp, afi_t afi); void nhrp_interface_update_nbma(struct interface *ifp, struct nhrp_gre_info *gre_info); |