diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-01-08 09:58:19 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-01-08 09:58:19 -0800 |
commit | 32d89608c6383feb60781117a72e0e10f388626d (patch) | |
tree | 19398240f039802ad3ad6f69991037f61f092d69 /zebra/rt_netlink.c | |
parent | dcc88cf610dea7cd46738706c6e81cd23eb0a797 (diff) | |
download | quagga-32d89608c6383feb60781117a72e0e10f388626d.tar.bz2 quagga-32d89608c6383feb60781117a72e0e10f388626d.tar.xz |
Move pid check back to original location
There is a possiblity of some hostile netlink user getting
bogus responses in the conversation between zebra and kernel.
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r-- | zebra/rt_netlink.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index a1fbb7c4..850a271e 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -290,6 +290,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 ( NULL, LOG_ERR, "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)) { @@ -1050,13 +1057,6 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h) static int netlink_information_fetch (struct sockaddr_nl *snl, struct nlmsghdr *h) { - /* 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 ); - return 0; - } - switch (h->nlmsg_type) { case RTM_NEWROUTE: |