Commit b2450e46b7 ("flower: fix clang warnings") caused enc_key_id
and u32 to be printed without indentation. Fix this by printing two
spaces before calling print_uint_name_value.
Signed-off-by: Wojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
vlan listing from `bridge link -d` was broken by commit f32e4977dc ("bridge:
add json support for link command"). print_vlan_info() expects to be passed a
IFLA_AF_SPEC attribute (as is done in print_vlan()) but that commit changed
the call in link.c to pass a IFLA_BRIDGE_VLAN_INFO attribute instead. As a
result, a struct bridge_vlan_info is mistakenly parsed as a struct rtattr and
print_vlan_info() usually exits early in this callpath.
The output style of print_vlan_info() (one line per vlan) is different from
the output style of `bridge link` (multiple attributes per line). The json
output is also unsuitable for `bridge link`. Since vlan listing is available
from `bridge vlan`, remove it from `bridge link` instead of trying to change
print_vlan_info().
Note that previously, bridge master devices would be included in the output
when specifying '-d' (and only in that case) but they are no longer
included because there is no detailed information to show for master
devices if we are not printing a vlan listing:
$ bridge link
4: vxlan0: <BROADCAST,MULTICAST> mtu 1500 master br0 state disabled priority 32 cost 100
$ bridge -d link
3: br0: <BROADCAST,MULTICAST> mtu 1500 master br0
4: vxlan0: <BROADCAST,MULTICAST> mtu 1500 master br0 state disabled priority 32 cost 100
hairpin off guard off root_block off fastleave off learning on flood on mcast_flood on mcast_to_unicast off neigh_suppress off vlan_tunnel on isolated off
$ ./bridge/bridge -d link
4: vxlan0: <BROADCAST,MULTICAST> mtu 1500 master br0 state disabled priority 32 cost 100
hairpin off guard off root_block off fastleave off learning on flood on mcast_flood on mcast_to_unicast off neigh_suppress off vlan_tunnel on isolated off
Fixes: f32e4977dc ("bridge: add json support for link command")
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Fixes: fab9a18a2e ("bridge: request vlans along with link information")
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
'tmp' string is used for safe tokenizing, but it is not required after
getting all the widths in -w option. As 'tmp' string is obtained by strdup
call, the caller has to deallocate it to avoid memory leak.
Signed-off-by: Maxim Petrov <mmrmaximuzz@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
The can help menu misses three spaces for the TDCV, TDCO and TDCF
parameters, making the closing curly bracket unaligned.
For reference, before this patch:
| $ ip link help can
| Usage: ip link set DEVICE type can
| [ bitrate BITRATE [ sample-point SAMPLE-POINT] ] |
| [ tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1
| phase-seg2 PHASE-SEG2 [ sjw SJW ] ]
|
| [ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] |
| [ dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1
| dphase-seg2 PHASE-SEG2 [ dsjw SJW ] ]
| [ tdcv TDCV tdco TDCO tdcf TDCF ]
|
| [ loopback { on | off } ]
| [ listen-only { on | off } ]
| [ triple-sampling { on | off } ]
| [ one-shot { on | off } ]
| [ berr-reporting { on | off } ]
| [ fd { on | off } ]
| [ fd-non-iso { on | off } ]
| [ presume-ack { on | off } ]
| [ cc-len8-dlc { on | off } ]
| [ tdc-mode { auto | manual | off } ]
|
| [ restart-ms TIME-MS ]
| [ restart ]
|
| [ termination { 0..65535 } ]
|
| Where: BITRATE := { NUMBER in bps }
| SAMPLE-POINT := { 0.000..0.999 }
| TQ := { NUMBER in ns }
| PROP-SEG := { NUMBER in tq }
| PHASE-SEG1 := { NUMBER in tq }
| PHASE-SEG2 := { NUMBER in tq }
| SJW := { NUMBER in tq }
| TDCV := { NUMBER in tc}
| TDCO := { NUMBER in tc}
| TDCF := { NUMBER in tc}
| RESTART-MS := { 0 | NUMBER in ms }
... and after this patch:
| $ ip link help can
| Usage: ip link set DEVICE type can
| [ bitrate BITRATE [ sample-point SAMPLE-POINT] ] |
| [ tq TQ prop-seg PROP_SEG phase-seg1 PHASE-SEG1
| phase-seg2 PHASE-SEG2 [ sjw SJW ] ]
|
| [ dbitrate BITRATE [ dsample-point SAMPLE-POINT] ] |
| [ dtq TQ dprop-seg PROP_SEG dphase-seg1 PHASE-SEG1
| dphase-seg2 PHASE-SEG2 [ dsjw SJW ] ]
| [ tdcv TDCV tdco TDCO tdcf TDCF ]
|
| [ loopback { on | off } ]
| [ listen-only { on | off } ]
| [ triple-sampling { on | off } ]
| [ one-shot { on | off } ]
| [ berr-reporting { on | off } ]
| [ fd { on | off } ]
| [ fd-non-iso { on | off } ]
| [ presume-ack { on | off } ]
| [ cc-len8-dlc { on | off } ]
| [ tdc-mode { auto | manual | off } ]
|
| [ restart-ms TIME-MS ]
| [ restart ]
|
| [ termination { 0..65535 } ]
|
| Where: BITRATE := { NUMBER in bps }
| SAMPLE-POINT := { 0.000..0.999 }
| TQ := { NUMBER in ns }
| PROP-SEG := { NUMBER in tq }
| PHASE-SEG1 := { NUMBER in tq }
| PHASE-SEG2 := { NUMBER in tq }
| SJW := { NUMBER in tq }
| TDCV := { NUMBER in tc }
| TDCO := { NUMBER in tc }
| TDCF := { NUMBER in tc }
| RESTART-MS := { 0 | NUMBER in ms }
Fixes: 0c263d7c36 ("iplink_can: add new CAN FD bittiming parameters:
Transmitter Delay Compensat ion (TDC)")
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Currently dcb decodes the response from "dcb app add" and "del" by
interpreting the returned attribute as u8. But the value stored there is
actually a negative errno value.
Additionally, "dcb app" currently shows two sets of messages, one in
dcb_set_attribute_attr_cb() where the issue is detected, and another as a
result of error return from that function.
The current state is as follows:
# dcb app add dev swp36 dscp-prio 20:2
Error when attempting to set attribute: Unknown error 239
Attribute write: No such file or directory
Fix the "unknown error" issue by correctly decoding the attribute as i8 and
negating it. Furthermore, set errno to that value, and let the top-level
"attribute write" error message show the correct message.
Initialize errno to 0 before the dcb_talk() dispatch, and make the error
print conditional on errno != 0. This way the few error messages that are
worth describing in the place where they are detected will not cause the
second error message to be printed.
The fixed reporting looks like this:
# dcb app add dev swp36 dscp-prio 20:2
Attribute write: File exists
Reported-by: Maksym Yaremchuk <maksymy@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
rtnl_open_byproto() does not close the opened socket in case of
errors, and the socket is returned to the caller in the `fd` field of
the struct. However, none of the callers care about the socket, so
close it in the function immediately to avoid any potential resource
leaks.
Signed-off-by: Maxim Petrov <mmrmaximuzz@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
For action police there is an conform-exceed action control
which can be for example "jump 2 / pipe".
The current parsing loop is doing one more iteration than necessary
and results in ok var being 3.
Example filter:
tc filter add dev enp8s0f0_0 ingress protocol ip prio 2 flower \
verbose action police rate 100mbit burst 12m \
conform-exceed jump 1 / pipe mirred egress redirect dev enp8s0f0_1 action drop
Before this change the command will fail.
Trying to add another "pipe" before mirred as a workaround for the stopping the loop
in ok var 3 resulting in result2 not being saved and wrong filter.
... conform-exceed jump 1 / pipe pipe mirred ...
Example dump of the action part:
... action order 1: police 0x1 rate 100Mbit burst 12Mb mtu 2Kb action jump 1 overhead 0b ...
Fix the behavior by removing redundant case 2 handling, either argc is over or breaking.
Example dump of the action part with the fix:
... action order 1: police 0x1 rate 100Mbit burst 12Mb mtu 2Kb action jump 1/pipe overhead 0b ...
Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
The cited commit removed the space after the local/remote tunnel print
and resulted in "broken" output:
gre remote 1.1.1.2local 1.1.1.1ttl inherit erspan_ver 0 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Fixes: 5632cf69ad ("tunnel: fix clang warning")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
Justin Iurman says:
====================
The insertion frequency is represented as "k/n", meaning IOAM will be
added to "k" packets over "n" packets, with 0 < k <= n <= 1000000.
Therefore, it provides the following range of insertion frequencies:
[0.0001% ... 100%].
Default frequency is "1/1" (i.e., applied to all packets) for backward
compatibility.
Previous command:
ip -6 ro ad fc00::1/128 encap ioam6 mode ...
New command:
ip -6 ro ad fc00::1/128 encap ioam6 [ freq k/n ] mode ...
====================
Signed-off-by: David Ahern <dsahern@kernel.org>
Update the ip-route documentation to include the IOAM insertion
frequency.
Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
Signed-off-by: David Ahern <dsahern@kernel.org>
This patch adds support for the IOAM insertion frequency by introducing
a new parameter "freq". The expected value is "k/n", see the patchset
description for more details.
Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
Signed-off-by: David Ahern <dsahern@kernel.org>
Update kernel headers to commit:
d8c2858181cc ("net/switchdev: use struct_size over open coded arithmetic")
Signed-off-by: David Ahern <dsahern@kernel.org>
Add documentation for gro_max_size.
Also make clear gso_max_size/gso_max_segs can be set after device creation.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Coco Li <lixiaoyan@google.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
Add the ability to display or change the gro_max_size attribute.
ip link set dev eth1 gro_max_size 60000
ip -d link show eth1
5: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 9198 qdisc mq master eth0 state UP mode DEFAULT group default qlen 1000
link/ether bc:ae:c5:39:69:66 brd ff:ff:ff:ff:ff:ff promiscuity 0 minmtu 46 maxmtu 9600
<...> gro_max_size 60000
Signed-off-by: Coco Li <lixiaoyan@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
Currently the key struct of u32 filter does not support json. This
commit adds json support for showing key.
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
Tested-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
Currently u32 filter output does not support json. This commit uses
proper json functions to add support for it.
`sprint_u32_handle` adds an extra space after the raw check, remove the
extra space.
Signed-off-by: Wen Liang <liangwen12year@gmail.com>
Tested-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
When the dsfield option was added to ip rule, it only worked for add
and delete operations. For consistency, allow it when dumping rules
too.
Fixes: dec01609dc ("iproute2: Add dsfield as alias for tos for ip rules")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Introduce print_indent_name_value to do the indented style
used in flower.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
This fixes the indentation of types with newline flag.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
Add skip_hw and skip_sw flags for user to control whether
offload action to hardware.
Also we add hw_count to show how many hardwares accept to offload
the action.
Change man page to describe the usage of skip_sw and skip_hw flag.
An example to add and query action as below.
$ tc actions add action police rate 1mbit burst 100k index 100 skip_sw
$ tc -s -d actions list action police
total acts 1
action order 0: police 0x64 rate 1Mbit burst 100Kb mtu 2Kb action reclassify overhead 0b linklayer ethernet
ref 1 bind 0 installed 2 sec used 2 sec
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
skip_sw in_hw in_hw_count 1
used_hw_stats delayed
Signed-off-by: baowen zheng <baowen.zheng@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Tested-by: Victor Nogueira <victor@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
According to SELinux API, when resources are allocated using getpidcon()
of getfilecon(), they should be freed using freecon().
This commit makes ss use freecon() where appropriate, defining a stub
function executing a free() useful when iproute2 is compiled without
SELinux support.
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
All the actual code exists, but we neglect to recognize "default-prio" as a
CLI key for selection of what to show.
Reported-by: Maksym Yaremchuk <maksymy@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Stephen Hemminger says:
====================
This patch set makes iproute2-next main branch compile without warnings
on Clang 11 (and probably later versions).
====================
Signed-off-by: David Ahern <dsahern@kernel.org>
Clang complains about using non-format string in print_color_tv.
The ideal fix would be to put format attribute on all the print_XXX functions
in json_print.h. But that leads to furthur complications because the existing
code may pass a NULL as format if the format is unused since the print
is being done only for JSON output.
The comprimise is to just disable the warning for the one place
it shows up.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
Add format attribute to the format string in print routines.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
To fix clang warning about passing non-format string.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
When calling json_print with json only use a NULL instead of
empty string.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
Fix warning about passing non-format string.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
Clang complains about passing non-format string.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
Clang complains about passing a non-format string but the code here.
The old code was doing extra work the JSON case. JSON ignores one line mode.
This also fixes output format in oneline mode.
Fixes: 04b215015b ("tc_util: introduce a function to print JSON/non-JSON masked numbers")
Cc: elibr@mellanox.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
Clang complains about passing non-format string to print_string.
Handle this by splitting json and non-json parts.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
Netem is using empty format string to not print values.
Clang complains about this hack so don't do it.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
One more format attribute needed to resolve clang warnings.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
This catches future errors and silences warning from Clang.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
Error messages should go to stderr even if using JSON.
Fixes: 2704bd6255 ("tc: jsonify actions core")
Cc: jiri@mellanox.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This patch added the id check for deleting address in mptcp_parse_opt().
The ADDRESS argument is invalid for the non-zero id address, only needed
for the id 0 address.
# ip mptcp endpoint delete id 1
# ip mptcp endpoint delete id 0 10.0.1.1
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
Acked-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Some installation of Clang are unhappy about the use of a hand-rolled
formatting strings, and emit warnings such as this one:
dcb.c:334:31: warning: format string is not a string literal
[-Wformat-nonliteral]
Rewrite the impacted code so that it always uses literal format strings.
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ax25.h isn't guaranteed to be avilable in netax25/*;
it's dependent on our choice of libc (it's not available
on musl at least) [0].
Let's use the version from linux-headers.
[0] https://sourceware.org/glibc/wiki/Synchronizing_Headers
Bug: https://bugs.gentoo.org/831102
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>