netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] ip fou: respect preferred_family for IPv6
@ 2020-06-25 21:07 Sorah Fukumori
  2020-07-06 18:04 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Sorah Fukumori @ 2020-06-25 21:07 UTC (permalink / raw)
  To: netdev; +Cc: Sorah Fukumori

ip(8) accepts -family ipv6 (-6) option at the toplevel. It is
straightforward to support the existing option for modifying listener
on IPv6 addresses.

Maintain the backward compatibility by leaving ip fou -6 flag
implemented, while it's removed from the usage message.

Signed-off-by: Sorah Fukumori <her@sorah.jp>
---
 ip/ipfou.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ip/ipfou.c b/ip/ipfou.c
index ea126b08..9c697770 100644
--- a/ip/ipfou.c
+++ b/ip/ipfou.c
@@ -27,10 +27,10 @@
 static void usage(void)
 {
 	fprintf(stderr,
-		"Usage: ip fou add port PORT { ipproto PROTO  | gue } [ -6 ]\n"
+		"Usage: ip fou add port PORT { ipproto PROTO  | gue }\n"
 		"		   [ local IFADDR ] [ peer IFADDR ]\n"
 		"		   [ peer_port PORT ] [ dev IFNAME ]\n"
-		"       ip fou del port PORT [ -6 ] [ local IFADDR ]\n"
+		"       ip fou del port PORT [ local IFADDR ]\n"
 		"		   [ peer IFADDR ] [ peer_port PORT ]\n"
 		"		   [ dev IFNAME ]\n"
 		"       ip fou show\n"
@@ -55,13 +55,17 @@ static int fou_parse_opt(int argc, char **argv, struct nlmsghdr *n,
 {
 	const char *local = NULL, *peer = NULL;
 	__u16 port, peer_port = 0;
-	__u8 family = AF_INET;
+	__u8 family = preferred_family;
 	bool gue_set = false;
 	int ipproto_set = 0;
 	__u8 ipproto, type;
 	int port_set = 0;
 	int index = 0;
 
+	if (preferred_family == AF_UNSPEC) {
+		family = AF_INET;
+	}
+
 	while (argc > 0) {
 		if (!matches(*argv, "port")) {
 			NEXT_ARG();
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH iproute2] ip fou: respect preferred_family for IPv6
  2020-06-25 21:07 [PATCH iproute2] ip fou: respect preferred_family for IPv6 Sorah Fukumori
@ 2020-07-06 18:04 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2020-07-06 18:04 UTC (permalink / raw)
  To: Sorah Fukumori; +Cc: netdev

On Fri, 26 Jun 2020 06:07:12 +0900
Sorah Fukumori <her@sorah.jp> wrote:

> ip(8) accepts -family ipv6 (-6) option at the toplevel. It is
> straightforward to support the existing option for modifying listener
> on IPv6 addresses.
> 
> Maintain the backward compatibility by leaving ip fou -6 flag
> implemented, while it's removed from the usage message.
> 
> Signed-off-by: Sorah Fukumori <her@sorah.jp>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-06 18:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25 21:07 [PATCH iproute2] ip fou: respect preferred_family for IPv6 Sorah Fukumori
2020-07-06 18:04 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).