|
|
049c96 |
From 6a865378a9e17df5ae352b3b41c96deb32a5b16d Mon Sep 17 00:00:00 2001
|
|
|
02706e |
From: Phil Sutter <psutter@redhat.com>
|
|
|
049c96 |
Date: Wed, 17 Feb 2016 14:05:14 +0100
|
|
|
049c96 |
Subject: [PATCH] ipaddress: simplify ipaddr_flush()
|
|
|
02706e |
|
|
|
049c96 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1291825
|
|
|
049c96 |
Upstream Status: commit c6995c4802523
|
|
|
02706e |
|
|
|
02706e |
commit c6995c48025233902a5b0c5fe88654e17ea934f6
|
|
|
02706e |
Author: Phil Sutter <phil@nwl.cc>
|
|
|
02706e |
Date: Tue Nov 24 15:31:00 2015 +0100
|
|
|
02706e |
|
|
|
02706e |
ipaddress: simplify ipaddr_flush()
|
|
|
02706e |
|
|
|
02706e |
Since it's no longer relevant whether an IP address is primary or
|
|
|
02706e |
secondary when flushing, ipaddr_flush() can be simplified a bit.
|
|
|
02706e |
|
|
|
02706e |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
02706e |
---
|
|
|
049c96 |
ip/ipaddress.c | 38 +-------------------------------------
|
|
|
049c96 |
1 file changed, 1 insertion(+), 37 deletions(-)
|
|
|
02706e |
|
|
|
02706e |
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
|
|
|
049c96 |
index f4537db..6f50354 100644
|
|
|
02706e |
--- a/ip/ipaddress.c
|
|
|
02706e |
+++ b/ip/ipaddress.c
|
|
|
049c96 |
@@ -885,28 +885,6 @@ int print_addrinfo(const struct sockaddr_nl *who, struct nlmsghdr *n,
|
|
|
02706e |
return 0;
|
|
|
02706e |
}
|
|
|
02706e |
|
|
|
02706e |
-static int print_addrinfo_primary(const struct sockaddr_nl *who,
|
|
|
02706e |
- struct nlmsghdr *n, void *arg)
|
|
|
02706e |
-{
|
|
|
02706e |
- struct ifaddrmsg *ifa = NLMSG_DATA(n);
|
|
|
02706e |
-
|
|
|
02706e |
- if (ifa->ifa_flags & IFA_F_SECONDARY)
|
|
|
02706e |
- return 0;
|
|
|
02706e |
-
|
|
|
02706e |
- return print_addrinfo(who, n, arg);
|
|
|
02706e |
-}
|
|
|
02706e |
-
|
|
|
02706e |
-static int print_addrinfo_secondary(const struct sockaddr_nl *who,
|
|
|
02706e |
- struct nlmsghdr *n, void *arg)
|
|
|
02706e |
-{
|
|
|
02706e |
- struct ifaddrmsg *ifa = NLMSG_DATA(n);
|
|
|
02706e |
-
|
|
|
02706e |
- if (!(ifa->ifa_flags & IFA_F_SECONDARY))
|
|
|
02706e |
- return 0;
|
|
|
02706e |
-
|
|
|
02706e |
- return print_addrinfo(who, n, arg);
|
|
|
02706e |
-}
|
|
|
02706e |
-
|
|
|
02706e |
struct nlmsg_list
|
|
|
02706e |
{
|
|
|
02706e |
struct nlmsg_list *next;
|
|
|
049c96 |
@@ -1149,26 +1127,12 @@ static int ipaddr_flush(void)
|
|
|
02706e |
filter.flushe = sizeof(flushb);
|
|
|
02706e |
|
|
|
02706e |
while ((max_flush_loops == 0) || (round < max_flush_loops)) {
|
|
|
02706e |
- const struct rtnl_dump_filter_arg a[3] = {
|
|
|
02706e |
- {
|
|
|
02706e |
- .filter = print_addrinfo_secondary,
|
|
|
02706e |
- .arg1 = stdout,
|
|
|
02706e |
- },
|
|
|
02706e |
- {
|
|
|
02706e |
- .filter = print_addrinfo_primary,
|
|
|
02706e |
- .arg1 = stdout,
|
|
|
02706e |
- },
|
|
|
02706e |
- {
|
|
|
02706e |
- .filter = NULL,
|
|
|
02706e |
- .arg1 = NULL,
|
|
|
02706e |
- },
|
|
|
02706e |
- };
|
|
|
02706e |
if (rtnl_wilddump_request(&rth, filter.family, RTM_GETADDR) < 0) {
|
|
|
02706e |
perror("Cannot send dump request");
|
|
|
02706e |
exit(1);
|
|
|
02706e |
}
|
|
|
02706e |
filter.flushed = 0;
|
|
|
02706e |
- if (rtnl_dump_filter_l(&rth, a) < 0) {
|
|
|
049c96 |
+ if (rtnl_dump_filter(&rth, print_addrinfo, stdout) < 0) {
|
|
|
02706e |
fprintf(stderr, "Flush terminated\n");
|
|
|
02706e |
exit(1);
|
|
|
02706e |
}
|
|
|
02706e |
--
|
|
|
049c96 |
1.8.3.1
|
|
|
02706e |
|