[PATCH] rtnetlink: add IFLA_GROUP to ifla_policy

2017-06-20 Thread Serhey Popovych
Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- v2: Rebased to kernel/git/davem/net.git net/core/rtnetlink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 5e61456..467a2f4 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnet

Re: [PATCH] loopback: Force LOOPBACK_IFINDEX for registration

2017-06-20 Thread Serhey Popovych
> From: Serhey Popovych <serhe.popov...@gmail.com> > Date: Fri, 16 Jun 2017 15:10:03 +0300 > >> Now with commit 9c7dafb (net: Allow to create links with >> given ifindex) support registration of network devices >> with specific ifindex is added. >> >&g

ipv6: Do not leak throw route references

2017-06-20 Thread Serhey Popovych
g for throw routes") Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- v2: Rebased to kernel/git/davem/net.git repository Address several scripts/checkpatch.pl issues. net/ipv6/fib6_rules.c | 22 ++ net/ipv6/ip6_fib.c| 3 +-- 2 files changed, 7 insert

Re: fib_rules: Resolve goto rules target on delete

2017-06-21 Thread Serhey Popovych
> From: Serhey Popovych <serhe.popov...@gmail.com> > Date: Fri, 16 Jun 2017 15:44:47 +0300 > >> We should avoid marking goto rules unresolved when their >> target is actually reachable after rule deletion. >> >> Consolder following sample scenario: >

veth: Be more robust on network device creation when no attributes

2017-06-21 Thread Serhey Popovych
alid or name based on rtnl ops kind and random address is used. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- v2: Rebase to kernel/davem/net.git drivers/net/veth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/veth.c b/drivers/net/ve

veth: Be more robust on network device creation when no attributes

2017-06-21 Thread Serhey Popovych
alid or name based on rtnl ops kind and random address is used. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- v3: Really rebase to kernel/davem/net.git v2: Rebase to kernel/davem/net.git drivers/net/veth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -

Re: [PATCH] loopback: Force LOOPBACK_IFINDEX for registration

2017-06-21 Thread Serhey Popovych
> >> From: Serhey Popovych <serhe.popov...@gmail.com> >> Date: Fri, 16 Jun 2017 15:10:03 +0300 >> >>> Now with commit 9c7dafb (net: Allow to create links with >>> given ifindex) support registration of network devices >>> with specific i

Re: [PATCH 1/3] dev: Prevent creating network devices with negative ifindex

2017-06-16 Thread Serhey Popovych
>> What do you think? > > Passing -1 is an error, it doesn't make sense to try and be > helpful to buggy userland. Here is commit I actually change/fix: commit 9c7dafbfab15 ("net: Allow to create links with given ifindex") In this change done the opposite: check for ifm->ifi_index moved to

[PATCH] loopback: Force LOOPBACK_IFINDEX for registration

2017-06-16 Thread Serhey Popovych
system can continue without network namespace failed in loopback init path, unless it is init_net namespace where we panic() anyway. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- drivers/net/loopback.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/d

fib_rules: Resolve goto rules target on delete

2017-06-16 Thread Serhey Popovych
of first rule with preference 32100 we mark all goto rules as unreachable, even when rule with same preference as removed one still present. Check if next rule with same preference is available and make all rules with goto action pointing to it. Signed-off-by: Serhey Popovych <serhe.po

ipv6: Do not leak throw route references

2017-06-16 Thread Serhey Popovych
throw route) since we never return routing table entry with dst.error == -EAGAIN when CONFIG_IPV6_MULTIPLE_TABLES is on. Also there is no point to check for RTF_REJECT flag since it is always set throw route. Fixes: 73ba57b (ipv6: fix backtracking for throw routes) Signed-off-by: Serhey Po

rtnetlink: add IFLA_GROUP to ifla_policy

2017-06-16 Thread Serhey Popovych
Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- net/core/rtnetlink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 2769ad9..6e4d6c2 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -931,6 +931,7 @@ static

[PATCH] veth: Be more robust on network device creation when no attributes

2017-06-16 Thread Serhey Popovych
from peer_tb when valid or name based on rtnl ops kind and random address is used. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- drivers/net/veth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index 06894

[PATCH 0/3] dev: Fix network device ifindex allocation

2017-06-16 Thread Serhey Popovych
0x7fff; i++)); do ifname="dummy$i"; [ ! -d "/sys/class/net/$ifname" ] || continue ip link add dev "$ifname" index "$i" type dummy done * (minor) check for dev->ifindex being greater than zero.

