mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-16 20:36:38 +00:00
ip fou: respect preferred_family for IPv6
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> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
d80a05b795
commit
9e5d246877
10
ip/ipfou.c
10
ip/ipfou.c
@ -27,10 +27,10 @@
|
|||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
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"
|
" [ local IFADDR ] [ peer IFADDR ]\n"
|
||||||
" [ peer_port PORT ] [ dev IFNAME ]\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"
|
" [ peer IFADDR ] [ peer_port PORT ]\n"
|
||||||
" [ dev IFNAME ]\n"
|
" [ dev IFNAME ]\n"
|
||||||
" ip fou show\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;
|
const char *local = NULL, *peer = NULL;
|
||||||
__u16 port, peer_port = 0;
|
__u16 port, peer_port = 0;
|
||||||
__u8 family = AF_INET;
|
__u8 family = preferred_family;
|
||||||
bool gue_set = false;
|
bool gue_set = false;
|
||||||
int ipproto_set = 0;
|
int ipproto_set = 0;
|
||||||
__u8 ipproto, type;
|
__u8 ipproto, type;
|
||||||
int port_set = 0;
|
int port_set = 0;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
|
if (preferred_family == AF_UNSPEC) {
|
||||||
|
family = AF_INET;
|
||||||
|
}
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
if (!matches(*argv, "port")) {
|
if (!matches(*argv, "port")) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
|
Loading…
Reference in New Issue
Block a user