Re: [PATCH iproute2] fix print_0xhex on 32 bit

2018-12-19 Thread Serhey Popovych
Stephen Hemminger wrote: > The argument to print_0xhex is converted to unsigned long long > so the format string give for normal printout has to be some > variant of %llx. Otherwise, bogus values will be printed on > 32 bit platforms. Sorry it is too late and change is merged as commit 90c5c969f0

[PATCH net-next] tun: Consistently configure generic netdev params via rtnetlink

2018-10-09 Thread Serhey Popovych
tun_validate() when @data is NULL that is always in case since rtnl_link_ops->maxtype is zero in tun driver. Fixes: f019a7a594d9 ("tun: Implement ip link del tunXXX") Signed-off-by: Serhey Popovych --- drivers/net/tun.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/driver

[PATCH iproute2] ipaddress: Fix and make consistent label match handling

2018-07-14 Thread Serhey Popovych
Fixes: commit 9516823051ce ("ipaddress: Improve print_linkinfo()") Reported-by: Vincent Bernat Signed-off-by: Serhey Popovych --- ip/ipaddress.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 5009bfe..ea8211c 100644 --

Re: [PATCH iproute2-next] ipaddress: fix label matching

2018-07-14 Thread Serhey Popovych
Serhey Popovych wrote: > Vincent Bernat wrote: >> ❦ 11 juillet 2018 21:01 -0400, David Ahern  : >> >>>> +++ b/ip/ipaddress.c >>>> @@ -837,11 +837,6 @@ int print_linkinfo(const struct sockaddr_nl *who, >>>>if (!name) >>

Re: [PATCH iproute2-next] ipaddress: fix label matching

2018-07-14 Thread Serhey Popovych
Vincent Bernat wrote: > ❦ 11 juillet 2018 21:01 -0400, David Ahern  : > >>> +++ b/ip/ipaddress.c >>> @@ -837,11 +837,6 @@ int print_linkinfo(const struct sockaddr_nl *who, >>> if (!name) >>> return -1; >>> >>> - if (filter.label && >>> - (!filter.family || filter.family

[PATCH iproute2-next v4 1/4] utils: Introduce and use nodev() helper routine

2018-03-07 Thread Serhey Popovych
and returns -1 to it's caller. Either call exit() or return to the caller to preserve behaviour before change. Use -nodev() in traffic control (tc) code to return 1. Simplify expression for checking for argument being 0/NULL in @if statement. Signed-off-by: Serhey Popovych --- bridge/

[PATCH iproute2-next v4 4/4] iplink: Perform most of request buffer setups and checks in iplink_parse()

2018-03-07 Thread Serhey Popovych
are not needed outside. While there change return -1 to exit(-1) for group parsing errors: we want to stop further command processing unless -force option is given to get error line easily. Signed-off-by: Serhey Popovych --- ip/ip_common.h|4 +- ip/iplink.c | 143

[PATCH iproute2-next v4 2/4] iplink: Use "dev" and "name" parameters interchangeable when possible

2018-03-07 Thread Serhey Popovych
behaviour on link create: ip link add {name|dev} veth1a type veth peer {name|dev} veth1b Signed-off-by: Serhey Popovych --- ip/iplink.c | 34 ++ 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/ip/iplink.c b/ip/iplink.c index 5471626..b43

[PATCH iproute2-next v4 0/4] iplink: Improve iplink_parse()

2018-03-07 Thread Serhey Popovych
ments to help identify failing line in batch mode. Thanks, Serhii Serhey Popovych (4): utils: Introduce and use nodev() helper routine iplink: Use "dev" and "name" parameters interchangeable when possible iplink: Follow documented behaviour when "index" is

[PATCH iproute2-next v4 3/4] iplink: Follow documented behaviour when "index" is given

2018-03-07 Thread Serhey Popovych
ed for ip link delete scenario (actually "index" being ignored in favor to "dev"). Prohibit "index" when configuring/deleting group of network devices. Signed-off-by: Serhey Popovych --- ip/iplink.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) d

Re: [PATCH iproute2 2/3] ss: Fix build with old libc headers without AF_VSOCK

2018-03-01 Thread Serhey Popovych
Stephen Hemminger wrote: > On Tue, 27 Feb 2018 14:06:51 +0200 > Serhey Popovych wrote: > >> diff --git a/include/compat/libc/bits/socket.h >> b/include/compat/libc/bits/socket.h >> new file mode 100644 >> index 000..25ef0d5 >> --- /dev/null >

Re: [PATCH iproute2 1/3] ip: Fix compilation with kernel headers < 3.4

2018-03-01 Thread Serhey Popovych
Stephen Hemminger wrote: > On Tue, 27 Feb 2018 21:34:56 +0200 > Serhey Popovych wrote: > >> Stephen Hemminger wrote: >>> On Tue, 27 Feb 2018 14:06:50 +0200 >>> Serhey Popovych wrote: >>> >>>> Since commit 596b1c94aa38 ("iprout

Re: [PATCH iproute2 1/3] ip: Fix compilation with kernel headers < 3.4

2018-02-27 Thread Serhey Popovych
Stephen Hemminger wrote: > On Tue, 27 Feb 2018 14:06:50 +0200 > Serhey Popovych wrote: > >> Since commit 596b1c94aa38 ("iproute: build more easily on Android"), >> iproute2 uses types __kernel_long_t and __kernel_ulong_t but does not >> provide internal defi

Re: [PATCH iproute2] Fix compilation with kernel headers < 3.4

2018-02-27 Thread Serhey Popovych
Thomas De Schampheleire wrote: > On Mon, Feb 26, 2018 at 09:46:41PM +0200, Serhey Popovych wrote: >> Since commit 596b1c94aa38e21b7a8c8562e8b61ccb744255d2, iproute2 uses types >> __kernel_long_t and __kernel_ulong_t but does not provide internal >> definitions for it.

[PATCH iproute2 3/3] ip: Get rid of custom netinet/tcp.h

2018-02-27 Thread Serhey Popovych
eport ecnseen") and original one introducing this include commit 76e5d2c39201 ("add include/netinet/tcp.h"). Any missing functionality and compatibility stuff must go to "compat" subdirectory in include/. Signed-off-by: Serhey Popovych ---

[PATCH iproute2 0/3] ip: Provide compatibility bits to build with old glibc/kernel headers

2018-02-27 Thread Serhey Popovych
x27;s contents for compat. As usal reviews, comments and suggestions are welcome. Thanks, Serhii Serhey Popovych (3): ip: Fix compilation with kernel headers < 3.4 ss: Fix build with old libc headers without AF_VSOCK ip: Get rid of custom netinet/tcp.h Makefile

[PATCH iproute2 1/3] ip: Fix compilation with kernel headers < 3.4

2018-02-27 Thread Serhey Popovych
Thomas De Schampheleire Signed-off-by: Serhey Popovych --- Makefile |5 - include/compat/kernel/linux/sysinfo.h | 14 ++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 include/compat/kernel/linux/sysinfo.h diff --git a/

[PATCH iproute2 2/3] ss: Fix build with old libc headers without AF_VSOCK

2018-02-27 Thread Serhey Popovych
ompatibility; adjust AF_MAX and PF_MAX to reflect change. Tested in Debian 7 (Wheezy) environment with glibc-2.13 and Linux Kernel 3.2. Still supported config until 31 May 2018 according to Debian LTS support page. Signed-off-by: Serhey Popovych --- include/compat/libc/bits/socket.h | 15 +++

Re: [PATCH iproute2] Fix compilation with kernel headers < 3.4

2018-02-26 Thread Serhey Popovych
Thomas De Schampheleire wrote: > On Mon, Feb 26, 2018 at 09:46:41PM +0200, Serhey Popovych wrote: >> Since commit 596b1c94aa38e21b7a8c8562e8b61ccb744255d2, iproute2 uses types >> __kernel_long_t and __kernel_ulong_t but does not provide internal >> definitions for it.

Re: [PATCH iproute2-next v3 8/8] iplink: Reduce number of arguments to iplink_parse()

2018-02-26 Thread Serhey Popovych
Serhey Popovych wrote: > David Ahern wrote: >> On 2/26/18 11:20 AM, Serhey Popovych wrote: >>> Stephen Hemminger wrote: >>>> On Thu, 22 Feb 2018 15:02:06 +0200 >>>> Serhey Popovych wrote: >>>> >>>>> +struct iplink_parse_args {

Re: [PATCH iproute2] Fix compilation with kernel headers < 3.4

2018-02-26 Thread Serhey Popovych
Serhey Popovych wrote: > Since commit 596b1c94aa38e21b7a8c8562e8b61ccb744255d2, iproute2 uses types > __kernel_long_t and __kernel_ulong_t but does not provide internal > definitions for it. > > This means that compilation using kernel headers that are older than 3.4 > (wher

[PATCH iproute2] Fix compilation with kernel headers < 3.4

2018-02-26 Thread Serhey Popovych
Signed-off-by: Serhey Popovych --- include/linux/sysinfo.h | 14 ++ misc/ss.c | 10 ++ 2 files changed, 24 insertions(+) create mode 100644 include/linux/sysinfo.h diff --git a/include/linux/sysinfo.h b/include/linux/sysinfo.h new file mode 100644 index

Re: [PATCH iproute2] Fix compilation with kernel headers < 3.4

2018-02-26 Thread Serhey Popovych
Thomas De Schampheleire wrote: > Since commit 596b1c94aa38e21b7a8c8562e8b61ccb744255d2, iproute2 uses types > __kernel_long_t and __kernel_ulong_t but does not provide internal > definitions for it. I tried one time to build with headers from 3.2 (last supported LTS at the moment) and found that A

Re: [PATCH iproute2-next v3 8/8] iplink: Reduce number of arguments to iplink_parse()

2018-02-26 Thread Serhey Popovych
David Ahern wrote: > On 2/26/18 11:20 AM, Serhey Popovych wrote: >> Stephen Hemminger wrote: >>> On Thu, 22 Feb 2018 15:02:06 +0200 >>> Serhey Popovych wrote: >>> >>>> +struct iplink_parse_args { >>>> + const char *dev; >>>&g

Re: [PATCH iproute2-next v3 8/8] iplink: Reduce number of arguments to iplink_parse()

2018-02-26 Thread Serhey Popovych
Stephen Hemminger wrote: > On Thu, 22 Feb 2018 15:02:06 +0200 > Serhey Popovych wrote: > >> +struct iplink_parse_args { >> +const char *dev; >> +const char *name; >> +const char *type; >> + >> +/* This definitely must be the last on

Re: [PATCH iproute2-next v3 8/8] iplink: Reduce number of arguments to iplink_parse()

2018-02-26 Thread Serhey Popovych
David Ahern wrote: > On 2/22/18 6:02 AM, Serhey Popovych wrote: >> Introduce new @struct iplink_parse_args data structure to consolidate >> arguments to iplink_parse(). This will reduce number of arguments >> passed to it. >> >> Pass this data structure to ->pa

Re: [PATCH iproute2-next v3 5/8] veth,vxcan: Save/reinitialize/restore whole @struct ifinfomsg

2018-02-26 Thread Serhey Popovych
David Ahern wrote: > On 2/22/18 6:02 AM, Serhey Popovych wrote: >> Now in iplink_parse() we use ->ifi_change and ->ifi_flags fields and >> plan to use ->ifi_index with upcoming change. >> >> Saving, restoring and reinitializing individual fields is error prone

Re: [PATCH iproute2-next v3 6/8] iplink: Perform most of request buffer setups and checks in iplink_parse()

2018-02-26 Thread Serhey Popovych
David Ahern wrote: > On 2/22/18 6:02 AM, Serhey Popovych wrote: >> To benefit other users (e.g. link_veth.c) of iplink_parse() from >> additional attribute checks and setups made in iplink_modify(). This >> catches most of weired cobination of parameters to peer device >>

Re: [PATCH iproute2-next v3 5/8] veth,vxcan: Save/reinitialize/restore whole @struct ifinfomsg

2018-02-26 Thread Serhey Popovych
David Ahern wrote: > On 2/22/18 6:02 AM, Serhey Popovych wrote: >> Now in iplink_parse() we use ->ifi_change and ->ifi_flags fields and >> plan to use ->ifi_index with upcoming change. >> >> Saving, restoring and reinitializing individual fields is error prone

Re: [PATCH iproute2-next v3 8/8] iplink: Reduce number of arguments to iplink_parse()

2018-02-26 Thread Serhey Popovych
David Ahern wrote: > On 2/22/18 6:02 AM, Serhey Popovych wrote: >> Introduce new @struct iplink_parse_args data structure to consolidate >> arguments to iplink_parse(). This will reduce number of arguments >> passed to it. >> >> Pass this data structure to ->pa

Re: [PATCH iproute2-next v3 2/8] iplink: Correctly report error when network device isn't found

2018-02-25 Thread Serhey Popovych
David Ahern wrote: > On 2/22/18 6:02 AM, Serhey Popovych wrote: >> @@ -650,6 +658,9 @@ int iplink_parse(int argc, char **argv, struct >> iplink_req *req, >> bool drv = strcmp(*argv, "xdpdrv") == 0; >> bool offlo

[PATCH iproute2-next v3 1/8] utils: Introduce and use nodev() helper routine

2018-02-22 Thread Serhey Popovych
and returns -1 to it's caller. Either call exit() or return to the caller to preserve behaviour before change. Use -nodev() in traffic control (tc) code to return 1. Simplify expression for checking for argument being 0/NULL in @if statement. Signed-off-by: Serhey Popovych --- bridge/

[PATCH iproute2-next v3 3/8] iplink: Use "dev" and "name" parameters interchangeable when possible

2018-02-22 Thread Serhey Popovych
behaviour on link create: ip link add {name|dev} veth1a type veth peer {name|dev} veth1b Signed-off-by: Serhey Popovych --- ip/iplink.c | 34 ++ 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/ip/iplink.c b/ip/iplink.c index fc358fc..135

[PATCH iproute2-next v3 5/8] veth,vxcan: Save/reinitialize/restore whole @struct ifinfomsg

2018-02-22 Thread Serhey Popovych
in device ifinfomsg data. Since @struct ifinfomsg is small enough with known sizeof() compiler may inline memcpy()/memset() with few load/store instructions. Signed-off-by: Serhey Popovych --- ip/iplink_vxcan.c | 22 -- ip/link_veth.c| 22 -- 2 files ch

[PATCH iproute2-next v3 0/8] iplink: Improve iplink_parse()

2018-02-22 Thread Serhey Popovych
a exit() when failing to parse command line arguments to help identify failing line in batch mode. Thanks, Serhii Serhey Popovych (8): utils: Introduce and use nodev() helper routine iplink: Correctly report error when network device isn't found iplink: Use "dev" and "

[PATCH iproute2-next v3 6/8] iplink: Perform most of request buffer setups and checks in iplink_parse()

2018-02-22 Thread Serhey Popovych
needed outside. While there change return -1 to exit(-1) for group parsing errors: we want to stop further command processing unless -force option is given to get error line easily. Signed-off-by: Serhey Popovych --- ip/ip_common.h|3 +- ip/iplink.c | 118

[PATCH iproute2-next v3 7/8] iplink: Move data structures to block of their users

2018-02-22 Thread Serhey Popovych
This will consolidate data and code using it in single place and prepare for upcoming ->parse_opt() method change. Signed-off-by: Serhey Popovych --- ip/link_gre.c| 32 ip/link_gre6.c | 32 ip/link_ip6tnl.c |

[PATCH iproute2-next v3 4/8] iplink: Follow documented behaviour when "index" is given

2018-02-22 Thread Serhey Popovych
ed for ip link delete scenario (actually "index" being ignored in favor to "dev"). Prohibit "index" when configuring/deleting group of network devices. Signed-off-by: Serhey Popovych --- ip/iplink.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) d

[PATCH iproute2-next v3 2/8] iplink: Correctly report error when network device isn't found

2018-02-22 Thread Serhey Popovych
not found) for this. Signed-off-by: Serhey Popovych --- ip/iplink.c | 16 +--- ip/iplink_xdp.c |7 +-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ip/iplink.c b/ip/iplink.c index 5471626..fc358fc 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -569,6 +569,1

[PATCH iproute2-next v3 8/8] iplink: Reduce number of arguments to iplink_parse()

2018-02-22 Thread Serhey Popovych
off-by: Serhey Popovych --- ip/ip_common.h | 16 +--- ip/iplink.c | 34 ++ ip/iplink_bond.c |4 +++- ip/iplink_bond_slave.c |4 +++- ip/iplink_bridge.c |4 +++- ip/iplink_bridge_slave.c |4 +++-

Re: [PATCH iproute2-next v2 2/7] iplink: Correctly report error when network device isn't found

2018-02-20 Thread Serhey Popovych
David Ahern wrote: > On 2/20/18 2:37 PM, Serhey Popovych wrote: >> Distinguish cases when "dev" parameter isn't given from cases where no >> network device corresponding to "dev" is found. >> >> Do not check for index validity in xdp_parse():

Re: [PATCH iproute2-next v2] ip: link_gre6.c: Support IP6_TNL_F_ALLOW_LOCAL_REMOTE flag

2018-02-20 Thread Serhey Popovych
Petr Machata wrote: > For IP-in-IP tunnels, one can specify the [no]allow-localremote command > when configuring a device. Under the hood, this flips the > IP6_TNL_F_ALLOW_LOCAL_REMOTE flag on the netdevice. However, ip6gretap > and ip6erspan devices, where the flag is also relevant, are not IP-in-

Re: [PATCH iproute2-next v2 3/7] iplink: Use "dev" and "name" parameters interchangeable when possible

2018-02-20 Thread Serhey Popovych
Stephen Hemminger wrote: > On Tue, 20 Feb 2018 23:37:25 +0200 > Serhey Popovych wrote: > >> Both of them accept network device name as argument, but have different >> meaning: >> >> dev - is a device by it's name, >> name - name for specific d

[PATCH iproute2-next v2 3/7] iplink: Use "dev" and "name" parameters interchangeable when possible

2018-02-20 Thread Serhey Popovych
tility behaviour on link create: ip link add {name|dev} veth1a type veth peer {name|dev} veth1b Signed-off-by: Serhey Popovych --- ip/iplink.c | 34 ++ 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/ip/iplink.c b/ip/iplink.c index

[PATCH iproute2-next v2 7/7] iplink: Reduce number of arguments to iplink_parse()

2018-02-20 Thread Serhey Popovych
off-by: Serhey Popovych --- ip/ip_common.h | 16 +--- ip/iplink.c | 34 ++ ip/iplink_bond.c |4 +++- ip/iplink_bond_slave.c |4 +++- ip/iplink_bridge.c |4 +++- ip/iplink_bridge_slave.c |4 +++-

[PATCH iproute2-next v2 2/7] iplink: Correctly report error when network device isn't found

2018-02-20 Thread Serhey Popovych
not found) for this. Signed-off-by: Serhey Popovych --- ip/iplink.c | 16 +--- ip/iplink_xdp.c |7 +-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ip/iplink.c b/ip/iplink.c index 5471626..fc358fc 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -569,6 +569,1

[PATCH iproute2-next v2 5/7] iplink: Perform most of request buffer setups and checks in iplink_parse()

2018-02-20 Thread Serhey Popovych
and processing unless -force option is given to get error line easily. Signed-off-by: Serhey Popovych --- ip/ip_common.h|3 +- ip/iplink.c | 118 + ip/iplink_vxcan.c | 27 +++- ip/link_veth.c| 27 +++- 4 files chan

[PATCH iproute2-next v2 6/7] iplink: Move data structures to block of their users

2018-02-20 Thread Serhey Popovych
This will consolidate data and code using it in single place and prepare for upcoming ->parse_opt() method change. Signed-off-by: Serhey Popovych --- ip/link_gre.c| 32 ip/link_gre6.c | 32 ip/link_ip6tnl.c |

[PATCH iproute2-next v2 0/7] iplink: Improve iplink_parse()

2018-02-20 Thread Serhey Popovych
v2 Terminate via exit() when failing to parse command line arguments to help identify failing line in batch mode. Thanks, Serhii Serhey Popovych (7): utils: Introduce and use nodev() helper routine iplink: Correctly report error when network device isn't found iplink: Use "dev" and

[PATCH iproute2-next v2 4/7] iplink: Follow documented behaviour when "index" is given

2018-02-20 Thread Serhey Popovych
ed for ip link delete scenario (actually "index" being ignored in favor to "dev"). Prohibit "index" when configuring/deleting group of network devices. Signed-off-by: Serhey Popovych --- ip/iplink.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) d

[PATCH iproute2-next v2 1/7] utils: Introduce and use nodev() helper routine

2018-02-20 Thread Serhey Popovych
and returns -1 to it's caller. Either call exit() or return to the caller to preserve behaviour before change. Use -nodev() in traffic control (tc) code to return 1. Simplify expression for checking for argument being 0/NULL in @if statement. Signed-off-by: Serhey Popovych --- bridge/

Re: [PATCH iproute2-next 1/8] iplink: Return from function instead of calling exit()

2018-02-20 Thread Serhey Popovych
David Ahern wrote: > On 2/20/18 1:17 PM, Serhey Popovych wrote: >> Stephen Hemminger wrote: >>> On Tue, 20 Feb 2018 21:39:51 +0200 >>> Serhey Popovych wrote: >>> >>>> Signed-off-by: Serhey Popovych >>>> --- >>>> ip/iplink.

Re: [PATCH iproute2-next 1/8] iplink: Return from function instead of calling exit()

2018-02-20 Thread Serhey Popovych
Stephen Hemminger wrote: > On Tue, 20 Feb 2018 21:39:51 +0200 > Serhey Popovych wrote: > >> Signed-off-by: Serhey Popovych >> --- >> ip/iplink.c | 12 ++-- >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/ip/iplink.c b

Re: [PATCH iproute2] ip: link_gre6.c: Support IP6_TNL_F_ALLOW_LOCAL_REMOTE flag

2018-02-20 Thread Serhey Popovych
Petr Machata wrote: > For IP-in-IP tunnels, one can specify the [no]allow-localremote command > when configuring a device. Under the hood, this flips the > IP6_TNL_F_ALLOW_LOCAL_REMOTE flag on the netdevice. However, ip6gretap > and ip6erspan devices, where the flag is also relevant, are not IP-in-

[PATCH iproute2-next 3/8] iplink: Correctly report error when network device isn't found

2018-02-20 Thread Serhey Popovych
t found) for this. Use exit(-nodev()) in has_dev() instead of return since missarg() will call exit() and thus requires change. Signed-off-by: Serhey Popovych --- ip/iplink.c | 16 +--- ip/iplink_xdp.c |7 +-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --gi

[PATCH iproute2-next 2/8] utils: Introduce and use nodev() helper routine

2018-02-20 Thread Serhey Popovych
and returns -1 to it's caller. Return to the caller instead of exit(-1) in tunnel code. Use -nodev() in traffic control (tc) code to return 1. Simplify expression for checking for argument being 0/NULL in @if statement. Signed-off-by: Serhey Popovych --- bridge/fdb.c |

[PATCH iproute2-next 8/8] iplink: Reduce number of arguments to iplink_parse()

2018-02-20 Thread Serhey Popovych
off-by: Serhey Popovych --- ip/ip_common.h | 16 +--- ip/iplink.c | 34 ++ ip/iplink_bond.c |4 +++- ip/iplink_bond_slave.c |4 +++- ip/iplink_bridge.c |4 +++- ip/iplink_bridge_slave.c |4 +++-

[PATCH iproute2-next 6/8] iplink: Perform most of request buffer setups and checks in iplink_parse()

2018-02-20 Thread Serhey Popovych
structure as now ->ifi_index is set inside iplist_parse(). Using memcpy() with constant length inlined by compiler. Drop @link, @group and @index from iplink_parse() parameters list: they are not needed outside. Signed-off-by: Serhey Popovych --- ip/ip_common.h|3 +- ip/iplink.c |

[PATCH iproute2-next 4/8] iplink: Use "dev" and "name" parameters interchangeable when possible

2018-02-20 Thread Serhey Popovych
tility behaviour on link create: ip link add {name|dev} veth1a type veth peer {name|dev} veth1b Signed-off-by: Serhey Popovych --- ip/iplink.c | 34 ++ 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/ip/iplink.c b/ip/iplink.c index

[PATCH iproute2-next 1/8] iplink: Return from function instead of calling exit()

2018-02-20 Thread Serhey Popovych
Signed-off-by: Serhey Popovych --- ip/iplink.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ip/iplink.c b/ip/iplink.c index 74c377c..a2c8108 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -653,7 +653,7 @@ int iplink_parse(int argc, char **argv, struct

[PATCH iproute2-next 5/8] iplink: Follow documented behaviour when "index" is given

2018-02-20 Thread Serhey Popovych
ed for ip link delete scenario (actually "index" being ignored in favor to "dev"). Prohibit "index" when configuring/deleting group of network devices. Signed-off-by: Serhey Popovych --- ip/iplink.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) d

[PATCH iproute2-next 7/8] iplink: Move data structures to block of their users

2018-02-20 Thread Serhey Popovych
This will consolidate data and code using it in single place and prepare for upcoming ->parse_opt() method change. Signed-off-by: Serhey Popovych --- ip/link_gre.c| 32 ip/link_gre6.c | 32 ip/link_ip6tnl.c |

[PATCH iproute2-next 0/8] iplink: Improve iplink_parse()

2018-02-20 Thread Serhey Popovych
nks, Serhii Serhey Popovych (8): iplink: Return from function instead of calling exit() utils: Introduce and use nodev() helper routine iplink: Correctly report error when network device isn't found iplink: Use "dev" and "name" parameters interchangeable when possible

Re: [PATCH iproute2-next 1/4] bridge: implement json pretty print flag

2018-02-19 Thread Serhey Popovych
Stephen Hemminger wrote: > Make bridge work like other iproute2 commands with standard -j and -p > flags. > > Signed-off-by: Stephen Hemminger > --- > bridge/br_common.h | 3 ++- > bridge/bridge.c| 9 ++--- > bridge/fdb.c | 10 ++ > bridge/mdb.c | 12 ++-- >

Re: [PATCH iproute2-next] ip link: add support to display extended tun attributes

2018-02-19 Thread Serhey Popovych
Sabrina Dubroca wrote: > Signed-off-by: Sabrina Dubroca > Reviewed-by: Stefano Brivio > --- > > I included the uapi changes from the kernel patch. Let me know if I > need to resend without the header changes. > > include/uapi/linux/if_link.h | 18 ++ > ip/iptuntap.c| 85

Re: [PATCH iproute2-next v5 0/9] ipaddress: Make print_linkinfo_brief() static

2018-02-16 Thread Serhey Popovych
David Ahern wrote: > On 2/15/18 2:23 PM, Serhey Popovych wrote: >> With this series I propose to make print_linkinfo_brief() static in >> favor of print_linkinfo() as single point for linkinfo printing. >> > > ... > >> >> Thanks, >> Serhii >

Re: [PATCH iproute2-next v4 7/9] utils: Introduce and use get_ifname_rta()

2018-02-15 Thread Serhey Popovych
David Ahern wrote: > On 2/15/18 11:34 AM, Serhey Popovych wrote: >> Be consistent in handling of IFLA_IFNAME attribute in all places: if >> there is no attribute report bug to stderr and use ll_idx_n2a() as >> last measure to get name in "if%u" format instead of

[PATCH iproute2-next v5 5/9] ipaddress: Simplify print_linkinfo_brief() and it's usage

2018-02-15 Thread Serhey Popovych
Simplify calling code in ipaddr_list_flush_or_save() by introducing intermediate variable of @struct nlmsghdr, drop duplicated code: print_linkinfo_brief() never returns values other than <= 0 so we can move print_selected_addrinfo() outside of each block. Signed-off-by: Serhey Popovych ---

[PATCH iproute2-next v5 1/9] ipaddress: Abstract IFA_LABEL matching code

2018-02-15 Thread Serhey Popovych
second for filter.label being non NULL. This allows us to further simplify down code and prepare for ll_idx_n2a() replacement with ll_index_to_name() without 80 columns checkpatch notice. Signed-off-by: Serhey Popovych --- ip/ipaddress.c | 57 +++--

[PATCH iproute2-next v5 4/9] ipaddress: Improve print_linkinfo()

2018-02-15 Thread Serhey Popovych
ouldn't be considered 3) replace open coded access to IFLA_IFNAME attribute data by RTA_DATA() with rta_getattr_str() 4) simplify ifname printing since name is never NULL, thanks to (2). Signed-off-by: Serhey Popovych --- ip/ipaddress.c | 30 +- 1 f

[PATCH iproute2-next v5 6/9] lib: Correct object file dependencies

2018-02-15 Thread Serhey Popovych
. Tested using make clean && make -j4. No problems so far. Signed-off-by: Serhey Popovych --- Makefile |2 +- lib/Makefile |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 32587db..b526d3b 100644 --- a/Makefile +++ b/Makefile

[PATCH iproute2-next v5 8/9] utils: Introduce and use print_name_and_link() to print name@link

2018-02-15 Thread Serhey Popovych
ther code (e.g. ll_name_to_index() and ll_index_to_name()) supporting such template. Signed-off-by: Serhey Popovych --- bridge/link.c | 13 +++-- include/utils.h |4 ip/ipaddress.c | 44 ++-- lib/util

[PATCH iproute2-next v5 3/9] utils: Reimplement ll_idx_n2a() and introduce ll_idx_a2n()

2018-02-15 Thread Serhey Popovych
greather than zero. Also introduce ll_idx_n2a() conterpart: ll_idx_a2n() that is used to translate name of the "if%u" form to index using sscanf(). Signed-off-by: Serhey Popovych --- include/ll_map.h |4 +++- lib/ll_map.c | 31 +-- 2 files chan

[PATCH iproute2-next v5 7/9] utils: Introduce and use get_ifname_rta()

2018-02-15 Thread Serhey Popovych
turn from kernel and ll_idx_n2a(). Signed-off-by: Serhey Popovych --- bridge/link.c |8 include/utils.h |1 + ip/ipaddress.c | 20 lib/utils.c | 19 +++ 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/bridge/link.c b

[PATCH iproute2-next v5 9/9] ipaddress: Make print_linkinfo_brief() static

2018-02-15 Thread Serhey Popovych
lp compiler optimize exit for both print_linkinfo_brief() and normal paths. Signed-off-by: Serhey Popovych --- ip/ip_common.h |2 -- ip/ipaddress.c | 76 ip/iplink.c|5 +--- 3 files changed, 11 insertions(+), 72 deletions

[PATCH iproute2-next v5 0/9] ipaddress: Make print_linkinfo_brief() static

2018-02-15 Thread Serhey Popovych
ts to support attribute parse that finally will be used to simplify ip/tunnel RTM_GETLINK code. As always reviews, comments, suggestions and criticism is welcome. v5 Fix build failures caused by incorrect dependency: libnetlink.a does not depend on ll_map.o, instead ll_map.o depends on it. v4

[PATCH iproute2-next v5 2/9] ipaddress: ll_map: Replace ll_idx_n2a() with ll_index_to_name()

2018-02-15 Thread Serhey Popovych
There is no reentrancy as well as deferred result usage for all cases where ll_idx_n2a() being used: it is safe to use ll_index_to_name() that internally calls ll_idx_n2a() with static buffer to hold result. While there print master network device name using correct color. Signed-off-by: Serhey

[PATCH iproute2-next v4 0/9] ipaddress: Make print_linkinfo_brief() static

2018-02-15 Thread Serhey Popovych
o support attribute parse that finally will be used to simplify ip/tunnel RTM_GETLINK code. As always reviews, comments, suggestions and criticism is welcome. v4 Print master network device name using correct color. v3 Fixed subject line. v2 Rebased to current iproute2-next/master. N

[PATCH iproute2-next v4 2/9] ipaddress: ll_map: Replace ll_idx_n2a() with ll_index_to_name()

2018-02-15 Thread Serhey Popovych
There is no reentrancy as well as deferred result usage for all cases where ll_idx_n2a() being used: it is safe to use ll_index_to_name() that internally calls ll_idx_n2a() with static buffer to hold result. While there print master network device name using correct color. Signed-off-by: Serhey

[PATCH iproute2-next v4 6/9] lib: Correct object file dependencies

2018-02-15 Thread Serhey Popovych
Neither internal libnetlink nor libgenl depends on ll_map.o: prepare for upcoming changes that brings much more cleaner dependency between utils.o and ll_map.o. Signed-off-by: Serhey Popovych --- lib/Makefile |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib

[PATCH iproute2-next v4 3/9] utils: Reimplement ll_idx_n2a() and introduce ll_idx_a2n()

2018-02-15 Thread Serhey Popovych
greather than zero. Also introduce ll_idx_n2a() conterpart: ll_idx_a2n() that is used to translate name of the "if%u" form to index using sscanf(). Signed-off-by: Serhey Popovych --- include/ll_map.h |4 +++- lib/ll_map.c | 31 +-- 2 files chan

[PATCH iproute2-next v4 5/9] ipaddress: Simplify print_linkinfo_brief() and it's usage

2018-02-15 Thread Serhey Popovych
Simplify calling code in ipaddr_list_flush_or_save() by introducing intermediate variable of @struct nlmsghdr, drop duplicated code: print_linkinfo_brief() never returns values other than <= 0 so we can move print_selected_addrinfo() outside of each block. Signed-off-by: Serhey Popovych ---

[PATCH iproute2-next v4 7/9] utils: Introduce and use get_ifname_rta()

2018-02-15 Thread Serhey Popovych
turn from kernel and ll_idx_n2a(). Signed-off-by: Serhey Popovych --- bridge/link.c |8 include/utils.h |1 + ip/ipaddress.c | 20 lib/utils.c | 19 +++ 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/bridge/link.c b

[PATCH iproute2-next v4 1/9] ipaddress: Abstract IFA_LABEL matching code

2018-02-15 Thread Serhey Popovych
second for filter.label being non NULL. This allows us to further simplify down code and prepare for ll_idx_n2a() replacement with ll_index_to_name() without 80 columns checkpatch notice. Signed-off-by: Serhey Popovych --- ip/ipaddress.c | 57 +++--

[PATCH iproute2-next v4 8/9] utils: Introduce and use print_name_and_link() to print name@link

2018-02-15 Thread Serhey Popovych
ther code (e.g. ll_name_to_index() and ll_index_to_name()) supporting such template. Signed-off-by: Serhey Popovych --- bridge/link.c | 13 +++-- include/utils.h |4 ip/ipaddress.c | 44 ++-- lib/util

[PATCH iproute2-next v4 4/9] ipaddress: Improve print_linkinfo()

2018-02-15 Thread Serhey Popovych
ouldn't be considered 3) replace open coded access to IFLA_IFNAME attribute data by RTA_DATA() with rta_getattr_str() 4) simplify ifname printing since name is never NULL, thanks to (2). Signed-off-by: Serhey Popovych --- ip/ipaddress.c | 30 +- 1 f

[PATCH iproute2-next v4 9/9] ipaddress: Make print_linkinfo_brief() static

2018-02-15 Thread Serhey Popovych
lp compiler optimize exit for both print_linkinfo_brief() and normal paths. Signed-off-by: Serhey Popovych --- ip/ip_common.h |2 -- ip/ipaddress.c | 76 ip/iplink.c|5 +--- 3 files changed, 11 insertions(+), 72 deletions

[PATCH iproute2-next] ip: Use single variable to represent -pretty

2018-02-15 Thread Serhey Popovych
y both support JSON output and thus depend show_pretty in new_json_obj(). Assuming above use common variable to represent -pretty option, define it in utils.c and declare in utils.h that is commonly used. Replace show_pretty with pretty. Fixes: a233caa0aaee ("json: make pretty printing option

Re: [PATCH iproute2-next 0/9] ipaddress: Make print_linkinfo_brief() static

2018-02-14 Thread Serhey Popovych
David Ahern wrote: > On 2/14/18 1:09 PM, Serhey Popovych wrote: > >> >> Any comments on this series? Should I perform some additional testing? >> >> > > I thought I had applied them. Can you re-send and cc me? > Done. v2 is broken due to missing subje

[PATCH iproute2-next v3 7/9] utils: Introduce and use get_ifname_rta()

2018-02-14 Thread Serhey Popovych
turn from kernel and ll_idx_n2a(). Signed-off-by: Serhey Popovych --- bridge/link.c |8 include/utils.h |1 + ip/ipaddress.c | 20 lib/utils.c | 19 +++ 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/bridge/link.c b

[PATCH iproute2-next v3 5/9] ipaddress: Simplify print_linkinfo_brief() and it's usage

2018-02-14 Thread Serhey Popovych
Simplify calling code in ipaddr_list_flush_or_save() by introducing intermediate variable of @struct nlmsghdr, drop duplicated code: print_linkinfo_brief() never returns values other than <= 0 so we can move print_selected_addrinfo() outside of each block. Signed-off-by: Serhey Popovych ---

[PATCH iproute2-next v3 3/9] utils: Reimplement ll_idx_n2a() and introduce ll_idx_a2n()

2018-02-14 Thread Serhey Popovych
greather than zero. Also introduce ll_idx_n2a() conterpart: ll_idx_a2n() that is used to translate name of the "if%u" form to index using sscanf(). Signed-off-by: Serhey Popovych --- include/ll_map.h |4 +++- lib/ll_map.c | 31 +-- 2 files chan

[PATCH iproute2-next v3 8/9] utils: Introduce and use print_name_and_link() to print name@link

2018-02-14 Thread Serhey Popovych
ther code (e.g. ll_name_to_index() and ll_index_to_name()) supporting such template. Signed-off-by: Serhey Popovych --- bridge/link.c | 13 +++-- include/utils.h |4 ip/ipaddress.c | 44 ++-- lib/util

[PATCH iproute2-next v3 2/9] ipaddress: ll_map: Replace ll_idx_n2a() with ll_index_to_name()

2018-02-14 Thread Serhey Popovych
There is no reentrancy as well as deferred result usage for all cases where ll_idx_n2a() being used: it is safe to use ll_index_to_name() that internally calls ll_idx_n2a() with static buffer to hold result. Signed-off-by: Serhey Popovych --- ip/ipaddress.c | 14 +- 1 file changed

[PATCH iproute2-next v3 6/9] lib: Correct object file dependencies

2018-02-14 Thread Serhey Popovych
Neither internal libnetlink nor libgenl depends on ll_map.o: prepare for upcoming changes that brings much more cleaner dependency between utils.o and ll_map.o. Signed-off-by: Serhey Popovych --- lib/Makefile |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib

[PATCH iproute2-next v3 0/9] ipaddress: Make print_linkinfo_brief() static

2018-02-14 Thread Serhey Popovych
support attribute parse that finally will be used to simplify ip/tunnel RTM_GETLINK code. As always reviews, comments, suggestions and criticism is welcome. v3 Fixed subject line. v2 Rebased to current iproute2-next/master. No changes. Thanks, Serhii Serhey Popovych (9): ipaddres

[PATCH iproute2-next v3 9/9] ipaddress: Make print_linkinfo_brief() static

2018-02-14 Thread Serhey Popovych
lp compiler optimize exit for both print_linkinfo_brief() and normal paths. Signed-off-by: Serhey Popovych --- ip/ip_common.h |2 -- ip/ipaddress.c | 76 ip/iplink.c|5 +--- 3 files changed, 11 insertions(+), 72 deletions

[PATCH iproute2-next v3 1/9] ipaddress: Abstract IFA_LABEL matching code

2018-02-14 Thread Serhey Popovych
second for filter.label being non NULL. This allows us to further simplify down code and prepare for ll_idx_n2a() replacement with ll_index_to_name() without 80 columns checkpatch notice. Signed-off-by: Serhey Popovych --- ip/ipaddress.c | 57 +++--

[PATCH iproute2-next v3 4/9] ipaddress: Improve print_linkinfo()

2018-02-14 Thread Serhey Popovych
ouldn't be considered 3) replace open coded access to IFLA_IFNAME attribute data by RTA_DATA() with rta_getattr_str() 4) simplify ifname printing since name is never NULL, thanks to (2). Signed-off-by: Serhey Popovych --- ip/ipaddress.c | 30 +- 1 f

Re: [PATCH iproute2-next v2 0/9] With this series I propose to make print_linkinfo_brief() static in

2018-02-14 Thread Serhey Popovych
ted by the series. > > All this work is done in prepare of iplink_get() enhancements to support > attribute parse that finally will be used to simplify ip/tunnel > RTM_GETLINK code. > > As always reviews, comments, suggestions and criticism is welcome. > > v2 >

  1   2   3   4   >