[PATCH 2/3] dev: Avoid infinite loop on network device index exhaustion

2017-06-16 Thread Serhey Popovych
with ifindex == 1 (LOOPBACK_IFINDEX) in dev_new_index() we should fail and return invalid index value (0). Adjust callers to correctly handle error case of dev_new_index(). Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- net/core/dev.c | 30 ++ 1 file c

[PATCH 1/3] dev: Prevent creating network devices with negative ifindex

2017-06-16 Thread Serhey Popovych
Interface index is signed integer, we can pass ifm->ifi_index from userspace via netlink and create network device with negative ifindex value. Fixes: 9c7dafbfab15 ("net: Allow to create links with given ifindex") Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> ---

[PATCH 3/3] veth: Set ifindex only if given and not negative

2017-06-16 Thread Serhey Popovych
There is already check for ifindex being non negative in register_netdevice(). Do the same here for convenience. Fixes: e6f8f1a739b6 ("veth: Allow to create peer link with given ifindex") Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- drivers/net/veth.c | 2 +- 1

Re: [PATCH 2/3] dev: Avoid infinite loop on network device index exhaustion

2017-06-16 Thread Serhey Popovych
> On Fri, 16 Jun 2017 17:23:52 +0300 > Serhey Popovych <serhe.popov...@gmail.com> wrote: > >> If network device indexes exhaust in namespace dev_new_index() >> can loop indefinitely since there is no condition to exit >> except case where free index is found.

dev: Reclaim network device indexes

2017-06-16 Thread Serhey Popovych
network device index when it is smaller than last allocated index in namespace. This also has positive side effect for equal distribution of network devices per buckets in index hash table. That positively affects performance of dev_get_by_index() family. Signed-off-by: Serhey Popovych <serhe.po

Re: [PATCH 1/3] dev: Prevent creating network devices with negative ifindex

2017-06-16 Thread Serhey Popovych
> On Fri, 16 Jun 2017 17:23:51 +0300 > Serhey Popovych <serhe.popov...@gmail.com> wrote: > >> Interface index is signed integer, we can pass ifm->ifi_index >> from userspace via netlink and create network device with >> negative ifindex value. >> >

[PATCH net-next] dev: Correctly get length of alias string in dev_set_alias()

2017-12-18 Thread Serhey Popovych
by putting '\0' not at @len - 1. Use strnlen() to get length of zero terminated string and not access beyond @len. Correct comment about @len and explain how to unset alias (i.e. use zero for @len). Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- net/core/dev.c | 4 +++- 1 file c

[PATCH iproute2 0/3] ip/tunnels: Reuse code, vti6 zero endpoint support and minor cleanup

2017-12-18 Thread Serhey Popovych
additional checks for zero endpoint in vti6 code. This completes and unifies support for unconfiguring local/remote endpoint for tunnel. See individual patch description message for details. Thanks, Serhii Serhey Popovych (3): ip/tunnel: Use tnl_parse_key() to parse tunnel key link_ip6tnl

[PATCH iproute2 1/3] ip/tunnel: Use tnl_parse_key() to parse tunnel key

2017-12-18 Thread Serhey Popovych
variables from unsigned integer to __be32 to reflect nature of the value they store and place error message in tnl_parse_key() on a single line to make single call to fprintf(). Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre.c

[PATCH iproute2 3/3] link_vti6: Always add local/remote endpoint attributes

2017-12-18 Thread Serhey Popovych
. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_vti6.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ip/link_vti6.c b/ip/link_vti6.c index f631839..4136b0e 100644 --- a/ip/link_vti6.c +++ b/ip/link_vti6.c @@ -154,10 +154,8 @@ get_

[PATCH iproute2 2/3] link_ip6tnl: Use IN6ADDR_ANY_INIT to initialize local/remote endpoints

2017-12-18 Thread Serhey Popovych
Use specialized helper to initialize endpoint addresses with zeros instead of open coding this. This unifies initialization style with other ipv6 tunnel variants (i.e. gre6 and vti6). Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_ip6tnl.c |4 ++-- 1 file chan

[PATCH iproute2 0/3] Improve iplink index, alias and name parameters handling

