mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

71 lines
2.1 KiB

--- zebra-0.91a/zebra/rt_netlink.c.netlink Tue Jan 23 03:10:04 2001
+++ zebra-0.91a/zebra/rt_netlink.c Wed Oct 29 22:46:44 2003
@@ -46,9 +46,8 @@
int seq;
struct sockaddr_nl snl;
char *name;
-} netlink = { -1, 0, {0}, "netlink-listen" }, /* kernel messages */
- netlink_cmd = { -1, 0, {0}, "netlink-cmd" }, /* command channel */
- netlink_addr = {-1, 0, {0}, "netlink-addr" }; /* address channel */
+} netlink_sock ={ -1, 0, {0}, "netlink-listen" }, /* kernel messages */
+ netlink_cmd = { -1, 0, {0}, "netlink-cmd" }; /* command channel */
struct message nlmsg_str[] =
{
@@ -206,6 +205,13 @@
return -1;
}
+ /* JF: Ignore messages that aren't from the kernel */
+ if ( snl.nl_pid != 0 )
+ {
+ zlog ( NULL, LOG_ERR, "Ignoring message from pid %u", snl.nl_pid );
+ continue;
+ }
+
for (h = (struct nlmsghdr *) buf; NLMSG_OK (h, status);
h = NLMSG_NEXT (h, status))
{
@@ -1052,7 +1058,7 @@
snl.nl_family = AF_NETLINK;
/* Talk to netlink socket. */
- ret = netlink_talk (&req.n, &netlink);
+ ret = netlink_talk (&req.n, &netlink_sock);
if (ret < 0)
return -1;
@@ -1270,7 +1276,7 @@
if (family == AF_INET)
nl = &netlink_cmd;
else
- nl = &netlink;
+ nl = &netlink_sock;
/* Talk to netlink socket. */
return netlink_talk (&req.n, nl);
@@ -1384,8 +1390,8 @@
int sock;
sock = THREAD_FD (thread);
- ret = netlink_parse_info (netlink_information_fetch, &netlink);
- thread_add_read (master, kernel_read, NULL, netlink.sock);
+ ret = netlink_parse_info (netlink_information_fetch, &netlink_sock);
+ thread_add_read (master, kernel_read, NULL, netlink_sock.sock);
return 0;
}
@@ -1401,10 +1407,10 @@
#ifdef HAVE_IPV6
groups |= RTMGRP_IPV6_ROUTE|RTMGRP_IPV6_IFADDR;
#endif /* HAVE_IPV6 */
- netlink_socket (&netlink, groups);
+ netlink_socket (&netlink_sock, groups);
netlink_socket (&netlink_cmd, 0);
/* Register kernel socket. */
- if (netlink.sock > 0)
- thread_add_read (master, kernel_read, NULL, netlink.sock);
+ if (netlink_sock.sock > 0)
+ thread_add_read (master, kernel_read, NULL, netlink_sock.sock);
}