[PATCH RFC net-next 4/5] net/ipv4: Update inet_dump_ifaddr to support NLM_F_DUMP_PROPER_HDR

2018-09-28 Thread dsahern
From: David Ahern Update inet_dump_ifaddr to check for NLM_F_DUMP_PROPER_HDR in the netlink message header. If the flag is set, the dump request is expected to have an ifaddrmsg struct as the header potentially followed by one or more attributes. Any data passed in the header or as an attribute

[PATCH RFC net-next 2/5] net/ipv6: Refactor address dump to push inet6_fill_args to in6_dump_addrs

2018-09-28 Thread dsahern
From: David Ahern Pull the inet6_fill_args arg up to in6_dump_addrs and move netnsid into it. Since IFA_TARGET_NETNSID is a kernel side filter add the NLM_F_DUMP_FILTERED flag so userspace knows the request was honored. Signed-off-by: David Ahern --- net/ipv6/addrconf.c | 59

[PATCH RFC net-next 5/5] net/ipv6: Update inet6_dump_addr to support NLM_F_DUMP_PROPER_HDR

2018-09-28 Thread dsahern
From: David Ahern Update inet6_dump_addr to check for NLM_F_DUMP_PROPER_HDR in the netlink message header. If the flag is set, the dump request is expected to have an ifaddrmsg struct as the header potentially followed by one or more attributes. Any data passed in the header or as an attribute

[PATCH RFC net-next 3/5] netlink: introduce NLM_F_DUMP_PROPER_HDR flag

2018-09-28 Thread dsahern
From: David Ahern Add a new flag, NLM_F_DUMP_PROPER_HDR, for userspace to indicate to the kernel that it believes it is sending the right header struct for the dump message type (ifinfomsg, ifaddrmsg, rtmsg, fib_rule_hdr, ...). Setting the flag in the netlink message header indicates to the

[PATCH RFC net-next 1/5] net/netlink: Pass extack to dump callbacks

2018-09-28 Thread dsahern
From: David Ahern Pass extack to dump callbacks by adding extack to netlink_dump_control and transferring to netlink_callback. Update rtnetlink as the first user. Signed-off-by: David Ahern --- include/linux/netlink.h | 2 ++ net/core/rtnetlink.c | 1 + net/netlink/af_netlink.c | 1 + 3

[PATCH RFC net-next 0/5] rtnetlink: Add support for rigid checking of data in dump request

2018-09-28 Thread dsahern
From: David Ahern There are many use cases where a user wants to influence what is returned in a dump for some rtnetlink command: one is wanting data for a different namespace than the one the request is received and another is limiting the amount of data returned in the dump to a specific set

[PATCH net] net/ipv6: Remove extra call to ip6_convert_metrics for multipath case

2018-09-26 Thread dsahern
From: David Ahern The change to move metrics from the dst to rt6_info moved the call to ip6_convert_metrics from ip6_route_add to ip6_route_info_create. In doing so it makes the call in ip6_route_info_append redundant and actually leaks the metrics installed as part of the ip6_route_info_create.

[PATCH net-next] scsi: libcxgbi: fib6_ino reference in rt6_info is rcu protected

2018-09-10 Thread dsahern
From: David Ahern The fib6_info reference in rt6_info is rcu protected. Add a helper to extract prefsrc from and update cxgbi_check_route6 to use it. Fixes: 0153167aebd0 ("net/ipv6: Remove rt6i_prefsrc") Reported-by: kbuild test robot Signed-off-by: David Ahern ---

[PATCH net-next] net/ipv6: Remove rt6i_prefsrc

2018-09-10 Thread dsahern
From: David Ahern After the conversion to fib6_info, rt6i_prefsrc has a single user that reads the value and otherwise it is only set. The one reader can be converted to use rt->from so rt6i_prefsrc can be removed, reducing rt6_info by another 20 bytes. Signed-off-by: David Ahern ---

[PATCH net] netfilter: bridge: Don't sabotage nf_hook calls from an l3mdev

2018-09-07 Thread dsahern
From: David Ahern For starters, the bridge netfilter code registers operations that are invoked any time nh_hook is called. Specifically, ip_sabotage_in watches for nested calls for NF_INET_PRE_ROUTING when a bridge is in the stack. Packet wise, the bridge netfilter hook runs first.

[PATCH RFC net-next 16/18] net/ipv6: Allow routes to use nexthop objects

2018-08-31 Thread dsahern
From: David Ahern Allow users to specify a nexthop id to use with a route. Signed-off-by: David Ahern --- include/net/ip6_fib.h | 4 +++ include/net/nexthop.h | 3 ++ net/ipv4/nexthop.c| 5 +++ net/ipv6/addrconf.c | 3 ++ net/ipv6/ip6_fib.c| 17 --- net/ipv6/ndisc.c

[PATCH RFC net-next 11/18] net: Initial nexthop code