2017-12-18 Thread Serhey Popovych
does not exceed IFALIASZ - 1. 3) Drop redundant name parameter length checks in iplink_vxcan.c and link_veth.c. See individual patch description message for details. Thanks, Serhii Serhey Popovych (3): iplink: Improve index parameter handling iplink: Process "alias"

[PATCH iproute2 1/3] iplink: Improve index parameter handling

2017-12-18 Thread Serhey Popovych
. No need to initialize ifi_index with 0 since it is already initialized at the @struct req initialization time and not modified in iplink_parse(). Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/iplink.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --g

[PATCH iproute2 3/3] iplink: Kill redundant network device name checks

2017-12-18 Thread Serhey Popovych
Since commit 625df645b703 (Check user supplied interface name lengths) iplink_parse() validates network device name using check_ifname() helpers. Remove redundant "name" length checks from iplink_parse() callers. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- i

[PATCH iproute2 2/3] iplink: Process "alias" parameter correctly

2017-12-18 Thread Serhey Popovych
Do not stop parameters processing after "alias" parameter: it might not be a last one. Seems copy pasted from "type" parameter code. Check it's length does not exceed IFALIASZ - 1. Better we warn than get RTNL error. Signed-off-by: Serhey Popovych <serhe.popov...@gmai

[PATCH iproute2 2/3] utils: ll_map: Update name and type for existing entry

2017-12-19 Thread Serhey Popovych
duplications. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- lib/ll_map.c | 33 ++--- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/ll_map.c b/lib/ll_map.c index f65614f..abe7bdc 100644 --- a/lib/ll_map.c +++ b/lib/ll_map.c @@ -10,6

[PATCH iproute2 3/3] utils: ll_map: Make network device name fixed size array of char

2017-12-19 Thread Serhey Popovych
/store instructions on 64/32 bit systems. Check if IFLA_IFNAME attribute present in netlink message (should always) and use strncpy() to pad name with zeros. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- lib/ll_map.c | 20 1 file changed, 12 insertions

[PATCH iproute2 0/3] Forbid "type" for peer, update ifname and make it array in ll_cache

2017-12-19 Thread Serhey Popovych
benefit from compiler call inlining. See individual patch description message for details. Thanks, Serhii Serhey Popovych (3): vxcan,veth: Forbid "type" for peer device utils: ll_map: Update name and type for existing entry utils: ll_map: Make network device name fixed size

[PATCH iproute2 1/3] vxcan,veth: Forbid "type" for peer device

2017-12-19 Thread Serhey Popovych
: argument "type" is wrong: not supported for peer Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/iplink_vxcan.c |3 +++ ip/link_veth.c|3 +++ 2 files changed, 6 insertions(+) diff --git a/ip/iplink_vxcan.c b/ip/iplink_vxcan.c index c13224c..13f2577

[PATCH iproute2 2/2] ip/tunnel: No need to free answer after rtnl_talk() on error

2017-12-19 Thread Serhey Popovych
Since rtnl_talk() never returns with answer buffer allocated on error we do not need to release it manually. After this initializing answer with NULL before rtnl_talk() is useless. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre.c|3 +-- ip/link_gre6.c

[PATCH iproute2 1/2] utils: ll_addr: Handle ARPHRD_IP6GRE in ll_addr_n2a()

2017-12-19 Thread Serhey Popovych
default link/tunnel6 :: brd :: 19: ip6gre0: mtu 1456 qdisc noop state DOWN mode DEFAULT group default link/gre6 :: brd :: Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- lib/ll_addr.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ll_ad

[PATCH iproute2 0/2] ip/tunnel: Do not free() answer on rtnl_talk() error, correct ip6gre

2017-12-19 Thread Serhey Popovych
with ll_addr_n2a(): endpoints are IPv6 addresses, not hex dump. See individual patch description message for details. Thanks, Serhii Serhey Popovych (2): utils: ll_addr: Handle ARPHRD_IP6GRE in ll_addr_n2a() ip/tunnel: No need to free answer after rtnl_talk() on error ip/link_gre.c|3

[PATCH iproute2 1/3] ip/tunnel: Unify setup and accept zero address for local/remote endpoints

2017-12-13 Thread Serhey Popovych
It is fully legal to submit zero (INADDR_ANY/IN6ADDR_ANY_INIT) value for local and/or remote endpoints for all tunnel drivers: no need additionally check this in userspace. Note that all tunnel specific code already can pass zero address to the kernel. Signed-off-by: Serhey Popovych <serhe.po

