Fix ip rule flush

This commit is contained in:
shemminger 2005-10-12 22:32:34 +00:00
parent 393c43784c
commit b77caeba0e
2 changed files with 11 additions and 1 deletions

View File

@ -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

View 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;