2018-08-31 Thread dsahern
From: David Ahern Initial import of nexthop code. - Add new RTM commands for nexthop objects. - Add new uapi attributes for creating nexthops. Attributes are similar to the current nexthop attributes for routes. - Add basic helpers for ipv4 and ipv6 references to nexthop data Similar to

[PATCH RFC net-next 08/18] net/ipv4: Move device validation to helper

2018-08-31 Thread dsahern
From: David Ahern Move the device matching check in __fib_validate_source to a helper. Code move only; no functional change intended. Signed-off-by: David Ahern --- net/ipv4/fib_frontend.c | 44 +++- 1 file changed, 27 insertions(+), 17 deletions(-)

[PATCH RFC net-next 03/18] net/ipv4: export fib_info_update_nh_saddr

2018-08-31 Thread dsahern
From: David Ahern Add scope as input argument versus relying on fib_info reference in fib_nh and export fib_info_update_nh_saddr. Signed-off-by: David Ahern --- include/net/ip_fib.h | 5 +++-- net/ipv4/fib_semantics.c | 9 - 2 files changed, 7 insertions(+), 7 deletions(-) diff

[PATCH RFC net-next 12/18] net/ipv4: Add nexthop helpers for ipv4 integration

2018-08-31 Thread dsahern
From: David Ahern Add nexthop reference to fib_info along with a list_head for tracking the association of nexthop back to the fib_info. Add helpers to take a fib_info and return a fib_nh, a nexthop device and nexthop gateway. Add helper to validate a nexthop works with a fib_info.

[PATCH RFC net-next 10/18] net/ipv6: Make fib6_nh optional at the end of fib6_info

2018-08-31 Thread dsahern
From: David Ahern Move fib6_nh to the end of fib6_info and make an array of size 0. Pass a flag to fib6_info_alloc indicating if the allocation needs to add space for a fib6_nh. The current code path always has a fib6_nh allocated; with nexthop objects they will not. Signed-off-by: David Ahern

[PATCH RFC net-next 07/18] net: ipv4: Add fib_nh to fib_result

2018-08-31 Thread dsahern
From: David Ahern Add nexthop selection to fib_result and update FIB_RES macros to use it. Right now, fib_nh in fib_result will point to a nexthop within a fib_info. Later, fib_nh can point to data with a nexthop. Signed-off-by: David Ahern --- include/net/ip_fib.h | 21

[PATCH RFC net-next 04/18] net/ipv4: export fib_check_nh

2018-08-31 Thread dsahern
From: David Ahern Change fib_check_nh to take net, table and scope as input arguments over struct fib_config and export for use by nexthop code. Signed-off-by: David Ahern --- include/net/ip_fib.h | 2 ++ net/ipv4/fib_semantics.c | 18 +- 2 files changed, 11

[PATCH RFC net-next 17/18] net: Add support for nexthop groups

2018-08-31 Thread dsahern
From: David Ahern Allow the creation of nexthop groups which reference other nexthop objects to create multipath routes. TO-DO: Add mpath support to IPv6 Signed-off-by: David Ahern --- include/net/nexthop.h| 77 +-- net/ipv4/fib_semantics.c | 5 +- net/ipv4/nexthop.c | 511

[PATCH RFC net-next 06/18] net/ipv4: Create init and release helpers for fib_nh

2018-08-31 Thread dsahern
From: David Ahern Consolidate the fib_nh initialization which is duplicated between fib_create_info for single path and fib_get_nhs for multipath. Move the fib_nh cleanup code from free_fib_info_rcu into a new helper, fib_nh_release. Move classid accounting into fib_nh_release which is called

[PATCH RFC net-next 13/18] net/ipv4: Convert existing use of fib_info to new helpers

2018-08-31 Thread dsahern
From: David Ahern Remove direct accesses to fi->fib_nh in favor of the helpers added in the previous patch. Signed-off-by: David Ahern --- .../net/ethernet/mellanox/mlxsw/spectrum_router.c| 4 +++- drivers/net/ethernet/rocker/rocker_ofdpa.c | 20 ++--

[PATCH RFC net-next 01/18] net: Rename net/nexthop.h net/rtnh.h

2018-08-31 Thread dsahern
From: David Ahern The header contains rtnh_ macros so rename the file accordingly. Allows next patch to use the nexthop.h name. Signed-off-by: David Ahern --- include/net/{nexthop.h => rtnh.h} | 4 ++-- net/core/lwtunnel.c | 2 +- net/decnet/dn_fib.c | 2 +-

[PATCH RFC net-next 09/18] net/ipv6: Create init and release helpers for fib6_nh

2018-08-31 Thread dsahern
From: David Ahern Refactor initialization and cleanup of fib6_nh to helpers similar to what was done for IPv4. Add fib6_nh_init to the ipv6 stubs for use by core code when ipv6 is built as a module. The replace helper is small enough, so make an inline rather than requiring it to go through