[PATCH iproute2 2/3] ip/tunnel: Use get_addr() instead of get_prefix() for local/remote endpoints

2017-12-13 Thread Serhey Popovych
it is possible to create tunnel with commands: ipli add dev ip6gre2 type ip6gre local fe80::1/64 remote fe80::2/64 ip -4 li add dev ip6gre2 type ip6gre local 10.0.0.1/24 remote 10.0.0.2/24 Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/ip6tunnel.c |8 ++

[PATCH iproute2 3/3] ip: gre: fix IFLA_GRE_LINK attribute sizing

2017-12-13 Thread Serhey Popovych
Attribute IFLA_GRE_LINK is 32 bit long, not 8 bit. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/link_gre.c b/ip/link_gre.c index 6f82fb4..09f1e44 100644 --- a/ip/link_gre.c ++

[PATCH iproute2 0/3] Improve tunnel local/remote endpoint params and gre link attribute handling

2017-12-13 Thread Serhey Popovych
are zero (e.g. INADDR_ANY): it is fully legal value, accepted by the kernel. See individual patch description message for details. Thanks, Serhii Serhey Popovych (3): ip/tunnel: Unify setup and accept zero address for local/remote endpoints ip/tunnel: Use get_addr() instead of get_prefix

[PATCH iproute2 v3 4/7] ip6/tunnel: Unify flowlabel printing

2018-01-08 Thread Serhey Popovych
attribute is given and IP6_TNL_F_USE_ORIG_FLOWLABEL isn't set. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 15 --- ip/link_ip6tnl.c | 14 -- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_

[PATCH iproute2 0/7] ip6/tunnel: Unify tclass, flowlabel and encap_limit output

2018-01-08 Thread Serhey Popovych
With this series I want to improve printing of tclass, flowlabel and encapsulation limit (encap_limit) options. Everything within this series is open for your comments, suggestions and criticism. See individual patch description message for details. Thanks, Serhii Serhey Popovych (7): ip6

[PATCH iproute2 v3 3/7] ip6/tunnel: Unify tclass printing

2018-01-08 Thread Serhey Popovych
and check for IFLA_GRE_FLOWINFO attribute presense. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 16 +--- ip/link_ip6tnl.c | 16 +--- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_gre6.c

[PATCH iproute2 v3 1/7] ip6/tunnel: Fix tclass output

2018-01-08 Thread Serhey Popovych
s: 1facc1c61c07 ("ip: link_ip6tnl.c: add json output support") Fixes: 2e706e12d9b0 ("Merge branch 'master' into net-next") Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c |2 +- ip/link_ip6tnl.c |2 +- 2 files changed, 2 insertions(+), 2

[PATCH iproute2 v3 2/7] ip6tnl/tunnel: Do not print obscure flowinfo

2018-01-08 Thread Serhey Popovych
It is implementation internal and main purpose of printing it seems debugging. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_ip6tnl.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c index 8e84ed0..e084975

[PATCH iproute2 v3 0/7] ip6/tunnel: Unify tclass, flowlabel and encap_limit output

2018-01-08 Thread Serhey Popovych
With this series I want to improve printing of tclass, flowlabel and encapsulation limit (encap_limit) options. Everything within this series is open for your comments, suggestions and criticism. See individual patch description message for details. Thanks, Serhii Serhey Popovych (7): ip6

[PATCH iproute2 v3 5/7] ip6/tunnel: Unify encap_limit printing

2018-01-08 Thread Serhey Popovych
Use %u format specifier to print it in link_gre6.c and make code more readable. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 11 --- ip/link_ip6tnl.c | 12 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ip/link_

[PATCH iproute2 v3 6/7] gre6/tunnel: Output flowlabel after tclass

2018-01-08 Thread Serhey Popovych
To follow ip6tnl output print flowlabel after tclass in link_gre6.c. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_gre6.c index 8

[PATCH iproute2 3/7] ip6/tunnel: Unify tclass printing

2018-01-08 Thread Serhey Popovych
and check for IFLA_GRE_FLOWINFO attribute presense. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 16 +--- ip/link_ip6tnl.c | 16 +--- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_gre6.c

[PATCH iproute2 7/7] ip6tnl/tunnel: Output hoplimit before encapsulation limit

2018-01-08 Thread Serhey Popovych
To follow gre6 output print hoplimit before encapsulation limit in link_ip6tnl.c. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_ip6tnl.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c index 3

