diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-05-19 13:32:30 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-05-19 13:32:30 -0700 |
commit | 685a4b330aff3edff8e1c72638cf8a65bf655da1 (patch) | |
tree | 1b8422f5f63b496243f34a76c43a51d0768c8004 | |
parent | 1d909aa44b4738214d5b0b846d591e3c7bd044ae (diff) | |
download | quagga-685a4b330aff3edff8e1c72638cf8a65bf655da1.tar.bz2 quagga-685a4b330aff3edff8e1c72638cf8a65bf655da1.tar.xz |
remove unneeded privledge changes
Netlink recvmsg always succeeds, there are no permission checks in
the kernel on receive, only on send and bind. This reduces the number
of system calls and any potential security vulnerabilty in recvmsg().
-rw-r--r-- | zebra/rt_netlink.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 4b9daef4..954e0791 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -335,25 +335,16 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *), struct sockaddr_nl snl; struct msghdr msg = { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 }; struct nlmsghdr *h; - int save_errno; - - if (zserv_privs.change (ZPRIVS_RAISE)) - zlog (NULL, LOG_ERR, "Can't raise privileges"); status = recvmsg (nl->sock, &msg, 0); - save_errno = errno; - - if (zserv_privs.change (ZPRIVS_LOWER)) - zlog (NULL, LOG_ERR, "Can't lower privileges"); - if (status < 0) { - if (save_errno == EINTR) + if (errno == EINTR) continue; - if (save_errno == EWOULDBLOCK || save_errno == EAGAIN) + if (errno == EWOULDBLOCK || errno == EAGAIN) break; zlog (NULL, LOG_ERR, "%s recvmsg overrun: %s", - nl->name, safe_strerror(save_errno)); + nl->name, safe_strerror(errno)); continue; } |