[PATCH RFC net-next 02/18] net: ipv4: export fib_good_nh and fib_flush

2018-08-31 Thread dsahern
From: David Ahern Export fib_good_nh for use by the nexthop code when selecting a path within a multipath nexthop. As nexthops are deleted, fib entries referencing it are marked dead. Export fib_flush so those entries can be removed in a timely manner. Signed-off-by: David Ahern ---

[PATCH RFC net-next 05/18] net/ipv4: Define fib_get_nhs when CONFIG_IP_ROUTE_MULTIPATH is disabled

2018-08-31 Thread dsahern
From: David Ahern Define fib_get_nhs to return EINVAL when CONFIG_IP_ROUTE_MULTIPATH is not enabled and remove the ifdef check for CONFIG_IP_ROUTE_MULTIPATH. Signed-off-by: David Ahern --- net/ipv4/fib_semantics.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff

[PATCH RFC net-next 18/18] net/ipv4: Optimization for fib_info lookup

2018-08-31 Thread dsahern
From: David Ahern Be optimistic about re-using a fib_info when nexthop id is given and the route does not use metrics. Avoids a memory allocation which in most cases is expected to be freed anyways. Signed-off-by: David Ahern --- net/ipv4/fib_semantics.c | 48

[PATCH RFC net-next 15/18] net/ipv6: Use helpers to access fib6_nh data

2018-08-31 Thread dsahern
From: David Ahern Similar to ipv4, add helpers for accessing fib6_nh data and convert existing users. Signed-off-by: David Ahern --- include/net/ip6_fib.h | 11 -- include/net/ip6_route.h | 2 ++ include/net/nexthop.h | 40 +++

[PATCH iproute2-next] ip: Add support for nexthop objects

2018-08-31 Thread dsahern
From: David Ahern Signed-off-by: David Ahern --- include/uapi/linux/nexthop.h | 56 include/uapi/linux/rtnetlink.h | 8 + ip/Makefile| 3 +- ip/ip.c| 3 +- ip/ip_common.h | 7 +- ip/ipmonitor.c | 6 +

[PATCH RFC net-next 14/18] net/ipv4: Allow routes to use nexthop objects

2018-08-31 Thread dsahern
From: David Ahern Add new RTA attribute to allow a user to specify a nexthop id to use with a route instead of the current nexthop specification. Signed-off-by: David Ahern --- include/net/ip_fib.h | 1 + include/uapi/linux/rtnetlink.h | 1 + net/ipv4/fib_frontend.c| 7

[PATCH RFC net-next 00/18] net: Improve route scalability via support for nexthop objects

2018-08-31 Thread dsahern
From: David Ahern As mentioned at netconf in Seoul, we would like to introduce nexthops as independent objects from the routes to better align with both routing daemons and hardware and to improve route insertion times into the kernel. This series adds nexthop objects with their own lifecycle.

[PATCH net] net/ipv6: Only update MTU metric if it set

2018-08-30 Thread dsahern
From: David Ahern Jan reported a regression after an update to 4.18.5. In this case ipv6 default route is setup by systemd-networkd based on data from an RA. The RA contains an MTU of 1492 which is used when the route is first inserted but then systemd-networkd pushes down updates to the default

[PATCH net-next] net/ipv6: Do not reset nl_net in ip6_route_info_create

2018-08-29 Thread dsahern
From: David Ahern nl_net is set on entry to ip6_route_info_create. Only devices within that namespace are considered so no need to reset it before returning. Signed-off-by: David Ahern --- net/ipv6/route.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/ipv6/route.c

[PATCH net-next] net/ipv4: Add extack message that dev is required for ONLINK

2018-08-29 Thread dsahern
From: David Ahern Make IPv4 consistent with IPv6 and return an extack message that the ONLINK flag requires a nexthop device. Signed-off-by: David Ahern --- net/ipv4/fib_semantics.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/fib_semantics.c

[PATCH net] net/ipv6: Put lwtstate when destroying fib6_info

2018-08-20 Thread dsahern
From: David Ahern Prior to the introduction of fib6_info lwtstate was managed by the dst code. With fib6_info releasing lwtstate needs to be done when the struct is freed. Fixes: 93531c674315 ("net/ipv6: separate handling of FIB entries from dst based routes") Signed-off-by: David Ahern ---

[PATCH v2 net-next] veth: Free queues on link delete