[PATCH iproute2 6/7] gre6/tunnel: Output flowlabel after tclass

2018-01-08 Thread Serhey Popovych
To follow ip6tnl output print flowlabel after tclass in link_gre6.c. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_gre6.c index 8

[PATCH iproute2 4/7] ip6/tunnel: Unify flowlabel printing

2018-01-08 Thread Serhey Popovych
attribute is given and IP6_TNL_F_USE_ORIG_FLOWLABEL isn't set. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 15 --- ip/link_ip6tnl.c | 14 -- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_

[PATCH iproute2 5/7] ip6/tunnel: Unify encap_limit printing

2018-01-08 Thread Serhey Popovych
Use %u format specifier to print it in link_gre6.c and make code more readable. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 11 --- ip/link_ip6tnl.c | 12 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ip/link_

Re: [PATCH iproute2 v3 0/7] ip6/tunnel: Unify tclass, flowlabel and encap_limit output

2018-01-08 Thread Serhey Popovych
> See individual patch description message for details. > > Thanks, > Serhii > > Serhey Popovych (7): > ip6/tunnel: Fix tclass output > ip6tnl/tunnel: Do not print obscure flowinfo > ip6/tunnel: Unify tclass printing > ip6/tunnel: Unify flowlabel printing >

[PATCH iproute2 2/7] ip6tnl/tunnel: Do not print obscure flowinfo

2018-01-08 Thread Serhey Popovych
It is implementation internal and main purpose of printing it seems debugging. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_ip6tnl.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c index 8e84ed0..e084975

[PATCH iproute2 1/7] ip6/tunnel: Fix tclass output

2018-01-08 Thread Serhey Popovych
s: 1facc1c61c07 ("ip: link_ip6tnl.c: add json output support") Fixes: 2e706e12d9b0 ("Merge branch 'master' into net-next") Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c |2 +- ip/link_ip6tnl.c |2 +- 2 files changed, 2 insertions(+), 2

[PATCH iproute2 v4 7/7] ip6tnl/tunnel: Output hoplimit before encapsulation limit

2018-01-10 Thread Serhey Popovych
To follow gre6 output print hoplimit before encapsulation limit in link_ip6tnl.c. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_ip6tnl.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c index 3

[PATCH iproute2 v4 6/7] gre6/tunnel: Output flowlabel after tclass

2018-01-10 Thread Serhey Popovych
To follow ip6tnl output print flowlabel after tclass in link_gre6.c. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_gre6.c index 8

[PATCH iproute2 v4 4/7] ip6/tunnel: Unify flowlabel printing

2018-01-10 Thread Serhey Popovych
attribute is given and IP6_TNL_F_USE_ORIG_FLOWLABEL isn't set. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 15 --- ip/link_ip6tnl.c | 14 -- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_

[PATCH iproute2 v4 2/7] ip6tnl/tunnel: Do not print obscure flowinfo

2018-01-10 Thread Serhey Popovych
It is implementation internal and main purpose of printing it seems debugging. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_ip6tnl.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c index 8e84ed0..e084975

[PATCH iproute2 v4 1/7] ip6/tunnel: Fix tclass output

2018-01-10 Thread Serhey Popovych
s: 1facc1c61c07 ("ip: link_ip6tnl.c: add json output support") Fixes: 2e706e12d9b0 ("Merge branch 'master' into net-next") Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c |2 +- ip/link_ip6tnl.c |2 +- 2 files changed, 2 insertions(+), 2

Re: [PATCH iproute2 0/7] ip6/tunnel: Unify tclass, flowlabel and encap_limit output

2018-01-10 Thread Serhey Popovych
Stephen Hemminger wrote: > On Mon, 8 Jan 2018 19:06:31 +0200 > Serhey Popovych <serhe.popov...@gmail.com> wrote: > >> With this series I want to improve printing of tclass, >> flowlabel and encapsulation limit (encap_limit) options. >> >> Everything withi

[PATCH iproute2 v4 3/7] ip6/tunnel: Unify tclass printing

2018-01-10 Thread Serhey Popovych
and check for IFLA_GRE_FLOWINFO attribute presense. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 16 +--- ip/link_ip6tnl.c | 16 +--- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_gre6.c

[PATCH iproute2 v4 0/7] iptnl/tunnel: Open JSON section, kill code duplication and print iptnl mode

