summaryrefslogtreecommitdiffstats
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r--zebra/rt_netlink.c379
1 files changed, 176 insertions, 203 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 07e86647..8f8ad58a 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -41,6 +41,7 @@
#include "zebra/redistribute.h"
#include "zebra/interface.h"
#include "zebra/debug.h"
+#include <stddef.h>
/* Socket interface to kernel */
struct nlsock
@@ -65,7 +66,7 @@ static const struct message nlmsg_str[] = {
{0, NULL}
};
-static const char *nexthop_types_desc[] =
+static const char *nexthop_types_desc[] =
{
"none",
"Directly connected",
@@ -85,32 +86,11 @@ extern struct zebra_privs_t zserv_privs;
extern u_int32_t nl_rcvbufsize;
-/* Note: on netlink systems, there should be a 1-to-1 mapping between interface
- names and ifindex values. */
-static void
-set_ifindex(struct interface *ifp, unsigned int ifi_index)
-{
- struct interface *oifp;
+extern int rib_system_routes;
- if (((oifp = if_lookup_by_index(ifi_index)) != NULL) && (oifp != ifp))
- {
- if (ifi_index == IFINDEX_INTERNAL)
- zlog_err("Netlink is setting interface %s ifindex to reserved "
- "internal value %u", ifp->name, ifi_index);
- else
- {
- if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug("interface index %d was renamed from %s to %s",
- ifi_index, oifp->name, ifp->name);
- if (if_is_up(oifp))
- zlog_err("interface rename detected on up interface: index %d "
- "was renamed from %s to %s, results are uncertain!",
- ifi_index, oifp->name, ifp->name);
- if_delete_update(oifp);
- }
- }
- ifp->ifindex = ifi_index;
-}
+static void
+netlink_delroute (int family, void *dest, int length, void *gate,
+ int index, int table, int proto);
static int
netlink_recvbuf (struct nlsock *nl, uint32_t newsize)
@@ -280,7 +260,8 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
while (1)
{
- char buf[4096];
+ //increased from 4096 to 32768 as recvmsg overrun error
+ char buf[32768];
struct iovec iov = { buf, sizeof buf };
struct sockaddr_nl snl;
struct msghdr msg = { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 };
@@ -293,6 +274,7 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
continue;
if (errno == EWOULDBLOCK || errno == EAGAIN)
break;
+
zlog (NULL, LOG_ERR, "%s recvmsg overrun: %s",
nl->name, safe_strerror(errno));
continue;
@@ -311,6 +293,13 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
return -1;
}
+ /* JF: Ignore messages that aren't from the kernel */
+ if ( snl.nl_pid != 0 )
+ {
+ zlog_debug ("Ignoring message from pid %u", snl.nl_pid );
+ continue;
+ }
+
for (h = (struct nlmsghdr *) buf; NLMSG_OK (h, (unsigned int) status);
h = NLMSG_NEXT (h, status))
{
@@ -462,14 +451,28 @@ netlink_interface (struct sockaddr_nl *snl, struct nlmsghdr *h)
#endif /* IFLA_WIRELESS */
if (tb[IFLA_IFNAME] == NULL)
- return -1;
+ {
+ zlog_err("%s: missing interface name in message", __func__);
+ return -1;
+ }
name = (char *) RTA_DATA (tb[IFLA_IFNAME]);
+ if (ifi->ifi_index == IFINDEX_INTERNAL)
+ {
+ zlog_err("%s: reserved ifindex", __func__);
+ return -1;
+ }
+
/* Add interface. */
- ifp = if_get_by_name (name);
- set_ifindex(ifp, ifi->ifi_index);
+ ifp = if_lookup_by_index(ifi->ifi_index);
+ if (!ifp)
+ {
+ ifp = if_create(name, strlen(name));
+ ifp->ifindex = ifi->ifi_index;
+ }
+ strncpy(ifp->name, name, INTERFACE_NAMSIZ);
ifp->flags = ifi->ifi_flags & 0x0000fffff;
- ifp->mtu6 = ifp->mtu = *(int *) RTA_DATA (tb[IFLA_MTU]);
+ ifp->mtu6 = ifp->mtu = *(uint32_t *) RTA_DATA (tb[IFLA_MTU]);
ifp->metric = 1;
/* Hardware type and address. */
@@ -523,7 +526,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h)
#ifdef HAVE_IPV6
&& ifa->ifa_family != AF_INET6
#endif /* HAVE_IPV6 */
- )
+ )
return 0;
if (h->nlmsg_type != RTM_NEWADDR && h->nlmsg_type != RTM_DELADDR)
@@ -548,7 +551,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h)
{
char buf[BUFSIZ];
zlog_debug ("netlink_interface_addr %s %s:",
- lookup (nlmsg_str, h->nlmsg_type), ifp->name);
+ lookup (nlmsg_str, h->nlmsg_type), ifp->name);
if (tb[IFA_LOCAL])
zlog_debug (" IFA_LOCAL %s/%d",
inet_ntop (ifa->ifa_family, RTA_DATA (tb[IFA_LOCAL]),
@@ -614,9 +617,25 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h)
if (ifa->ifa_family == AF_INET)
{
if (h->nlmsg_type == RTM_NEWADDR)
- connected_add_ipv4 (ifp, flags,
- (struct in_addr *) addr, ifa->ifa_prefixlen,
- (struct in_addr *) broad, label);
+ {
+ struct connected *ifc;
+ ifc = connected_add_ipv4 (ifp, flags,
+ (struct in_addr *) addr, ifa->ifa_prefixlen,
+ (struct in_addr *) broad, label);
+
+ /* If address added, but interface is down,
+ then remove the FIB entry from kernel.
+ */
+ if (rib_system_routes && ifc && !if_is_operative (ifp))
+ {
+ struct prefix_ipv4 p;
+ PREFIX_COPY_IPV4(&p, CONNECTED_PREFIX(ifc));
+ apply_mask_ipv4 (&p);
+
+ netlink_delroute (p.family, &p.prefix, p.prefixlen, NULL,
+ ifp->ifindex, RT_TABLE_MAIN, RTPROT_KERNEL);
+ }
+ }
else
connected_delete_ipv4 (ifp, flags,
(struct in_addr *) addr, ifa->ifa_prefixlen,
@@ -626,9 +645,9 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h)
if (ifa->ifa_family == AF_INET6)
{
if (h->nlmsg_type == RTM_NEWADDR)
- connected_add_ipv6 (ifp, flags,
- (struct in6_addr *) addr, ifa->ifa_prefixlen,
- (struct in6_addr *) broad, label);
+ connected_add_ipv6 (ifp, flags,
+ (struct in6_addr *) addr, ifa->ifa_prefixlen,
+ (struct in6_addr *) broad, label);
else
connected_delete_ipv6 (ifp,
(struct in6_addr *) addr, ifa->ifa_prefixlen,
@@ -699,7 +718,7 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h)
src = NULL;
if (tb[RTA_OIF])
- index = *(int *) RTA_DATA (tb[RTA_OIF]);
+ index = *(uint32_t *) RTA_DATA (tb[RTA_OIF]);
if (tb[RTA_DST])
dest = RTA_DATA (tb[RTA_DST]);
@@ -714,7 +733,7 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h)
gate = RTA_DATA (tb[RTA_GATEWAY]);
if (tb[RTA_PRIORITY])
- metric = *(int *) RTA_DATA(tb[RTA_PRIORITY]);
+ metric = *(uint32_t *) RTA_DATA(tb[RTA_PRIORITY]);
if (rtm->rtm_family == AF_INET)
{
@@ -723,7 +742,8 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h)
memcpy (&p.prefix, dest, 4);
p.prefixlen = rtm->rtm_dst_len;
- rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, flags, &p, gate, src, index, table, metric, 0);
+ rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, flags, &p, gate, src, index,
+ table, metric, 0, rtm->rtm_scope);
}
#ifdef HAVE_IPV6
if (rtm->rtm_family == AF_INET6)
@@ -830,7 +850,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
src = NULL;
if (tb[RTA_OIF])
- index = *(int *) RTA_DATA (tb[RTA_OIF]);
+ index = *(uint32_t *) RTA_DATA (tb[RTA_OIF]);
if (tb[RTA_DST])
dest = RTA_DATA (tb[RTA_DST]);
@@ -861,7 +881,8 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
}
if (h->nlmsg_type == RTM_NEWROUTE)
- rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, src, index, table, 0, 0);
+ rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, src, index, table, 0,
+ 0, rtm->rtm_scope);
else
rib_delete_ipv4 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, table);
}
@@ -936,66 +957,103 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
#endif /* IFLA_WIRELESS */
if (tb[IFLA_IFNAME] == NULL)
- return -1;
+ {
+ zlog_err("%s: missing interface name", __func__);
+ return -1;
+ }
name = (char *) RTA_DATA (tb[IFLA_IFNAME]);
/* Add interface. */
if (h->nlmsg_type == RTM_NEWLINK)
{
- ifp = if_lookup_by_name (name);
+ unsigned long new_flags = ifi->ifi_flags & 0x0000fffff;
+ unsigned int mtu = *(uint32_t *) RTA_DATA (tb[IFLA_MTU]);
+ ifp = if_lookup_by_index (ifi->ifi_index);
+ /* New interface */
if (ifp == NULL || !CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE))
{
if (ifp == NULL)
- ifp = if_get_by_name (name);
-
- set_ifindex(ifp, ifi->ifi_index);
- ifp->flags = ifi->ifi_flags & 0x0000fffff;
- ifp->mtu6 = ifp->mtu = *(int *) RTA_DATA (tb[IFLA_MTU]);
- ifp->metric = 1;
-
- /* If new link is added. */
- if_add_update (ifp);
+ {
+ ifp = if_create(name, strlen(name));
+ ifp->ifindex = ifi->ifi_index;
+ ifp->metric = 1;
+ }
+ else if (strcmp(ifp->name, name) != 0)
+ {
+ strncpy(ifp->name, name, INTERFACE_NAMSIZ);
+ }
+
+ zlog_info ("interface %s index %d %s added.",
+ name, ifi->ifi_index, if_flag_dump(new_flags));
+
+ ifp->flags = new_flags;
+ ifp->mtu6 = ifp->mtu = mtu;
+
+ /* If new link is added. */
+ if_add_update (ifp);
}
- else
- {
- /* Interface status change. */
- set_ifindex(ifp, ifi->ifi_index);
- ifp->mtu6 = ifp->mtu = *(int *) RTA_DATA (tb[IFLA_MTU]);
- ifp->metric = 1;
-
- if (if_is_operative (ifp))
- {
- ifp->flags = ifi->ifi_flags & 0x0000fffff;
- if (!if_is_operative (ifp))
- if_down (ifp);
+ /* Interface status change. */
+ else if (new_flags != ifp->flags)
+ {
+ ifp->mtu6 = ifp->mtu = mtu;
+
+ zlog_info ("interface %s index %d changed %s.",
+ name, ifi->ifi_index, if_flag_dump(new_flags));
+
+ if (if_is_operative (ifp))
+ {
+ ifp->flags = new_flags;
+ if (!if_is_operative (ifp))
+ if_down (ifp);
else
/* Must notify client daemons of new interface status. */
- zebra_interface_up_update (ifp);
- }
- else
- {
- ifp->flags = ifi->ifi_flags & 0x0000fffff;
- if (if_is_operative (ifp))
- if_up (ifp);
- }
- }
+ zebra_interface_up_update (ifp);
+ }
+ else
+ {
+ ifp->flags = new_flags;
+ if (if_is_operative (ifp))
+ if_up (ifp);
+ }
+ }
+ /* Interface name change */
+ else if (strcmp(ifp->name, name) != 0)
+ {
+ ifp->mtu = ifp->mtu6 = mtu;
+ zlog_info("interface index %d was renamed from %s to %s",
+ ifi->ifi_index, ifp->name, name);
+
+ strncpy(ifp->name, name, INTERFACE_NAMSIZ);
+ rib_update();
+ }
+ /* Interface mtu change */
+ else if (mtu != ifp->mtu)
+ {
+ zlog_info("interface index %d mtu changed from %u to %u",
+ ifp->mtu, mtu);
+ ifp->mtu = ifp->mtu6 = mtu;
+ if (if_is_operative (ifp))
+ zebra_interface_up_update (ifp);
+ }
}
else
{
- /* RTM_DELLINK. */
- ifp = if_lookup_by_name (name);
-
+ // RTM_DELLINK.
+ ifp = if_lookup_by_index (ifi->ifi_index);
if (ifp == NULL)
{
- zlog (NULL, LOG_WARNING, "interface %s is deleted but can't find",
- name);
+ zlog (NULL, LOG_WARNING, "interface %s index %d is deleted but can't find",
+ name, ifi->ifi_index);
return 0;
}
+ else
+ zlog_info ("interface %s index %d deleted.",
+ name, ifi->ifi_index);
if_delete_update (ifp);
+ if_delete (ifp);
}
-
return 0;
}
@@ -1188,11 +1246,6 @@ netlink_talk (struct nlmsghdr *n, struct nlsock *nl)
/* Request an acknowledgement by setting NLM_F_ACK */
n->nlmsg_flags |= NLM_F_ACK;
- if (IS_ZEBRA_DEBUG_KERNEL)
- zlog_debug ("netlink_talk: %s type %s(%u), seq=%u", nl->name,
- lookup (nlmsg_str, n->nlmsg_type), n->nlmsg_type,
- n->nlmsg_seq);
-
/* Send message to netlink interface. */
if (zserv_privs.change (ZPRIVS_RAISE))
zlog (NULL, LOG_ERR, "Can't raise privileges");
@@ -1217,15 +1270,11 @@ netlink_talk (struct nlmsghdr *n, struct nlsock *nl)
}
/* Routing table change via netlink interface. */
-static int
-netlink_route (int cmd, int family, void *dest, int length, void *gate,
- int index, int zebra_flags, int table)
+static void
+netlink_delroute (int family, void *dest, int length, void *gate,
+ int index, int table, int proto)
{
- int ret;
- int bytelen;
- struct sockaddr_nl snl;
- int discard;
-
+ int bytelen = (family == AF_INET ? 4 : 16);
struct
{
struct nlmsghdr n;
@@ -1235,59 +1284,25 @@ netlink_route (int cmd, int family, void *dest, int length, void *gate,
memset (&req, 0, sizeof req);
- bytelen = (family == AF_INET ? 4 : 16);
-
req.n.nlmsg_len = NLMSG_LENGTH (sizeof (struct rtmsg));
- req.n.nlmsg_flags = NLM_F_CREATE | NLM_F_REQUEST;
- req.n.nlmsg_type = cmd;
+ req.n.nlmsg_flags = NLM_F_REQUEST;
+ req.n.nlmsg_type = RTM_DELROUTE;
req.r.rtm_family = family;
+ req.r.rtm_scope = RT_SCOPE_NOWHERE;
req.r.rtm_table = table;
req.r.rtm_dst_len = length;
- req.r.rtm_protocol = RTPROT_ZEBRA;
- req.r.rtm_scope = RT_SCOPE_UNIVERSE;
-
- if ((zebra_flags & ZEBRA_FLAG_BLACKHOLE)
- || (zebra_flags & ZEBRA_FLAG_REJECT))
- discard = 1;
- else
- discard = 0;
-
- if (cmd == RTM_NEWROUTE)
- {
- if (discard)
- {
- if (zebra_flags & ZEBRA_FLAG_BLACKHOLE)
- req.r.rtm_type = RTN_BLACKHOLE;
- else if (zebra_flags & ZEBRA_FLAG_REJECT)
- req.r.rtm_type = RTN_UNREACHABLE;
- else
- assert (RTN_BLACKHOLE != RTN_UNREACHABLE); /* false */
- }
- else
- req.r.rtm_type = RTN_UNICAST;
- }
if (dest)
addattr_l (&req.n, sizeof req, RTA_DST, dest, bytelen);
- if (!discard)
- {
- if (gate)
- addattr_l (&req.n, sizeof req, RTA_GATEWAY, gate, bytelen);
- if (index > 0)
- addattr32 (&req.n, sizeof req, RTA_OIF, index);
- }
+ if (gate)
+ addattr_l (&req.n, sizeof req, RTA_GATEWAY, gate, bytelen);
- /* Destination netlink address. */
- memset (&snl, 0, sizeof snl);
- snl.nl_family = AF_NETLINK;
+ if (index > 0)
+ addattr32 (&req.n, sizeof req, RTA_OIF, index);
/* Talk to netlink socket. */
- ret = netlink_talk (&req.n, &netlink_cmd);
- if (ret < 0)
- return -1;
-
- return 0;
+ netlink_talk (&req.n, &netlink_cmd);
}
/* Routing table change via netlink interface. */
@@ -1326,6 +1341,20 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
else
discard = 0;
+ switch (rib->type) {
+ case ZEBRA_ROUTE_KERNEL:
+ /* FIXME: should remember original protocol from RTM_NEWLINK */
+ req.r.rtm_protocol = RTPROT_BOOT;
+ break;
+ case ZEBRA_ROUTE_CONNECT:
+ req.r.rtm_protocol = RTPROT_KERNEL;
+ break;
+ default:
+ req.r.rtm_protocol = RTPROT_ZEBRA;
+ }
+
+ req.r.rtm_scope = rib->scope;
+
if (cmd == RTM_NEWROUTE)
{
if (discard)
@@ -1343,8 +1372,8 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
addattr_l (&req.n, sizeof req, RTA_DST, &p->u.prefix, bytelen);
- /* Metric. */
- addattr32 (&req.n, sizeof req, RTA_PRIORITY, rib->metric);
+ if (rib->type != ZEBRA_ROUTE_CONNECT)
+ addattr32 (&req.n, sizeof req, RTA_PRIORITY, rib->metric);
if (discard)
{
@@ -1743,12 +1772,12 @@ kernel_delete_ipv6 (struct prefix *p, struct rib *rib)
}
/* Delete IPv6 route from the kernel. */
-int
+void
kernel_delete_ipv6_old (struct prefix_ipv6 *dest, struct in6_addr *gate,
- unsigned int index, int flags, int table)
+ unsigned int index, int table)
{
- return netlink_route (RTM_DELROUTE, AF_INET6, &dest->prefix,
- dest->prefixlen, gate, index, flags, table);
+ netlink_delroute (AF_INET6, &dest->prefix,
+ dest->prefixlen, gate, index, table, RTPROT_ZEBRA);
}
#endif /* HAVE_IPV6 */
@@ -1831,72 +1860,20 @@ kernel_read (struct thread *thread)
return 0;
}
-<<<<<<< HEAD:zebra/rt_netlink.c
-/* Filter out messages from self that occur on listener socket */
-static void netlink_install_filter (int sock)
-=======
/* Filter out messages from self that occur on listener socket,
caused by our actions on the command socket
*/
static void netlink_install_filter (int sock, __u32 pid)
->>>>>>> 41dc3488cf127a1e23333459a0c316ded67f7ff3:zebra/rt_netlink.c
{
-<<<<<<< HEAD:zebra/rt_netlink.c
- /*
- * Filter is equivalent to netlink_route_change
- *
- * if (h->nlmsg_type == RTM_DELROUTE || h->nlmsg_type == RTM_NEWROUTE) {
- * if (rtm->rtm_type != RTM_UNICAST)
- * return 0;
- * if (rtm->rtm_flags & RTM_F_CLONED)
- * return 0;
- * if (rtm->rtm_protocol == RTPROT_REDIRECT)
- * return 0;
- * if (rtm->rtm_protocol == RTPROT_KERNEL)
- * return 0;
- * if (rtm->rtm_protocol == RTPROT_ZEBRA && h->nlmsg_type == RTM_NEWROUTE)
- * return 0;
- * }
- * return 0xffff;
- */
-=======
->>>>>>> 41dc3488cf127a1e23333459a0c316ded67f7ff3:zebra/rt_netlink.c
struct sock_filter filter[] = {
-<<<<<<< HEAD:zebra/rt_netlink.c
- /* 0*/ BPF_STMT(BPF_LD|BPF_ABS|BPF_H, offsetof(struct nlmsghdr, nlmsg_type)),
- /* 1*/ BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(RTM_DELROUTE), 1, 0),
- /* 2*/ BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(RTM_NEWROUTE), 0, 11),
- /* 3*/ BPF_STMT(BPF_LD|BPF_ABS|BPF_B,
- sizeof(struct nlmsghdr) + offsetof(struct rtmsg, rtm_type)),
- /* 4*/ BPF_JUMP(BPF_JMP|BPF_B, RTN_UNICAST, 0, 8),
- /* 5*/ BPF_STMT(BPF_LD|BPF_ABS|BPF_B,
- sizeof(struct nlmsghdr) + offsetof(struct rtmsg, rtm_flags)),
- /* 6*/ BPF_JUMP(BPF_JMP|BPF_JSET|BPF_K, RTM_F_CLONED, 6, 0),
- /* 7*/ BPF_STMT(BPF_LD|BPF_ABS|BPF_B,
- sizeof(struct nlmsghdr) + offsetof(struct rtmsg, rtm_protocol)),
- /* 8*/ BPF_JUMP(BPF_JMP+ BPF_B, RTPROT_REDIRECT, 4, 0),
- /* 9*/ BPF_JUMP(BPF_JMP+ BPF_B, RTPROT_KERNEL, 0, 1),
- /*10*/ BPF_JUMP(BPF_JMP+ BPF_B, RTPROT_ZEBRA, 0, 3),
- /*11*/ BPF_STMT(BPF_LD|BPF_ABS|BPF_H, offsetof(struct nlmsghdr, nlmsg_type)),
- /*12*/ BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(RTM_NEWROUTE), 0, 1),
- /*13*/ BPF_STMT(BPF_RET|BPF_K, 0), /* drop */
- /*14*/ BPF_STMT(BPF_RET|BPF_K, 0xffff), /* keep */
-=======
- /* 0: ldh [4] */
- BPF_STMT(BPF_LD|BPF_ABS|BPF_H, offsetof(struct nlmsghdr, nlmsg_type)),
- /* 1: jeq 0x18 jt 3 jf 6 */
- BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(RTM_NEWROUTE), 1, 0),
- /* 2: jeq 0x19 jt 3 jf 6 */
- BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htons(RTM_DELROUTE), 0, 3),
- /* 3: ldw [12] */
+ /* 0: ldw [12] */
BPF_STMT(BPF_LD|BPF_ABS|BPF_W, offsetof(struct nlmsghdr, nlmsg_pid)),
- /* 4: jeq XX jt 5 jf 6 */
+ /* 1: jeq XX jt 2 jf 3 */
BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, htonl(pid), 0, 1),
- /* 5: ret 0 (skip) */
+ /* 2: ret 0 (skip) */
BPF_STMT(BPF_RET|BPF_K, 0),
- /* 6: ret 0xffff (keep) */
+ /* 3: ret 0xffff (keep) */
BPF_STMT(BPF_RET|BPF_K, 0xffff),
->>>>>>> 41dc3488cf127a1e23333459a0c316ded67f7ff3:zebra/rt_netlink.c
};
struct sock_fprog prog = {
@@ -1925,9 +1902,6 @@ kernel_init (void)
/* Register kernel socket. */
if (netlink.sock > 0)
{
-<<<<<<< HEAD:zebra/rt_netlink.c
- netlink_install_filter (netlink.sock);
-=======
/* Only want non-blocking on the netlink event socket */
if (fcntl (netlink.sock, F_SETFL, O_NONBLOCK) < 0)
zlog (NULL, LOG_ERR, "Can't set %s socket flags: %s", netlink.name,
@@ -1938,7 +1912,6 @@ kernel_init (void)
netlink_recvbuf (&netlink, nl_rcvbufsize);
netlink_install_filter (netlink.sock, netlink_cmd.snl.nl_pid);
->>>>>>> 41dc3488cf127a1e23333459a0c316ded67f7ff3:zebra/rt_netlink.c
thread_add_read (zebrad.master, kernel_read, NULL, netlink.sock);
}
}