net: ILA notification mechanism and fixes
Subsystems (4)
v5 cover net: ILA notification mechanism and fixes
This patch set adds support to get netlink notifications for ILA routes when a route is used.
This patch set contains:
- General infrastructure for route notifications
- The ILA route notification mechanism
- Add net to ila build_state
- Add flush command to ila_xlat
- Fix use of rhashtable for latest fixes
Route notifications will be used in conjunction with populating ILA forwarding caches. There are three methods described in the ILA Mapping Protocol. These are redirects, request/reply, and push. The ILA route mechanism is relevant to the first two methods.
- ILA router secure redirect mechanism-- This is used on an ILA router where a notification is sent when an ILA host route is used. The purpose of this notification is to send an ILA redirect towards the ILA forwarding node of a source to inform it of a direct ILA route. When the forwarding node receives the redirect it can populate its cache so that subsequent packets take the direct path. This is the RECOMMENDED method.
- Cache address resolution-- This used to perform request/reply address resolution on a route. As noted on netdev list, a request/reply mechanism is susceptible to DOS attacks. For this reason, this method is not NOT RECOMMENDED as the primary means to populate an ILA cache.
ILAMP is described in
https://www.ietf.org/internet-drafts/draft-herbert-ila-ilamp-00.txt
Tested:
Ran ILA traffic, set up ILA notify routes and observed correct routing message via ip monitor.
v5:
- Fix some compiler and sparse warnings
- Generalize route notify with RTM_NOTIFYROUTE,
RTNLGRP_ROUTE_NOTIFY (suggested by Roopa)
v4:
- Remove front end cache per davem feedback
- Eliminate separate LWT type just use ILA LWT already in place
v3:
- Removed rhashtable changes to their own patch set
- Restructure ILA code to be more amenable to changes
- Remove extra call back functions in resolution interface
Changes from initial RFC:
- Added net argument to LWT build_state
- Made resolve timeout an attribute of the LWT encap route
- Changed ILA notifications to be regular routing messages of event RTM_ADDR_RESOLVE, family RTNL_FAMILY_ILA, and group RTNLGRP_ILA_NOTIFY
Tom Herbert (7):
lwt: Add net to build_state argument
rtnetlink: Add notify route message types
ila: Fix use of rhashtable walk in ila_xlat.c
ila: Call library function alloc_bucket_locks
ila: Create main ila source file
ila: Flush netlink command to clear xlat table
ila: Route notify
include/net/lwtunnel.h | 6 +- include/uapi/linux/ila.h | 3 + include/uapi/linux/rtnetlink.h | 6 + net/core/lwt_bpf.c | 2 +- net/core/lwtunnel.c | 4 +- net/ipv4/fib_semantics.c | 13 +- net/ipv4/ip_tunnel_core.c | 4 +- net/ipv6/ila/Makefile | 2 +- net/ipv6/ila/ila.h | 27 +++- net/ipv6/ila/ila_common.c | 30 ----- net/ipv6/ila/ila_lwt.c | 275 ++++++++++++++++++++++++++------------ net/ipv6/ila/ila_main.c | 121 +++++++++++++++++ net/ipv6/ila/ila_xlat.c | 290 ++++++++++++++++++++--------------------- net/ipv6/route.c | 2 +- net/ipv6/seg6_iptunnel.c | 2 +- net/ipv6/seg6_local.c | 5 +- net/mpls/mpls_iptunnel.c | 2 +- 17 files changed, 511 insertions(+), 283 deletions(-) create mode 100644 net/ipv6/ila/ila_main.c
Signature · 1 line
2.11.0
PATCH v5 1/7 lwt: Add net to build_state argument
Users of LWT need to know net if they want to have per net operations in LWT.
--- include/net/lwtunnel.h | 6 +++--- net/core/lwt_bpf.c | 2 +- net/core/lwtunnel.c | 4 ++-- net/ipv4/fib_semantics.c | 13 ++++++++----- net/ipv4/ip_tunnel_core.c | 4 ++-- net/ipv6/ila/ila_lwt.c | 2 +- net/ipv6/route.c | 2 +- net/ipv6/seg6_iptunnel.c | 2 +- net/ipv6/seg6_local.c | 5 +++-- net/mpls/mpls_iptunnel.c | 2 +- 10 files changed, 23 insertions(+), 19 deletions(-)
include/net/lwtunnel.h +3 -3
@@ -34,7 +34,7 @@ struct lwtunnel_state { };struct lwtunnel_encap_ops { -int (*build_state)(struct nlattr *encap, +int (*build_state)(struct net *net,struct nlattr *encap,unsigned int family,const void *cfg,struct lwtunnel_state **ts,struct netlink_ext_ack *extack);
@@ -113,7 +113,7 @@ int lwtunnel_valid_encap_type(u16 encap_type, struct netlink_ext_ack *extack);int lwtunnel_valid_encap_type_attr (struct nlattr *attr,int len,struct netlink_ext_ack *extack); -int lwtunnel_build_state(u16 encap_type, +int lwtunnel_build_state(struct net *net, u16 encap_type, struct nlattr *encap, unsigned int family, const void *cfg, struct lwtunnel_state **lws,
@@ -192,7 +192,7 @@ static inline int lwtunnel_valid_encap_type_attr(struct nlattr *attr, int len,return 0 ; } -static inline int lwtunnel_build_state(u16 encap_type, +static inline int lwtunnel_build_state(struct net *net, u16 encap_type, struct nlattr *encap, unsigned int family, const void *cfg, struct lwtunnel_state **lws,
net/core/lwt_bpf.c +1 -1
@@ -238,7 +238,7 @@ static const struct nla_policy bpf_nl_policy[LWT_BPF_MAX + 1] = { [LWT_BPF_XMIT_HEADROOM] = { .type = NLA_U32 }, }; -static int bpf_build_state (struct nlattr *nla, +static int bpf_build_state (struct net *net,struct nlattr *nla,unsigned int family,const void *cfg,struct lwtunnel_state **ts,struct netlink_ext_ack *extack)
net/core/lwtunnel.c +2 -2
@@ -103,7 +103,7 @@ int lwtunnel_encap_del_ops(const struct lwtunnel_encap_ops *ops, }EXPORT_SYMBOL_GPL (lwtunnel_encap_del_ops); -int lwtunnel_build_state (u16 encap_type, +int lwtunnel_build_state (struct net *net,u16 encap_type,struct nlattr *encap,unsigned int family,const void *cfg,struct lwtunnel_state **lws,struct netlink_ext_ack *extack)
@@ -124,7 +124,7 @@ int lwtunnel_build_state(u16 encap_type, ops =rcu_dereference (lwtun_encaps[encap_type]);if (likely (ops && ops->build_state &&try_module_get (ops->owner))) { found = true; - ret = ops->build_state (encap, family, cfg, lws, extack); + ret = ops->build_state (net, encap, family, cfg, lws, extack);if (ret)module_put (ops->owner); }
net/ipv4/fib_semantics.c +8 -5
@@ -523,6 +523,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,if (nla) {struct lwtunnel_state *lwtstate;struct nlattr *nla_entype; +struct net *net = cfg->fc_nlinfo.nl_net; nla_entype =nla_find (attrs, attrlen,RTA_ENCAP_TYPE );
@@ -533,7 +534,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh, goto err_inval; } - ret =lwtunnel_build_state (nla_get_u16 ( + ret =lwtunnel_build_state (net,nla_get_u16 ( nla_entype), nla,AF_INET , cfg, &lwtstate, extack);
@@ -607,7 +608,7 @@ static void fib_rebalance(struct fib_info *fi)#endif /* CONFIG_IP_ROUTE_MULTIPATH */ -static int fib_encap_match(u16 encap_type, +static int fib_encap_match(struct net *net, u16 encap_type, struct nlattr *encap, const struct fib_nh *nh, const struct fib_config *cfg,
@@ -619,7 +620,7 @@ static int fib_encap_match(u16 encap_type,if (encap_type ==LWTUNNEL_ENCAP_NONE )return 0 ; - ret =lwtunnel_build_state (encap_type, encap,AF_INET , + ret =lwtunnel_build_state (net, encap_type, encap,AF_INET , cfg, &lwtstate, extack);if (!ret) { result =lwtunnel_cmp_encap (lwtstate, nh->nh_lwtstate);
@@ -632,6 +633,7 @@ static int fib_encap_match(u16 encap_type,int fib_nh_match (struct fib_config *cfg,struct fib_info *fi,struct netlink_ext_ack *extack) { +struct net *net = cfg->fc_nlinfo.nl_net;#ifdef CONFIG_IP_ROUTE_MULTIPATH struct rtnexthop *rtnh;int remaining;
@@ -642,7 +644,8 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi,if (cfg->fc_oif || cfg->fc_gw) {if (cfg->fc_encap) { -if (fib_encap_match (cfg->fc_encap_type, cfg->fc_encap, +if (fib_encap_match (net, cfg->fc_encap_type, + cfg->fc_encap, fi->fib_nh, cfg, extack))return 1 ; }
@@ -1180,7 +1183,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg, "LWT encap type not specified"); goto err_inval; } - err =lwtunnel_build_state (cfg->fc_encap_type, + err =lwtunnel_build_state (net, cfg->fc_encap_type, cfg->fc_encap,AF_INET , cfg, &lwtstate, extack);if (err)
net/ipv4/ip_tunnel_core.c +2 -2
@@ -228,7 +228,7 @@ static const struct nla_policy ip_tun_policy[LWTUNNEL_IP_MAX + 1] = { [LWTUNNEL_IP_FLAGS] = { .type = NLA_U16 }, }; -static int ip_tun_build_state (struct nlattr *attr, +static int ip_tun_build_state (struct net *net,struct nlattr *attr,unsigned int family,const void *cfg,struct lwtunnel_state **ts,struct netlink_ext_ack *extack)
@@ -327,7 +327,7 @@ static const struct nla_policy ip6_tun_policy[LWTUNNEL_IP6_MAX + 1] = { [LWTUNNEL_IP6_FLAGS] = { .type = NLA_U16 }, }; -static int ip6_tun_build_state (struct nlattr *attr, +static int ip6_tun_build_state (struct net *net,struct nlattr *attr,unsigned int family,const void *cfg,struct lwtunnel_state **ts,struct netlink_ext_ack *extack)
net/ipv6/ila/ila_lwt.c +1 -1
@@ -125,7 +125,7 @@ static const struct nla_policy ila_nl_policy[ILA_ATTR_MAX + 1] = { [ILA_ATTR_HOOK_TYPE] = { .type = NLA_U8, }, }; -static int ila_build_state (struct nlattr *nla, +static int ila_build_state (struct net *net,struct nlattr *nla,unsigned int family,const void *cfg,struct lwtunnel_state **ts,struct netlink_ext_ack *extack)
net/ipv6/route.c +1 -1
@@ -2565,7 +2565,7 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg,if (cfg->fc_encap) {struct lwtunnel_state *lwtstate; - err =lwtunnel_build_state (cfg->fc_encap_type, + err =lwtunnel_build_state (net, cfg->fc_encap_type, cfg->fc_encap,AF_INET6 , cfg, &lwtstate, extack);if (err)
net/ipv6/seg6_iptunnel.c +1 -1
@@ -359,7 +359,7 @@ static int seg6_output(struct net *net, struct sock *sk, struct sk_buff *skb)return err; } -static int seg6_build_state (struct nlattr *nla, +static int seg6_build_state (struct net *net,struct nlattr *nla,unsigned int family,const void *cfg,struct lwtunnel_state **ts,struct netlink_ext_ack *extack)
net/ipv6/seg6_local.c +3 -2
@@ -779,8 +779,9 @@ static int parse_nla_action(struct nlattr **attrs, struct seg6_local_lwt *slwt)return 0 ; } -static int seg6_local_build_state (struct nlattr *nla,unsigned int family, -const void *cfg,struct lwtunnel_state **ts, +static int seg6_local_build_state (struct net *net,struct nlattr *nla, +unsigned int family,const void *cfg, +struct lwtunnel_state **ts,struct netlink_ext_ack *extack) {struct nlattr *tb[SEG6_LOCAL_MAX +1 ];
net/mpls/mpls_iptunnel.c +1 -1
@@ -157,7 +157,7 @@ static int mpls_xmit(struct sk_buff *skb)return -EINVAL ; } -static int mpls_build_state (struct nlattr *nla, +static int mpls_build_state (struct net *net,struct nlattr *nla,unsigned int family,const void *cfg,struct lwtunnel_state **ts,struct netlink_ext_ack *extack)
Signature · 1 line
2.11.0
PATCH v5 2/7 rtnetlink: Add notify route message types
In reply to Tom HerbertAdd notify route message and notify rtnl group. This is used to send a notification about a route. For example, this will be used with ILA to notify a daemon to send an ILA redirect.
--- include/uapi/linux/rtnetlink.h | 5 +++++ 1 file changed, 5 insertions(+)
include/uapi/linux/rtnetlink.h +5 -0
@@ -150,6 +150,9 @@ enum { RTM_NEWCACHEREPORT = 96,#define RTM_NEWCACHEREPORT RTM_NEWCACHEREPORT + RTM_NOTIFYROUTE = 98, +#define RTM_NOTIFYROUTE RTM_NOTIFYROUTE + __RTM_MAX,#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) };
@@ -677,6 +680,8 @@ enum rtnetlink_groups {#define RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV4_MROUTE_R RTNLGRP_IPV6_MROUTE_R,#define RTNLGRP_IPV6_MROUTE_R RTNLGRP_IPV6_MROUTE_R + RTNLGRP_ROUTE_NOTIFY, +#define RTNLGRP_ROUTE_NOTIFY RTNLGRP_ROUTE_NOTIFY __RTNLGRP_MAX };#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
Signature · 1 line
2.11.0
PATCH v5 3/7 ila: Fix use of rhashtable walk in ila_xlat.c
In reply to Tom HerbertPerform better EAGAIN handling, handle case where ila_dump_info fails and we missed objects in the dump, and add a skip index to skip over ila entires in a list on a rhashtable node that have already been visited (by a previous call to ila_nl_dump).
--- net/ipv6/ila/ila_xlat.c | 70 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 16 deletions(-)
net/ipv6/ila/ila_xlat.c +54 -16
@@ -474,24 +474,31 @@ static int ila_nl_cmd_get_mapping(struct sk_buff *skb, struct genl_info *info)struct ila_dump_iter {struct rhashtable_iter rhiter; +int skip; };static int ila_nl_dump_start (struct netlink_callback *cb) {struct net *net =sock_net (cb->skb->sk);struct ila_net *ilan =net_generic (net, ila_net_id); -struct ila_dump_iter *iter = (struct ila_dump_iter *)cb->args[0 ]; +struct ila_dump_iter *iter; +int ret; -if (!iter) { - iter =kmalloc (sizeof (*iter),GFP_KERNEL ); -if (!iter) -return -ENOMEM ; + iter =kmalloc (sizeof (*iter),GFP_KERNEL ); +if (!iter) +return -ENOMEM ; - cb->args[0 ] = (long )iter; + ret =rhashtable_walk_init (&ilan->rhash_table, &iter->rhiter, +GFP_KERNEL ); +if (ret) { +kfree (iter); +return ret; } -return rhashtable_walk_init (&ilan->rhash_table, &iter->rhiter, -GFP_KERNEL ); + iter->skip =0 ; + cb->args[0 ] = (long )iter; + +return ret; }static int ila_nl_dump_done (struct netlink_callback *cb)
@@ -509,20 +516,45 @@ static int ila_nl_dump(struct sk_buff *skb, struct netlink_callback *cb) {struct ila_dump_iter *iter = (struct ila_dump_iter *)cb->args[0 ];struct rhashtable_iter *rhiter = &iter->rhiter; +int skip = iter->skip;struct ila_map *ila;int ret;rhashtable_walk_start (rhiter); -for (;;) { - ila =rhashtable_walk_next (rhiter); +/* Get first entry */ + ila =rhashtable_walk_peek (rhiter); + +if (ila && !IS_ERR (ila) && skip) { +/* Skip over visited entries */ + +while (ila && skip) { +/* Skip over any ila entries in this list that we +* have already dumped. +*/ + ila =rcu_access_pointer (ila->next); + skip--; + } + } + skip =0 ; + +for (;;) {if (IS_ERR (ila)) { -if (PTR_ERR (ila) == -EAGAIN ) -continue ; ret =PTR_ERR (ila); - goto done; +if (ret == -EAGAIN ) { +/* Table has changed and iter has reset. Return +* -EAGAIN to the application even if we have +* written data to the skb. The application +* needs to deal with this. +*/ + + goto out_ret; + }else { +break ; + } }else if (!ila) { + ret =0 ;break ; }
@@ -531,15 +563,21 @@ static int ila_nl_dump(struct sk_buff *skb, struct netlink_callback *cb) cb->nlh->nlmsg_seq,NLM_F_MULTI , skb, ILA_CMD_GET);if (ret) - goto done; + goto out; + skip++; ila =rcu_access_pointer (ila->next); } + + skip =0 ; + ila =rhashtable_walk_next (rhiter); } - ret = skb->len; +out: + iter->skip = skip; + ret = (skb->len ? : ret); -done: +out_ret:rhashtable_walk_stop (rhiter);return ret; }
Signature · 1 line
2.11.0
PATCH v5 4/7 ila: Call library function alloc_bucket_locks
In reply to Tom HerbertTo allocate the array of bucket locks for the hash table we now call library function alloc_bucket_spinlocks.
--- net/ipv6/ila/ila_xlat.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)
net/ipv6/ila/ila_xlat.c +5 -17
@@ -31,26 +31,14 @@ struct ila_net {bool hooks_registered; }; +#define MAX_LOCKS 1024#define LOCKS_PER_CPU 10static int alloc_ila_locks (struct ila_net *ilan) { -unsigned int i, size; -unsigned int nr_pcpus =num_possible_cpus (); - - nr_pcpus = min_t(unsigned int, nr_pcpus, 32UL); - size =roundup_pow_of_two (nr_pcpus *LOCKS_PER_CPU ); - -if (sizeof (spinlock_t) !=0 ) { - ilan->locks =kvmalloc (size *sizeof (spinlock_t),GFP_KERNEL ); -if (!ilan->locks) -return -ENOMEM ; -for (i =0 ; i < size; i++) -spin_lock_init (&ilan->locks[i]); - } - ilan->locks_mask = size -1 ; - -return 0 ; +return alloc_bucket_spinlocks (&ilan->locks, &ilan->locks_mask, +MAX_LOCKS ,LOCKS_PER_CPU , +GFP_KERNEL ); }static u32 hashrnd__read_mostly ;
@@ -639,7 +627,7 @@ static __net_exit void ila_exit_net(struct net *net)rhashtable_free_and_destroy (&ilan->rhash_table, ila_free_cb,NULL ); -kvfree (ilan->locks); +free_bucket_spinlocks (ilan->locks);if (ilan->hooks_registered) nf_unregister_net_hooks(net, ila_nf_hook_ops,
Signature · 1 line
2.11.0
PATCH v5 5/7 ila: Create main ila source file
In reply to Tom HerbertCreate a main ila file that contains the module initialization functions as well as netlink definitions. Previously these were defined in ila_xlat and ila_common. This approach allows better extensibility.
--- net/ipv6/ila/Makefile | 2 +- net/ipv6/ila/ila.h | 26 ++++++++- net/ipv6/ila/ila_common.c | 30 ---------- net/ipv6/ila/ila_main.c | 115 +++++++++++++++++++++++++++++++++++++ net/ipv6/ila/ila_xlat.c | 142 +++++++++------------------------------------- 5 files changed, 168 insertions(+), 147 deletions(-) create mode 100644 net/ipv6/ila/ila_main.c
net/ipv6/ila/Makefile +1 -1
@@ -4,4 +4,4 @@ obj-$(CONFIG_IPV6_ILA) += ila.o -ila-objs := ila_common.o ila_lwt.o ila_xlat.o +ila-objs := ila_main.o ila_common.o ila_lwt.o ila_xlat.o
net/ipv6/ila/ila.h +24 -2
@@ -19,6 +19,7 @@#include <linux/skbuff.h> #include <linux/types.h> #include <net/checksum.h> +#include <net/genetlink.h> #include <net/ip.h> #include <net/protocol.h> #include <uapi/linux/ila.h>
@@ -104,9 +105,30 @@ void ila_update_ipv6_locator(struct sk_buff *skb, struct ila_params *p,void ila_init_saved_csum (struct ila_params *p); +struct ila_net { +struct { +struct rhashtable rhash_table; +spinlock_t *locks;/* Bucket locks for entry manipulation */ +unsigned int locks_mask; +bool hooks_registered; + } xlat; +}; +int ila_lwt_init (void );void ila_lwt_fini (void ); -int ila_xlat_init (void ); -void ila_xlat_fini (void ); + +int ila_xlat_init_net (struct net *net); +void ila_xlat_exit_net (struct net *net); + +int ila_xlat_nl_cmd_add_mapping (struct sk_buff *skb,struct genl_info *info); +int ila_xlat_nl_cmd_del_mapping (struct sk_buff *skb,struct genl_info *info); +int ila_xlat_nl_cmd_get_mapping (struct sk_buff *skb,struct genl_info *info); +int ila_xlat_nl_dump_start (struct netlink_callback *cb); +int ila_xlat_nl_dump_done (struct netlink_callback *cb); +int ila_xlat_nl_dump (struct sk_buff *skb,struct netlink_callback *cb); + +extern unsigned int ila_net_id; + +extern struct genl_family ila_nl_family;#endif /* __ILA_H */
net/ipv6/ila/ila_common.c +0 -30
@@ -154,33 +154,3 @@ void ila_update_ipv6_locator(struct sk_buff *skb, struct ila_params *p, iaddr->loc = p->locator; } -static int __init ila_init (void ) -{ -int ret; - - ret =ila_lwt_init (); - -if (ret) - goto fail_lwt; - - ret =ila_xlat_init (); -if (ret) - goto fail_xlat; - -return 0 ; -fail_xlat: -ila_lwt_fini (); -fail_lwt: -return ret; -} - -static void __exit ila_fini(void) -{ -ila_xlat_fini (); -ila_lwt_fini (); -} - -module_init (ila_init); -module_exit (ila_fini); -MODULE_AUTHOR ("Tom Herbert <[email protected]>" ); -MODULE_LICENSE ("GPL" );
net/ipv6/ila/ila_main.c new file +115 -0
115 lines not on this page · raw message
net/ipv6/ila/ila_xlat.c +28 -114
295 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v5 6/7 ila: Flush netlink command to clear xlat table
In reply to Tom HerbertAdd ILA_CMD_FLUSH netlink command to clear the ILA translation table.
--- include/uapi/linux/ila.h | 1 + net/ipv6/ila/ila.h | 1 + net/ipv6/ila/ila_main.c | 6 +++++ net/ipv6/ila/ila_xlat.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 68 insertions(+), 2 deletions(-)
include/uapi/linux/ila.h +1 -0
@@ -30,6 +30,7 @@ enum {ILA_CMD_ADD ,ILA_CMD_DEL ,ILA_CMD_GET , +ILA_CMD_FLUSH , __ILA_CMD_MAX, };
net/ipv6/ila/ila.h +1 -0
@@ -123,6 +123,7 @@ void ila_xlat_exit_net(struct net *net);int ila_xlat_nl_cmd_add_mapping (struct sk_buff *skb,struct genl_info *info);int ila_xlat_nl_cmd_del_mapping (struct sk_buff *skb,struct genl_info *info);int ila_xlat_nl_cmd_get_mapping (struct sk_buff *skb,struct genl_info *info); +int ila_xlat_nl_cmd_flush (struct sk_buff *skb,struct genl_info *info);int ila_xlat_nl_dump_start (struct netlink_callback *cb);int ila_xlat_nl_dump_done (struct netlink_callback *cb);int ila_xlat_nl_dump (struct sk_buff *skb,struct netlink_callback *cb);
net/ipv6/ila/ila_main.c +6 -0
@@ -27,6 +27,12 @@ static const struct genl_ops ila_nl_ops[] = { .flags = GENL_ADMIN_PERM, }, { + .cmd = ILA_CMD_FLUSH, + .doit = ila_xlat_nl_cmd_flush, + .policy = ila_nl_policy, + .flags = GENL_ADMIN_PERM, + }, + { .cmd = ILA_CMD_GET, .doit = ila_xlat_nl_cmd_get_mapping, .start = ila_xlat_nl_dump_start,
net/ipv6/ila/ila_xlat.c +60 -2
81 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v5 7/7 ila: Route notify
In reply to Tom HerbertImplement RTM notifications for ILA routers. This adds support to ILA LWT to send a netlink RTM message when a router is uses.
The ILA notify mechanism can be used in two contexts:
- On an ILA forwarding cache a route prefix can be configured to do an ILA notification. This method is used when address resolution needs to be done on an address.
- One an ILA router an ILA host route entry may include a noitification. The purpose of this is to get a notification to a userspace daemon to send and ILA redirect
This patch also adds a routing protocol number for ILA.
--- include/uapi/linux/ila.h | 2 + include/uapi/linux/rtnetlink.h | 1 + net/ipv6/ila/ila_lwt.c | 273 ++++++++++++++++++++++++++++------------- 3 files changed, 191 insertions(+), 85 deletions(-)
include/uapi/linux/ila.h +2 -0
@@ -19,6 +19,8 @@ enum {ILA_ATTR_CSUM_MODE ,/* u8 */ ILA_ATTR_IDENT_TYPE ,/* u8 */ ILA_ATTR_HOOK_TYPE ,/* u8 */ +ILA_ATTR_NOTIFY_DST ,/* flag */ +ILA_ATTR_NOTIFY_SRC ,/* flag */ __ILA_ATTR_MAX, };
include/uapi/linux/rtnetlink.h +1 -0
@@ -256,6 +256,7 @@ enum {#define RTPROT_NTK 15/* Netsukuku */ #define RTPROT_DHCP 16/* DHCP client */ #define RTPROT_MROUTED 17/* Multicast daemon */ +#define RTPROT_ILA 18/* ILA route */ #define RTPROT_BABEL 42/* Babel daemon */ /* rtm_scope
net/ipv6/ila/ila_lwt.c +188 -85
386 lines not on this page · raw message
Signature · 1 line
2.11.0
David Miller
maintainerFrom: Tom Herbert <[email protected]>
Date: Thu, 21 Dec 2017 11:33:25 -0800
Quoted 5 lines
This patch set adds support to get netlink notifications for ILA routes when a route is used.
This patch set contains:
Quoted 8 lines
- General infrastructure for route notifications
- The ILA route notification mechanism
- Add net to ilabuild_state
- Add flush command toila_xlat
- Fix use of rhashtable for latest fixesRoute notifications will be used in conjunction with populating ILA forwarding caches.
Tom, this is just a wolf in sheep's clothing.
It's still a cache controllable by external entities.
It still therefore has the DoS'ability aspects.
You can keep reframing this thing you want out there, either by explicitly filling the cache in the kernel or doing it via userspace responding the netlink events, but it's still the same exact thing with the same set of problems.
I'm sorry, but I can't apply this series. Nor any series that adds a DoS'able facility of forwarding/switching/route objects to the kernel.
Thanks.
Quoted 14 lines · David Miller
From: Tom Herbert <[email protected]>
Date: Thu, 21 Dec 2017 11:33:25 -0800Quoted 11 lines
This patch set adds support to get netlink notifications for ILA routes when a route is used.
This patch set contains:
- General infrastructure for route notifications
- The ILA route notification mechanism
- Add net to ilabuild_state
- Add flush command toila_xlat
- Fix use of rhashtable for latest fixes
Quoted 5 lines
Quoted 2 lines
Route notifications will be used in conjunction with populating ILA forwarding caches.
Tom, this is just a wolf in sheep's clothing.
Dave,
Quoted 2 lines
It's still a cache controllable by external entities.
Yep, that's the nature of the problem. In networks of even modest scale we anticipate that we'll see the number of virtual addresses (identifiers) far exceed the number of physical hosts. The mapping of virtual to physical address is not aggregable, so at full we expect 10s of billions of these discrete mappings in a single network. No single device will be able hold all these mappings, so they'll be sharded amongst some number of routers. This works fine for connectivity except that it would be nice to eliminate the triangular routing by having the source perform encapsulation for destination itself. So this is the motivation for a working set cache. It is an optimization, but in networks like 3GPP, it's a big win to eliminate anchor points in mobility.
Quoted 2 lines
It still therefore has the DoS'ability aspects.
True, if implemented without consideration of DOS this is a very bad thing as proven already by others. However if we know this going in then DOS'ability can be mitigated or eliminated depending on the rest of the implementation and architecture, similar to how SYN attacks can be dealt with.
For example, suppose a device has 10G input link, we want a cache entry to be usable for at least 30 seconds, and we have no control over the users on the other side of the link (a typical eNodeB scenario). That gives a worse case of 19M pps, 585M packets over 30 seconds. Assuming 64 bytes per cache entry that gets us to 37G of memory needed in the host. That amount of memory is reasonable for a networking device. Cost of memory should drop over next few years so 10X scaling within ten years seems feasible.
Quoted 5 lines
You can keep reframing this thing you want out there, either by explicitly filling the cache in the kernel or doing it via userspace responding the netlink events, but it's still the same exact thing with the same set of problems.
I would point out that the attack surface area using a redirect mechanism is _way_ less than request/response that was used by LISP or OVS.
Quoted 4 lines
I'm sorry, but I can't apply this series. Nor any series that adds a DoS'able facility of forwarding/switching/route objects to the kernel.
Technically, this patch set was just adding route notificates that facilitate but aren't a requirement for cache management. However, I do sympathsize with your concerns. Scaling and DOS are precisely the big problem to overcome in network virtualization and identifier/locator split.
Happy Holidays!
Tom