2018-01-10 Thread Serhey Popovych
unnel mode to be inline with ip6tnl. See individual patch description message for details. This is v2. Fixed proto value for ipip tunnel mode: "proto ipip" vs "proto ip4ip4" previously. v4 rebased to current upstream v1..v3 no changes. initially started with v3 instead of v1 Than

[PATCH iproute2 v4 5/7] ip6/tunnel: Unify encap_limit printing

2018-01-10 Thread Serhey Popovych
Use %u format specifier to print it in link_gre6.c and make code more readable. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 11 --- ip/link_ip6tnl.c | 12 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ip/link_

[PATCH iproute2 v5 0/7] ip6/tunnel: Unify tclass, flowlabel and encap_limit output

2018-01-10 Thread Serhey Popovych
v4 rebased to current upstream v1..v3 no changes. initially started with v3 instead of v1 Thanks, Serhii Serhey Popovych (7): ip6/tunnel: Fix tclass output ip6tnl/tunnel: Do not print obscure flowinfo ip6/tunnel: Unify tclass printing ip6/tunnel: Unify flowlabel printing ip6/tunnel

[PATCH iproute2 v5 3/7] ip6/tunnel: Unify tclass printing

2018-01-10 Thread Serhey Popovych
and check for IFLA_GRE_FLOWINFO attribute presense. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 16 +--- ip/link_ip6tnl.c | 16 +--- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_gre6.c

[PATCH iproute2 v5 2/7] ip6tnl/tunnel: Do not print obscure flowinfo

2018-01-10 Thread Serhey Popovych
It is implementation internal and main purpose of printing it seems debugging. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_ip6tnl.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c index 8e84ed0..e084975

[PATCH iproute2 v5 1/7] ip6/tunnel: Fix tclass output

2018-01-10 Thread Serhey Popovych
s: 1facc1c61c07 ("ip: link_ip6tnl.c: add json output support") Fixes: 2e706e12d9b0 ("Merge branch 'master' into net-next") Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c |2 +- ip/link_ip6tnl.c |2 +- 2 files changed, 2 insertions(+), 2

[PATCH iproute2 v5 5/7] ip6/tunnel: Unify encap_limit printing

2018-01-10 Thread Serhey Popovych
Use %u format specifier to print it in link_gre6.c and make code more readable. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 11 --- ip/link_ip6tnl.c | 12 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ip/link_

[PATCH iproute2 v5 4/7] ip6/tunnel: Unify flowlabel printing

2018-01-10 Thread Serhey Popovych
attribute is given and IP6_TNL_F_USE_ORIG_FLOWLABEL isn't set. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 15 --- ip/link_ip6tnl.c | 14 -- 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_

[PATCH iproute2 v5 6/7] gre6/tunnel: Output flowlabel after tclass

2018-01-10 Thread Serhey Popovych
To follow ip6tnl output print flowlabel after tclass in link_gre6.c. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre6.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ip/link_gre6.c b/ip/link_gre6.c index 8

[PATCH iproute2 v5 7/7] ip6tnl/tunnel: Output hoplimit before encapsulation limit

2018-01-10 Thread Serhey Popovych
To follow gre6 output print hoplimit before encapsulation limit in link_ip6tnl.c. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_ip6tnl.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c index 3

Re: [PATCH iproute2 v4 0/7] iptnl/tunnel: Open JSON section, kill code duplication and print iptnl mode

2018-01-10 Thread Serhey Popovych
Serhey Popovych wrote: > In this series I present following improvements and fixes: > > 1) Add missing open_json_context() to link_iptnl.c > for "encap" options. > > 2) Get rid of code duplication when parsing tunnel mode > parameters in l

[PATCH iproute2 v2 5/9] ip/tunnel: Abstract tunnel encapsulation options printing

2018-01-18 Thread Serhey Popovych
of fputs() and fprintf() to print encapsulation for !is_json_context(). Print "unknown" parameter for "encap" type in PRINT_FP context using "%s " format specifier and benefit from complite time string merge. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.

[PATCH iproute2 v2 9/9] tunnel: Return constant string without copying it

2018-01-18 Thread Serhey Popovych
We return constant string from tnl_strproto(), no need to copy it to temporary buffer and then return such buffer as const: return constant string instead. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/tunnel.c | 25 +++-- 1 file changed, 7 inse

Re: [PATCH iproute2] tunnel: Return constant string without copying it

