net: Modify all rtnetlink methods to only work in the initial namespace
Subsystems (8)
PATCH 1/5 net: Modify all rtnetlink methods to only work in the initial namespace
Before I can enable rtnetlink to work in all network namespaces I need to be certain that something won't break. So this patch deliberately disables all of the rtnletlink methods in everything except the initial network namespace. After the methods have been audited this extra check can be disabled.
--- net/bridge/br_netlink.c | 9 +++++++++ net/core/fib_rules.c | 11 +++++++++++ net/core/neighbour.c | 18 ++++++++++++++++++ net/core/rtnetlink.c | 19 +++++++++++++++++++ net/decnet/dn_dev.c | 12 ++++++++++++ net/decnet/dn_fib.c | 8 ++++++++ net/decnet/dn_route.c | 8 ++++++++ net/decnet/dn_table.c | 4 ++++ net/ipv4/devinet.c | 12 ++++++++++++ net/ipv4/fib_frontend.c | 12 ++++++++++++ net/ipv4/route.c | 4 ++++ net/ipv6/addrconf.c | 31 +++++++++++++++++++++++++++++++ net/ipv6/ip6_fib.c | 4 ++++ net/ipv6/route.c | 12 ++++++++++++ net/sched/act_api.c | 10 ++++++++++ net/sched/cls_api.c | 10 ++++++++++ net/sched/sch_api.c | 21 +++++++++++++++++++++ 17 files changed, 205 insertions(+), 0 deletions(-)
net/bridge/br_netlink.c +9 -0
@@ -13,6 +13,7 @@#include <linux/kernel.h> #include <net/rtnetlink.h> #include <net/net_namespace.h> +#include <net/sock.h> #include "br_private.h" static inline size_t br_nlmsg_size (void )
@@ -107,9 +108,13 @@ errout:*/ static int br_dump_ifinfo (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;struct net_device *dev;int idx; +if (net != &init_net) +return 0 ; + idx =0 ;for_each_netdev (&init_net, dev) {/* not a bridge port */
@@ -135,12 +140,16 @@ skip:*/ static int br_rtm_setlink (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct ifinfomsg *ifm;struct nlattr *protinfo;struct net_device *dev;struct net_bridge_port *p;u8 new_state; +if (net != &init_net) +return -EINVAL ; +if (nlmsg_len (nlh) <sizeof (*ifm))return -EINVAL ;
net/core/fib_rules.c +11 -0
@@ -206,6 +206,9 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)struct nlattr *tb[FRA_MAX +1 ];int err = -EINVAL , unresolved =0 ; +if (net != &init_net) +return -EINVAL ; +if (nlh->nlmsg_len <nlmsg_msg_size (sizeof (*frh))) goto errout;
@@ -336,12 +339,16 @@ errout:static int fib_nl_delrule (struct sk_buff *skb,struct nlmsghdr * nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct fib_rule_hdr *frh =nlmsg_data (nlh);struct fib_rules_ops *ops =NULL ;struct fib_rule *rule, *tmp;struct nlattr *tb[FRA_MAX +1 ];int err = -EINVAL ; +if (net != &init_net) +return -EINVAL ; +if (nlh->nlmsg_len <nlmsg_msg_size (sizeof (*frh))) goto errout;
@@ -517,9 +524,13 @@ skip:static int fib_nl_dumprule (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;struct fib_rules_ops *ops;int idx =0 , family; +if (net != &init_net) +return -EINVAL ; + family =rtnl_msg_family (cb->nlh);if (family !=AF_UNSPEC ) {/* Protocol specific dump request */
net/core/neighbour.c +18 -0
@@ -1448,6 +1448,9 @@ static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)struct net_device *dev =NULL ;int err = -EINVAL ; +if (net != &init_net) +return -EINVAL ; +if (nlmsg_len (nlh) <sizeof (*ndm)) goto out;
@@ -1514,6 +1517,9 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)struct net_device *dev =NULL ;int err; +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*ndm), tb,NDA_MAX ,NULL );if (err <0 ) goto out;
@@ -1788,11 +1794,15 @@ static const struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] = {static int neightbl_set (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct neigh_table *tbl;struct ndtmsg *ndtmsg;struct nlattr *tb[NDTA_MAX +1 ];int err; +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*ndtmsg), tb,NDTA_MAX , nl_neightbl_policy);if (err <0 )
@@ -1912,11 +1922,15 @@ errout:static int neightbl_dump_info (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;int family, tidx, nidx =0 ;int tbl_skip = cb->args[0 ];int neigh_skip = cb->args[1 ];struct neigh_table *tbl; +if (net != &init_net) +return 0 ; + family = ((struct rtgenmsg *)nlmsg_data (cb->nlh))->rtgen_family;read_lock (&neigh_tbl_lock);
@@ -2041,9 +2055,13 @@ out:static int neigh_dump_info (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;struct neigh_table *tbl;int t, family, s_t; +if (net != &init_net) +return 0 ; +read_lock (&neigh_tbl_lock); family = ((struct rtgenmsg *)nlmsg_data (cb->nlh))->rtgen_family; s_t = cb->args[0 ];
net/core/rtnetlink.c +19 -0
@@ -707,6 +707,9 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)int s_idx = cb->args[0 ];struct net_device *dev; +if (net != &init_net) +return 0 ; + idx =0 ;for_each_netdev (net, dev) {if (idx < s_idx)
@@ -909,6 +912,9 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)struct nlattr *tb[IFLA_MAX +1 ];char ifname[IFNAMSIZ ]; +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFLA_MAX , ifla_policy);if (err <0 ) goto errout;
@@ -957,6 +963,9 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)struct nlattr *tb[IFLA_MAX +1 ];int err; +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFLA_MAX , ifla_policy);if (err <0 )return err;
@@ -1038,6 +1047,9 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)struct nlattr *linkinfo[IFLA_INFO_MAX +1 ];int err; +if (net != &init_net) +return -EINVAL ; +#ifdef CONFIG_KMOD replay:#endif
@@ -1164,6 +1176,9 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)struct sk_buff *nskb;int err; +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFLA_MAX , ifla_policy);if (err <0 )return err;
@@ -1199,9 +1214,13 @@ errout:static int rtnl_dump_all (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;int idx;int s_idx = cb->family; +if (net != &init_net) +return 0 ; +if (s_idx ==0 ) s_idx =1 ;for (idx=1 ; idx<NPROTO ; idx++) {
net/decnet/dn_dev.c +12 -0
@@ -647,12 +647,16 @@ static const struct nla_policy dn_ifa_policy[IFA_MAX+1] = {static int dn_nl_deladdr (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct nlattr *tb[IFA_MAX +1 ];struct dn_dev *dn_db;struct ifaddrmsg *ifm;struct dn_ifaddr *ifa, **ifap;int err = -EADDRNOTAVAIL ; +if (net != &init_net) + goto errout; + err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFA_MAX , dn_ifa_policy);if (err <0 ) goto errout;
@@ -679,6 +683,7 @@ errout:static int dn_nl_newaddr (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct nlattr *tb[IFA_MAX +1 ];struct net_device *dev;struct dn_dev *dn_db;
@@ -686,6 +691,9 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)struct dn_ifaddr *ifa;int err; +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFA_MAX , dn_ifa_policy);if (err <0 )return err;
@@ -791,11 +799,15 @@ errout:static int dn_nl_dump_ifaddr (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;int idx, dn_idx =0 , skip_ndevs, skip_naddr;struct net_device *dev;struct dn_dev *dn_db;struct dn_ifaddr *ifa; +if (net != &init_net) +return 0 ; + skip_ndevs = cb->args[0 ]; skip_naddr = cb->args[1 ];
net/decnet/dn_fib.c +8 -0
@@ -506,10 +506,14 @@ static int dn_fib_check_attr(struct rtmsg *r, struct rtattr **rta)static int dn_fib_rtm_delroute (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct dn_fib_table *tb;struct rtattr **rta = arg;struct rtmsg *r =NLMSG_DATA (nlh); +if (net != &init_net) +return -EINVAL ; +if (dn_fib_check_attr (r, rta))return -EINVAL ;
@@ -522,10 +526,14 @@ static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *static int dn_fib_rtm_newroute (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct dn_fib_table *tb;struct rtattr **rta = arg;struct rtmsg *r =NLMSG_DATA (nlh); +if (net != &init_net) +return -EINVAL ; +if (dn_fib_check_attr (r, rta))return -EINVAL ;
net/decnet/dn_route.c +8 -0
@@ -1530,6 +1530,7 @@ rtattr_failure:*/ static int dn_cache_getroute (struct sk_buff *in_skb,struct nlmsghdr *nlh,void *arg) { +struct net *net = in_skb->sk->sk_net;struct rtattr **rta = arg;struct rtmsg *rtm =NLMSG_DATA (nlh);struct dn_route *rt =NULL ;
@@ -1538,6 +1539,9 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, voidstruct sk_buff *skb;struct flowi fl; +if (net != &init_net) +return -EINVAL ; +memset (&fl,0 ,sizeof (fl)); fl.proto =DNPROTO_NSP ;
@@ -1615,10 +1619,14 @@ out_free:*/ int dn_cache_dump (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;struct dn_route *rt;int h, s_h;int idx, s_idx; +if (net != &init_net) +return 0 ; +if (NLMSG_PAYLOAD (cb->nlh,0 ) <sizeof (struct rtmsg ))return -EINVAL ;if (!(((struct rtmsg *)NLMSG_DATA (cb->nlh))->rtm_flags&RTM_F_CLONED ))
net/decnet/dn_table.c +4 -0
@@ -463,12 +463,16 @@ static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb,int dn_fib_dump (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;unsigned int h, s_h;unsigned int e =0 , s_e;struct dn_fib_table *tb;struct hlist_node *node;int dumped =0 ; +if (net != &init_net) +return 0 ; +if (NLMSG_PAYLOAD (cb->nlh,0 ) >=sizeof (struct rtmsg ) && ((struct rtmsg *)NLMSG_DATA (cb->nlh))->rtm_flags&RTM_F_CLONED )return dn_cache_dump (skb, cb);
net/ipv4/devinet.c +12 -0
@@ -441,6 +441,7 @@ struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,static int inet_rtm_deladdr (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct nlattr *tb[IFA_MAX +1 ];struct in_device *in_dev;struct ifaddrmsg *ifm;
@@ -449,6 +450,9 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *argASSERT_RTNL (); +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFA_MAX , ifa_ipv4_policy);if (err <0 ) goto errout;
@@ -561,10 +565,14 @@ errout:static int inet_rtm_newaddr (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct in_ifaddr *ifa;ASSERT_RTNL (); +if (net != &init_net) +return -EINVAL ; + ifa =rtm_to_ifaddr (nlh);if (IS_ERR (ifa))return PTR_ERR (ifa);
@@ -1175,12 +1183,16 @@ nla_put_failure:static int inet_dump_ifaddr (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;int idx, ip_idx;struct net_device *dev;struct in_device *in_dev;struct in_ifaddr *ifa;int s_ip_idx, s_idx = cb->args[0 ]; +if (net != &init_net) +return 0 ; + s_ip_idx = ip_idx = cb->args[1 ]; idx =0 ;for_each_netdev (&init_net, dev) {
net/ipv4/fib_frontend.c +12 -0
@@ -527,10 +527,14 @@ errout:static int inet_rtm_delroute (struct sk_buff *skb,struct nlmsghdr * nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct fib_config cfg;struct fib_table *tb;int err; +if (net != &init_net) +return -EINVAL ; + err =rtm_to_fib_config (skb, nlh, &cfg);if (err <0 ) goto errout;
@@ -548,10 +552,14 @@ errout:static int inet_rtm_newroute (struct sk_buff *skb,struct nlmsghdr * nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct fib_config cfg;struct fib_table *tb;int err; +if (net != &init_net) +return -EINVAL ; + err =rtm_to_fib_config (skb, nlh, &cfg);if (err <0 ) goto errout;
@@ -569,12 +577,16 @@ errout:static int inet_dump_fib (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;unsigned int h, s_h;unsigned int e =0 , s_e;struct fib_table *tb;struct hlist_node *node;int dumped =0 ; +if (net != &init_net) +return 0 ; +if (nlmsg_len (cb->nlh) >=sizeof (struct rtmsg ) && ((struct rtmsg *)nlmsg_data (cb->nlh))->rtm_flags &RTM_F_CLONED )return ip_rt_dump (skb, cb);
net/ipv4/route.c +4 -0
@@ -2552,6 +2552,7 @@ nla_put_failure:static int inet_rtm_getroute (struct sk_buff *in_skb,struct nlmsghdr * nlh,void *arg) { +struct net *net = in_skb->sk->sk_net;struct rtmsg *rtm;struct nlattr *tb[RTA_MAX +1 ];struct rtable *rt =NULL ;
@@ -2561,6 +2562,9 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, voidint err;struct sk_buff *skb; +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*rtm), tb,RTA_MAX , rtm_ipv4_policy);if (err <0 ) goto errout;
net/ipv6/addrconf.c +31 -0
@@ -3003,11 +3003,15 @@ static const struct nla_policy ifa_ipv6_policy[IFA_MAX+1] = {static int inet6_rtm_deladdr (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct ifaddrmsg *ifm;struct nlattr *tb[IFA_MAX +1 ];struct in6_addr *pfx;int err; +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFA_MAX , ifa_ipv6_policy);if (err <0 )return err;
@@ -3060,6 +3064,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags,static int inet6_rtm_newaddr (struct sk_buff *skb,struct nlmsghdr *nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct ifaddrmsg *ifm;struct nlattr *tb[IFA_MAX +1 ];struct in6_addr *pfx;
@@ -3069,6 +3074,9 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)u8 ifa_flags;int err; +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFA_MAX , ifa_ipv6_policy);if (err <0 )return err;
@@ -3342,26 +3350,42 @@ done:static int inet6_dump_ifaddr (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;enum addr_type_t type =UNICAST_ADDR ; + +if (net != &init_net) +return 0 ; +return inet6_dump_addr (skb, cb, type); }static int inet6_dump_ifmcaddr (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;enum addr_type_t type =MULTICAST_ADDR ; + +if (net != &init_net) +return 0 ; +return inet6_dump_addr (skb, cb, type); }static int inet6_dump_ifacaddr (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;enum addr_type_t type =ANYCAST_ADDR ; + +if (net != &init_net) +return 0 ; +return inet6_dump_addr (skb, cb, type); }static int inet6_rtm_getaddr (struct sk_buff *in_skb,struct nlmsghdr * nlh,void *arg) { +struct net *net = in_skb->sk->sk_net;struct ifaddrmsg *ifm;struct nlattr *tb[IFA_MAX +1 ];struct in6_addr *addr =NULL ;
@@ -3370,6 +3394,9 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh,struct sk_buff *skb;int err; +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFA_MAX , ifa_ipv6_policy);if (err <0 ) goto errout;
@@ -3587,11 +3614,15 @@ nla_put_failure:static int inet6_dump_ifinfo (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;int idx, err;int s_idx = cb->args[0 ];struct net_device *dev;struct inet6_dev *idev; +if (net != &init_net) +return 0 ; +read_lock (&dev_base_lock); idx =0 ;for_each_netdev (&init_net, dev) {
net/ipv6/ip6_fib.c +4 -0
@@ -361,6 +361,7 @@ end:static int inet6_dump_fib (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;unsigned int h, s_h;unsigned int e =0 , s_e;struct rt6_rtnl_dump_arg arg;
@@ -369,6 +370,9 @@ static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)struct hlist_node *node;int res =0 ; +if (net != &init_net) +return 0 ; + s_h = cb->args[0 ]; s_e = cb->args[1 ];
net/ipv6/route.c +12 -0
@@ -2080,9 +2080,13 @@ errout:static int inet6_rtm_delroute (struct sk_buff *skb,struct nlmsghdr * nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct fib6_config cfg;int err; +if (net != &init_net) +return -EINVAL ; + err =rtm_to_fib6_config (skb, nlh, &cfg);if (err <0 )return err;
@@ -2092,9 +2096,13 @@ static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *astatic int inet6_rtm_newroute (struct sk_buff *skb,struct nlmsghdr * nlh,void *arg) { +struct net *net = skb->sk->sk_net;struct fib6_config cfg;int err; +if (net != &init_net) +return -EINVAL ; + err =rtm_to_fib6_config (skb, nlh, &cfg);if (err <0 )return err;
@@ -2229,6 +2237,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg)static int inet6_rtm_getroute (struct sk_buff *in_skb,struct nlmsghdr * nlh,void *arg) { +struct net *net = in_skb->sk->sk_net;struct nlattr *tb[RTA_MAX +1 ];struct rt6_info *rt;struct sk_buff *skb;
@@ -2236,6 +2245,9 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, voidstruct flowi fl;int err, iif =0 ; +if (net != &init_net) +return -EINVAL ; + err =nlmsg_parse (nlh,sizeof (*rtm), tb,RTA_MAX , rtm_ipv6_policy);if (err <0 ) goto errout;
net/sched/act_api.c +10 -0
@@ -18,6 +18,8 @@#include <linux/skbuff.h> #include <linux/init.h> #include <linux/kmod.h> +#include <net/net_namespace.h> +#include <net/sock.h> #include <net/sch_generic.h> #include <net/act_api.h> #include <net/netlink.h>
@@ -924,10 +926,14 @@ done:static int tc_ctl_action (struct sk_buff *skb,struct nlmsghdr *n,void *arg) { +struct net *net = skb->sk->sk_net;struct rtattr **tca = arg;u32 pid = skb ?NETLINK_CB (skb).pid :0 ;int ret =0 , ovr =0 ; +if (net != &init_net) +return -EINVAL ; +if (tca[TCA_ACT_TAB -1 ] ==NULL ) {printk ("tc_ctl_action: received NO action attribs\n" );return -EINVAL ;
@@ -997,6 +1003,7 @@ find_dump_kind(struct nlmsghdr *n)static int tc_dump_action (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;struct nlmsghdr *nlh;unsigned char *b =skb_tail_pointer (skb);struct rtattr *x;
@@ -1006,6 +1013,9 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)struct tcamsg *t = (struct tcamsg *)NLMSG_DATA (cb->nlh);struct rtattr *kind =find_dump_kind (cb->nlh); +if (net != &init_net) +return 0 ; +if (kind ==NULL ) {printk ("tc_dump_action: action bad kind\n" );return 0 ;
net/sched/cls_api.c +10 -0
@@ -23,6 +23,8 @@#include <linux/init.h> #include <linux/kmod.h> #include <linux/netlink.h> +#include <net/net_namespace.h> +#include <net/sock.h> #include <net/netlink.h> #include <net/pkt_sched.h> #include <net/pkt_cls.h>
@@ -119,6 +121,7 @@ static __inline__ u32 tcf_auto_prio(struct tcf_proto *tp)static int tc_ctl_tfilter (struct sk_buff *skb,struct nlmsghdr *n,void *arg) { +struct net *net = skb->sk->sk_net;struct rtattr **tca;struct tcmsg *t;u32 protocol;
@@ -135,6 +138,9 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)unsigned long fh;int err; +if (net != &init_net) +return -EINVAL ; + replay: tca = arg; t =NLMSG_DATA (n);
@@ -375,6 +381,7 @@ static int tcf_node_dump(struct tcf_proto *tp, unsigned long n, struct tcf_walkestatic int tc_dump_tfilter (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;int t;int s_t;struct net_device *dev;
@@ -385,6 +392,9 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)struct Qdisc_class_ops *cops;struct tcf_dump_args arg; +if (net != &init_net) +return 0 ; +if (cb->nlh->nlmsg_len <NLMSG_LENGTH (sizeof (*tcm)))return skb->len;if ((dev =dev_get_by_index (&init_net, tcm->tcm_ifindex)) ==NULL )
net/sched/sch_api.c +21 -0
@@ -29,6 +29,7 @@#include <linux/hrtimer.h> #include <net/net_namespace.h> +#include <net/sock.h> #include <net/netlink.h> #include <net/pkt_sched.h>
@@ -599,6 +600,7 @@ check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w)static int tc_get_qdisc (struct sk_buff *skb,struct nlmsghdr *n,void *arg) { +struct net *net = skb->sk->sk_net;struct tcmsg *tcm =NLMSG_DATA (n);struct rtattr **tca = arg;struct net_device *dev;
@@ -607,6 +609,9 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)struct Qdisc *p =NULL ;int err; +if (net != &init_net) +return -EINVAL ; +if ((dev =__dev_get_by_index (&init_net, tcm->tcm_ifindex)) ==NULL )return -ENODEV ;
@@ -660,6 +665,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)static int tc_modify_qdisc (struct sk_buff *skb,struct nlmsghdr *n,void *arg) { +struct net *net = skb->sk->sk_net;struct tcmsg *tcm;struct rtattr **tca;struct net_device *dev;
@@ -667,6 +673,9 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)struct Qdisc *q, *p;int err; +if (net != &init_net) +return -EINVAL ; + replay:/* Reinit, just in case something touches this. */ tcm =NLMSG_DATA (n);
@@ -872,11 +881,15 @@ err_out:static int tc_dump_qdisc (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;int idx, q_idx;int s_idx, s_q_idx;struct net_device *dev;struct Qdisc *q; +if (net != &init_net) +return 0 ; + s_idx = cb->args[0 ]; s_q_idx = q_idx = cb->args[1 ];read_lock (&dev_base_lock);
@@ -920,6 +933,7 @@ done:static int tc_ctl_tclass (struct sk_buff *skb,struct nlmsghdr *n,void *arg) { +struct net *net = skb->sk->sk_net;struct tcmsg *tcm =NLMSG_DATA (n);struct rtattr **tca = arg;struct net_device *dev;
@@ -932,6 +946,9 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)u32 qid =TC_H_MAJ (clid);int err; +if (net != &init_net) +return -EINVAL ; +if ((dev =__dev_get_by_index (&init_net, tcm->tcm_ifindex)) ==NULL )return -ENODEV ;
@@ -1106,6 +1123,7 @@ static int qdisc_class_dump(struct Qdisc *q, unsigned long cl, struct qdisc_walkstatic int tc_dump_tclass (struct sk_buff *skb,struct netlink_callback *cb) { +struct net *net = skb->sk->sk_net;int t;int s_t;struct net_device *dev;
@@ -1113,6 +1131,9 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)struct tcmsg *tcm = (struct tcmsg *)NLMSG_DATA (cb->nlh);struct qdisc_dump_args arg; +if (net != &init_net) +return 0 ; +if (cb->nlh->nlmsg_len <NLMSG_LENGTH (sizeof (*tcm)))return 0 ;if ((dev =dev_get_by_index (&init_net, tcm->tcm_ifindex)) ==NULL )
Signature · 1 line
1.5.3.rc6.17.g1911
PATCH 2/5 net: Make rtnetlink infrastructure network namespace aware
After this patch none of the netlink callback support anything except the initial network namespace but the rtnetlink infrastructure now handles multiple network namespaces.
--- include/linux/rtnetlink.h | 8 ++-- include/net/net_namespace.h | 3 + net/bridge/br_netlink.c | 4 +- net/core/fib_rules.c | 4 +- net/core/neighbour.c | 4 +- net/core/rtnetlink.c | 96 +++++++++++++++++++++++++++++++++++++------ net/decnet/dn_dev.c | 4 +- net/decnet/dn_route.c | 2 +- net/decnet/dn_table.c | 4 +- net/ipv4/devinet.c | 4 +- net/ipv4/fib_semantics.c | 4 +- net/ipv4/ipmr.c | 4 +- net/ipv4/route.c | 2 +- net/ipv6/addrconf.c | 14 +++--- net/ipv6/route.c | 6 +- net/sched/act_api.c | 8 ++-- net/sched/cls_api.c | 2 +- net/sched/sch_api.c | 4 +- net/wireless/wext.c | 5 ++- 19 files changed, 129 insertions(+), 53 deletions(-)
include/linux/rtnetlink.h +4 -4
@@ -582,11 +582,11 @@ extern int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr, ({ data =RTA_PAYLOAD (rta) >= len ?RTA_DATA (rta) :NULL ; \ __rtattr_parse_nested_compat(tb, max, rta, len); }) -extern int rtnetlink_send (struct sk_buff *skb,u32 pid,u32 group,int echo); -extern int rtnl_unicast (struct sk_buff *skb,u32 pid); -extern int rtnl_notify (struct sk_buff *skb,u32 pid,u32 group, +extern int rtnetlink_send (struct sk_buff *skb,struct net *net,u32 pid,u32 group,int echo); +extern int rtnl_unicast (struct sk_buff *skb,struct net *net,u32 pid); +extern int rtnl_notify (struct sk_buff *skb,struct net *net,u32 pid,u32 group,struct nlmsghdr *nlh,gfp_t flags); -extern void rtnl_set_sk_err (u32 group,int error); +extern void rtnl_set_sk_err (struct net *net,u32 group,int error);extern int rtnetlink_put_metrics (struct sk_buff *skb,u32 *metrics); extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, u32 id, u32 ts, u32 tsage, long expires,
include/net/net_namespace.h +3 -0
@@ -10,6 +10,7 @@struct proc_dir_entry ;struct net_device ; +struct sock ;struct net {atomic_t count;/* To decided when the network * namespace should be freed.
@@ -29,6 +30,8 @@ struct net {struct list_head dev_base_head;struct hlist_head *dev_name_head;struct hlist_head *dev_index_head; + +struct sock *rtnl;/* rtnetlink socket */ };#ifdef CONFIG_NET
net/bridge/br_netlink.c +2 -2
@@ -97,10 +97,10 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port)kfree_skb (skb); goto errout; } - err =rtnl_notify (skb,0 ,RTNLGRP_LINK ,NULL ,GFP_ATOMIC ); + err =rtnl_notify (skb, &init_net,0 ,RTNLGRP_LINK ,NULL ,GFP_ATOMIC ); errout:if (err <0 ) -rtnl_set_sk_err (RTNLGRP_LINK , err); +rtnl_set_sk_err (&init_net,RTNLGRP_LINK , err); }/*
net/core/fib_rules.c +2 -2
@@ -577,10 +577,10 @@ static void notify_rule_change(int event, struct fib_rule *rule,kfree_skb (skb); goto errout; } - err =rtnl_notify (skb, pid, ops->nlgroup, nlh,GFP_KERNEL ); + err =rtnl_notify (skb, &init_net, pid, ops->nlgroup, nlh,GFP_KERNEL ); errout:if (err <0 ) -rtnl_set_sk_err (ops->nlgroup, err); +rtnl_set_sk_err (&init_net, ops->nlgroup, err); }static void attach_rules (struct list_head *rules,struct net_device *dev)
net/core/neighbour.c +2 -2
@@ -2466,10 +2466,10 @@ static void __neigh_notify(struct neighbour *n, int type, int flags)kfree_skb (skb); goto errout; } - err =rtnl_notify (skb,0 ,RTNLGRP_NEIGH ,NULL ,GFP_ATOMIC ); + err =rtnl_notify (skb, &init_net,0 ,RTNLGRP_NEIGH ,NULL ,GFP_ATOMIC ); errout:if (err <0 ) -rtnl_set_sk_err (RTNLGRP_NEIGH , err); +rtnl_set_sk_err (&init_net,RTNLGRP_NEIGH , err); }#ifdef CONFIG_ARPD
net/core/rtnetlink.c +83 -13
180 lines not on this page · raw message
net/decnet/dn_dev.c +2 -2
@@ -791,10 +791,10 @@ static void dn_ifaddr_notify(int event, struct dn_ifaddr *ifa)kfree_skb (skb); goto errout; } - err =rtnl_notify (skb,0 , RTNLGRP_DECnet_IFADDR,NULL ,GFP_KERNEL ); + err =rtnl_notify (skb, &init_net,0 , RTNLGRP_DECnet_IFADDR,NULL ,GFP_KERNEL ); errout:if (err <0 ) -rtnl_set_sk_err (RTNLGRP_DECnet_IFADDR, err); +rtnl_set_sk_err (&init_net, RTNLGRP_DECnet_IFADDR, err); }static int dn_nl_dump_ifaddr (struct sk_buff *skb,struct netlink_callback *cb)
net/decnet/dn_route.c +1 -1
@@ -1606,7 +1606,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void goto out_free; } -return rtnl_unicast (skb,NETLINK_CB (in_skb).pid); +return rtnl_unicast (skb, &init_net,NETLINK_CB (in_skb).pid); out_free:kfree_skb (skb);
net/decnet/dn_table.c +2 -2
@@ -375,10 +375,10 @@ static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id,kfree_skb (skb); goto errout; } - err =rtnl_notify (skb, pid, RTNLGRP_DECnet_ROUTE, nlh,GFP_KERNEL ); + err =rtnl_notify (skb, &init_net, pid, RTNLGRP_DECnet_ROUTE, nlh,GFP_KERNEL ); errout:if (err <0 ) -rtnl_set_sk_err (RTNLGRP_DECnet_ROUTE, err); +rtnl_set_sk_err (&init_net, RTNLGRP_DECnet_ROUTE, err); } static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb,
net/ipv4/devinet.c +2 -2
@@ -1241,10 +1241,10 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa, struct nlmsghdr *nlh,kfree_skb (skb); goto errout; } - err =rtnl_notify (skb, pid,RTNLGRP_IPV4_IFADDR , nlh,GFP_KERNEL ); + err =rtnl_notify (skb, &init_net, pid,RTNLGRP_IPV4_IFADDR , nlh,GFP_KERNEL ); errout:if (err <0 ) -rtnl_set_sk_err (RTNLGRP_IPV4_IFADDR , err); +rtnl_set_sk_err (&init_net,RTNLGRP_IPV4_IFADDR , err); }#ifdef CONFIG_SYSCTL
net/ipv4/fib_semantics.c +2 -2
@@ -320,11 +320,11 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,kfree_skb (skb); goto errout; } - err =rtnl_notify (skb, info->pid,RTNLGRP_IPV4_ROUTE , + err =rtnl_notify (skb, &init_net, info->pid,RTNLGRP_IPV4_ROUTE , info->nlh,GFP_KERNEL ); errout:if (err <0 ) -rtnl_set_sk_err (RTNLGRP_IPV4_ROUTE , err); +rtnl_set_sk_err (&init_net,RTNLGRP_IPV4_ROUTE , err); }/* Return the first fib alias matching TOS with
net/ipv4/ipmr.c +2 -2
@@ -321,7 +321,7 @@ static void ipmr_destroy_unres(struct mfc_cache *c) e->error = -ETIMEDOUT ;memset (&e->msg,0 ,sizeof (e->msg)); -rtnl_unicast (skb,NETLINK_CB (skb).pid); +rtnl_unicast (skb, &init_net,NETLINK_CB (skb).pid); }else kfree_skb (skb); }
@@ -533,7 +533,7 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)memset (&e->msg,0 ,sizeof (e->msg)); } -rtnl_unicast (skb,NETLINK_CB (skb).pid); +rtnl_unicast (skb, &init_net,NETLINK_CB (skb).pid); }else ip_mr_forward (skb, c,0 ); }
net/ipv4/route.c +1 -1
@@ -2635,7 +2635,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, voidif (err <=0 ) goto errout_free; - err =rtnl_unicast (skb,NETLINK_CB (in_skb).pid); + err =rtnl_unicast (skb, &init_net,NETLINK_CB (in_skb).pid); errout:return err;
net/ipv6/addrconf.c +7 -7
@@ -3429,7 +3429,7 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh,kfree_skb (skb); goto errout_ifa; } - err =rtnl_unicast (skb,NETLINK_CB (in_skb).pid); + err =rtnl_unicast (skb, &init_net,NETLINK_CB (in_skb).pid); errout_ifa:in6_ifa_put (ifa); errout:
@@ -3452,10 +3452,10 @@ static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)kfree_skb (skb); goto errout; } - err =rtnl_notify (skb,0 ,RTNLGRP_IPV6_IFADDR ,NULL ,GFP_ATOMIC ); + err =rtnl_notify (skb, &init_net,0 ,RTNLGRP_IPV6_IFADDR ,NULL ,GFP_ATOMIC ); errout:if (err <0 ) -rtnl_set_sk_err (RTNLGRP_IPV6_IFADDR , err); +rtnl_set_sk_err (&init_net,RTNLGRP_IPV6_IFADDR , err); } static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
@@ -3660,10 +3660,10 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev)kfree_skb (skb); goto errout; } - err =rtnl_notify (skb,0 ,RTNLGRP_IPV6_IFADDR ,NULL ,GFP_ATOMIC ); + err =rtnl_notify (skb, &init_net,0 ,RTNLGRP_IPV6_IFADDR ,NULL ,GFP_ATOMIC ); errout:if (err <0 ) -rtnl_set_sk_err (RTNLGRP_IPV6_IFADDR , err); +rtnl_set_sk_err (&init_net,RTNLGRP_IPV6_IFADDR , err); }static inline size_t inet6_prefix_nlmsg_size (void )
@@ -3729,10 +3729,10 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev,kfree_skb (skb); goto errout; } - err =rtnl_notify (skb,0 ,RTNLGRP_IPV6_PREFIX ,NULL ,GFP_ATOMIC ); + err =rtnl_notify (skb, &init_net,0 ,RTNLGRP_IPV6_PREFIX ,NULL ,GFP_ATOMIC ); errout:if (err <0 ) -rtnl_set_sk_err (RTNLGRP_IPV6_PREFIX , err); +rtnl_set_sk_err (&init_net,RTNLGRP_IPV6_PREFIX , err); }static void __ipv6_ifa_notify (int event,struct inet6_ifaddr *ifp)
net/ipv6/route.c +3 -3
@@ -2307,7 +2307,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void goto errout; } - err =rtnl_unicast (skb,NETLINK_CB (in_skb).pid); + err =rtnl_unicast (skb, &init_net,NETLINK_CB (in_skb).pid); errout:return err; }
@@ -2337,10 +2337,10 @@ void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info)kfree_skb (skb); goto errout; } - err =rtnl_notify (skb, pid,RTNLGRP_IPV6_ROUTE , nlh,gfp_any ()); + err =rtnl_notify (skb, &init_net, pid,RTNLGRP_IPV6_ROUTE , nlh,gfp_any ()); errout:if (err <0 ) -rtnl_set_sk_err (RTNLGRP_IPV6_ROUTE , err); +rtnl_set_sk_err (&init_net,RTNLGRP_IPV6_ROUTE , err); }/*
net/sched/act_api.c +4 -4
@@ -660,7 +660,7 @@ act_get_notify(u32 pid, struct nlmsghdr *n, struct tc_action *a, int event)return -EINVAL ; } -return rtnl_unicast (skb, pid); +return rtnl_unicast (skb, &init_net, pid); } static struct tc_action *
@@ -781,7 +781,7 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid) nlh->nlmsg_flags |=NLM_F_ROOT ;module_put (a->ops->owner);kfree (a); - err =rtnetlink_send (skb, pid,RTNLGRP_TC , n->nlmsg_flags&NLM_F_ECHO ); + err =rtnetlink_send (skb, &init_net, pid,RTNLGRP_TC , n->nlmsg_flags&NLM_F_ECHO );if (err >0 )return 0 ;
@@ -844,7 +844,7 @@ tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event)/* now do the delete */ tcf_action_destroy (head,0 ); - ret =rtnetlink_send (skb, pid,RTNLGRP_TC , + ret =rtnetlink_send (skb, &init_net, pid,RTNLGRP_TC , n->nlmsg_flags&NLM_F_ECHO );if (ret >0 )return 0 ;
@@ -888,7 +888,7 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event, nlh->nlmsg_len =skb_tail_pointer (skb) - b;NETLINK_CB (skb).dst_group =RTNLGRP_TC ; - err =rtnetlink_send (skb, pid,RTNLGRP_TC , flags&NLM_F_ECHO ); + err =rtnetlink_send (skb, &init_net, pid,RTNLGRP_TC , flags&NLM_F_ECHO );if (err >0 ) err =0 ;return err;
net/sched/cls_api.c +1 -1
@@ -361,7 +361,7 @@ static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n,return -EINVAL ; } -return rtnetlink_send (skb, pid,RTNLGRP_TC , n->nlmsg_flags&NLM_F_ECHO ); +return rtnetlink_send (skb, &init_net, pid,RTNLGRP_TC , n->nlmsg_flags&NLM_F_ECHO ); }struct tcf_dump_args
net/sched/sch_api.c +2 -2
@@ -872,7 +872,7 @@ static int qdisc_notify(struct sk_buff *oskb, struct nlmsghdr *n, }if (skb->len) -return rtnetlink_send (skb, pid,RTNLGRP_TC , n->nlmsg_flags&NLM_F_ECHO ); +return rtnetlink_send (skb, &init_net, pid,RTNLGRP_TC , n->nlmsg_flags&NLM_F_ECHO ); err_out:kfree_skb (skb);
@@ -1103,7 +1103,7 @@ static int tclass_notify(struct sk_buff *oskb, struct nlmsghdr *n,return -EINVAL ; } -return rtnetlink_send (skb, pid,RTNLGRP_TC , n->nlmsg_flags&NLM_F_ECHO ); +return rtnetlink_send (skb, &init_net, pid,RTNLGRP_TC , n->nlmsg_flags&NLM_F_ECHO ); }struct qdisc_dump_args
net/wireless/wext.c +4 -1
@@ -1137,7 +1137,7 @@ static void wireless_nlevent_process(unsigned long data)struct sk_buff *skb;while ((skb =skb_dequeue (&wireless_nlevent_queue))) -rtnl_notify (skb,0 ,RTNLGRP_LINK ,NULL ,GFP_ATOMIC ); +rtnl_notify (skb, &init_net,0 ,RTNLGRP_LINK ,NULL ,GFP_ATOMIC ); } static DECLARE_TASKLET(wireless_nlevent_tasklet, wireless_nlevent_process, 0);
@@ -1189,6 +1189,9 @@ static void rtmsg_iwinfo(struct net_device *dev, char *event, int event_len)struct sk_buff *skb;int err; +if (dev->nd_net != &init_net) +return ; + skb =nlmsg_new (NLMSG_DEFAULT_SIZE ,GFP_ATOMIC );if (!skb)return ;
Signature · 1 line
1.5.3.rc6.17.g1911
A message that is not in the archive (sent off-list or not yet received): m1hcle9td8.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org
PATCH 3/5 net: Make the netlink methods in rtnetlink handle multiple network namespaces
After the previous prep work this just consists of removing checks limiting the code to work in the initial network namespace, and updating rtmsg_ifinfo so we can generate events for devices in something other then the initial network namespace.
Referring to network other network devices like the IFLA_LINK and IFLA_MASTER attributes do, gets interesting if those network devices happen to be in other network namespaces. Currently ifindex numbers are allocated globally so I have taken the path of least resistance and not still report the information even though the devices they are talking about are invisible.
If applications start getting confused or when ifindex numbers become local to the network namespace we may need to do something different in the future.
--- net/core/rtnetlink.c | 27 +++------------------------ 1 files changed, 3 insertions(+), 24 deletions(-)
net/core/rtnetlink.c +3 -24
@@ -741,9 +741,6 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)int s_idx = cb->args[0 ];struct net_device *dev; -if (net != &init_net) -return 0 ; - idx =0 ;for_each_netdev (net, dev) {if (idx < s_idx)
@@ -946,9 +943,6 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)struct nlattr *tb[IFLA_MAX +1 ];char ifname[IFNAMSIZ ]; -if (net != &init_net) -return -EINVAL ; - err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFLA_MAX , ifla_policy);if (err <0 ) goto errout;
@@ -997,9 +991,6 @@ static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)struct nlattr *tb[IFLA_MAX +1 ];int err; -if (net != &init_net) -return -EINVAL ; - err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFLA_MAX , ifla_policy);if (err <0 )return err;
@@ -1081,9 +1072,6 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)struct nlattr *linkinfo[IFLA_INFO_MAX +1 ];int err; -if (net != &init_net) -return -EINVAL ; -#ifdef CONFIG_KMOD replay:#endif
@@ -1210,9 +1198,6 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)struct sk_buff *nskb;int err; -if (net != &init_net) -return -EINVAL ; - err =nlmsg_parse (nlh,sizeof (*ifm), tb,IFLA_MAX , ifla_policy);if (err <0 )return err;
@@ -1248,13 +1233,9 @@ errout:static int rtnl_dump_all (struct sk_buff *skb,struct netlink_callback *cb) { -struct net *net = skb->sk->sk_net;int idx;int s_idx = cb->family; -if (net != &init_net) -return 0 ; -if (s_idx ==0 ) s_idx =1 ;for (idx=1 ; idx<NPROTO ; idx++) {
@@ -1276,6 +1257,7 @@ static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)void rtmsg_ifinfo (int type,struct net_device *dev,unsigned change) { +struct net *net = dev->nd_net;struct sk_buff *skb;int err = -ENOBUFS ;
@@ -1290,10 +1272,10 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)kfree_skb (skb); goto errout; } - err =rtnl_notify (skb, &init_net,0 ,RTNLGRP_LINK ,NULL ,GFP_KERNEL ); + err =rtnl_notify (skb, net,0 ,RTNLGRP_LINK ,NULL ,GFP_KERNEL ); errout:if (err <0 ) -rtnl_set_sk_err (&init_net,RTNLGRP_LINK , err); +rtnl_set_sk_err (net,RTNLGRP_LINK , err); }/* Protected by RTNL sempahore. */
@@ -1392,9 +1374,6 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi {struct net_device *dev = ptr; -if (dev->nd_net != &init_net) -return NOTIFY_DONE ; -switch (event) {case NETDEV_UNREGISTER :rtmsg_ifinfo (RTM_DELLINK , dev, ~0U );
Signature · 1 line
1.5.3.rc6.17.g1911
PATCH 4/5 net: Make AF_PACKET handle multiple network namespaces
This is done by making packet_sklist_lock and packet_sklist per network namespace and adding an additional filter condition on received packets to ensure they came from the proper network namespace.
--- include/net/net_namespace.h | 4 + net/packet/af_packet.c | 129 +++++++++++++++++++++++++++--------------- 2 files changed, 87 insertions(+), 46 deletions(-)
include/net/net_namespace.h +4 -0
@@ -32,6 +32,10 @@ struct net {struct hlist_head *dev_index_head;struct sock *rtnl;/* rtnetlink socket */ + +/* List of all packet sockets. */ +rwlock_t packet_sklist_lock; +struct hlist_head packet_sklist; };#ifdef CONFIG_NET
net/packet/af_packet.c +83 -46
316 lines not on this page · raw message
Signature · 1 line
1.5.3.rc6.17.g1911
PATCH 5/5 net: Make AF_UNIX per network namespace safe.
Because of the global nature of garbage collection, and because of the cost of per namespace hash tables unix_socket_table has been kept global. With a filter added on lookups so we don't see sockets from the wrong namespace.
Currently I don't fold the namesapce into the hash so multiple namespaces using the same socket name will be guaranteed a hash collision.
--- net/unix/af_unix.c | 113 +++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 86 insertions(+), 27 deletions(-)
net/unix/af_unix.c +86 -27
@@ -270,7 +270,8 @@ static inline void unix_insert_socket(struct hlist_head *list, struct sock *sk)spin_unlock (&unix_table_lock); } -static struct sock *__unix_find_socket_byname (struct sockaddr_un *sunname, +static struct sock *__unix_find_socket_byname (struct net *net, +struct sockaddr_un *sunname,int len,int type,unsigned hash) {struct sock *s;
@@ -279,6 +280,9 @@ static struct sock *__unix_find_socket_byname(struct sockaddr_un *sunname,sk_for_each (s, node, &unix_socket_table[hash ^ type]) {struct unix_sock *u =unix_sk (s); +if (s->sk_net != net) +continue ; +if (u->addr->len == len && !memcmp (u->addr->name, sunname, len)) goto found;
@@ -288,21 +292,22 @@ found:return s; } -static inline struct sock *unix_find_socket_byname (struct sockaddr_un *sunname, +static inline struct sock *unix_find_socket_byname (struct net *net, +struct sockaddr_un *sunname,int len,int type,unsigned hash) {struct sock *s;spin_lock (&unix_table_lock); - s =__unix_find_socket_byname (sunname, len, type, hash); + s =__unix_find_socket_byname (net, sunname, len, type, hash);if (s)sock_hold (s);spin_unlock (&unix_table_lock);return s; } -static struct sock *unix_find_socket_byinode (struct inode *i) +static struct sock *unix_find_socket_byinode (struct net *net,struct inode *i) {struct sock *s;struct hlist_node *node;
@@ -312,6 +317,9 @@ static struct sock *unix_find_socket_byinode(struct inode *i) &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) {struct dentry *dentry =unix_sk (s)->dentry; +if (s->sk_net != net) +continue ; +if (dentry && dentry->d_inode == i) {sock_hold (s);
@@ -630,9 +638,6 @@ out:static int unix_create (struct net *net,struct socket *sock,int protocol) { -if (net != &init_net) -return -EAFNOSUPPORT ; -if (protocol && protocol !=PF_UNIX )return -EPROTONOSUPPORT ;
@@ -676,6 +681,7 @@ static int unix_release(struct socket *sock)static int unix_autobind (struct socket *sock) {struct sock *sk = sock->sk; +struct net *net = sk->sk_net;struct unix_sock *u =unix_sk (sk);static u32 ordernum =1 ;struct unix_address * addr;
@@ -702,7 +708,7 @@ retry:spin_lock (&unix_table_lock); ordernum = (ordernum+1 )&0xFFFFF ; -if (__unix_find_socket_byname (addr->name, addr->len, sock->type, +if (__unix_find_socket_byname (net, addr->name, addr->len, sock->type, addr->hash)) {spin_unlock (&unix_table_lock);/* Sanity yield. It is unusual case, but yet... */
@@ -722,7 +728,8 @@ out: mutex_unlock(&u->readlock);return err; } -static struct sock *unix_find_other (struct sockaddr_un *sunname,int len, +static struct sock *unix_find_other (struct net *net, +struct sockaddr_un *sunname,int len,int type,unsigned hash,int *error) {struct sock *u;
@@ -740,7 +747,7 @@ static struct sock *unix_find_other(struct sockaddr_un *sunname, int len, err = -ECONNREFUSED ;if (!S_ISSOCK (nd.dentry->d_inode->i_mode)) goto put_fail; - u=unix_find_socket_byinode (nd.dentry->d_inode); + u=unix_find_socket_byinode (net, nd.dentry->d_inode);if (!u) goto put_fail;
@@ -756,7 +763,7 @@ static struct sock *unix_find_other(struct sockaddr_un *sunname, int len, } }else { err = -ECONNREFUSED ; - u=unix_find_socket_byname (sunname, len, type, hash); + u=unix_find_socket_byname (net, sunname, len, type, hash);if (u) {struct dentry *dentry; dentry =unix_sk (u)->dentry;
@@ -778,6 +785,7 @@ fail:static int unix_bind (struct socket *sock,struct sockaddr *uaddr,int addr_len) {struct sock *sk = sock->sk; +struct net *net = sk->sk_net;struct unix_sock *u =unix_sk (sk);struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;struct dentry * dentry =NULL ;
@@ -852,7 +860,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)if (!sunaddr->sun_path[0 ]) { err = -EADDRINUSE ; -if (__unix_find_socket_byname (sunaddr, addr_len, +if (__unix_find_socket_byname (net, sunaddr, addr_len, sk->sk_type, hash)) {unix_release_addr (addr); goto out_unlock;
@@ -918,6 +926,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags) {struct sock *sk = sock->sk; +struct net *net = sk->sk_net;struct sockaddr_un *sunaddr=(struct sockaddr_un *)addr;struct sock *other;unsigned hash;
@@ -934,7 +943,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, goto out; restart: - other=unix_find_other (sunaddr, alen, sock->type, hash, &err); + other=unix_find_other (net, sunaddr, alen, sock->type, hash, &err);if (!other) goto out;
@@ -1014,6 +1023,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, {struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;struct sock *sk = sock->sk; +struct net *net = sk->sk_net;struct unix_sock *u =unix_sk (sk), *newu, *otheru;struct sock *newsk =NULL ;struct sock *other =NULL ;
@@ -1053,7 +1063,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, restart:/* Find listening sock. */ - other =unix_find_other (sunaddr, addr_len, sk->sk_type, hash, &err); + other =unix_find_other (net, sunaddr, addr_len, sk->sk_type, hash, &err);if (!other) goto out;
@@ -1329,6 +1339,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, {struct sock_iocb *siocb =kiocb_to_siocb (kiocb);struct sock *sk = sock->sk; +struct net *net = sk->sk_net;struct unix_sock *u =unix_sk (sk);struct sockaddr_un *sunaddr=msg->msg_name;struct sock *other =NULL ;
@@ -1392,7 +1403,7 @@ restart:if (sunaddr ==NULL ) goto out_free; - other =unix_find_other (sunaddr, namelen, sk->sk_type, + other =unix_find_other (net, sunaddr, namelen, sk->sk_type, hash, &err);if (other==NULL ) goto out_free;
@@ -1998,12 +2009,18 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl#ifdef CONFIG_PROC_FS -static struct sock *unix_seq_idx (int *iter,loff_t pos) +struct unix_iter_state { +struct net *net; +int i; +}; +static struct sock *unix_seq_idx (struct unix_iter_state *iter,loff_t pos) {loff_t off =0 ;struct sock *s; -for (s =first_unix_socket (iter); s; s =next_unix_socket (iter, s)) { +for (s =first_unix_socket (&iter->i); s; s =next_unix_socket (&iter->i, s)) { +if (s->sk_net != iter->net) +continue ;if (off == pos)return s; ++off;
@@ -2014,17 +2031,24 @@ static struct sock *unix_seq_idx(int *iter, loff_t pos)static void *unix_seq_start (struct seq_file *seq,loff_t *pos) { +struct unix_iter_state *iter = seq->private;spin_lock (&unix_table_lock); -return *pos ?unix_seq_idx (seq->private, *pos -1 ) : ((void *)1 ); +return *pos ?unix_seq_idx (iter, *pos -1 ) : ((void *)1 ); }static void *unix_seq_next (struct seq_file *seq,void *v,loff_t *pos) { +struct unix_iter_state *iter = seq->private; +struct sock *sk = v; ++*pos;if (v == (void *)1 ) -return first_unix_socket (seq->private); -return next_unix_socket (seq->private, v); + sk =first_unix_socket (&iter->i); +else + sk =next_unix_socket (&iter->i, sk); +while (sk && (sk->sk_net != iter->net)) + sk =next_unix_socket (&iter->i, sk); +return sk; }static void unix_seq_stop (struct seq_file *seq,void *v)
@@ -2088,7 +2112,7 @@ static int unix_seq_open(struct inode *inode, struct file *file) {struct seq_file *seq;int rc = -ENOMEM ; -int *iter =kmalloc (sizeof (int ),GFP_KERNEL ); +struct unix_iter_state *iter =kmalloc (sizeof (*iter),GFP_KERNEL );if (!iter) goto out;
@@ -2099,7 +2123,12 @@ static int unix_seq_open(struct inode *inode, struct file *file) seq = file->private_data; seq->private = iter; - *iter =0 ; + iter->i =0 ; + iter->net =get_proc_net (inode); +if (!iter->net) { +seq_release_private (inode, file); + rc = -ENXIO ; + } out:return rc; out_kfree:
@@ -2107,12 +2136,20 @@ out_kfree: goto out; } +static int unix_seq_release (struct inode *inode,struct file *file) +{ +struct seq_file *seq = file->private_data; +struct unix_iter_state *iter = seq->private; +put_net (iter->net); +return seq_release_private (inode, file); +} +static const struct file_operations unix_seq_fops = { .owner =THIS_MODULE , .open = unix_seq_open, .read = seq_read, .llseek = seq_lseek, - .release = seq_release_private, + .release = unix_seq_release, };#endif
@@ -2123,6 +2160,30 @@ static struct net_proto_family unix_family_ops = { .owner = THIS_MODULE, }; + +static int unix_net_init (struct net *net) +{ +int error = -ENOMEM ; + +#ifdef CONFIG_PROC_FS +if (!proc_net_fops_create (net,"unix" ,0 , &unix_seq_fops)) + goto out; +#endif + error =0 ; +out: +return 0 ; +} + +static void unix_net_exit (struct net *net) +{ +proc_net_remove (net,"unix" ); +} + +static struct pernet_operations unix_net_ops = { + .init = unix_net_init, + .exit = unix_net_exit, +}; +static int __init af_unix_init (void ) {int rc =-1 ;
@@ -2138,9 +2199,7 @@ static int __init af_unix_init(void) }sock_register (&unix_family_ops); -#ifdef CONFIG_PROC_FS -proc_net_fops_create (&init_net,"unix" ,0 , &unix_seq_fops); -#endif +register_pernet_subsys (&unix_net_ops);unix_sysctl_register (); out:return rc;
@@ -2150,8 +2209,8 @@ static void __exit af_unix_exit(void) {sock_unregister (PF_UNIX );unix_sysctl_unregister (); -proc_net_remove (&init_net,"unix" );proto_unregister (&unix_proto); +unregister_pernet_subsys (&unix_net_ops); }module_init (af_unix_init);
Signature · 1 line
1.5.3.rc6.17.g1911
Re: [PATCH 5/5] net: Make AF_UNIX per network namespace safe.
Quoted 8 lines · Eric W. Biederman
Because of the global nature of garbage collection, and because of the cost of per namespace hash tables
unix_socket_tablehas been kept global. With a filter added on lookups so we don't see sockets from the wrong namespace.Currently I don't fold the namesapce into the hash so multiple namespaces using the same socket name will be guaranteed a hash collision.
That doesn't sound like a good thing :) Is there a reason for not avoiding the collisions?
Re: [PATCH 5/5] net: Make AF_UNIX per network namespace safe.
Quoted 6 lines · Patrick McHardy
Quoted 5 lines · Eric W. Biederman
Because of the global nature of garbage collection, and because of the cost of per namespace hash tables
unix_socket_tablehas been kept global. With a filter added on lookups so we don't see sockets from the wrong namespace.
Quoted 7 lines
Quoted 3 lines
Currently I don't fold the namesapce into the hash so multiple namespaces using the same socket name will be guaranteed a hash collision.
That doesn't sound like a good thing :) Is there a reason for not avoiding the collisions?
Two reasons. Minimizing the size of the changes to make review easier, and I don't know if hash collisions are likely in practice or if they matter. I don't believe we can't physically collide and have the same inode because we make a node in the filesystem. The abstract domain is local to linux and so people don't use it as much.
All of which boils down to. I don't see it matter a heck of a lot especially initially. So I did the traditional unix thing and started with a simple and stupid implementation. But it didn't quite feel right to me either so I documented it.
Whipping up a patch to take the namespace into account in mkname doesn't look to hard though.
Eric
Re: [PATCH 5/5] net: Make AF_UNIX per network namespace safe.
Quoted 17 lines · Eric W. Biederman
Quoted 7 lines · Patrick McHardy
Quoted 3 lines
Currently I don't fold the namesapce into the hash so multiple namespaces using the same socket name will be guaranteed a hash collision.
That doesn't sound like a good thing :) Is there a reason for not avoiding the collisions?
Two reasons. Minimizing the size of the changes to make review easier, and I don't know if hash collisions are likely in practice or if they matter. I don't believe we can't physically collide and have the same inode because we make a node in the filesystem. The abstract domain is local to linux and so people don't use it as much.
Quoted 7 lines
All of which boils down to. I don't see it matter a heck of a lot especially initially. So I did the traditional unix thing and started with a simple and stupid implementation. But it didn't quite feel right to me either so I documented it.
Whipping up a patch to take the namespace into account in mkname doesn't look to hard though.
It doesn't look like it would increase patch size significantly (about 4 more changed lines), but it could of course be done in a follow-up patch.
Re: [PATCH 2/5] net: Make rtnetlink infrastructure network namespace aware
In reply to Eric W. BiedermanQuoted 28 lines · Eric W. Biederman
void
rtnl_unlock(void)
{net/core/rtnetlink.c +24
-2-mutex_unlock (&rtnl_mutex); -if (rtnl && rtnl->sk_receive_queue.qlen) +struct net *net; + +/* +* Loop through all of the rtnl sockets until none of them (in +* a live network namespace) have queue packets. +* +* We have to be careful with the locking here as +* sk_data_ready aka rtnetlink_rcv takes the rtnl_mutex. +* +* To ensure the network namespace does not exit while +* we are processing packets on it's rtnl socket we +* grab a reference to the network namespace, ignoring +* it if the network namespace has already exited. +*/ +retry: +for_each_net (net) { +struct sock *rtnl = net->rtnl; + +if (!rtnl || !rtnl->sk_receive_queue.qlen) +continue ; + +if (!maybe_get_net (net)) +continue ; +
net/core/rtnetlink.c void __rtnl_unlock(void) · line 109
Quoted 10 lines
net/core/rtnetlink.c +7
-0+mutex_unlock (&rtnl_mutex); rtnl->sk_data_ready (rtnl,0 ); +mutex_lock (&rtnl_mutex); +put_net (net); + goto retry; + } +mutex_unlock (&rtnl_mutex); +netdev_run_todo (); }
I'm wondering why this receive queue processing on unlock is still necessary today, we don't do trylock in rtnetlink_rcv anymore, so all senders will simply wait until the lock is released and then process the queue.
Re: [PATCH 2/5] net: Make rtnetlink infrastructure network namespace aware
Quoted 4 lines · Patrick McHardy
I'm wondering why this receive queue processing on unlock is still necessary today, we don't do trylock in
rtnetlink_rcvanymore, so all senders will simply wait until the lock is released and then process the queue.
Good question, I should probably look. I was lazy and didn't go back and audit why we were doing this. I just coded a routine that I was certain would work. It does appear that we are processing the queue with sk_data_read when we add a message, so this may be completely unnecessary. I will go back and look. If we can remove this bit things should be simpler.
Eric
Re: [PATCH 2/5] net: Make rtnetlink infrastructure network namespace aware
Quoted 9 lines · Eric W. Biederman
Quoted 4 lines · Patrick McHardy
I'm wondering why this receive queue processing on unlock is still necessary today, we don't do trylock in
rtnetlink_rcvanymore, so all senders will simply wait until the lock is released and then process the queue.
Quoted 6 lines
Good question, I should probably look. I was lazy and didn't go back and audit why we were doing this. I just coded a routine that I was certain would work. It does appear that we are processing the queue with
sk_data_readwhen we add a message, so this may be completely unnecessary. I will go back and look. If we can remove this bit things should be simpler.
Maybe I can save you some time: we used to do down_trylock() for the rtnl mutex, so senders would simply return if someone else was already processing the queue *or* the rtnl was locked for some other reason. In the first case the process already processing the queue would also process the new messages, but if it the rtnl was locked for some other reason (for example during module registration) the message would sit in the queue until the next rtnetlink sendmsg call, which is why rtnl_unlock does queue processing. Commit 6756ae4b changed the down_trylock to mutex_lock, so senders will now simply wait until the mutex is released and then call netlink_run_queue themselves. This means its not needed anymore.
Re: [PATCH 2/5] net: Make rtnetlink infrastructure network namespace aware
Quoted 4 lines · Patrick McHardy
Maybe I can save you some time: we used to do
down_trylock()for the rtnl mutex, so senders would simply return if someone else was already processing the queue *or* the rtnl was locked for some other reason. In the first case the process already
Quoted 8 lines
processing the queue would also process the new messages, but if it the rtnl was locked for some other reason (for example during module registration) the message would sit in the queue until the next rtnetlink sendmsg call, which is why
rtnl_unlockdoes queue processing. Commit6756ae4bchanged thedown_trylocktomutex_lock, so senders will now simply wait until the mutex is released and then callnetlink_run_queuethemselves. This means its not needed anymore.
Sounds reasonable.
I started looking through the code paths and I currently cannot see anything that would leave a message on a kernel rtnl socket.
However I did a quick test adding a WARN_ON if there were any messages found in the queue during rtnl_unlock and I found this code path getting invoked from linkwatch_event. So there is clearly something I don't understand, and it sounds at odds just a bit from your description.
If we can remove the extra queue processing that would be great, as it looks like a nice way to simplify the locking and the special cases in the code.
Eric
Re: [Devel] Re: [PATCH 2/5] net: Make rtnetlink infrastructure network namespace aware
Hmm, so it looks like we do not need this queue processing at all...
Regards,
Den
Quoted 31 lines · Eric W. Biederman
Quoted 4 lines · Patrick McHardy
Maybe I can save you some time: we used to do
down_trylock()for the rtnl mutex, so senders would simply return if someone else was already processing the queue *or* the rtnl was locked for some other reason. In the first case the process alreadyQuoted 8 lines
processing the queue would also process the new messages, but if it the rtnl was locked for some other reason (for example during module registration) the message would sit in the queue until the next rtnetlink sendmsg call, which is why
rtnl_unlockdoes queue processing. Commit6756ae4bchanged thedown_trylocktomutex_lock, so senders will now simply wait until the mutex is released and then callnetlink_run_queuethemselves. This means its not needed anymore.Sounds reasonable.
I started looking through the code paths and I currently cannot see anything that would leave a message on a kernel rtnl socket.
However I did a quick test adding a
WARN_ONif there were any messages found in the queue duringrtnl_unlockand I found this code path getting invoked fromlinkwatch_event. So there is clearly something I don't understand, and it sounds at odds just a bit from your description.If we can remove the extra queue processing that would be great, as it looks like a nice way to simplify the locking and the special cases in the code.
Eric
Re: [PATCH 2/5] net: Make rtnetlink infrastructure network namespace aware
In reply to Eric W. BiedermanQuoted 19 lines · Eric W. Biederman
Quoted 4 lines · Patrick McHardy
Maybe I can save you some time: we used to do
down_trylock()for the rtnl mutex, so senders would simply return if someone else was already processing the queue *or* the rtnl was locked for some other reason. In the first case the process alreadyQuoted 8 lines
processing the queue would also process the new messages, but if it the rtnl was locked for some other reason (for example during module registration) the message would sit in the queue until the next rtnetlink sendmsg call, which is why
rtnl_unlockdoes queue processing. Commit6756ae4bchanged thedown_trylocktomutex_lock, so senders will now simply wait until the mutex is released and then callnetlink_run_queuethemselves. This means its not needed anymore.Sounds reasonable.
Quoted 8 lines
I started looking through the code paths and I currently cannot see anything that would leave a message on a kernel rtnl socket.
However I did a quick test adding a
WARN_ONif there were any messages found in the queue duringrtnl_unlockand I found this code path getting invoked fromlinkwatch_event. So there is clearly something I don't understand, and it sounds at odds just a bit from your description.
That sounds like a bug. Did you place the WARN_ON before or after the mutex_unlock()?
Re: [Devel] Re: [PATCH 2/5] net: Make rtnetlink infrastructure network namespace aware
Quoted 29 lines · Patrick McHardy
Quoted 18 lines · Eric W. Biederman
Quoted 4 lines · Patrick McHardy
Maybe I can save you some time: we used to do
down_trylock()for the rtnl mutex, so senders would simply return if someone else was already processing the queue *or* the rtnl was locked for some other reason. In the first case the process alreadyQuoted 8 lines
processing the queue would also process the new messages, but if it the rtnl was locked for some other reason (for example during module registration) the message would sit in the queue until the next rtnetlink sendmsg call, which is why
rtnl_unlockdoes queue processing. Commit6756ae4bchanged thedown_trylocktomutex_lock, so senders will now simply wait until the mutex is released and then callnetlink_run_queuethemselves. This means its not needed anymore.Sounds reasonable.
Quoted 8 lines
I started looking through the code paths and I currently cannot see anything that would leave a message on a kernel rtnl socket.
However I did a quick test adding a
WARN_ONif there were any messages found in the queue duringrtnl_unlockand I found this code path getting invoked fromlinkwatch_event. So there is clearly something I don't understand, and it sounds at odds just a bit from your description.
Quoted 2 lines
That sounds like a bug. Did you place the
WARN_ONbefore or after themutex_unlock()?
The presence of the message in the queue during rtnl_unlock is quite possible as normal user->kernel message processing path for rtnl is the following:
netlink_sendmsg
netlink_unicast
netlink_sendskb
skb_queue_tail
netlink_data_ready
rtnetlink_rcv
mutex_lock(&rtnl_mutex);
netlink_run_queue(sk, qlen, &rtnetlink_rcv_msg);
mutex_unlock(&rtnl_mutex);so, the presence of the packet in the rtnl queue on rtnl_unlock is normal race with a rtnetlink_rcv for me.
Regards,
Den
Re: [Devel] Re: [PATCH 2/5] net: Make rtnetlink infrastructure network namespace aware
Quoted 14 lines · Denis V. Lunev
The presence of the message in the queue during
rtnl_unlockis quite possible as normaluser->kernelmessage processing path for rtnl is the following:
netlink_sendmsg
netlink_unicastnetlink_sendskb skb_queue_tail netlink_data_ready rtnetlink_rcv mutex_lock(&rtnl_mutex); netlink_run_queue(sk, qlen, &rtnetlink_rcv_msg); mutex_unlock(&rtnl_mutex);
Quoted 2 lines
so, the presence of the packet in the rtnl queue on
rtnl_unlockis normal race with artnetlink_rcvfor me.
Yes. That is what I saw in practice as well.
Thanks for confirming this.
It happened to reproducible because I had a dhcp client asking for a list of links in parallel with the actual link coming up during boot.
Looking at netlink_unicast and netlink_broadcast I am generally convinced that we can remove the call of sk_data_ready inrtnl_unlock. I think those are the only two possible paths
through there and I don't see how we could miss a processing a packet on the way through there.
What would be nice is if we could figure out how to eliminate this race. As that would allow netlink packets to be processed synchronously and we could actually use current for security checks, and for getting the context of the calling process.
Right now we are 99% of the way there but because of the above race the code must all be written as if netlink packets were coming in completely asynchronously. Which is unfortunate and a pain.
Eric
Quoted 6 lines · Eric W. Biederman
Before I can enable rtnetlink to work in all network namespaces I need to be certain that something won't break. So this patch deliberately disables all of the rtnletlink methods in everything except the initial network namespace. After the methods have been audited this extra check can be disabled.
[...]
net/bridge/br_netlink.c errout: · line 113
Quoted 6 lines
static int
br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb){net/bridge/br_netlink.c +1
-0+struct net *net = skb->sk->sk_net;struct net_device *dev;int idx;
I've read some code today greping 'init_net.loopback_dev' and found interesting non-trivial for me issue.
Network namespace is extracted from the packet in two different ways in TCP. This is a socket for outgoing path and a device for incoming. Though, there are some places called uniformly both from incoming and outgoing path.
Typical example is netfilters. They are called uniformly all around the code. The prototype is the following:
static unsigned int reject6_target(struct sk_buff **pskb,
const struct net_device *in, const struct net_device *out, unsigned int hooknum, const struct xt_target *target, const void *targinfo);
So, we are bound to the following options:
- perform additional non-uniform hacks around to place 'struct net' into other and other structures like xt_target
- add 7th parameter here and over
- introduce an skb_net field in the 'struct sk_buff' making all code uniform, at least when we have an skb
I think that this is not the last place with such a parameter list and we should make a decision at this point when the code in not mainline yet.
As far as I understand, netfilters are not touched by the Eric and we can face some non-trivial problems there.
So, if my point about uniformity is valid, this patchset looks wrong and should be re-worked :(
Regards,
Den
Quoted 26 lines · Denis V. Lunev
Quoted 6 lines · Eric W. Biederman
Before I can enable rtnetlink to work in all network namespaces I need to be certain that something won't break. So this patch deliberately disables all of the rtnletlink methods in everything except the initial network namespace. After the methods have been audited this extra check can be disabled.
[...]
net/bridge/br_netlink.c errout: · line 113
Quoted 6 lines
static int
br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb){net/bridge/br_netlink.c +1
-0+struct net *net = skb->sk->sk_net;struct net_device *dev;int idx;I've read some code today greping 'init_net.loopback_dev' and found interesting non-trivial for me issue.
Network namespace is extracted from the packet in two different ways in TCP. This is a socket for outgoing path and a device for incoming. Though, there are some places called uniformly both from incoming and outgoing path.
Typical example is netfilters. They are called uniformly all around the code. The prototype is the following:
Quoted 7 lines
static unsigned int reject6_target(struct
sk_buff**pskb,
const structnet_device*in, const structnet_device*out, unsigned int hooknum, const structxt_target*target, const void *targinfo);
Thanks Denis for auditing the code.
As far as I see, struct net_device *in is NULL for outgoing traffic and struct net_device *out is NULL for ingress traffic. Except for the FORWARD rules where both are filled. If we are following network namespace semantic, we should not have two network devices belonging to two differents namespaces, right ? In this case, the following line of code should be sufficient to retrieve the network namespace, no ?
struct net *net = in?in->nd_net:out->nd_net;
Quoted 7 lines
So, we are bound to the following options:
- perform additional non-uniform hacks around to place 'struct net' into other and other structures likext_target
- add 7th parameter here and over
- introduce anskb_netfield in the 'structsk_buff' making all code uniform, at least when we have an skb
Quoted 5 lines
I think that this is not the last place with such a parameter list and we should make a decision at this point when the code in not mainline yet.
As far as I understand, netfilters are not touched by the Eric and we can face some non-trivial problems there.
In Eric's git tree:
http://git.kernel.org/?p=linux/kernel/git/ebiederm/linux-2.6-netns.git
There are some modifications concerning net/ipv4/netfiler/iptable_filter.c and at the ipt_hook function, there is:
struct net *net = (in?in:out)->nd_net;
Quoted 2 lines
So, if my point about uniformity is valid, this patchset looks wrong and should be re-worked :(
As Eric said, we want to build the network namespace step by step, taking care of not breaking the init network namespace.
If you want to make iptables per namespace or catch problems before the code goes to Dave's tree, IMHO it will be more convenient to post to containers@ the patches against netns49, where the modifications will be in a network namespace big picture.
Regards.
-- Daniel
Quoted 27 lines · Daniel Lezcano
struct net *net = in?in->nd_net:out->nd_net;
Quoted 7 lines
So, we are bound to the following options:
- perform additional non-uniform hacks around to place 'struct net' into other and other structures likext_target
- add 7th parameter here and over
- introduce anskb_netfield in the 'structsk_buff' making all code uniform, at least when we have an skbQuoted 6 lines
I think that this is not the last place with such a parameter list and we should make a decision at this point when the code in not mainline yet.
As far as I understand, netfilters are not touched by the Eric and we can face some non-trivial problems there.
In Eric's git tree:
http://git.kernel.org/?p=linux/kernel/git/ebiederm/linux-2.6-netns.gitThere are some modifications concerning
net/ipv4/netfiler/iptable_filter.cand at theipt_hookfunction, there is:struct net *net = (in?in:out)->nd_net;
Quoted 2 lines
So, if my point about uniformity is valid, this patchset looks wrong and should be re-worked :(
Quoted 8 lines
As Eric said, we want to build the network namespace step by step, taking care of not breaking the init network namespace.
If you want to make iptables per namespace or catch problems before the code goes to Dave's tree, IMHO it will be more convenient to post to containers@ the patches against netns49, where the modifications will be in a network namespace big picture.
my point is somewhat another. Yes, this is enough for that place. If so, I must scatter these checks all around in the netfilters code. Brr.
In forward chain the situation is different for Layer3 switching. Let's assume that we have an OpenVZ scheme, where the packet flows from socket to device and after that from device to device via forwarding path. You can't call skb_orphan on namespace switching as this breaks UDP flow regulation. Virtual network device is fast while real Ethernet is slow, packets will be dropped on queue in real device. So, the situation with packet on send path with a socket from other namespace is possible :(
I just pray for uniformity to concentrate on the code rather than on guesses on which path we are :(
Regards,
Den
Quoted 33 lines · Denis V. Lunev
Quoted 6 lines · Eric W. Biederman
Before I can enable rtnetlink to work in all network namespaces I need to be certain that something won't break. So this patch deliberately disables all of the rtnletlink methods in everything except the initial network namespace. After the methods have been audited this extra check can be disabled.
[...]
net/bridge/br_netlink.c errout: · line 113
Quoted 6 lines
static int
br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb){net/bridge/br_netlink.c +1
-0+struct net *net = skb->sk->sk_net;struct net_device *dev;int idx;I've read some code today greping 'init_net.loopback_dev' and found interesting non-trivial for me issue.
Network namespace is extracted from the packet in two different ways in TCP. This is a socket for outgoing path and a device for incoming. Though, there are some places called uniformly both from incoming and outgoing path.
Typical example is netfilters. They are called uniformly all around the code. The prototype is the following:
static unsigned int reject6_target(struct
sk_buff**pskb,
const structnet_device*in, const structnet_device*out, unsigned int hooknum, const structxt_target*target, const void *targinfo);
Quoted 7 lines
So, we are bound to the following options:
- perform additional non-uniform hacks around to place 'struct net' into other and other structures likext_target
- add 7th parameter here and over- introduce an
skb_netfield in the 'structsk_buff' making all code uniform, at least when we have an skb
No. That bloats a sk_buff, changes the semantics of moving a skb around, and decreases performance (because we have to maintain the field on a fast path).
There will not be a skb_net field.
The entire concept of skb_net is a maintenance disaster.
Quoted 2 lines
I think that this is not the last place with such a parameter list and we should make a decision at this point when the code in not mainline yet.
Certainly that is what I have a proof of concept tree for. So we can see how these things look before we merge them.
Quoted 2 lines
As far as I understand, netfilters are not touched by the Eric and we can face some non-trivial problems there.
No. In my proof of concept tree I should have working per network namespace netfilter code. My intention was to just do enough to see what the impact would be so most of the netfilter code (in my tree) insists on running in the initial network namespace. But there are a few pieces that are fully converted. Please take a look.
Quoted 2 lines
So, if my point about uniformity is valid, this patchset looks wrong and should be re-worked :(
This patchset does need to get rebased on top of net-2.6.25 when it opens and hopefully your patchset to remove the unnecessary work in rtnl_unlock, and to really process netlink requests in process context. I see a need for the more fundamental change you seem to be advocating.
Differentiating between the incoming and the outgoing code paths is something we already do permission checking, for locking, for sleeping, etc. Modifying the code requires reading and understanding it in context. That is the nature of code.
This does make large patches going across the entire networking stack making something a network namespace parameter difficult, but it should not cause any problem for maintenance or other work on the code. As shown by the fact that even outside the tree rebasing my network namespace patches has not been all that difficult.
So no I don't think uniformity, or beauty or elegance is what we are after right now. Trying to hard in that direction ultimately obfuscates the code.
What we want is something that is simple, straight forward, and doesn't require you to be an expert in network namespaces to understand the code or the patches.
In the particular case of the netfilter hooks we don't have a network namespace parameter laying around before we call NF_HOOK, and the idiom "net = (in?in:out)->nd_net" seems perfectly accurate so it seems reasonable to me to derive the network namespace that way in generic code. Although thinking about this. We know which hooks we are being called from so we may in fact actually know if which of in or out must be valid when we get to the netfilter hook.
Eric
A message that is not in the archive (sent off-list or not yet received): m13awilq1r.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org
Eric W. Biederman wrote:
[..]
Quoted 26 lines
Quoted 2 lines
- introduce an
skb_netfield in the 'structsk_buff' making all code uniform, at least when we have an skbNo. That bloats a
sk_buff, changes the semantics of moving a skb around, and decreases performance (because we have to maintain the field on a fast path).There will not be a
skb_netfield.The entire concept of
skb_netis a maintenance disaster.Quoted 2 lines
I think that this is not the last place with such a parameter list and we should make a decision at this point when the code in not mainline yet.
Certainly that is what I have a proof of concept tree for. So we can see how these things look before we merge them.
Quoted 2 lines
As far as I understand, netfilters are not touched by the Eric and we can face some non-trivial problems there.
No. In my proof of concept tree I should have working per network namespace netfilter code. My intention was to just do enough to see what the impact would be so most of the netfilter code (in my tree) insists on running in the initial network namespace. But there are a few pieces that are fully converted. Please take a look.
Quoted 8 lines
Quoted 2 lines
So, if my point about uniformity is valid, this patchset looks wrong and should be re-worked :(
This patchset does need to get rebased on top of net-2.6.25 when it opens and hopefully your patchset to remove the unnecessary work in
rtnl_unlock, and to really process netlink requests in process context. I see a need for the more fundamental change you seem to be advocating.
I see that current patchset of RTNL code is attached. I'll start the next piece of work next week after some reaction from people.
[..]
Quoted 8 lines
In the particular case of the netfilter hooks we don't have a network namespace parameter laying around before we call
NF_HOOK, and the idiom "net = (in?in:out)->nd_net" seems perfectly accurate so it seems reasonable to me to derive the network namespace that way in generic code. Although thinking about this. We know which hooks we are being called from so we may in fact actually know if which of in or out must be valid when we get to the netfilter hook.
I understand your position. But still have some points :)
First. A real-life usecase we have recently fixed in the OpenVZ. I have described it in the previous post, but (may be) not in great details.
UDP buffers management for outgoing traffic.
The packet carries over a destructor, which is called in skb_orphan in the real networking device. This destructor allows to queue more packets. There is no problem in the current implementation. But there is one after namespace introduction in the following configuration:
[NS1] <-> [NS2] <-> [world]
There are two namespaces on the host. One of them is connected to the outside world via another and the packet follows usual forwarding path in NS2.
The problem: if we call skb_orphan in [NS1] outgoing device, there is a great possibility to have a really huge packet drop in [NS2] on queuing operation.
In OpenVZ we have added skb_orphan into receive path (tcp_v4_rcv, __udp4_lib_rcv etc) and removed one from our virtual devices. As unfortunate side effect we have packet in NS2 with a socket from NS1.
So, we should have an architectural solution for this from a beginning. It will be too late to hack around and change namespace lookup scheme.
I see that we should adopt a generic approach:
- each concrete packet belongs to a concrete namespace
- if function has a packet as a parameter, we should get namespace from packet
- if skb->dev is present we should get namespace as skb->dev->nd_net
- otherwise we should get skb->sk->sk_net. If skb->sk is NULL -> this is a bug
So, for the case of all netfilter calls we'll have a pskb->dev->nd_net defined correctly.
Regards,
Den
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Denis V. Lunev
Quoted 5 lines
This patchset does need to get rebased on top of net-2.6.25 when it opens and hopefully your patchset to remove the unnecessary work in
rtnl_unlock, and to really process netlink requests in process context. I see a need for the more fundamental change you seem to be advocating.
Grr. That last sentence should have been I do not see a need for the more fundamental change you seem to be advocating.
Quoted 14 lines
I see that current patchset of RTNL code is attached. I'll start the next piece of work next week after some reaction from people.
I understand your position. But still have some points :)
First. A real-life usecase we have recently fixed in the OpenVZ. I have described it in the previous post, but (may be) not in great details.
UDP buffers management for outgoing traffic.
The packet carries over a destructor, which is called inskb_orphanin the real networking device. This destructor allows to queue more packets. There is no problem in the current implementation. But there is one after namespace introduction in the following configuration:
Quoted 4 lines
[NS1] <-> [NS2] <-> [world]There are two namespaces on the host. One of them is connected to the outside world via another and the packet follows usual forwarding path in NS2.
Yes. We can't quite do that today because of the missing ipv4 support, but the basic infrastructure exists to describe this is already merged.
Quoted 3 lines
The problem: if we call
skb_orphanin [NS1] outgoing device, there is a great possibility to have a really huge packet drop in [NS2] on queuing operation.
Yes. Removing skb_orphan from veth to solve this looks like a pretty substantial hack. A clean solution is more likely to resemble ethernet pause frames so we temporarily plug the virtual device. Although there are issues with that as currently virtual devices don't have queues.
Quoted 3 lines
In OpenVZ we have added
skb_orphaninto receive path (tcp_v4_rcv,__udp4_lib_rcvetc) and removed one from our virtual devices. As unfortunate side effect we have packet in NS2 with a socket from NS1.
That also does some really nasty things to accounting. Using the macvlan devices solve all of this rather neatly and with higher performance.
Quoted 2 lines
So, we should have an architectural solution for this from a beginning. It will be too late to hack around and change namespace lookup scheme.
However what you are specifically concerned about seems to be using skb->sk->sk_net. Currently the only place I use this is in the rtnetlink code because the functions that process packets are not also passed a socket. Those functions we could easily pass in an explicit namespace or a socket parameter, and so those functions would not care.
Quoted 4 lines
I see that we should adopt a generic approach:
- each concrete packet belongs to a concrete namespace
- if function has a packet as a parameter, we should get namespace from packet
This approach when suggested in earlier review was pretty substantially shot down. Shrinking the size of struct sk_buff is currently an ongoing todo for the linux networking stack.
Quoted 3 lines
- if
skb->devis present we should get namespace asskb->dev->nd_net
- otherwise we should getskb->sk->sk_net. Ifskb->skis NULL -> this is a bug
Currently killing skb->dev is a todo list item, so using it more is probably the wrong approach.
I do agree the duplication information between fields on the skb and fields passed to functions is a pain. Moving more onto the skb seems contrary to the how the rest of the networking stack would like to go, so it is likely better to simply remove skb->dev and pass an explicit dev parameter instead. Please note that parameters passed explicitly will live in registers and will be quite fast.
Quoted 2 lines
So, for the case of all netfilter calls we'll have a
pskb->dev->nd_netdefined correctly.
That would certainly be a nice extra, but that really seems the wrong way to go. I would rather add an explicit struct net *net parameter to nf_hookfn.
Eric
A message that is not in the archive (sent off-list or not yet received): m1r6k2gk2w.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org
Quoted 10 lines · Eric W. Biederman
Quoted 5 lines · Denis V. Lunev
Quoted 5 lines
This patchset does need to get rebased on top of net-2.6.25 when it opens and hopefully your patchset to remove the unnecessary work in
rtnl_unlock, and to really process netlink requests in process context. I see a need for the more fundamental change you seem to be advocating.Grr. That last sentence should have been I do not see a need for the more fundamental change you seem to be advocating.
why?
Quoted 27 lines
Quoted 8 lines
First. A real-life usecase we have recently fixed in the OpenVZ. I have described it in the previous post, but (may be) not in great details.
UDP buffers management for outgoing traffic.
The packet carries over a destructor, which is called inskb_orphanin the real networking device. This destructor allows to queue more packets. There is no problem in the current implementation. But there is one after namespace introduction in the following configuration:Quoted 4 lines
[NS1] <-> [NS2] <-> [world]There are two namespaces on the host. One of them is connected to the outside world via another and the packet follows usual forwarding path in NS2.
Yes. We can't quite do that today because of the missing ipv4 support, but the basic infrastructure exists to describe this is already merged.
Quoted 3 lines
The problem: if we call
skb_orphanin [NS1] outgoing device, there is a great possibility to have a really huge packet drop in [NS2] on queuing operation.Yes. Removing
skb_orphanfrom veth to solve this looks like a pretty substantial hack. A clean solution is more likely to resemble ethernet pause frames so we temporarily plug the virtual device. Although there are issues with that as currently virtual devices don't have queues.
Quoted 7 lines
Quoted 3 lines
In OpenVZ we have added
skb_orphaninto receive path (tcp_v4_rcv,__udp4_lib_rcvetc) and removed one from our virtual devices. As unfortunate side effect we have packet in NS2 with a socket from NS1.That also does some really nasty things to accounting. Using the macvlan devices solve all of this rather neatly and with higher performance.
veth is not mainly affected, if it is connected to a bridge there will be no problem. You are talking about decision to switch/choose VE on level 2, I am told about layer 3, i.e. at the moment of routing/based on IP. So,
I do not understand how this will help me in my usecase. The macvlan device transmit the packet into real device. OK. But it does not help if I want to setup router in one namespace for another.
Basically, queue stop will not help, as routing namespace can have two interfaces, one fast and one slow. In your case we should stop accepting the message based on the slowest one?
Quoted 26 lines
Quoted 2 lines
So, we should have an architectural solution for this from a beginning. It will be too late to hack around and change namespace lookup scheme.
However what you are specifically concerned about seems to be using
skb->sk->sk_net. Currently the only place I use this is in the rtnetlink code because the functions that process packets are not also passed a socket. Those functions we could easily pass in an explicit namespace or a socket parameter, and so those functions would not care.Quoted 4 lines
I see that we should adopt a generic approach:
- each concrete packet belongs to a concrete namespace
- if function has a packet as a parameter, we should get namespace from packetThis approach when suggested in earlier review was pretty substantially shot down. Shrinking the size of struct
sk_buffis currently an ongoing todo for the linux networking stack.Quoted 3 lines
- if
skb->devis present we should get namespace asskb->dev->nd_net
- otherwise we should getskb->sk->sk_net. Ifskb->skis NULL -> this is a bugCurrently killing
skb->devis a todo list item, so using it more is probably the wrong approach.
Quoted 6 lines
I do agree the duplication information between fields on the skb and fields passed to functions is a pain. Moving more onto the skb seems contrary to the how the rest of the networking stack would like to go, so it is likely better to simply remove
skb->devand pass an explicit dev parameter instead. Please note that parameters passed explicitly will live in registers and will be quite fast.
how much registers do you have on i386 for this? the call found in my original letter already has 6. Additionally, we can be shot by embedded people arguing about 1 more argument and additional not needed for them code.... And namespace code becomes unremovable one by usual ifdef way.
Regards,
Den
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Denis V. Lunev
Quoted 2 lines
Grr. That last sentence should have been I do not see a need for the more fundamental change you seem to be advocating.
why?
Because I do not see the need. There are certainly details that can be improved, but you seem to be talking about ripping everything out, ignoring the reviews and the acceptance that has happened and starting from scratch all over again.
I don't see the need to start again from scratch.
Quoted 5 lines
veth is not mainly affected, if it is connected to a bridge there will be no problem. You are talking about decision to switch/choose VE on level 2, I am told about layer 3, i.e. at the moment of routing/based on IP. So,
Quoted 7 lines
I do not understand how this will help me in my usecase. The macvlan device transmit the packet into real device. OK. But it does not help if I want to setup router in one namespace for another.
Basically, queue stop will not help, as routing namespace can have two interfaces, one fast and one slow. In your case we should stop accepting the message based on the slowest one?
You are proposing a solution that only works for namespaces, while the problem continues to exist in all other routing cases. Solving this in a namespace specific way seems to reduce the value of using namespaces for testing weird aspects of the networking stack. And except for OpenVZ this is not a common case for anyone yet, so it seems a seriously premature optimization. Given that it could only be one path having something like ECN for UDP to slow the transmitter down would be nice.
The point of the macvlan example is that I believe that will be our common case when things network namespaces are deployed in the real world. Both because macvlans are easier to setup then routing or bridging, and because they perform better.
Further this problem feels like an application bug to me. Going from a fast to a slow network when you are saturating the fast network with UDP packets will cause packets to be dropped. If this is a problem the application should slow down it's packet transmission rate or at least wait for an ACK periodically.
Quoted 5 lines
how much registers do you have on i386 for this? the call found in my original letter already has 6. Additionally, we can be shot by embedded people arguing about 1 more argument and additional not needed for them code.... And namespace code becomes unremovable one by usual ifdef way.
Mucking with data on the skb has all kinds of potential for slowing down the fast path of the networking stack, and if the networking stack is slow the embedded people won't even use it. So as much as I am sympathetic to preventing code size growth, maintenance and performance are higher priorities. Especially when you are advocating growth in the fast path, while I am only advocating growth in the slow path.
As for i386 stack accesses are optimized almost as well as registers, so function parameters are still not a bad deal.
From the first couple of rounds of review the clear message was:
Maintainable and comprehensible code and don't touch the fast path.
If to achieve the above I have to use a solution that distresses the embedded people my apologies.
Eric
A message that is not in the archive (sent off-list or not yet received): m1przlbmu4.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org
Quoted 2 lines
If to achieve the above I have to use a solution that distresses the embedded people my apologies.
Sounds good for me :)
Regards,
Den