]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
Fix ip rule flush
authorshemminger <shemminger>
Wed, 12 Oct 2005 22:32:34 +0000 (22:32 +0000)
committershemminger <shemminger>
Wed, 12 Oct 2005 22:32:34 +0000 (22:32 +0000)
ChangeLog
ip/iprule.c

index 0353f1e0ffdf063e1e0fa93471fab9063cef62dd..5de10e8fd0298cabee9d2f45f762b41267cb5457 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-10-12  Jamal Hadi Salim <hadi@znyx.com>
+
+       * Fix ip rule flush, need to reopen rtnl
+
 2005-10-07  Stephen Hemminger  <shemminger@osdl.org>
 
        * Reenable ip mroute
index cfe252a2be48f2b1866c2ccbad89d1d808b29fb2..ccf699ffeb1c108142bf6ac23d732d72b878f3a6 100644 (file)
@@ -300,6 +300,7 @@ static int iprule_modify(int cmd, int argc, char **argv)
 
 static int flush_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 {
+       struct rtnl_handle rth2;
        struct rtmsg *r = NLMSG_DATA(n);
        int len = n->nlmsg_len;
        struct rtattr * tb[RTA_MAX+1];
@@ -314,8 +315,13 @@ static int flush_rule(const struct sockaddr_nl *who, struct nlmsghdr *n, void *a
                n->nlmsg_type = RTM_DELRULE;
                n->nlmsg_flags = NLM_F_REQUEST;
 
-               if (rtnl_talk(&rth, n, 0, 0, NULL, NULL, NULL) < 0)
+               if (rtnl_open(&rth2, 0) < 0)
+                       return -1;
+
+               if (rtnl_talk(&rth2, n, 0, 0, NULL, NULL, NULL) < 0)
                        return -2;
+
+               rtnl_close(&rth2);
        }
 
        return 0;