2018-08-14 Thread dsahern
From: David Ahern kmemleak reported new suspected memory leaks. $ cat /sys/kernel/debug/kmemleak unreferenced object 0x8800354d5c00 (size 1024): comm "ip", pid 836, jiffies 4294722952 (age 25.904s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

[PATCH net] veth: Free queues on link delete

2018-08-14 Thread dsahern
From: David Ahern kmemleak reported new suspected memory leaks. $ cat /sys/kernel/debug/kmemleak unreferenced object 0x880130b6ec00 (size 1024): comm "ip", pid 916, jiffies 4296194668 (age 7251.672s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

[PATCH iproute2] devlink: CTRL_ATTR_FAMILY_ID is a u16

2018-07-20 Thread dsahern
From: David Ahern CTRL_ATTR_FAMILY_ID is a u16, not a u32. Update devlink accordingly. Fixes: a3c4b484a1edd ("add devlink tool") Signed-off-by: David Ahern --- devlink/mnlg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devlink/mnlg.c b/devlink/mnlg.c index

[PATCH net] net/ipv6: Fix linklocal to global address with VRF

2018-07-19 Thread dsahern
From: David Ahern Example setup: host: ip -6 addr add dev eth1 2001:db8:104::4 where eth1 is enslaved to a VRF switch: ip -6 ro add 2001:db8:104::4/128 dev br1 where br1 only has an LLA ping6 2001:db8:104::4 ssh 2001:db8:104::4 (NOTE: UDP

[PATCH v2 net] net/ipv6: Do not allow device only routes via the multipath API

2018-07-15 Thread dsahern
From: David Ahern Eric reported that reverting the patch that fixed and simplified IPv6 multipath routes means reverting back to invalid userspace notifications. eg., $ ip -6 route add 2001:db8:1::/64 nexthop dev eth0 nexthop dev eth1 only generates a single notification: 2001:db8:1::/64 dev

[PATCH net] net/ipv6: Do not allow device only routes via the multipath API

2018-07-12 Thread dsahern
From: David Ahern Eric reported that reverting the patch that fixed and simplified IPv6 multipath routes means reverting back to invalid userspace notifications. eg., $ ip -6 route add 2001:db8:1::/64 nexthop dev eth0 nexthop dev eth1 only generates a single notification: 2001:db8:1::/64 dev

[PATCH net] net/ipv4: Set oif in fib_compute_spec_dst

2018-07-07 Thread dsahern
From: David Ahern Xin reported that icmp replies may not use the address on the device the echo request is received if the destination address is broadcast. Instead a route lookup is done without considering VRF context. Fix by setting oif in flow struct to the master device if it is enslaved.

[PATCH v2 net] net/ipv6: Revert attempt to simplify route replace and append

2018-07-03 Thread dsahern
From: David Ahern NetworkManager likes to manage linklocal prefix routes and does so with the NLM_F_APPEND flag, breaking attempts to simplify the IPv6 route code and by extension enable multipath routes with device only nexthops. Revert f34436a43092 and these followup patches: 6eba08c3626b

[PATCH net] net/ipv6: Revert attempt to simplify route replace and append

2018-07-02 Thread dsahern
From: David Ahern NetworkManager likes to manage linklocal prefix routes and does so with the NLM_F_APPEND flag, breaking attempts to simplify the IPv6 route code and by extension enable multipath routes with device only nexthops. Revert f34436a43092 and its followup 6eba08c3626b ("ipv6: Only

[PATCH net] net/ipv6: Fix updates to prefix route

2018-06-28 Thread dsahern
From: David Ahern Sowmini reported that a recent commit broke prefix routes for linklocal addresses. The newly added modify_prefix_route is attempting to add a new prefix route when the ifp priority does not match the route metric however the check needs to account for the default priority. In

[PATCH v3 bpf-net] bpf: Change bpf_fib_lookup to return lookup status

2018-06-26 Thread dsahern
From: David Ahern For ACLs implemented using either FIB rules or FIB entries, the BPF program needs the FIB lookup status to be able to drop the packet. Since the bpf_fib_lookup API has not reached a released kernel yet, change the return code to contain an encoding of the FIB lookup result and

[PATCH net-next] netlink: Return extack message if attribute validation fails

2018-06-26 Thread dsahern
From: David Ahern Have one extack message for parsing and validating. Signed-off-by: David Ahern --- lib/nlattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nlattr.c b/lib/nlattr.c index dfa55c873c13..e335bcafa9e4 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c

[PATCH v2 bpf-net] bpf: Change bpf_fib_lookup to return lookup status

2018-06-20 Thread dsahern
From: David Ahern For ACLs implemented using either FIB rules or FIB entries, the BPF program needs the FIB lookup status to be able to drop the packet. Since the bpf_fib_lookup API has not reached a released kernel yet, change the return code to contain an encoding of the FIB lookup result and

[PATCH net] net/tcp: Fix socket lookups with SO_BINDTODEVICE

2018-06-18 Thread dsahern
From: David Ahern Similar to 69678bcd4d2d ("udp: fix SO_BINDTODEVICE"), TCP socket lookups need to fail if dev_match is not true. Currently, a packet to a given port can match a socket bound to device when it should not. In the VRF case, this causes the lookup to hit a VRF socket and not a

[PATCH bpf-net] bpf: Change bpf_fib_lookup to return lookup status

2018-06-17 Thread dsahern
From: David Ahern For ACLs implemented using either FIB rules or FIB entries, the BPF program needs the FIB lookup status to be able to drop the packet. Since the bpf_fib_lookup API has not reached a released kernel yet, change the return code to contain an encoding of the FIB lookup result and

[PATCH net] net/ipv6: Ensure cfg is properly initialized in ipv6_create_tempaddr

2018-06-11 Thread dsahern
From: David Ahern Valdis reported a BUG in ipv6_add_addr: [ 1820.832682] BUG: unable to handle kernel NULL pointer dereference at 0209 [ 1820.832728] RIP: 0010:ipv6_add_addr+0x280/0xd10 [ 1820.832732] Code: 49 8b 1f 0f 84 6a 0a 00 00 48 85 db 0f 84 4e 0a 00 00 48 8b 03 48 8b 53 08

[PATCH v2 net-next 1/3] devlink: Add extack to reload and port_{un,}split operations

2018-06-05 Thread dsahern
From: David Ahern Add extack argument to reload, port_split and port_unsplit operations. Signed-off-by: David Ahern Acked-by: Jiri Pirko --- drivers/net/ethernet/mellanox/mlxsw/core.c | 9 ++--- drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 5 +++--

[PATCH v2 net-next 3/3] mlxsw: Add extack messages for port_{un,}split failures

2018-06-05 Thread dsahern
From: David Ahern Return messages in extack for port split/unsplit errors. e.g., $ devlink port split swp1s1 count 4 Error: mlxsw_spectrum: Port cannot be split further. devlink answers: Invalid argument $ devlink port unsplit swp4 Error: mlxsw_spectrum: Port was not split.

[PATCH v2 net-next 0/3] devlink: Add extack messages for reload and port split/unsplit

2018-06-05 Thread dsahern
From: David Ahern Patch 1 adds extack arg to reload, port_split and port_unsplit devlink operations. Patch 2 adds extack messages for reload operation in netdevsim. Patch 3 adds extack messages to port split/unsplit in mlxsw driver. v2 - make the extack messages align with existing dev_err

[PATCH v2 net-next 2/3] netdevsim: Add extack error message for devlink reload

2018-06-05 Thread dsahern
From: David Ahern devlink reset command can fail if a FIB resource limit is set to a value lower than the current occupancy. Return a proper message indicating the reason for the failure. $ devlink resource sh netdevsim/netdevsim0 netdevsim/netdevsim0: name IPv4 size unlimited unit entry

[PATCH net-next 1/3] devlink: Add extack to reload and port_{un,}split operations

2018-06-04 Thread dsahern
From: David Ahern Add extack argument to reload, port_split and port_unsplit operations. Signed-off-by: David Ahern --- drivers/net/ethernet/mellanox/mlxsw/core.c | 9 ++--- drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 5 +++-- drivers/net/netdevsim/devlink.c

[PATCH net-next 3/3] mlxsw: Add extack messages for port_{un,}split failures

2018-06-04 Thread dsahern
From: David Ahern Return messages in extack for port split/unsplit errors. e.g., $ devlink port split swp1s1 count 4 Error: mlxsw_spectrum: Port cannot be split further. devlink answers: Invalid argument $ devlink port unsplit swp4 Error: mlxsw_spectrum: Port was not split.

[PATCH net-next 2/3] netdevsim: Add extack error message for devlink reload

2018-06-04 Thread dsahern
From: David Ahern devlink reset command can fail if a FIB resource limit is set to a value lower than the current occupancy. Return a proper message indicating the reason for the failure. $ devlink resource sh netdevsim/netdevsim0 netdevsim/netdevsim0: name IPv4 size unlimited unit entry

[PATCH net-next 0/3] devlink: Add extack messages for reload and port split/unsplit

2018-06-04 Thread dsahern
From: David Ahern Patch 1 adds extack arg to reload, port_split and port_unsplit devlink operations. Patch 2 adds extack messages for reload operation in netdevsim. Patch 3 adds extack messages to port split/unsplit in mlxsw driver. David Ahern (3): devlink: Add extack to reload and

[PATCH net] net/ipv6: prevent use after free in ip6_route_mpath_notify

2018-06-04 Thread dsahern
From: David Ahern syzbot reported a use-after-free: BUG: KASAN: use-after-free in ip6_route_mpath_notify+0xe9/0x100 net/ipv6/route.c:4180 Read of size 4 at addr 8801bf789cf0 by task syz-executor756/4555 CPU: 1 PID: 4555 Comm: syz-executor756 Not tainted 4.17.0-rc7+ #78 Hardware name:

[PATCH bpf-next] bpf: flowlabel in bpf_fib_lookup should be flowinfo

2018-06-03 Thread dsahern
From: David Ahern As Michal noted the flow struct takes both the flow label and priority. Update the bpf_fib_lookup API to note that it is flowinfo and not just the flow label. Cc: Michal Kubecek Signed-off-by: David Ahern --- include/uapi/linux/bpf.h | 2 +- net/core/filter.c | 2

[PATCH iproute2] iplink_vrf: Save device index from response for return code

2018-06-01 Thread dsahern
From: David Ahern A recent commit changed rtnl_talk_* to return the response message in allocated memory so callers need to free it. The change to name_is_vrf did not save the device index which is pointing to a struct inside the now allocated and freed memory resulting in garbage getting

[PATCH bpf-next] bpf: Change bpf_fib_lookup to return -EAFNOSUPPORT for unsupported address families

2018-05-30 Thread dsahern
From: David Ahern Update bpf_fib_lookup to return -EAFNOSUPPORT for unsupported address families. Allows userspace to probe for support as more are added (e.g., AF_MPLS). Signed-off-by: David Ahern --- net/core/filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH v2 iproute2-next] ip route: print RTA_CACHEINFO if it exists

2018-05-30 Thread dsahern
From: David Ahern RTA_CACHEINFO can be sent for non-cloned routes. If the attribute is present print it. Allows route dumps to print expires times for example which can exist on FIB entries. Signed-off-by: David Ahern --- v2 - leave print_cache_flags under r->rtm_flags & RTM_F_CLONED check

[PATCH bpf-next] bpf: Verify flags in bpf_fib_lookup

2018-05-29 Thread dsahern
From: David Ahern Verify flags argument contains only known flags. Allows programs to probe for support as more are added. Signed-off-by: David Ahern --- net/core/filter.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index

[PATCH bpf-next] bpf: Drop mpls from bpf_fib_lookup

2018-05-29 Thread dsahern
From: David Ahern MPLS support will not be submitted this dev cycle, but in working on it I do see a few changes are needed to the API. For now, drop mpls from the API. Since the fields in question are unions, the mpls fields can be added back later without affecting the uapi. Signed-off-by:

[PATCH net-next 3/7] net/ipv6: Pass ifa6_config struct to inet6_addr_modify

2018-05-27 Thread dsahern
From: David Ahern Update inet6_addr_modify to take ifa6_config argument versus a parameter list. This is an argument move only; no functional change intended. Signed-off-by: David Ahern --- net/ipv6/addrconf.c | 44

[PATCH net-next 6/7] net/ipv6: Add support for specifying metric of connected routes

2018-05-27 Thread dsahern
From: David Ahern Add support for IFA_RT_PRIORITY to ipv6 addresses. If the metric is changed on an existing address then the new route is inserted before removing the old one. Since the metric is one of the route keys, the prefix route can not be atomically replaced.

[PATCH net-next 2/7] net/ipv6: Pass ifa6_config struct to inet6_addr_add

2018-05-27 Thread dsahern
From: David Ahern Move the creation of struct ifa6_config up to callers of inet6_addr_add. Signed-off-by: David Ahern --- net/ipv6/addrconf.c | 112 ++-- 1 file changed, 57 insertions(+), 55 deletions(-)

[PATCH iproute2-next] ipaddress: Add support for address metric

2018-05-27 Thread dsahern
From: David Ahern Add support for IFA_RT_PRIORITY using the same keywords as iproute for RTA_PRIORITY. Signed-off-by: David Ahern --- include/uapi/linux/if_addr.h | 1 + ip/ipaddress.c | 15 ++- man/man8/ip-address.8.in | 6

[PATCH net-next 1/7] net/ipv6: Convert ipv6_add_addr to struct ifa6_config

2018-05-27 Thread dsahern
From: David Ahern Move config parameters for adding an ipv6 address to a struct. struct names stem from inet6_rtm_newaddr which is the modern handler for adding an address. Start the conversion to ifa6_config with ipv6_add_addr. This is an argument move only; no functional

[PATCH net-next 4/7] net: Add IFA_RT_PRIORITY address attribute

2018-05-27 Thread dsahern
From: David Ahern Currently, if two interfaces have addresses in the same connected route, then the order of the prefix route entries is determined by the order in which the addresses are assigned or the links brought up. Add IFA_RT_PRIORITY to allow user to specify the

[PATCH net-next 5/7] net/ipv4: Add support for specifying metric of connected routes

2018-05-27 Thread dsahern
From: David Ahern Add support for IFA_RT_PRIORITY to ipv4 addresses. If the metric is changed on an existing address then the new route is inserted before removing the old one. Since the metric is one of the route keys, the prefix route can not be replaced. Signed-off-by:

[PATCH net-next 0/7] net: Add address attribute to control metric of prefix route

2018-05-27 Thread dsahern
From: David Ahern For use cases such as VRR (Virtual Router Redundancy) interface managers want efficient control over the order of prefix routes when multiple interfaces have addresses with overlapping/duplicate subnets. Currently, if two interfaces have addresses in the

[PATCH net-next 7/7] selftests: fib_tests: Add prefix route tests with metric

2018-05-27 Thread dsahern
From: David Ahern Add tests verifying prefix routes are inserted with expected metric. IPv6 prefix route tests TEST: Default metric [ OK ] TEST: User specified metric on first device [ OK ] TEST: User specified

[PATCH v2 net-next 2/3] net/ipv6: Udate fib6_table_lookup tracepoint

2018-05-23 Thread dsahern
From: David Ahern Commit bb0ad1987e96 ("ipv6: fib6_rules: support for match on sport, dport and ip proto") added support for protocol and ports to FIB rules. Update the FIB lookup tracepoint to dump the parameters. Signed-off-by: David Ahern ---

[PATCH v2 net-next 0/3] net: Update fib_table_lookup tracepoints

2018-05-23 Thread dsahern
From: David Ahern Update the FIB lookup tracepoints to include ip proto and port fields from the flow struct. In the process make the IPv4 tracepoint inline with IPv6 which is much easier to use and follow the lookup and result. Remove the tracepoint in fib_validate_source

[PATCH v2 net-next 3/3] net/ipv4: Remove tracepoint in fib_validate_source

2018-05-23 Thread dsahern
From: David Ahern Tracepoint does not add value and the call to fib_lookup follows it which shows the same information and the fib lookup result. Signed-off-by: David Ahern --- include/trace/events/fib.h | 35 ---

[PATCH v2 net-next 1/3] net/ipv4: Udate fib_table_lookup tracepoint

2018-05-23 Thread dsahern
From: David Ahern Commit 4a2d73a4fb36 ("ipv4: fib_rules: support match on sport, dport and ip proto") added support for protocol and ports to FIB rules. Update the FIB lookup tracepoint to dump the parameters. In addition, make the IPv4 tracepoint similar to the IPv6 one

[PATCH RFC net-next 8/9] net/ipv6: Add support for specifying metric of connected routes

2018-05-23 Thread dsahern
From: David Ahern Add support for IFA_RT_PRIORITY to ipv6 addresses. If the metric is changed on an existing address then the new route is inserted before removing the old one. Since the metric is one of the route keys, the prefix route can not be atomically replaced.

[PATCH RFC net-next 4/9] net/ipv6: Pass ifa6_config struct to inet6_addr_add

2018-05-23 Thread dsahern
From: David Ahern Move the creation of struct ifa6_config up to callers of inet6_addr_add. Signed-off-by: David Ahern --- net/ipv6/addrconf.c | 112 ++-- 1 file changed, 57 insertions(+), 55 deletions(-)

[PATCH RFC net-next 2/9] net/ipv6: Convert ipv6_add_addr to struct ifa6_config

2018-05-23 Thread dsahern
From: David Ahern Convert ipv6_add_addr from a list of address parameters to use the new ifa6_config struct. Mapping of variable changes: addr --> cfg->pfx peer_addr --> cfg->peer_pfx pfxlen--> cfg->plen flags --> cfg->ifa_flags scope,

[PATCH RFC net-next 7/9] net/ipv4: Add support for specifying metric of connected routes

2018-05-23 Thread dsahern
From: David Ahern Add support for IFA_RT_PRIORITY to ipv4 addresses. If the metric is changed on an existing address then the new route is inserted before removing the old one. Since the metric is one of the route keys, the prefix route can not be replaced. Signed-off-by:

[PATCH RFC net-next 6/9] net: Add IFA_RT_PRIORITY address attribute

2018-05-23 Thread dsahern
From: David Ahern Currently, if two interfaces have addresses in the same connected route, then the order of the prefix route entries is determined by the order in which the addresses are assigned or the links brought up. Add IFA_RT_PRIORITY to allow user to specify the

[PATCH RFC net-next 3/9] net/ipv6: Remove temp variables in ipv6_create_tempaddr

2018-05-23 Thread dsahern
From: David Ahern Remove temp variables in favor of ifa6_config struct. Signed-off-by: David Ahern --- net/ipv6/addrconf.c | 26 +- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/net/ipv6/addrconf.c

[PATCH RFC net-next 5/9] net/ipv6: Pass ifa6_config struct to inet6_addr_modify

2018-05-23 Thread dsahern
From: David Ahern Update inet6_addr_modify to take ifa6_config. Signed-off-by: David Ahern --- net/ipv6/addrconf.c | 44 +++- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/net/ipv6/addrconf.c

[PATCH RFC net-next 0/9] net: Add address attribute to control metric of prefix route

2018-05-23 Thread dsahern
From: David Ahern For use cases such as VRR (Virtual Router Redundancy) interface managers want efficient control over the order of prefix routes when multiple interfaces have addresses with overlapping/duplicate subnets. Currently, if two interfaces have addresses in the

[PATCH RFC net-next 1/9] net/ipv6: Introduce ifa6_config struct

2018-05-23 Thread dsahern
From: David Ahern Move config parameters for adding an ipv6 address to a struct. struct names stem from inet6_rtm_newaddr which is the modern handler for adding an address. Signed-off-by: David Ahern --- include/net/addrconf.h | 12 1 file

[PATCH RFC net-next 9/9] selftests: fib_tests: Add prefix route tests with metric

2018-05-23 Thread dsahern
From: David Ahern Add tests verifying prefix routes are inserted with expected metric. IPv6 prefix route tests TEST: Default metric [ OK ] TEST: User specified metric on first device [ OK ] TEST: User specified

[PATCH iproute2-next] ip route: print RTA_CACHEINFO if it exists

2018-05-23 Thread dsahern
From: David Ahern RTA_CACHEINFO can be sent for non-cloned routes. If the attribute is present print it. Allows route dumps to print expires times for example which can exist on FIB entries. Signed-off-by: David Ahern --- ip/iproute.c | 14 +-

[PATCH iproute2] ip route: Print expires as signed int

2018-05-23 Thread dsahern
From: David Ahern rta_expires is a signed int; print it as one. Fixes: 663c3cb23103f ("iproute: implement JSON and color output") Signed-off-by: David Ahern --- ip/iproute.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH net-next 2/3] net/ipv6: Udate fib6_table_lookup tracepoint

2018-05-21 Thread dsahern
From: David Ahern Commit bb0ad1987e96 ("ipv6: fib6_rules: support for match on sport, dport and ip proto") added support for protocol and ports to FIB rules. Update the FIB lookup tracepoint to dump the parameters. Signed-off-by: David Ahern ---

[PATCH net-next 1/3] net/ipv4: Udate fib_table_lookup tracepoint

2018-05-21 Thread dsahern
From: David Ahern Commit 4a2d73a4fb36 ("ipv4: fib_rules: support match on sport, dport and ip proto") added support for protocol and ports to FIB rules. Update the FIB lookup tracepoint to dump the parameters. In addition, make the IPv4 tracepoint similar to the IPv6 one

[PATCH net-next 3/3] net/ipv4: Remove tracepoint in fib_validate_source

2018-05-21 Thread dsahern
From: David Ahern Tracepoint does not add value and the call to fib_lookup follows it which shows the same information and the fib lookup result. Signed-off-by: David Ahern --- include/trace/events/fib.h | 35 ---

[PATCH net-next 0/3] net: Update fib_table_lookup tracepoints

2018-05-21 Thread dsahern
From: David Ahern Update the FIB lookup tracepoints to include ip proto and port fields from the flow struct. In the process make the IPv4 tracepoint inline with IPv6 which is much easier to use and follow the lookup and result. Remove the tracepoint in fib_validate_source

[PATCH net-next 3/7] selftests: fib_tests: Add success-fail counts

2018-05-21 Thread dsahern
From: David Ahern As more tests are added, it is convenient to have a tally at the end. Signed-off-by: David Ahern --- tools/testing/selftests/net/fib_tests.sh | 7 +++ 1 file changed, 7 insertions(+) diff --git

[PATCH net-next 1/7] mlxsw: spectrum_router: Add support for route append

2018-05-21 Thread dsahern
From: David Ahern Handle append for gateway based routes. Dev-only multipath routes will be handled by a follow on patch. Signed-off-by: Ido Schimmel Signed-off-by: David Ahern ---

[PATCH net-next 0/7] net/ipv6: Fix route append and replace use cases

2018-05-21 Thread dsahern
From: David Ahern This patch set fixes a few append and replace uses cases for IPv6 and adds test cases that codifies the expectations of how append and replace are expected to work. In paricular it allows a multipath route to have a dev-only nexthop, something Thomas tried to

[PATCH net-next 4/7] selftests: fib_tests: Add command line options

2018-05-21 Thread dsahern
From: David Ahern Add command line options for controlling pause on fail, controlling specific tests to run and verbose mode rather than relying on environment variables. Signed-off-by: David Ahern --- tools/testing/selftests/net/fib_tests.sh | 53

[PATCH net-next 6/7] selftests: fib_tests: Add ipv6 route add append replace tests

2018-05-21 Thread dsahern
From: David Ahern Add IPv6 route tests covering add, append and replace permutations. Assumes the ability to add a basic single path route works; this is required for example when adding an address to an interface. $ fib_tests.sh -t ipv6_rt IPv6 route add / append tests

[PATCH net-next 2/7] net/ipv6: Simplify route replace and appending into multipath route

2018-05-21 Thread dsahern
From: David Ahern Bring consistency to ipv6 route replace and append semantics. Remove rt6_qualify_for_ecmp which is just guess work. It fails in 2 cases: 1. can not replace a route with a reject route. Existing code appends a new route instead of replacing the existing

  1   2   >