2018-01-18 Thread Serhey Popovych
Serhey Popovych wrote: > We return constant string from tnl_strproto(), no need > to copy it to temporary buffer and then return such > buffer as const: return constant string instead. > > Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> This change should be igno

[PATCH iproute2] iplink: Fix "alias" parameter length calculations

2018-01-18 Thread Serhey Popovych
We need NEXT_ARG() to get *argv pointing to "alias" parameter value. Overwise we get and check "alias" string length. Fixes: f88becf35e08 ("iplink: Process "alias" parameter correctly") Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com>

[PATCH iproute2 v2 3/9] ip/tunnel: Simplify and unify tos printing

2018-01-18 Thread Serhey Popovych
print_0xhex() and print_string() instead of fprintf() to output values. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/iplink_geneve.c | 23 --- ip/iplink_vxlan.c | 19 --- ip/link_gre.c | 23 --- ip/link_i

[PATCH iproute2 v2 2/9] ip/tunnel: Correct and unify ttl/hoplimit printing

2018-01-18 Thread Serhey Popovych
"uint" to reflect true nature of the ttl. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/ip6tunnel.c|5 - ip/iplink_geneve.c| 13 +++-- ip/iplink_vxlan.c | 15 +++ ip/iproute_lwtunnel.c |4 ++-- ip/ip

[PATCH iproute2 v2 4/9] ip/tunnel: Use print_0xhex() instead of print_string()

2018-01-18 Thread Serhey Popovych
-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre.c|5 ++--- ip/link_gre6.c |9 - ip/link_ip6tnl.c | 18 -- ip/link_iptnl.c | 22 ++ ip/link_vti.c|6 ++ ip/link_vti6.c |5 ++--- 6 files changed, 28 inse

[PATCH iproute2 v2 1/9] iplink: Use ll_index_to_name() instead of if_indextoname()

2018-01-18 Thread Serhey Popovych
path because in most cases cache populated. 2) It always return name in the form "if%d", even if entry is not in cache and ioctl() fails. This drops "link_index" from JSON output. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- bridge/fdb.c

[PATCH iproute2 v2 6/9] gre/tunnel: Print erspan_index using print_uint()

2018-01-18 Thread Serhey Popovych
One is missing in JSON output because fprintf() is used instead of print_uint(). Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre.c |3 ++- ip/link_gre6.c |4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ip/link_gre.c b/ip/link_gre.c

[PATCH iproute2 v2 0/9] ip/tunnel: Improve tunnel parameters printing

2018-01-18 Thread Serhey Popovych
" in the series: it is related to tunneling code too. Thanks, Serhii Serhey Popovych (9): iplink: Use ll_index_to_name() instead of if_indextoname() ip/tunnel: Correct and unify ttl/hoplimit printing ip/tunnel: Simplify and unify tos printing ip/tunnel: Use print_0xhex() instead of pri

[PATCH iproute2 v2 7/9] vti/tunnel: Unify ikey/okey printing

2018-01-18 Thread Serhey Popovych
as in rest of tunnel support code (64 bytes) and check return from inet_ntop(). Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_vti.c | 22 ++ ip/link_vti6.c | 14 ++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --gi

[PATCH iproute2 v2 8/9] vti6/tunnel: Unify and simplify link type help functions

2018-01-18 Thread Serhey Popovych
with other tunneling code. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_vti6.c | 32 ++-- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/ip/link_vti6.c b/ip/link_vti6.c index 6b61e3d..2a86d59 100644 --- a/ip/link_vti6.c +++

[PATCH iproute2 4/6] iplink_geneve: Get rid of inet_get_addr()

2018-01-18 Thread Serhey Popovych
Now we have additional information about address class from get_addr() we can use it in place of inet_get_addr(). Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/iplink_geneve.c | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --gi

[PATCH iproute2 5/6] iplink_vxlan: Get rid of inet_get_addr()

