diff options
Diffstat (limited to 'zebra/if_netlink.c')
| -rw-r--r-- | zebra/if_netlink.c | 67 |
1 files changed, 51 insertions, 16 deletions
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index be7a5ac78d..65fc8789f9 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -38,6 +38,7 @@ #include "vrf.h" #include "mpls.h" +#include "vty.h" #include "zebra/zserv.h" #include "zebra/zebra_ns.h" #include "zebra/zebra_vrf.h" @@ -172,6 +173,48 @@ netlink_to_zebra_link_type (unsigned int hwt) } } + +//Temporary Assignments to compile on older platforms. +#ifndef IFLA_BR_MAX +#define IFLA_BR_MAX 39 +#endif + +#ifndef IFLA_VXLAN_ID +#define IFLA_VXLAN_ID 1 +#endif + +#ifndef IFLA_VXLAN_LOCAL +#define IFLA_VXLAN_LOCAL 4 +#endif + +#ifndef IFLA_VXLAN_MAX +#define IFLA_VXLAN_MAX 26 +#endif + +#ifndef IFLA_BRIDGE_MAX +#define IFLA_BRIDGE_MAX 2 +#endif + +#ifndef IFLA_BRIDGE_VLAN_INFO +#define IFLA_BRIDGE_VLAN_INFO 2 +#endif + +#ifndef BRIDGE_VLAN_INFO_PVID +#define BRIDGE_VLAN_INFO_PVID (1<<1) +#endif + +#ifndef RTEXT_FILTER_BRVLAN +#define RTEXT_FILTER_BRVLAN (1<<1) +#endif + +#ifndef NTF_SELF +#define NTF_SELF 0x02 +#endif + +#ifndef IFLA_BR_VLAN_FILTERING +#define IFLA_BR_VLAN_FILTERING 7 +#endif + #define parse_rtattr_nested(tb, max, rta) \ netlink_parse_rtattr((tb), (max), RTA_DATA(rta), RTA_PAYLOAD(rta)) @@ -259,7 +302,7 @@ netlink_vrf_change (struct nlmsghdr *h, struct rtattr *tb, const char *name) during bootstrap. */ static int netlink_interface (struct sockaddr_nl *snl, struct nlmsghdr *h, - ns_id_t ns_id) + ns_id_t ns_id, int startup) { int len; struct ifinfomsg *ifi; @@ -360,7 +403,7 @@ interface_lookup_netlink (struct zebra_ns *zns) ret = netlink_request (AF_PACKET, RTM_GETLINK, &zns->netlink_cmd); if (ret < 0) return ret; - ret = netlink_parse_info (netlink_interface, &zns->netlink_cmd, zns, 0); + ret = netlink_parse_info (netlink_interface, &zns->netlink_cmd, zns, 0, 1); if (ret < 0) return ret; @@ -368,19 +411,17 @@ interface_lookup_netlink (struct zebra_ns *zns) ret = netlink_request (AF_INET, RTM_GETADDR, &zns->netlink_cmd); if (ret < 0) return ret; - ret = netlink_parse_info (netlink_interface_addr, &zns->netlink_cmd, zns, 0); + ret = netlink_parse_info (netlink_interface_addr, &zns->netlink_cmd, zns, 0, 1); if (ret < 0) return ret; -#ifdef HAVE_IPV6 /* Get IPv6 address of the interfaces. */ ret = netlink_request (AF_INET6, RTM_GETADDR, &zns->netlink_cmd); if (ret < 0) return ret; - ret = netlink_parse_info (netlink_interface_addr, &zns->netlink_cmd, zns, 0); + ret = netlink_parse_info (netlink_interface_addr, &zns->netlink_cmd, zns, 0, 1); if (ret < 0) return ret; -#endif /* HAVE_IPV6 */ return 0; } @@ -434,7 +475,7 @@ netlink_address (int cmd, int family, struct interface *ifp, addattr_l (&req.n, sizeof req, IFA_LABEL, ifc->label, strlen (ifc->label) + 1); - return netlink_talk (&req.n, &zns->netlink_cmd, zns); + return netlink_talk (netlink_talk_filter, &req.n, &zns->netlink_cmd, zns, 0); } int @@ -451,7 +492,7 @@ kernel_address_delete_ipv4 (struct interface *ifp, struct connected *ifc) int netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h, - ns_id_t ns_id) + ns_id_t ns_id, int startup) { int len; struct ifaddrmsg *ifa; @@ -466,11 +507,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h, zns = zebra_ns_lookup (ns_id); ifa = NLMSG_DATA (h); - if (ifa->ifa_family != AF_INET -#ifdef HAVE_IPV6 - && ifa->ifa_family != AF_INET6 -#endif /* HAVE_IPV6 */ - ) + if (ifa->ifa_family != AF_INET && ifa->ifa_family != AF_INET6) return 0; if (h->nlmsg_type != RTM_NEWADDR && h->nlmsg_type != RTM_DELADDR) @@ -570,7 +607,6 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h, (struct in_addr *) addr, ifa->ifa_prefixlen, (struct in_addr *) broad); } -#ifdef HAVE_IPV6 if (ifa->ifa_family == AF_INET6) { if (h->nlmsg_type == RTM_NEWADDR) @@ -588,14 +624,13 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h, (struct in6_addr *) addr, ifa->ifa_prefixlen, (struct in6_addr *) broad); } -#endif /* HAVE_IPV6 */ return 0; } int netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h, - ns_id_t ns_id) + ns_id_t ns_id, int startup) { int len; struct ifinfomsg *ifi; |
