summaryrefslogtreecommitdiffstats
path: root/ip
Commit message (Collapse)AuthorAgeFilesLines
* ip: add error reporting when RTM_GETNSID failedJan Engelhardt2020-10-121-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `ip addr` when run under qemu-user-riscv64, fails. This likely is due to qemu-5.1 not doing translation of RTM_GETNSID calls. Aborting ip completely is not helpful for the user however. This patch reworks the error handling. Before: rtest:/ # ip a 2: host0@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 request send failed: Operation not supported link/ether 46:3f:2d:88:3d:db brd ff:ff:ff:ff:ff:ffrtest:/ # Afterwards: rtest:/ # ip a 2: host0@if4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 rtnl_send(RTM_GETNSID): Operation not supported. Continuing anyway. link/ether 46:3f:2d:88:3d:db brd ff:ff:ff:ff:ff:ff link-netnsid 0 inet 192.168.72.147/28 brd 192.168.72.159 scope global host0 valid_lft forever preferred_lft forever inet6 fe80::443f:2dff:fe88:3ddb/64 scope link valid_lft forever preferred_lft forever Signed-off-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* addr: Fix noprefixroute and autojoin for IPv4Stephen Hemminger2020-10-061-2/+2
| | | | | | | | | | | | | | | These were reported as IPv6-only and ignored: # ip address add 192.0.2.2/24 dev dummy5 noprefixroute Warning: noprefixroute option can be set only for IPv6 addresses # ip address add 224.1.1.10/24 dev dummy5 autojoin Warning: autojoin option can be set only for IPv6 addresses This enables them back for IPv4. Fixes: 9d59c86e575b5 ("iproute2: ip addr: Organize flag properties structurally") Signed-off-by: Adel Belhouane <bugs.a.b@free.fr> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ipntable: add missing ndts_table_fulls ntable statEyal Birger2020-10-061-0/+5
| | | | | | | Used for tracking neighbour table overflows. Signed-off-by: Eyal Birger <eyal.birger@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ip: iplink_ipoib.c: Remove extra spacesKamal Heib2020-09-301-3/+3
| | | | | | | | | Remove the extra space between the reported ipoib attrs - use only one space instead of two. Fixes: de0389935f8c ("iplink: Added support for the kernel IPoIB RTNL ops") Signed-off-by: Kamal Heib <kamalheib1@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ip link: Fix indenting in help textPhil Sutter2020-08-311-20/+20
| | | | | | | | | | | | | | Indenting of 'ip link set' options below 'link-netns' was wrong, they should be on the same level as the above. While being at it, fix closing brackets in vf-specific options. Also write node/port_guid parameters in upper-case without curly braces: They are supposed to be replaced by values, not put literally. Fixes: 8589eb4efdf2a ("treewide: refactor help messages") Fixes: 5a3ec4ba64783 ("iplink: Update usage in help message") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* iplink: hsr: add support for creating PRP device similar to HSRMurali Karicheri2020-08-221-2/+15
| | | | | | | | | | | This patch enhances the iplink command to add a proto parameters to create PRP device/interface similar to HSR. Both protocols are quite similar and requires a pair of Ethernet interfaces. So re-use the existing HSR iplink command to create PRP device/interface as well. Use proto parameter to differentiate the two protocols. Signed-off-by: Murali Karicheri <m-karicheri2@ti.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* iproute2: ip maddress: Check multiaddr lengthSascha Hauer2020-08-221-4/+9
| | | | | | | | | | | | | | | | | ip maddress add|del takes a MAC address as argument, so insist on getting a length of ETH_ALEN bytes. This makes sure the passed argument is actually a MAC address and especially not an IPv4 address which was previously accepted and silently taken as a MAC address. While at it, do not print *argv in the error path as this has been modified by ll_addr_a2n() and doesn't contain the full string anymore, which can lead to misleading error messages. Also while at it, replace the hardcoded buffer size with the actual buffer size using sizeof(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* Merge branch 'main' into nextDavid Ahern2020-08-063-5/+5
|\ | | | | | | | | | | | | | | Conflicts: bridge/fdb.c man/man8/bridge.8 Signed-off-by: David Ahern <dsahern@kernel.org>
| * replace SNAPSHOT with auto-generated version stringStephen Hemminger2020-08-032-4/+4
| | | | | | | | | | | | | | | | | | | | Replace the iproute2 snapshot with a version string which is autogenerated as part of the build process using git describe. This will also allow seeing if the version of the command is built from the same sources is as upstream. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * mptcp: show all endpoints when no ID is specifiedMatthieu Baerts2020-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to 'ip mptcp help', 'endpoint show' can accept no argument: ip mptcp endpoint show [ id ID ] It makes sense to print all endpoints when no filter is used. So here if the following command is used, all endpoints are printed: ip mptcp endpoint show Same as: ip mptcp endpoint Fixes: 7e0767cd ("add support for mptcp netlink interface") Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | ip-xfrm: add support for oseq-may-wrap extra flagPetr Vaněk2020-08-032-1/+6
| | | | | | | | | | | | | | | | This flag allows to create SA where sequence number can cycle in outbound packets if set. Signed-off-by: Petr Vaněk <pv@excello.cz> Signed-off-by: David Ahern <dsahern@kernel.org>
* | Merge branch 'main' into nextDavid Ahern2020-07-146-8/+178
|\| | | | | | | Signed-off-by: David Ahern <dsahern@kernel.org>
| * ip xfrm: policy: support policies with IF_ID in get/delete/deleteallEyal Birger2020-07-131-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | The XFRMA_IF_ID attribute is set in policies for them to be associated with an XFRM interface (4.19+). Add support for getting/deleting policies with this attribute. For supporting 'deleteall' the XFRMA_IF_ID attribute needs to be explicitly copied. Signed-off-by: Eyal Birger <eyal.birger@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * ip address: remove useless includeAndrea Claudi2020-07-081-1/+0
| | | | | | | | | | | | | | utils.h is included two times in ipaddress.c, there is no need for that. Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * iplink_bareudp: use common include syntaxStephen Hemminger2020-07-081-4/+4
| | | | | | | | | | | | | | | | | | | | Follow the precedent of other parts of iproute2 follow the example of: Standard libc headers Linux headers Iproute2 support headers Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * ip link: initial support for bareudp devicesGuillaume Nault2020-07-063-2/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bareudp devices provide a generic L3 encapsulation for tunnelling different protocols like MPLS, IP, NSH, etc. inside a UDP tunnel. This patch is based on original work from Martin Varghese: https://lore.kernel.org/netdev/1570532361-15163-1-git-send-email-martinvarghesenokia@gmail.com/ Examples: - ip link add dev bareudp0 type bareudp dstport 6635 ethertype mpls_uc This creates a bareudp tunnel device which tunnels L3 traffic with ethertype 0x8847 (unicast MPLS traffic). The destination port of the UDP header will be set to 6635. The device will listen on UDP port 6635 to receive traffic. - ip link add dev bareudp0 type bareudp dstport 6635 ethertype ipv4 multiproto Same as the MPLS example, but for IPv4. The "multiproto" keyword allows the device to also tunnel IPv6 traffic. Signed-off-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * ip fou: respect preferred_family for IPv6Sorah Fukumori2020-07-061-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | ip(8) accepts -family ipv6 (-6) option at the toplevel. It is straightforward to support the existing option for modifying listener on IPv6 addresses. Maintain the backward compatibility by leaving ip fou -6 flag implemented, while it's removed from the usage message. Signed-off-by: Sorah Fukumori <her@sorah.jp> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
| * ip address: Fix loop initial declarations are only allowed in C99Roi Dayan2020-06-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some distros, i.e. rhel 7.6, compilation fails with the following: ipaddress.c: In function ‘lookup_flag_data_by_name’: ipaddress.c:1260:2: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int i = 0; i < ARRAY_SIZE(ifa_flag_data); ++i) { ^ ipaddress.c:1260:2: note: use option -std=c99 or -std=gnu99 to compile your code This commit fixes the single place needed for compilation to pass. Fixes: 9d59c86e575b ("iproute2: ip addr: Organize flag properties structurally") Signed-off-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | ipnexthop: support for fdb nexthopsRoopa Prabhu2020-06-111-1/+15
|/ | | | | | | | | | | | | | | This patch adds support to add and delete ecmp nexthops of type fdb. Such nexthops can be linked to vxlan fdb entries. $ip nexthop add id 12 via 172.16.1.2 fdb $ip nexthop add id 13 via 172.16.1.3 fdb $ip nexthop add id 102 group 12/13 fdb $bridge fdb add 02:02:00:00:00:13 dev vx10 nhid 102 self Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David Ahern <dsahern@gmail.com>
* Merge git://git.kernel.org/pub/scm/network/iproute2/iproute2-nextStephen Hemminger2020-06-0511-70/+1026
|\
| * iproute2: ip addr: Add support for setting 'optimistic'Ian K. Coolidge2020-05-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | optimistic DAD is controllable via sysctl for an interface or all interfaces on the system. This would affect addresses added by the kernel only. Recent kernels, however, have enabled support for adding optimistic address via userspace. This plumbs that support. Signed-off-by: David Ahern <dsahern@gmail.com>
| * iproute2: ip addr: Organize flag properties structurallyIan K. Coolidge2020-05-311-57/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This creates a nice systematic way to check that the various flags are mutable from userspace and that the address family is valid. Mutability properties are preserved to avoid introducing any behavioral change in this CL. However, previously, immutable flags were ignored and fell through to this confusing error: Error: either "local" is duplicate, or "dadfailed" is a garbage. But now, they just warn more explicitly: Warning: dadfailed option is not mutable from userspace Signed-off-by: David Ahern <dsahern@gmail.com>
| * lwtunnel: add support for rpl segment routingAlexander Aring2020-05-272-1/+122
| | | | | | | | | | | | | | | | | | | | | | This patch adds support for rpl segment routing settings. Example: ip -n ns0 -6 route add 2001::3 encap rpl segs \ fe80::c8fe:beef:cafe:cafe,fe80::c8fe:beef:cafe:beef dev lowpan0 Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
| * ss: introduce cgroup2 cache and helper functionsDmitry Yakunin2020-05-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch prepares infrastructure for matching sockets by cgroups. Two helper functions are added for transformation between cgroup v2 ID and pathname. Cgroup v2 cache is implemented as hash table indexed by ID. This cache is needed for faster lookups of socket cgroup. v2: - style fixes (David Ahern) Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru> Signed-off-by: David Ahern <dsahern@gmail.com>
| * Merge branch 'master' into nextDavid Ahern2020-05-051-1/+2
| |\ | | | | | | | | | Signed-off-by: David Ahern <dsahern@gmail.com>
| * | iproute_lwtunnel: add options support for erspan metadataXin Long2020-05-011-0/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is to add LWTUNNEL_IP_OPTS_ERSPAN's parse and print to implement erspan options support in iproute_lwtunnel. Option is expressed as version:index:dir:hwid, dir and hwid will be parsed when version is 2, while index will be parsed when version is 1. All of these are numbers. erspan doesn't support multiple options. With this patch, users can add and dump erspan options like: # ip netns add a # ip netns add b # ip -n a link add eth0 type veth peer name eth0 netns b # ip -n a link set eth0 up # ip -n b link set eth0 up # ip -n a addr add 10.1.0.1/24 dev eth0 # ip -n b addr add 10.1.0.2/24 dev eth0 # ip -n b link add erspan1 type erspan key 1 seq erspan 123 \ local 10.1.0.2 remote 10.1.0.1 # ip -n b addr add 1.1.1.1/24 dev erspan1 # ip -n b link set erspan1 up # ip -n b route add 2.1.1.0/24 dev erspan1 # ip -n a link add erspan1 type erspan key 1 seq local 10.1.0.1 external # ip -n a addr add 2.1.1.1/24 dev erspan1 # ip -n a link set erspan1 up # ip -n a route add 1.1.1.0/24 encap ip id 1 \ erspan_opts 2:123:1:2 dst 10.1.0.2 dev erspan1 # ip -n a route show # ip netns exec a ping 1.1.1.1 -c 1 1.1.1.0/24 encap ip id 1 src 0.0.0.0 dst 10.1.0.2 ttl 0 tos 0 erspan_opts 2:0:1:2 dev erspan1 scope link PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data. 64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=0.124 ms v1->v2: - improve the changelog. - use PRINT_ANY to support dumping with json format. v2->v3: - implement proper JSON object for opts instead of just bunch of strings. v3->v4: - keep the same format between input and output, json and non json. - print version, index, dir and hwid as uint. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
| * | iproute_lwtunnel: add options support for vxlan metadataXin Long2020-05-011-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is to add LWTUNNEL_IP_OPTS_VXLAN's parse and print to implement vxlan options support in iproute_lwtunnel. Option is expressed a number for gbp only, and vxlan doesn't support multiple options. With this patch, users can add and dump vxlan options like: # ip netns add a # ip netns add b # ip -n a link add eth0 type veth peer name eth0 netns b # ip -n a link set eth0 up # ip -n b link set eth0 up # ip -n a addr add 10.1.0.1/24 dev eth0 # ip -n b addr add 10.1.0.2/24 dev eth0 # ip -n b link add vxlan1 type vxlan id 1 local 10.1.0.2 \ remote 10.1.0.1 dev eth0 ttl 64 gbp # ip -n b addr add 1.1.1.1/24 dev vxlan1 # ip -n b link set vxlan1 up # ip -n b route add 2.1.1.0/24 dev vxlan1 # ip -n a link add vxlan1 type vxlan local 10.1.0.1 dev eth0 ttl 64 \ gbp external # ip -n a addr add 2.1.1.1/24 dev vxlan1 # ip -n a link set vxlan1 up # ip -n a route add 1.1.1.0/24 encap ip id 1 \ vxlan_opts 1110 dst 10.1.0.2 dev vxlan1 # ip -n a route show # ip netns exec a ping 1.1.1.1 -c 1 1.1.1.0/24 encap ip id 1 src 0.0.0.0 dst 10.1.0.2 ttl 0 tos 0 vxlan_opts 1110 dev vxlan1 scope link PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data. 64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=0.111 ms v1->v2: - improve the changelog. - get_u32 with base = 0 for gbp. - use PRINT_ANY to support dumping with json format. v2->v3: - implement proper JSON array for opts. v3->v4: - keep the same format between input and output, json and non json. - print gbp as uint. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
| * | iproute_lwtunnel: add options support for geneve metadataXin Long2020-05-011-2/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is to add LWTUNNEL_IP(6)_OPTS and LWTUNNEL_IP_OPTS_GENEVE's parse and print to implement geneve options support in iproute_lwtunnel. Options are expressed as class:type:data and multiple options may be listed using a comma delimiter, class and type are numbers and data is a hex string. With this patch, users can add and dump geneve options like: # ip netns add a # ip netns add b # ip -n a link add eth0 type veth peer name eth0 netns b # ip -n a link set eth0 up; ip -n b link set eth0 up # ip -n a addr add 10.1.0.1/24 dev eth0 # ip -n b addr add 10.1.0.2/24 dev eth0 # ip -n b link add geneve1 type geneve id 1 remote 10.1.0.1 ttl 64 # ip -n b addr add 1.1.1.1/24 dev geneve1 # ip -n b link set geneve1 up # ip -n b route add 2.1.1.0/24 dev geneve1 # ip -n a link add geneve1 type geneve external # ip -n a addr add 2.1.1.1/24 dev geneve1 # ip -n a link set geneve1 up # ip -n a route add 1.1.1.0/24 encap ip id 1 geneve_opts \ 1:1:1212121234567890,1:1:1212121234567890,1:1:1212121234567890 \ dst 10.1.0.2 dev geneve1 # ip -n a route show # ip netns exec a ping 1.1.1.1 -c 1 1.1.1.0/24 encap ip id 1 src 0.0.0.0 dst 10.1.0.2 ttl 0 tos 0 geneve_opts 1:1:1212121234567890,1:1:1212121234567890 ... PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data. 64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=0.079 ms v1->v2: - improve the changelog. - use PRINT_ANY to support dumping with json format. v2->v3: - implement proper JSON array for opts instead of just bunch of strings. v3->v4: - keep the same format between input and output, json and non json. - print class and type as uint and print data as hex string. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
| * | erspan: Add type I version 0 support.William Tu2020-04-302-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Type I ERSPAN frame format is based on the barebones IP + GRE(4-byte) encapsulation on top of the raw mirrored frame. Both type I and II use 0x88BE as protocol type. Unlike type II and III, no sequence number or key is required. To creat a type I erspan tunnel device: $ ip link add dev erspan11 type erspan \ local 172.16.1.100 remote 172.16.1.200 \ erspan_ver 0 CC: Dmitriy Andreyevskiy <dandreye@cisco.com> Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: David Ahern <dsahern@gmail.com>
| * | add support for mptcp netlink interfacePaolo Abeni2020-04-294-2/+440
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement basic commands to: - manipulate MPTCP endpoints list - manipulate MPTCP connection limits Examples: 1. Allows multiple subflows per MPTCP connection $ ip mptcp limits set subflows 2 2. Accept ADD_ADDR announcement from the peer (server): $ ip mptcp limits set add_addr_accepted 2 3. Add a ipv4 address to be annunced for backup subflows: $ ip mptcp endpoint add 10.99.1.2 signal backup 4. Add an ipv6 address used as source for additional subflows: $ ip mptcp endpoint add 2001::2 subflow Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
| * | macsec: add support for specifying offload at link add timeMark Starovoytov2020-04-261-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for configuring offload mode upon MACsec device creation. If offload mode is not specified, then netlink attribute is not added. Default behavior on the kernel side in this case is backward-compatible (offloading is disabled by default). Example: $ ip link add link eth0 macsec0 type macsec port 11 encrypt on offload mac Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com> Signed-off-by: Igor Russkikh <irusskikh@marvell.com> Signed-off-by: David Ahern <dsahern@gmail.com>
| * | macsec: add support for MAC offloadMark Starovoytov2020-04-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch enables MAC HW offload usage in iproute, since MACSec implementation supports it now. Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com> Signed-off-by: Igor Russkikh <irusskikh@marvell.com> Signed-off-by: David Ahern <dsahern@gmail.com>
* | | nexthop: Fix Deletion displayDonald Sharp2020-06-011-1/+1
| |/ |/| | | | | | | | | | | | | | | Actually display that deletions are happening when monitoring nexthops. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* | xfrm: also check for ipv6 state in xfrm_state_keepXin Long2020-04-271-1/+2
|/ | | | | | | | | | | | | | | | | | | | | As commit f9d696cf414c ("xfrm: not try to delete ipcomp states when using deleteall") does, this patch is to fix the same issue for ip6 state where xsinfo->id.proto == IPPROTO_IPV6. # ip xfrm state add src 2000::1 dst 2000::2 spi 0x1000 \ proto comp comp deflate mode tunnel sel src 2000::1 dst \ 2000::2 proto gre # ip xfrm sta deleteall Failed to send delete-all request : Operation not permitted Note that the xsinfo->proto in common states can never be IPPROTO_IPV6. Fixes: f9d696cf414c ("xfrm: not try to delete ipcomp states when using deleteall") Reported-by: Xiumei Mu <xmu@redhat.com> Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ip: link_gre: Do not send ERSPAN attributes to GRE tunnelsPetr Machata2020-04-131-12/+22
| | | | | | | | | | | | | In the commit referenced below, ip link started sending ERSPAN-specific attributes even for GRE and gretap tunnels. Fix by more carefully distinguishing between the GRE/tap and ERSPAN modes. Do not show ERSPAN-related help in GRE/tap mode, likewise do not accept ERSPAN arguments, or send ERSPAN attributes. Fixes: 83c543af872e ("erspan: set erspan_ver to 1 by default") Signed-off-by: Petr Machata <petrm@mellanox.com> Acked-by: William Tu <u9012063@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* Merge ../iproute2-nextStephen Hemminger2020-04-061-2/+81
|\
| * macsec: add an accessor for validate_strAntoine Tenart2020-03-041-2/+10
| | | | | | | | | | | | | | | | This patch adds an accessor for the validate_str array, to handle future changes adding a member. Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: David Ahern <dsahern@gmail.com>
| * macsec: add support for changing the offloading modeAntoine Tenart2020-03-041-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MacSEC can now be offloaded to specialized hardware devices. Offloading is off by default when creating a new MACsec interface, but the mode can be updated at runtime. This patch adds a new subcommand, `ip macsec offload`, to allow users to select the offloading mode of a MACsec interface. It takes the mode to switch to as an argument, which can for now either be 'off' or 'phy': # ip macsec offload macsec0 phy # ip macsec offload macsec0 off Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: David Ahern <dsahern@gmail.com>
| * macsec: report the offloading mode currently selectedAntoine Tenart2020-03-041-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support to report the MACsec offloading mode currently being enabled, which as of now can either be 'off' or 'phy'. This information is reported through the `ip macsec show` command: # ip macsec show 18: macsec0: protect on validate strict sc off sa off encrypt on send_sci on end_station off scb off replay off cipher suite: GCM-AES-128, using ICV length 16 TXSC: 3e5035b67c860001 on SA 0 0: PN 1, state on, key 00000000000000000000000000000000 RXSC: b4969112700f0001, state on 0: PN 1, state on, key 01000000000000000000000000000000 offload: phy 19: macsec1: protect on validate strict sc off sa off encrypt on send_sci on end_station off scb off replay off cipher suite: GCM-AES-128, using ICV length 16 TXSC: 3e5035b67c880001 on SA 0 1: PN 1, state on, key 00000000000000000000000000000000 RXSC: b4969112700f0001, state on 1: PN 1, state on, key 01000000000000000000000000000000 offload: off Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: David Ahern <dsahern@gmail.com>
* | nexthop: fix error reporting in filter dumpAndrea Claudi2020-03-151-2/+2
|/ | | | | | | | | | nh_dump_filter is missing a return value check in two cases. Fix this simply adding an assignment to the proper variable. Fixes: 63df8e8543b03 ("Add support for nexthop objects") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* xfrm: not try to delete ipcomp states when using deleteallXin Long2020-02-281-0/+3
| | | | | | | | | | | | | | | | | | | | | | | In kernel space, ipcomp(sub) states used by main states are not allowed to be deleted by users, they would be freed only when all main states are destroyed and no one uses them. In user space, ip xfrm sta deleteall doesn't filter these ipcomp states out, and it causes errors: # ip xfrm state add src 192.168.0.1 dst 192.168.0.2 spi 0x1000 \ proto comp comp deflate mode tunnel sel src 192.168.0.1 dst \ 192.168.0.2 proto gre # ip xfrm sta deleteall Failed to send delete-all request : Operation not permitted This patch is to fix it by filtering ipcomp states with a check xsinfo->id.proto == IPPROTO_IPIP. Fixes: c7699875bee0 ("Import patch ipxfrm-20040707_2.diff") Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ip route: Do not imply pref and ttl-propagate are per nexthopDonald Sharp2020-02-281-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently `ip -6 route show` gives us this output: sharpd@eva ~/i/ip (master)> ip -6 route show ::1 dev lo proto kernel metric 256 pref medium 4:5::6:7 nhid 18 proto static metric 20 nexthop via fe80::99 dev enp39s0 weight 1 nexthop via fe80::44 dev enp39s0 weight 1 pref medium Displaying `pref medium` as the last bit of output implies that the RTA_PREF is a per nexthop value, when it is infact a per route piece of data. Change the output to display RTA_PREF and RTA_TTL_PROPAGATE before the RTA_MULTIPATH data is shown: sharpd@eva ~/i/ip (master)> ./ip -6 route show ::1 dev lo proto kernel metric 256 pref medium 4:5::6:7 nhid 18 proto static metric 20 pref medium nexthop via fe80::99 dev enp39s0 weight 1 nexthop via fe80::44 dev enp39s0 weight 1 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Andrea Claudi <aclaudi@redhat.com> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* erspan: set erspan_ver to 1 by defaultXin Long2020-02-232-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Commit 289763626721 ("erspan: add erspan version II support") breaks the command: # ip link add erspan1 type erspan key 1 seq erspan 123 \ local 10.1.0.2 remote 10.1.0.1 as erspan_ver is set to 0 by default, then IFLA_GRE_ERSPAN_INDEX won't be set in gre_parse_opt(). # ip -d link show erspan1 ... erspan remote 10.1.0.1 local 10.1.0.2 ... erspan_index 0 erspan_ver 1 ^^^^^^^^^^^^^^ This patch is to change to set erspan_ver to 1 by default. Fixes: 289763626721 ("erspan: add erspan version II support") Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: William Tu <u9012063@gmail.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ip link: xstats: fix TX IGMP reports stringAndrea Claudi2020-01-291-1/+1
| | | | | | | | | This restore the string format we have before jsonification, adding a missing space between v2 and v3 on TX IGMP reports string. Fixes: a9bc23a79227a ("ip: bridge: add xstats json support") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* ip-xfrm: Fix help messagesAndrea Claudi2020-01-292-39/+6
| | | | | | | | | | | | | | | | | | | | | | After commit 8589eb4efdf2a ("treewide: refactor help messages") help messages for xfrm state and policy are broken, printing many times the same protocol in UPSPEC section: $ ip xfrm state help [...] UPSPEC := proto { { tcp | tcp | tcp | tcp } [ sport PORT ] [ dport PORT ] | { icmp | icmp | icmp } [ type NUMBER ] [ code NUMBER ] | gre [ key { DOTTED-QUAD | NUMBER } ] | PROTO } This happens because strxf_proto function is non-reentrant and gets called multiple times in the same fprintf instruction. This commit fix the issue avoiding calls to strxf_proto() with a constant param, just hardcoding strings for protocol names. Fixes: 8589eb4efdf2a ("treewide: refactor help messages") Signed-off-by: Andrea Claudi <aclaudi@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
* Merge branch 'master' of ↵Stephen Hemminger2020-01-297-12/+97
|\ | | | | | | | | | | git://git.kernel.org/pub/scm/network/iproute2/iproute2-next Resolved conflict in tc/f_flower.c
| * ip: xfrm: add espintcp encapsulationSabrina Dubroca2020-01-222-5/+11
| | | | | | | | | | | | | | | | | | | | | | While at it, convert xfrm_xfrma_print and xfrm_encap_type_parse to use the UAPI macros for encap_type as suggested by David Ahern, and add the UAPI udp.h header (sync'd from ipsec-next to get the TCP_ENCAP_ESPINTCP definition). Co-developed-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David Ahern <dsahern@gmail.com>
| * ip route: Print "rt_offload" and "rt_trap" indicationIdo Schimmel2020-01-181-0/+4
| | | | | | | | | | | | | | | | | | | | The kernel now signals the offload state of a route using the 'RTM_F_OFFLOAD' and 'RTM_F_TRAP' flags. Print these to help users understand the offload state of each route. The "rt_" prefix is used in order to distinguish it from the offload state of nexthops. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David Ahern <dsahern@gmail.com>
| * Merge branch 'master' into nextDavid Ahern2020-01-021-1/+3
| |\ | | | | | | | | | Signed-off-by: David Ahern <dsahern@gmail.com>
| * | iplink: bond: print lacp actor/partner oper states as stringsAndy Roulin2020-01-021-4/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 802.3ad/LACP actor/partner operating states are only printed as numbers, e.g, ad_actor_oper_port_state 15 Add an additional output in ip link show that prints a string describing the individual 3ad bit meanings in the following way: ad_actor_oper_port_state_str <active,short_timeout,aggregating,in_sync> JSON output is also supported, the field becomes a json array: "ad_actor_oper_port_state_str": ["active","short_timeout","aggregating","in_sync"] Signed-off-by: Andy Roulin <aroulin@cumulusnetworks.com> Signed-off-by: David Ahern <dsahern@gmail.com>