diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-05-02 15:28:50 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-05-02 15:28:50 -0700 |
commit | 019c42ca0d37f7a25d67843affeb3c099091d50a (patch) | |
tree | 2fbcc5354e48a933f60575629a48bb6887bac1f7 | |
parent | 64cb6fed376b0f6e91ae8d08a1e0a9658457a8ed (diff) | |
download | quagga-019c42ca0d37f7a25d67843affeb3c099091d50a.tar.bz2 quagga-019c42ca0d37f7a25d67843affeb3c099091d50a.tar.xz |
set/check nl port id on messages
The talk netlink socket should set it's own pid value, so
they can be ignored in listener.
-rw-r--r-- | zebra/rt_netlink.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index f84d6596..23262416 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -287,7 +287,7 @@ netlink_request (int family, int type, struct nlsock *nl) req.nlh.nlmsg_len = sizeof req; req.nlh.nlmsg_type = type; req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; - req.nlh.nlmsg_pid = 0; + req.nlh.nlmsg_pid = nl->snl.nl_pid; req.nlh.nlmsg_seq = ++nl->seq; req.g.rtgen_family = family; @@ -370,13 +370,6 @@ 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)) { @@ -1068,6 +1061,13 @@ netlink_link_change (struct sockaddr_nl *snl, struct nlmsghdr *h) 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: |