]> git.puffer.fish Git - matthieu/frr.git/commitdiff
[zebra:linux] netlink: no need to change privs for receive
authorStephen Hemminger <stephen.hemminger@vyatta.com>
Sun, 17 Aug 2008 16:01:44 +0000 (17:01 +0100)
committerPaul Jakma <paul@quagga.net>
Fri, 22 Aug 2008 18:56:25 +0000 (19:56 +0100)
2008-06-17 Stephen Hemminger <stephen.hemminger@vyatta.com>

* rt_netlink.c: (netlink_parse_info) Linux doesn't check privledges
  on receive, so avoid the overhead of lowering and raising the
  priviledges on each received message

Signed-off-by: Paul Jakma <paul@quagga.net>
zebra/rt_netlink.c

index 904367e0d5b311b3d0411eb0ccc31fd036b77b0c..05254498776974a5cd148a1934a3c2c62e7ad570 100644 (file)
@@ -285,25 +285,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;
         }