diff options
author | Paul Mackerras <paulus@samba.org> | 2008-01-31 01:25:51 +0100 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-01-31 01:25:51 +0100 |
commit | bd45ac0c5daae35e7c71138172e63df5cf644cf6 (patch) | |
tree | 5eb5a599bf6a9d7a8a34e802db932aa9e9555de4 /net/decnet | |
parent | Merge branch 'for-2.6.25' of git://git.secretlab.ca/git/linux-2.6-mpc52xx (diff) | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog (diff) | |
download | linux-bd45ac0c5daae35e7c71138172e63df5cf644cf6.tar.xz linux-bd45ac0c5daae35e7c71138172e63df5cf644cf6.zip |
Merge branch 'linux-2.6'
Diffstat (limited to 'net/decnet')
-rw-r--r-- | net/decnet/af_decnet.c | 2 | ||||
-rw-r--r-- | net/decnet/dn_dev.c | 70 | ||||
-rw-r--r-- | net/decnet/dn_fib.c | 10 | ||||
-rw-r--r-- | net/decnet/dn_neigh.c | 6 | ||||
-rw-r--r-- | net/decnet/dn_nsp_out.c | 2 | ||||
-rw-r--r-- | net/decnet/dn_route.c | 37 | ||||
-rw-r--r-- | net/decnet/dn_rules.c | 3 | ||||
-rw-r--r-- | net/decnet/dn_table.c | 8 | ||||
-rw-r--r-- | net/decnet/netfilter/Kconfig | 1 | ||||
-rw-r--r-- | net/decnet/netfilter/dn_rtmsg.c | 6 | ||||
-rw-r--r-- | net/decnet/sysctl_net_decnet.c | 23 |
11 files changed, 77 insertions, 91 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 57d574951838..acd48ee522d6 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c @@ -1904,7 +1904,7 @@ static inline struct sk_buff *dn_alloc_send_pskb(struct sock *sk, struct sk_buff *skb = sock_alloc_send_skb(sk, datalen, noblock, errcode); if (skb) { - skb->protocol = __constant_htons(ETH_P_DNA_RT); + skb->protocol = htons(ETH_P_DNA_RT); skb->pkt_type = PACKET_OUTGOING; } return skb; diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 3bc82dc83b38..1bbfce5f7a2d 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c @@ -173,10 +173,6 @@ static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen, static struct dn_dev_sysctl_table { struct ctl_table_header *sysctl_header; ctl_table dn_dev_vars[5]; - ctl_table dn_dev_dev[2]; - ctl_table dn_dev_conf_dir[2]; - ctl_table dn_dev_proto_dir[2]; - ctl_table dn_dev_root_dir[2]; } dn_dev_sysctl = { NULL, { @@ -224,30 +220,6 @@ static struct dn_dev_sysctl_table { }, {0} }, - {{ - .ctl_name = 0, - .procname = "", - .mode = 0555, - .child = dn_dev_sysctl.dn_dev_vars - }, {0}}, - {{ - .ctl_name = NET_DECNET_CONF, - .procname = "conf", - .mode = 0555, - .child = dn_dev_sysctl.dn_dev_dev - }, {0}}, - {{ - .ctl_name = NET_DECNET, - .procname = "decnet", - .mode = 0555, - .child = dn_dev_sysctl.dn_dev_conf_dir - }, {0}}, - {{ - .ctl_name = CTL_NET, - .procname = "net", - .mode = 0555, - .child = dn_dev_sysctl.dn_dev_proto_dir - }, {0}} }; static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms *parms) @@ -255,6 +227,16 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms * struct dn_dev_sysctl_table *t; int i; +#define DN_CTL_PATH_DEV 3 + + struct ctl_path dn_ctl_path[] = { + { .procname = "net", .ctl_name = CTL_NET, }, + { .procname = "decnet", .ctl_name = NET_DECNET, }, + { .procname = "conf", .ctl_name = NET_DECNET_CONF, }, + { /* to be set */ }, + { }, + }; + t = kmemdup(&dn_dev_sysctl, sizeof(*t), GFP_KERNEL); if (t == NULL) return; @@ -265,20 +247,16 @@ static void dn_dev_sysctl_register(struct net_device *dev, struct dn_dev_parms * } if (dev) { - t->dn_dev_dev[0].procname = dev->name; - t->dn_dev_dev[0].ctl_name = dev->ifindex; + dn_ctl_path[DN_CTL_PATH_DEV].procname = dev->name; + dn_ctl_path[DN_CTL_PATH_DEV].ctl_name = dev->ifindex; } else { - t->dn_dev_dev[0].procname = parms->name; - t->dn_dev_dev[0].ctl_name = parms->ctl_name; + dn_ctl_path[DN_CTL_PATH_DEV].procname = parms->name; + dn_ctl_path[DN_CTL_PATH_DEV].ctl_name = parms->ctl_name; } - t->dn_dev_dev[0].child = t->dn_dev_vars; - t->dn_dev_conf_dir[0].child = t->dn_dev_dev; - t->dn_dev_proto_dir[0].child = t->dn_dev_conf_dir; - t->dn_dev_root_dir[0].child = t->dn_dev_proto_dir; t->dn_dev_vars[0].extra1 = (void *)dev; - t->sysctl_header = register_sysctl_table(t->dn_dev_root_dir); + t->sysctl_header = register_sysctl_paths(dn_ctl_path, t->dn_dev_vars); if (t->sysctl_header == NULL) kfree(t); else @@ -647,11 +625,15 @@ 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; + int err = -EINVAL; + + if (net != &init_net) + goto errout; err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy); if (err < 0) @@ -681,6 +663,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; @@ -688,6 +671,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; @@ -785,19 +771,23 @@ 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) { + 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]; diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c index 3760a20d10d0..4aa9a423e606 100644 --- a/net/decnet/dn_fib.c +++ b/net/decnet/dn_fib.c @@ -203,8 +203,6 @@ static int dn_fib_check_nh(const struct rtmsg *r, struct dn_fib_info *fi, struct struct flowi fl; struct dn_fib_res res; - memset(&fl, 0, sizeof(fl)); - if (nh->nh_flags&RTNH_F_ONLINK) { struct net_device *dev; @@ -506,10 +504,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 +524,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; diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c index e851b143cca3..1ca13b17974d 100644 --- a/net/decnet/dn_neigh.c +++ b/net/decnet/dn_neigh.c @@ -580,8 +580,8 @@ static const struct seq_operations dn_neigh_seq_ops = { static int dn_neigh_seq_open(struct inode *inode, struct file *file) { - return seq_open_private(file, &dn_neigh_seq_ops, - sizeof(struct neigh_seq_state)); + return seq_open_net(inode, file, &dn_neigh_seq_ops, + sizeof(struct neigh_seq_state)); } static const struct file_operations dn_neigh_seq_fops = { @@ -589,7 +589,7 @@ static const struct file_operations dn_neigh_seq_fops = { .open = dn_neigh_seq_open, .read = seq_read, .llseek = seq_lseek, - .release = seq_release_private, + .release = seq_release_net, }; #endif diff --git a/net/decnet/dn_nsp_out.c b/net/decnet/dn_nsp_out.c index 7404653880b0..1964faf203e4 100644 --- a/net/decnet/dn_nsp_out.c +++ b/net/decnet/dn_nsp_out.c @@ -124,7 +124,7 @@ struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri) if ((skb = alloc_skb(size + hdr, pri)) == NULL) return NULL; - skb->protocol = __constant_htons(ETH_P_DNA_RT); + skb->protocol = htons(ETH_P_DNA_RT); skb->pkt_type = PACKET_OUTGOING; if (sk) diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 0e10ff21e292..31be29b8b5a3 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c @@ -107,7 +107,7 @@ static const int dn_rt_mtu_expires = 10 * 60 * HZ; static unsigned long dn_rt_deadline; -static int dn_dst_gc(void); +static int dn_dst_gc(struct dst_ops *ops); static struct dst_entry *dn_dst_check(struct dst_entry *, __u32); static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); static void dn_dst_link_failure(struct sk_buff *); @@ -185,7 +185,7 @@ static void dn_dst_check_expire(unsigned long dummy) mod_timer(&dn_route_timer, now + decnet_dst_gc_interval * HZ); } -static int dn_dst_gc(void) +static int dn_dst_gc(struct dst_ops *ops) { struct dn_route *rt, **rtp; int i; @@ -765,17 +765,6 @@ drop: } /* - * Drop packet. This is used for endnodes and for - * when we should not be forwarding packets from - * this dest. - */ -static int dn_blackhole(struct sk_buff *skb) -{ - kfree_skb(skb); - return NET_RX_DROP; -} - -/* * Used to catch bugs. This should never normally get * called. */ @@ -995,7 +984,7 @@ source_ok: * here */ if (!try_hard) { - neigh = neigh_lookup_nodev(&dn_neigh_table, &fl.fld_dst); + neigh = neigh_lookup_nodev(&dn_neigh_table, &init_net, &fl.fld_dst); if (neigh) { if ((oldflp->oif && (neigh->dev->ifindex != oldflp->oif)) || @@ -1207,7 +1196,8 @@ int dn_route_output_sock(struct dst_entry **pprt, struct flowi *fl, struct sock err = __dn_route_output_key(pprt, fl, flags & MSG_TRYHARD); if (err == 0 && fl->proto) { - err = xfrm_lookup(pprt, fl, sk, !(flags & MSG_DONTWAIT)); + err = xfrm_lookup(pprt, fl, sk, (flags & MSG_DONTWAIT) ? + 0 : XFRM_LOOKUP_WAIT); } return err; } @@ -1396,7 +1386,7 @@ make_route: default: case RTN_UNREACHABLE: case RTN_BLACKHOLE: - rt->u.dst.input = dn_blackhole; + rt->u.dst.input = dst_discard; } rt->rt_flags = flags; if (rt->u.dst.dev) @@ -1522,6 +1512,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; @@ -1530,6 +1521,9 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void struct sk_buff *skb; struct flowi fl; + if (net != &init_net) + return -EINVAL; + memset(&fl, 0, sizeof(fl)); fl.proto = DNPROTO_NSP; @@ -1557,7 +1551,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void kfree_skb(skb); return -ENODEV; } - skb->protocol = __constant_htons(ETH_P_DNA_RT); + skb->protocol = htons(ETH_P_DNA_RT); skb->dev = dev; cb->src = fl.fld_src; cb->dst = fl.fld_dst; @@ -1594,7 +1588,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); @@ -1607,10 +1601,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)) @@ -1752,8 +1750,7 @@ void __init dn_route_init(void) dn_dst_ops.kmem_cachep = kmem_cache_create("dn_dst_cache", sizeof(struct dn_route), 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); - init_timer(&dn_route_timer); - dn_route_timer.function = dn_dst_check_expire; + setup_timer(&dn_route_timer, dn_dst_check_expire, 0); dn_route_timer.expires = jiffies + decnet_dst_gc_interval * HZ; add_timer(&dn_route_timer); diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c index ffebea04cc99..5b7539b7fe0c 100644 --- a/net/decnet/dn_rules.c +++ b/net/decnet/dn_rules.c @@ -212,7 +212,7 @@ nla_put_failure: return -ENOBUFS; } -static u32 dn_fib_rule_default_pref(void) +static u32 dn_fib_rule_default_pref(struct fib_rules_ops *ops) { struct list_head *pos; struct fib_rule *rule; @@ -249,6 +249,7 @@ static struct fib_rules_ops dn_fib_rules_ops = { .policy = dn_fib_rule_policy, .rules_list = LIST_HEAD_INIT(dn_fib_rules_ops.rules_list), .owner = THIS_MODULE, + .fro_net = &init_net, }; void __init dn_fib_rules_init(void) diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index fda0772fa215..e09d915dbd77 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c @@ -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, @@ -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); diff --git a/net/decnet/netfilter/Kconfig b/net/decnet/netfilter/Kconfig index ecdb3f9f14ca..2f81de5e752f 100644 --- a/net/decnet/netfilter/Kconfig +++ b/net/decnet/netfilter/Kconfig @@ -4,6 +4,7 @@ menu "DECnet: Netfilter Configuration" depends on DECNET && NETFILTER && EXPERIMENTAL + depends on NETFILTER_ADVANCED config DECNET_NF_GRABULATOR tristate "Routing message grabulator (for userland routing daemon)" diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c index 43fcd29046d1..6d2bd3202048 100644 --- a/net/decnet/netfilter/dn_rtmsg.c +++ b/net/decnet/netfilter/dn_rtmsg.c @@ -115,7 +115,7 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb) RCV_SKB_FAIL(-EINVAL); } -static struct nf_hook_ops dnrmg_ops = { +static struct nf_hook_ops dnrmg_ops __read_mostly = { .hook = dnrmg_hook, .pf = PF_DECnet, .hooknum = NF_DN_ROUTE, @@ -137,7 +137,7 @@ static int __init dn_rtmsg_init(void) rv = nf_register_hook(&dnrmg_ops); if (rv) { - sock_release(dnrmg->sk_socket); + netlink_kernel_release(dnrmg); } return rv; @@ -146,7 +146,7 @@ static int __init dn_rtmsg_init(void) static void __exit dn_rtmsg_fini(void) { nf_unregister_hook(&dnrmg_ops); - sock_release(dnrmg->sk_socket); + netlink_kernel_release(dnrmg); } diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c index ae354a43fb97..228067c571ba 100644 --- a/net/decnet/sysctl_net_decnet.c +++ b/net/decnet/sysctl_net_decnet.c @@ -470,28 +470,15 @@ static ctl_table dn_table[] = { {0} }; -static ctl_table dn_dir_table[] = { - { - .ctl_name = NET_DECNET, - .procname = "decnet", - .mode = 0555, - .child = dn_table}, - {0} -}; - -static ctl_table dn_root_table[] = { - { - .ctl_name = CTL_NET, - .procname = "net", - .mode = 0555, - .child = dn_dir_table - }, - {0} +static struct ctl_path dn_path[] = { + { .procname = "net", .ctl_name = CTL_NET, }, + { .procname = "decnet", .ctl_name = NET_DECNET, }, + { } }; void dn_register_sysctl(void) { - dn_table_header = register_sysctl_table(dn_root_table); + dn_table_header = register_sysctl_paths(dn_path, dn_table); } void dn_unregister_sysctl(void) |