* [PATCH iproute2-next] iproute_lwtunnel: allow specifying 'src' for 'encap ip' / 'encap ip6'
@ 2018-08-17 7:31 Shmulik Ladkani
2018-08-17 15:00 ` Stephen Hemminger
2018-08-17 20:20 ` David Ahern
0 siblings, 2 replies; 4+ messages in thread
From: Shmulik Ladkani @ 2018-08-17 7:31 UTC (permalink / raw)
To: stephen, dsahern; +Cc: netdev, shmulik.ladkani, Shmulik Ladkani
This allows the user to specify the LWTUNNEL_IP_SRC/LWTUNNEL_IP6_SRC
when setting an lwtunnel encapsulation route.
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
---
ip/iproute_lwtunnel.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index 740da7c6..20d5545c 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -671,7 +671,7 @@ static int parse_encap_mpls(struct rtattr *rta, size_t len,
static int parse_encap_ip(struct rtattr *rta, size_t len,
int *argcp, char ***argvp)
{
- int id_ok = 0, dst_ok = 0, tos_ok = 0, ttl_ok = 0;
+ int id_ok = 0, dst_ok = 0, src_ok = 0, tos_ok = 0, ttl_ok = 0;
char **argv = *argvp;
int argc = *argcp;
@@ -694,6 +694,15 @@ static int parse_encap_ip(struct rtattr *rta, size_t len,
get_addr(&addr, *argv, AF_INET);
rta_addattr_l(rta, len, LWTUNNEL_IP_DST,
&addr.data, addr.bytelen);
+ } else if (strcmp(*argv, "src") == 0) {
+ inet_prefix addr;
+
+ NEXT_ARG();
+ if (src_ok++)
+ duparg2("src", *argv);
+ get_addr(&addr, *argv, AF_INET);
+ rta_addattr_l(rta, len, LWTUNNEL_IP_SRC,
+ &addr.data, addr.bytelen);
} else if (strcmp(*argv, "tos") == 0) {
__u32 tos;
@@ -805,7 +814,7 @@ static int parse_encap_ila(struct rtattr *rta, size_t len,
static int parse_encap_ip6(struct rtattr *rta, size_t len,
int *argcp, char ***argvp)
{
- int id_ok = 0, dst_ok = 0, tos_ok = 0, ttl_ok = 0;
+ int id_ok = 0, dst_ok = 0, src_ok = 0, tos_ok = 0, ttl_ok = 0;
char **argv = *argvp;
int argc = *argcp;
@@ -828,6 +837,15 @@ static int parse_encap_ip6(struct rtattr *rta, size_t len,
get_addr(&addr, *argv, AF_INET6);
rta_addattr_l(rta, len, LWTUNNEL_IP6_DST,
&addr.data, addr.bytelen);
+ } else if (strcmp(*argv, "src") == 0) {
+ inet_prefix addr;
+
+ NEXT_ARG();
+ if (src_ok++)
+ duparg2("src", *argv);
+ get_addr(&addr, *argv, AF_INET6);
+ rta_addattr_l(rta, len, LWTUNNEL_IP6_SRC,
+ &addr.data, addr.bytelen);
} else if (strcmp(*argv, "tc") == 0) {
__u32 tc;
--
2.18.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2-next] iproute_lwtunnel: allow specifying 'src' for 'encap ip' / 'encap ip6'
2018-08-17 7:31 [PATCH iproute2-next] iproute_lwtunnel: allow specifying 'src' for 'encap ip' / 'encap ip6' Shmulik Ladkani
@ 2018-08-17 15:00 ` Stephen Hemminger
2018-08-17 17:37 ` Shmulik Ladkani
2018-08-17 20:20 ` David Ahern
1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2018-08-17 15:00 UTC (permalink / raw)
To: Shmulik Ladkani; +Cc: dsahern, netdev, shmulik.ladkani, Shmulik Ladkani
On Fri, 17 Aug 2018 10:31:34 +0300
Shmulik Ladkani <shmulik@metanetworks.com> wrote:
> This allows the user to specify the LWTUNNEL_IP_SRC/LWTUNNEL_IP6_SRC
> when setting an lwtunnel encapsulation route.
>
> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
> ---
> ip/iproute_lwtunnel.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
> index 740da7c6..20d5545c 100644
> --- a/ip/iproute_lwtunnel.c
> +++ b/ip/iproute_lwtunnel.c
> @@ -671,7 +671,7 @@ static int parse_encap_mpls(struct rtattr *rta, size_t len,
> static int parse_encap_ip(struct rtattr *rta, size_t len,
> int *argcp, char ***argvp)
> {
> - int id_ok = 0, dst_ok = 0, tos_ok = 0, ttl_ok = 0;
> + int id_ok = 0, dst_ok = 0, src_ok = 0, tos_ok = 0, ttl_ok = 0;
> char **argv = *argvp;
> int argc = *argcp;
>
> @@ -694,6 +694,15 @@ static int parse_encap_ip(struct rtattr *rta, size_t len,
> get_addr(&addr, *argv, AF_INET);
> rta_addattr_l(rta, len, LWTUNNEL_IP_DST,
> &addr.data, addr.bytelen);
> + } else if (strcmp(*argv, "src") == 0) {
> + inet_prefix addr;
> +
> + NEXT_ARG();
> + if (src_ok++)
> + duparg2("src", *argv);
> + get_addr(&addr, *argv, AF_INET);
> + rta_addattr_l(rta, len, LWTUNNEL_IP_SRC,
> + &addr.data, addr.bytelen);
> } else if (strcmp(*argv, "tos") == 0) {
> __u32 tos;
>
> @@ -805,7 +814,7 @@ static int parse_encap_ila(struct rtattr *rta, size_t len,
> static int parse_encap_ip6(struct rtattr *rta, size_t len,
> int *argcp, char ***argvp)
> {
> - int id_ok = 0, dst_ok = 0, tos_ok = 0, ttl_ok = 0;
> + int id_ok = 0, dst_ok = 0, src_ok = 0, tos_ok = 0, ttl_ok = 0;
> char **argv = *argvp;
> int argc = *argcp;
>
> @@ -828,6 +837,15 @@ static int parse_encap_ip6(struct rtattr *rta, size_t len,
> get_addr(&addr, *argv, AF_INET6);
> rta_addattr_l(rta, len, LWTUNNEL_IP6_DST,
> &addr.data, addr.bytelen);
> + } else if (strcmp(*argv, "src") == 0) {
> + inet_prefix addr;
> +
> + NEXT_ARG();
> + if (src_ok++)
> + duparg2("src", *argv);
> + get_addr(&addr, *argv, AF_INET6);
> + rta_addattr_l(rta, len, LWTUNNEL_IP6_SRC,
> + &addr.data, addr.bytelen);
> } else if (strcmp(*argv, "tc") == 0) {
> __u32 tc;
>
If you accept an attribute on input you need to parse it and display it the
same way in the show command.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2-next] iproute_lwtunnel: allow specifying 'src' for 'encap ip' / 'encap ip6'
2018-08-17 15:00 ` Stephen Hemminger
@ 2018-08-17 17:37 ` Shmulik Ladkani
0 siblings, 0 replies; 4+ messages in thread
From: Shmulik Ladkani @ 2018-08-17 17:37 UTC (permalink / raw)
To: Stephen Hemminger, Shmulik Ladkani; +Cc: dsahern, netdev
Hi,
On Fri, 17 Aug 2018 08:00:22 -0700
Stephen Hemminger <stephen@networkplumber.org> wrote:
> If you accept an attribute on input you need to parse it and display it the
> same way in the show command.
Note print_encap_ip and print_encap_ip6 already handle LWTUNNEL_IP_SRC
and LWTUNNEL_IP6_SRC (since long ago, 1e5293056 and d95cdcf52).
The only missing part is treatment in parse_encap_ip and
parse_encap_ip6, as suggested by this patch.
Best,
Shmulik
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH iproute2-next] iproute_lwtunnel: allow specifying 'src' for 'encap ip' / 'encap ip6'
2018-08-17 7:31 [PATCH iproute2-next] iproute_lwtunnel: allow specifying 'src' for 'encap ip' / 'encap ip6' Shmulik Ladkani
2018-08-17 15:00 ` Stephen Hemminger
@ 2018-08-17 20:20 ` David Ahern
1 sibling, 0 replies; 4+ messages in thread
From: David Ahern @ 2018-08-17 20:20 UTC (permalink / raw)
To: Shmulik Ladkani, stephen; +Cc: netdev, shmulik.ladkani, Shmulik Ladkani
On 8/17/18 1:31 AM, Shmulik Ladkani wrote:
> This allows the user to specify the LWTUNNEL_IP_SRC/LWTUNNEL_IP6_SRC
> when setting an lwtunnel encapsulation route.
>
> Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
> ---
> ip/iproute_lwtunnel.c | 22 ++++++++++++++++++++--
> 1 file changed, 20 insertions(+), 2 deletions(-)
>
applied to iproute2-next. Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-17 23:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-17 7:31 [PATCH iproute2-next] iproute_lwtunnel: allow specifying 'src' for 'encap ip' / 'encap ip6' Shmulik Ladkani
2018-08-17 15:00 ` Stephen Hemminger
2018-08-17 17:37 ` Shmulik Ladkani
2018-08-17 20:20 ` David Ahern
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.