forked from Mirror/frr
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>
This commit is contained in:
parent
2ee43c873e
commit
bdbea51c98
|
@ -8,7 +8,6 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <linux/if_packet.h>
|
#include <linux/if_packet.h>
|
||||||
#include <sys/ioctl.h>
|
|
||||||
|
|
||||||
#include "nhrp_protocol.h"
|
#include "nhrp_protocol.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
@ -98,25 +97,6 @@ int os_recvmsg(uint8_t *buf, size_t *len, int *ifindex, uint8_t *addr,
|
||||||
return 0;
|
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)
|
static int linux_icmp_redirect_off(const char *iface)
|
||||||
{
|
{
|
||||||
char fname[PATH_MAX];
|
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);
|
ret |= linux_icmp_redirect_off(ifname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret |= linux_configure_arp(ifname, 1);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,6 +351,7 @@ void nhrp_interface_update(struct interface *ifp)
|
||||||
if (!if_ad->configured) {
|
if (!if_ad->configured) {
|
||||||
os_configure_dmvpn(ifp->ifindex, ifp->name,
|
os_configure_dmvpn(ifp->ifindex, ifp->name,
|
||||||
afi2family(afi));
|
afi2family(afi));
|
||||||
|
nhrp_interface_update_arp(ifp, true);
|
||||||
nhrp_send_zebra_configure_arp(ifp, afi2family(afi));
|
nhrp_send_zebra_configure_arp(ifp, afi2family(afi));
|
||||||
if_ad->configured = 1;
|
if_ad->configured = 1;
|
||||||
nhrp_interface_update_address(ifp, afi, 1);
|
nhrp_interface_update_address(ifp, afi, 1);
|
||||||
|
|
|
@ -452,6 +452,12 @@ int nhrp_send_zebra_gre_request(struct interface *ifp)
|
||||||
return zclient_send_zebra_gre_request(zclient, 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)
|
void nhrp_zebra_terminate(void)
|
||||||
{
|
{
|
||||||
zclient_register_neigh(zclient, VRF_DEFAULT, AFI_IP, false);
|
zclient_register_neigh(zclient, VRF_DEFAULT, AFI_IP, false);
|
||||||
|
|
|
@ -362,6 +362,7 @@ int sock_open_unix(const char *path);
|
||||||
|
|
||||||
void nhrp_interface_init(void);
|
void nhrp_interface_init(void);
|
||||||
void nhrp_interface_update(struct interface *ifp);
|
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_mtu(struct interface *ifp, afi_t afi);
|
||||||
void nhrp_interface_update_nbma(struct interface *ifp,
|
void nhrp_interface_update_nbma(struct interface *ifp,
|
||||||
struct nhrp_gre_info *gre_info);
|
struct nhrp_gre_info *gre_info);
|
||||||
|
|
Loading…
Reference in a new issue