2018-01-18 Thread Serhey Popovych
Now we have additional information about address class from get_addr() we can use it in place of inet_get_addr(). Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/iplink_vxlan.c | 72 +++-- 1 file changed, 26 insertions(

[PATCH iproute2 2/6] utils: Always specify family and ->bytelen in get_prefix_1()

2018-01-18 Thread Serhey Popovych
lue -1. Reduce intendation by one level and get rid of goto/label to make code more readable. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- lib/utils.c | 64 +-- 1 file changed, 32 insertions(+), 32 deletions(-) diff --gi

[PATCH iproute2 0/6] utils: Get rid of inet_get_addr()

2018-01-18 Thread Serhey Popovych
in ip/tunnel code (there will be additional series based on this one). Also fix get_addr_1() and get_prefix() to make sure it always provide correct ->family and ->bitlen. As always comments, suggestions and criticism are welcome. Thanks, Serhii Serhey Popovych (6): utils: Always specify

[PATCH iproute2 1/6] utils: Always specify family for address in get_addr_1()

2018-01-18 Thread Serhey Popovych
one explicitly given as @family: use af_byte_len() to correctly set address length. Still assume AF_INET when @family is AF_UNSPEC. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- lib/utils.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils.c b

[PATCH iproute2 6/6] ip: Get rid of inet_get_addr()

2018-01-18 Thread Serhey Popovych
Both geneve and vxlan modules are converted to use get_addr() we can replace inet_get_addr() in less problematic places and finally get rid of inet_get_addr(). Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- include/utils.h |1 - ip/iproute_lwtunnel.c |5 +++

[PATCH iproute2 3/6] utils: Fast inet address classification after get_addr()

2018-01-18 Thread Serhey Popovych
or unspecified inet bool is_addrtype_inet_not_multi(inet_prefix *addr) true if @addr is not multicast inet address false if @addr is not inet or multicast inet Last two are useful for case when we need inet address that is not unspecified or multicast. Signed-off-by: Serhey Popovych

[PATCH iproute2 2/4] iptnl/ip6tnl: Unify ttl/hoplimit parsing routines

2018-01-19 Thread Serhey Popovych
Handle "inherit" case properly for gre6 and ip6tnl. Use get_u8() in gre to parse ttl/hoplimit. Be consistent about "hlim" alias to ttl/hoplimit support. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_gre.c| 10 +++--- ip/link_gre6.c

[PATCH iproute2 4/4] iplink: Use ll_name_to_index() instead of if_nametoindex()

2018-01-19 Thread Serhey Popovych
() will attempt to get index from common name in form "if%d" that may be returned from ll_index_to_name(). This makes output from ip(8) coherent with it's input. Note that most of the code already switched from plain if_nametoindex() to ll_name_to_index() to cached variant. Signed-off-

[PATCH iproute2 0/4] ip/tunnel: Minor cleanups and improvements

2018-01-19 Thread Serhey Popovych
8) output and input parameter acceptance coherent. See individual patch description message for details. Thanks, Serhii Serhey Popovych (4): tunnel: Add space between encap-dport and encap-sport in non-JSON output iptnl/ip6tnl: Unify ttl/hoplimit parsing routines vti/vti6: Minor imp

[PATCH iproute2 3/4] vti/vti6: Minor improvements

2018-01-19 Thread Serhey Popovych
local/remote attributes from the ikey/okey in vti6 to match vti module. Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/link_vti.c |2 +- ip/link_vti6.c |6 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ip/link_vti.c b/ip/link_vti.c

[PATCH iproute2 1/4] tunnel: Add space between encap-dport and encap-sport in non-JSON output

2018-01-19 Thread Serhey Popovych
Fixes: bad76e6b1f44 ("ip/tunnel: Abstract tunnel encapsulation options printing") Fixes: e2d4588331fc ("ip: link_gre.c: add json output support") Signed-off-by: Serhey Popovych <serhe.popov...@gmail.com> --- ip/tunnel.c |4 ++-- 1 file changed, 2 insertions(+),

[PATCH iproute2-next v3 0/8] ip: Introduce and use get_addr_rta()/inet_addr_match_rta()

2018-01-24 Thread Serhey Popovych
in editor to 72 max. v2 Introduce and use inet_addr_match_rta() as suggested by David Ahern. Check for result from get_prefix() in places where inet_addr_match_rta() being used. Thanks, Serhii Serhey Popovych (8): utils: Introduce get_addr_rta() and inet_addr_match_rta() ipaddress: Use

[PATCH iproute2-next v3 1/8] utils: Introduce get_addr_rta() and inet_addr_match_rta()

2018-01-24 Thread Serhey Popovych
successfully if no attribute is given (@rta is NULL), reference address family is AF_UNSPEC or it's length isn't given; fails if get_attr_rta() can't get attribute or it's family does not match reference; calls inet_addr_match() to get final verdict. Signed-off-by: Serhey Popovych <serhe.po

  1   2   3   4   >