* [PATCH v2 iproute2-next 1/1] Support l2macnat in ip util
@ 2025-11-05 16:09 Dmitry Skorodumov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Skorodumov @ 2025-11-05 16:09 UTC (permalink / raw)
To: netdev; +Cc: andrey.bokhanko, Dmitry Skorodumov
Signed-off-by: Dmitry Skorodumov <skorodumov.dmitry@huawei.com>
---
include/uapi/linux/if_link.h | 1 +
ip/iplink_ipvlan.c | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index d05f5cc7..ec79f246 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -1267,6 +1267,7 @@ enum ipvlan_mode {
IPVLAN_MODE_L2 = 0,
IPVLAN_MODE_L3,
IPVLAN_MODE_L3S,
+ IPVLAN_MODE_L2_MACNAT,
IPVLAN_MODE_MAX
};
diff --git a/ip/iplink_ipvlan.c b/ip/iplink_ipvlan.c
index f29fa4f9..df2c1aa4 100644
--- a/ip/iplink_ipvlan.c
+++ b/ip/iplink_ipvlan.c
@@ -19,7 +19,7 @@ static void print_explain(struct link_util *lu, FILE *f)
fprintf(f,
"Usage: ... %s [ mode MODE ] [ FLAGS ]\n"
"\n"
- "MODE: l3 | l3s | l2\n"
+ "MODE: l3 | l3s | l2 | l2macnat\n"
"FLAGS: bridge | private | vepa\n"
"(first values are the defaults if nothing is specified).\n",
lu->id);
@@ -39,12 +39,15 @@ static int ipvlan_parse_opt(struct link_util *lu, int argc, char **argv,
if (strcmp(*argv, "l2") == 0)
mode = IPVLAN_MODE_L2;
+ else if (strcmp(*argv, "l2macnat") == 0)
+ mode = IPVLAN_MODE_L2_MACNAT;
else if (strcmp(*argv, "l3") == 0)
mode = IPVLAN_MODE_L3;
else if (strcmp(*argv, "l3s") == 0)
mode = IPVLAN_MODE_L3S;
else {
- fprintf(stderr, "Error: argument of \"mode\" must be either \"l2\", \"l3\" or \"l3s\"\n");
+ fprintf(stderr, "Error: argument of \"mode\" must be either "
+ "\"l2\", \"l2macnat\", \"l3\" or \"l3s\"\n");
return -1;
}
addattr16(n, 1024, IFLA_IPVLAN_MODE, mode);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 iproute2-next 1/1] Support l2macnat in ip util
@ 2025-11-18 11:23 Dmitry Skorodumov
2025-11-18 16:06 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Skorodumov @ 2025-11-18 11:23 UTC (permalink / raw)
To: netdev; +Cc: andrey.bokhanko, edumazet, Dmitry Skorodumov
Signed-off-by: Dmitry Skorodumov <skorodumov.dmitry@huawei.com>
---
include/uapi/linux/if_link.h | 1 +
ip/iplink_ipvlan.c | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index d05f5cc7..ec79f246 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -1267,6 +1267,7 @@ enum ipvlan_mode {
IPVLAN_MODE_L2 = 0,
IPVLAN_MODE_L3,
IPVLAN_MODE_L3S,
+ IPVLAN_MODE_L2_MACNAT,
IPVLAN_MODE_MAX
};
diff --git a/ip/iplink_ipvlan.c b/ip/iplink_ipvlan.c
index f29fa4f9..df2c1aa4 100644
--- a/ip/iplink_ipvlan.c
+++ b/ip/iplink_ipvlan.c
@@ -19,7 +19,7 @@ static void print_explain(struct link_util *lu, FILE *f)
fprintf(f,
"Usage: ... %s [ mode MODE ] [ FLAGS ]\n"
"\n"
- "MODE: l3 | l3s | l2\n"
+ "MODE: l3 | l3s | l2 | l2macnat\n"
"FLAGS: bridge | private | vepa\n"
"(first values are the defaults if nothing is specified).\n",
lu->id);
@@ -39,12 +39,15 @@ static int ipvlan_parse_opt(struct link_util *lu, int argc, char **argv,
if (strcmp(*argv, "l2") == 0)
mode = IPVLAN_MODE_L2;
+ else if (strcmp(*argv, "l2macnat") == 0)
+ mode = IPVLAN_MODE_L2_MACNAT;
else if (strcmp(*argv, "l3") == 0)
mode = IPVLAN_MODE_L3;
else if (strcmp(*argv, "l3s") == 0)
mode = IPVLAN_MODE_L3S;
else {
- fprintf(stderr, "Error: argument of \"mode\" must be either \"l2\", \"l3\" or \"l3s\"\n");
+ fprintf(stderr, "Error: argument of \"mode\" must be either "
+ "\"l2\", \"l2macnat\", \"l3\" or \"l3s\"\n");
return -1;
}
addattr16(n, 1024, IFLA_IPVLAN_MODE, mode);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 iproute2-next 1/1] Support l2macnat in ip util
2025-11-18 11:23 [PATCH v2 iproute2-next 1/1] Support l2macnat in ip util Dmitry Skorodumov
@ 2025-11-18 16:06 ` Stephen Hemminger
2025-11-20 11:22 ` Dmitry Skorodumov
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2025-11-18 16:06 UTC (permalink / raw)
To: Dmitry Skorodumov; +Cc: netdev, andrey.bokhanko, edumazet
On Tue, 18 Nov 2025 14:23:47 +0300
Dmitry Skorodumov <skorodumov.dmitry@huawei.com> wrote:
> Signed-off-by: Dmitry Skorodumov <skorodumov.dmitry@huawei.com>
Good start, but you need update ipvlan_print_opt as well.
The trigraph is getting long enough that it is time for a helper function.
Also need to update man page.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 iproute2-next 1/1] Support l2macnat in ip util
2025-11-18 16:06 ` Stephen Hemminger
@ 2025-11-20 11:22 ` Dmitry Skorodumov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Skorodumov @ 2025-11-20 11:22 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, andrey.bokhanko, edumazet
On 18.11.2025 19:06, Stephen Hemminger wrote:
> On Tue, 18 Nov 2025 14:23:47 +0300
> Dmitry Skorodumov <skorodumov.dmitry@huawei.com> wrote:
>
>> Signed-off-by: Dmitry Skorodumov <skorodumov.dmitry@huawei.com>
>
> Good start, but you need update ipvlan_print_opt as well.
> The trigraph is getting long enough that it is time for a helper function.
>
> Also need to update man page.
Updating man will be tricky: ipvlan/ipvtap part is near totally missing in man... I'll try, but likely help with final editing will be appreciated.
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-20 11:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-18 11:23 [PATCH v2 iproute2-next 1/1] Support l2macnat in ip util Dmitry Skorodumov
2025-11-18 16:06 ` Stephen Hemminger
2025-11-20 11:22 ` Dmitry Skorodumov
-- strict thread matches above, loose matches on Subject: below --
2025-11-05 16:09 Dmitry Skorodumov
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).