diff options
Diffstat (limited to 'net')
28 files changed, 243 insertions, 150 deletions
diff --git a/net/802/fc.c b/net/802/fc.c index cb3475ea6fda..34cf1ee014b8 100644 --- a/net/802/fc.c +++ b/net/802/fc.c | |||
@@ -82,13 +82,13 @@ static int fc_header(struct sk_buff *skb, struct net_device *dev, | |||
82 | 82 | ||
83 | static int fc_rebuild_header(struct sk_buff *skb) | 83 | static int fc_rebuild_header(struct sk_buff *skb) |
84 | { | 84 | { |
85 | #ifdef CONFIG_INET | ||
85 | struct fch_hdr *fch=(struct fch_hdr *)skb->data; | 86 | struct fch_hdr *fch=(struct fch_hdr *)skb->data; |
86 | struct fcllc *fcllc=(struct fcllc *)(skb->data+sizeof(struct fch_hdr)); | 87 | struct fcllc *fcllc=(struct fcllc *)(skb->data+sizeof(struct fch_hdr)); |
87 | if(fcllc->ethertype != htons(ETH_P_IP)) { | 88 | if(fcllc->ethertype != htons(ETH_P_IP)) { |
88 | printk("fc_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(fcllc->ethertype)); | 89 | printk("fc_rebuild_header: Don't know how to resolve type %04X addresses ?\n", ntohs(fcllc->ethertype)); |
89 | return 0; | 90 | return 0; |
90 | } | 91 | } |
91 | #ifdef CONFIG_INET | ||
92 | return arp_find(fch->daddr, skb); | 92 | return arp_find(fch->daddr, skb); |
93 | #else | 93 | #else |
94 | return 0; | 94 | return 0; |
diff --git a/net/bridge/netfilter/Kconfig b/net/bridge/netfilter/Kconfig index 366d3e9d51f8..ba6f73eb06c6 100644 --- a/net/bridge/netfilter/Kconfig +++ b/net/bridge/netfilter/Kconfig | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | menuconfig BRIDGE_NF_EBTABLES | 5 | menuconfig BRIDGE_NF_EBTABLES |
6 | tristate "Ethernet Bridge tables (ebtables) support" | 6 | tristate "Ethernet Bridge tables (ebtables) support" |
7 | depends on BRIDGE && BRIDGE_NETFILTER | ||
7 | select NETFILTER_XTABLES | 8 | select NETFILTER_XTABLES |
8 | help | 9 | help |
9 | ebtables is a general, extensible frame/packet identification | 10 | ebtables is a general, extensible frame/packet identification |
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index b0dc818a91d7..f1d07b5c1e17 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -96,7 +96,7 @@ static void net_free(struct net *net) | |||
96 | return; | 96 | return; |
97 | } | 97 | } |
98 | #endif | 98 | #endif |
99 | 99 | kfree(net->gen); | |
100 | kmem_cache_free(net_cachep, net); | 100 | kmem_cache_free(net_cachep, net); |
101 | } | 101 | } |
102 | 102 | ||
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 2f0ac3c3eb71..8008c8613027 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -152,7 +152,7 @@ static struct dn_dev_parms dn_dev_list[] = { | |||
152 | 152 | ||
153 | #define DN_DEV_LIST_SIZE ARRAY_SIZE(dn_dev_list) | 153 | #define DN_DEV_LIST_SIZE ARRAY_SIZE(dn_dev_list) |
154 | 154 | ||
155 | #define DN_DEV_PARMS_OFFSET(x) ((int) ((char *) &((struct dn_dev_parms *)0)->x)) | 155 | #define DN_DEV_PARMS_OFFSET(x) offsetof(struct dn_dev_parms, x) |
156 | 156 | ||
157 | #ifdef CONFIG_SYSCTL | 157 | #ifdef CONFIG_SYSCTL |
158 | 158 | ||
@@ -166,7 +166,7 @@ static int max_priority[] = { 127 }; /* From DECnet spec */ | |||
166 | 166 | ||
167 | static int dn_forwarding_proc(ctl_table *, int, struct file *, | 167 | static int dn_forwarding_proc(ctl_table *, int, struct file *, |
168 | void __user *, size_t *, loff_t *); | 168 | void __user *, size_t *, loff_t *); |
169 | static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen, | 169 | static int dn_forwarding_sysctl(ctl_table *table, |
170 | void __user *oldval, size_t __user *oldlenp, | 170 | void __user *oldval, size_t __user *oldlenp, |
171 | void __user *newval, size_t newlen); | 171 | void __user *newval, size_t newlen); |
172 | 172 | ||
@@ -318,7 +318,7 @@ static int dn_forwarding_proc(ctl_table *table, int write, | |||
318 | #endif | 318 | #endif |
319 | } | 319 | } |
320 | 320 | ||
321 | static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen, | 321 | static int dn_forwarding_sysctl(ctl_table *table, |
322 | void __user *oldval, size_t __user *oldlenp, | 322 | void __user *oldval, size_t __user *oldlenp, |
323 | void __user *newval, size_t newlen) | 323 | void __user *newval, size_t newlen) |
324 | { | 324 | { |
diff --git a/net/decnet/sysctl_net_decnet.c b/net/decnet/sysctl_net_decnet.c index 228067c571ba..36400b266896 100644 --- a/net/decnet/sysctl_net_decnet.c +++ b/net/decnet/sysctl_net_decnet.c | |||
@@ -132,7 +132,7 @@ static int parse_addr(__le16 *addr, char *str) | |||
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
135 | static int dn_node_address_strategy(ctl_table *table, int __user *name, int nlen, | 135 | static int dn_node_address_strategy(ctl_table *table, |
136 | void __user *oldval, size_t __user *oldlenp, | 136 | void __user *oldval, size_t __user *oldlenp, |
137 | void __user *newval, size_t newlen) | 137 | void __user *newval, size_t newlen) |
138 | { | 138 | { |
@@ -217,7 +217,7 @@ static int dn_node_address_handler(ctl_table *table, int write, | |||
217 | } | 217 | } |
218 | 218 | ||
219 | 219 | ||
220 | static int dn_def_dev_strategy(ctl_table *table, int __user *name, int nlen, | 220 | static int dn_def_dev_strategy(ctl_table *table, |
221 | void __user *oldval, size_t __user *oldlenp, | 221 | void __user *oldval, size_t __user *oldlenp, |
222 | void __user *newval, size_t newlen) | 222 | void __user *newval, size_t newlen) |
223 | { | 223 | { |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index b12dae2b0b2d..5154e729cf16 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1283,7 +1283,7 @@ static int devinet_conf_proc(ctl_table *ctl, int write, | |||
1283 | return ret; | 1283 | return ret; |
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen, | 1286 | static int devinet_conf_sysctl(ctl_table *table, |
1287 | void __user *oldval, size_t __user *oldlenp, | 1287 | void __user *oldval, size_t __user *oldlenp, |
1288 | void __user *newval, size_t newlen) | 1288 | void __user *newval, size_t newlen) |
1289 | { | 1289 | { |
@@ -1379,12 +1379,11 @@ int ipv4_doint_and_flush(ctl_table *ctl, int write, | |||
1379 | return ret; | 1379 | return ret; |
1380 | } | 1380 | } |
1381 | 1381 | ||
1382 | int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen, | 1382 | int ipv4_doint_and_flush_strategy(ctl_table *table, |
1383 | void __user *oldval, size_t __user *oldlenp, | 1383 | void __user *oldval, size_t __user *oldlenp, |
1384 | void __user *newval, size_t newlen) | 1384 | void __user *newval, size_t newlen) |
1385 | { | 1385 | { |
1386 | int ret = devinet_conf_sysctl(table, name, nlen, oldval, oldlenp, | 1386 | int ret = devinet_conf_sysctl(table, oldval, oldlenp, newval, newlen); |
1387 | newval, newlen); | ||
1388 | struct net *net = table->extra2; | 1387 | struct net *net = table->extra2; |
1389 | 1388 | ||
1390 | if (ret == 1) | 1389 | if (ret == 1) |
diff --git a/net/ipv4/netfilter/nf_defrag_ipv4.c b/net/ipv4/netfilter/nf_defrag_ipv4.c index aa2c50a180f7..fa2d6b6fc3e5 100644 --- a/net/ipv4/netfilter/nf_defrag_ipv4.c +++ b/net/ipv4/netfilter/nf_defrag_ipv4.c | |||
@@ -41,12 +41,13 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum, | |||
41 | int (*okfn)(struct sk_buff *)) | 41 | int (*okfn)(struct sk_buff *)) |
42 | { | 42 | { |
43 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 43 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
44 | #if !defined(CONFIG_NF_NAT) && !defined(CONFIG_NF_NAT_MODULE) | ||
44 | /* Previously seen (loopback)? Ignore. Do this before | 45 | /* Previously seen (loopback)? Ignore. Do this before |
45 | fragment check. */ | 46 | fragment check. */ |
46 | if (skb->nfct) | 47 | if (skb->nfct) |
47 | return NF_ACCEPT; | 48 | return NF_ACCEPT; |
48 | #endif | 49 | #endif |
49 | 50 | #endif | |
50 | /* Gather fragments. */ | 51 | /* Gather fragments. */ |
51 | if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) { | 52 | if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) { |
52 | if (nf_ct_ipv4_gather_frags(skb, | 53 | if (nf_ct_ipv4_gather_frags(skb, |
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 2ac9eaf1a8c9..a65cf692359f 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -584,6 +584,98 @@ static struct nf_ct_ext_type nat_extend __read_mostly = { | |||
584 | .flags = NF_CT_EXT_F_PREALLOC, | 584 | .flags = NF_CT_EXT_F_PREALLOC, |
585 | }; | 585 | }; |
586 | 586 | ||
587 | #if defined(CONFIG_NF_CT_NETLINK) || defined(CONFIG_NF_CT_NETLINK_MODULE) | ||
588 | |||
589 | #include <linux/netfilter/nfnetlink.h> | ||
590 | #include <linux/netfilter/nfnetlink_conntrack.h> | ||
591 | |||
592 | static const struct nla_policy protonat_nla_policy[CTA_PROTONAT_MAX+1] = { | ||
593 | [CTA_PROTONAT_PORT_MIN] = { .type = NLA_U16 }, | ||
594 | [CTA_PROTONAT_PORT_MAX] = { .type = NLA_U16 }, | ||
595 | }; | ||
596 | |||
597 | static int nfnetlink_parse_nat_proto(struct nlattr *attr, | ||
598 | const struct nf_conn *ct, | ||
599 | struct nf_nat_range *range) | ||
600 | { | ||
601 | struct nlattr *tb[CTA_PROTONAT_MAX+1]; | ||
602 | const struct nf_nat_protocol *npt; | ||
603 | int err; | ||
604 | |||
605 | err = nla_parse_nested(tb, CTA_PROTONAT_MAX, attr, protonat_nla_policy); | ||
606 | if (err < 0) | ||
607 | return err; | ||
608 | |||
609 | npt = nf_nat_proto_find_get(nf_ct_protonum(ct)); | ||
610 | if (npt->nlattr_to_range) | ||
611 | err = npt->nlattr_to_range(tb, range); | ||
612 | nf_nat_proto_put(npt); | ||
613 | return err; | ||
614 | } | ||
615 | |||
616 | static const struct nla_policy nat_nla_policy[CTA_NAT_MAX+1] = { | ||
617 | [CTA_NAT_MINIP] = { .type = NLA_U32 }, | ||
618 | [CTA_NAT_MAXIP] = { .type = NLA_U32 }, | ||
619 | }; | ||
620 | |||
621 | static int | ||
622 | nfnetlink_parse_nat(struct nlattr *nat, | ||
623 | const struct nf_conn *ct, struct nf_nat_range *range) | ||
624 | { | ||
625 | struct nlattr *tb[CTA_NAT_MAX+1]; | ||
626 | int err; | ||
627 | |||
628 | memset(range, 0, sizeof(*range)); | ||
629 | |||
630 | err = nla_parse_nested(tb, CTA_NAT_MAX, nat, nat_nla_policy); | ||
631 | if (err < 0) | ||
632 | return err; | ||
633 | |||
634 | if (tb[CTA_NAT_MINIP]) | ||
635 | range->min_ip = nla_get_be32(tb[CTA_NAT_MINIP]); | ||
636 | |||
637 | if (!tb[CTA_NAT_MAXIP]) | ||
638 | range->max_ip = range->min_ip; | ||
639 | else | ||
640 | range->max_ip = nla_get_be32(tb[CTA_NAT_MAXIP]); | ||
641 | |||
642 | if (range->min_ip) | ||
643 | range->flags |= IP_NAT_RANGE_MAP_IPS; | ||
644 | |||
645 | if (!tb[CTA_NAT_PROTO]) | ||
646 | return 0; | ||
647 | |||
648 | err = nfnetlink_parse_nat_proto(tb[CTA_NAT_PROTO], ct, range); | ||
649 | if (err < 0) | ||
650 | return err; | ||
651 | |||
652 | return 0; | ||
653 | } | ||
654 | |||
655 | static int | ||
656 | nfnetlink_parse_nat_setup(struct nf_conn *ct, | ||
657 | enum nf_nat_manip_type manip, | ||
658 | struct nlattr *attr) | ||
659 | { | ||
660 | struct nf_nat_range range; | ||
661 | |||
662 | if (nfnetlink_parse_nat(attr, ct, &range) < 0) | ||
663 | return -EINVAL; | ||
664 | if (nf_nat_initialized(ct, manip)) | ||
665 | return -EEXIST; | ||
666 | |||
667 | return nf_nat_setup_info(ct, &range, manip); | ||
668 | } | ||
669 | #else | ||
670 | static int | ||
671 | nfnetlink_parse_nat_setup(struct nf_conn *ct, | ||
672 | enum nf_nat_manip_type manip, | ||
673 | struct nlattr *attr) | ||
674 | { | ||
675 | return -EOPNOTSUPP; | ||
676 | } | ||
677 | #endif | ||
678 | |||
587 | static int __net_init nf_nat_net_init(struct net *net) | 679 | static int __net_init nf_nat_net_init(struct net *net) |
588 | { | 680 | { |
589 | net->ipv4.nat_bysource = nf_ct_alloc_hashtable(&nf_nat_htable_size, | 681 | net->ipv4.nat_bysource = nf_ct_alloc_hashtable(&nf_nat_htable_size, |
@@ -654,6 +746,9 @@ static int __init nf_nat_init(void) | |||
654 | 746 | ||
655 | BUG_ON(nf_nat_seq_adjust_hook != NULL); | 747 | BUG_ON(nf_nat_seq_adjust_hook != NULL); |
656 | rcu_assign_pointer(nf_nat_seq_adjust_hook, nf_nat_seq_adjust); | 748 | rcu_assign_pointer(nf_nat_seq_adjust_hook, nf_nat_seq_adjust); |
749 | BUG_ON(nfnetlink_parse_nat_setup_hook != NULL); | ||
750 | rcu_assign_pointer(nfnetlink_parse_nat_setup_hook, | ||
751 | nfnetlink_parse_nat_setup); | ||
657 | return 0; | 752 | return 0; |
658 | 753 | ||
659 | cleanup_extend: | 754 | cleanup_extend: |
@@ -667,10 +762,12 @@ static void __exit nf_nat_cleanup(void) | |||
667 | nf_ct_l3proto_put(l3proto); | 762 | nf_ct_l3proto_put(l3proto); |
668 | nf_ct_extend_unregister(&nat_extend); | 763 | nf_ct_extend_unregister(&nat_extend); |
669 | rcu_assign_pointer(nf_nat_seq_adjust_hook, NULL); | 764 | rcu_assign_pointer(nf_nat_seq_adjust_hook, NULL); |
765 | rcu_assign_pointer(nfnetlink_parse_nat_setup_hook, NULL); | ||
670 | synchronize_net(); | 766 | synchronize_net(); |
671 | } | 767 | } |
672 | 768 | ||
673 | MODULE_LICENSE("GPL"); | 769 | MODULE_LICENSE("GPL"); |
770 | MODULE_ALIAS("nf-nat-ipv4"); | ||
674 | 771 | ||
675 | module_init(nf_nat_init); | 772 | module_init(nf_nat_init); |
676 | module_exit(nf_nat_cleanup); | 773 | module_exit(nf_nat_cleanup); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index a6d7c584f53b..942be04e7955 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2908,8 +2908,6 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write, | |||
2908 | } | 2908 | } |
2909 | 2909 | ||
2910 | static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table, | 2910 | static int ipv4_sysctl_rtcache_flush_strategy(ctl_table *table, |
2911 | int __user *name, | ||
2912 | int nlen, | ||
2913 | void __user *oldval, | 2911 | void __user *oldval, |
2914 | size_t __user *oldlenp, | 2912 | size_t __user *oldlenp, |
2915 | void __user *newval, | 2913 | void __user *newval, |
@@ -2972,16 +2970,13 @@ static int ipv4_sysctl_rt_secret_interval(ctl_table *ctl, int write, | |||
2972 | } | 2970 | } |
2973 | 2971 | ||
2974 | static int ipv4_sysctl_rt_secret_interval_strategy(ctl_table *table, | 2972 | static int ipv4_sysctl_rt_secret_interval_strategy(ctl_table *table, |
2975 | int __user *name, | ||
2976 | int nlen, | ||
2977 | void __user *oldval, | 2973 | void __user *oldval, |
2978 | size_t __user *oldlenp, | 2974 | size_t __user *oldlenp, |
2979 | void __user *newval, | 2975 | void __user *newval, |
2980 | size_t newlen) | 2976 | size_t newlen) |
2981 | { | 2977 | { |
2982 | int old = ip_rt_secret_interval; | 2978 | int old = ip_rt_secret_interval; |
2983 | int ret = sysctl_jiffies(table, name, nlen, oldval, oldlenp, newval, | 2979 | int ret = sysctl_jiffies(table, oldval, oldlenp, newval, newlen); |
2984 | newlen); | ||
2985 | 2980 | ||
2986 | rt_secret_reschedule(old); | 2981 | rt_secret_reschedule(old); |
2987 | 2982 | ||
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 276d047fb85a..1bb10df8ce7d 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c | |||
@@ -64,8 +64,8 @@ static int ipv4_local_port_range(ctl_table *table, int write, struct file *filp, | |||
64 | } | 64 | } |
65 | 65 | ||
66 | /* Validate changes from sysctl interface. */ | 66 | /* Validate changes from sysctl interface. */ |
67 | static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name, | 67 | static int ipv4_sysctl_local_port_range(ctl_table *table, |
68 | int nlen, void __user *oldval, | 68 | void __user *oldval, |
69 | size_t __user *oldlenp, | 69 | size_t __user *oldlenp, |
70 | void __user *newval, size_t newlen) | 70 | void __user *newval, size_t newlen) |
71 | { | 71 | { |
@@ -80,7 +80,7 @@ static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name, | |||
80 | }; | 80 | }; |
81 | 81 | ||
82 | inet_get_local_port_range(range, range + 1); | 82 | inet_get_local_port_range(range, range + 1); |
83 | ret = sysctl_intvec(&tmp, name, nlen, oldval, oldlenp, newval, newlen); | 83 | ret = sysctl_intvec(&tmp, oldval, oldlenp, newval, newlen); |
84 | if (ret == 0 && newval && newlen) { | 84 | if (ret == 0 && newval && newlen) { |
85 | if (range[1] < range[0]) | 85 | if (range[1] < range[0]) |
86 | ret = -EINVAL; | 86 | ret = -EINVAL; |
@@ -109,8 +109,8 @@ static int proc_tcp_congestion_control(ctl_table *ctl, int write, struct file * | |||
109 | return ret; | 109 | return ret; |
110 | } | 110 | } |
111 | 111 | ||
112 | static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name, | 112 | static int sysctl_tcp_congestion_control(ctl_table *table, |
113 | int nlen, void __user *oldval, | 113 | void __user *oldval, |
114 | size_t __user *oldlenp, | 114 | size_t __user *oldlenp, |
115 | void __user *newval, size_t newlen) | 115 | void __user *newval, size_t newlen) |
116 | { | 116 | { |
@@ -122,7 +122,7 @@ static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name, | |||
122 | int ret; | 122 | int ret; |
123 | 123 | ||
124 | tcp_get_default_congestion_control(val); | 124 | tcp_get_default_congestion_control(val); |
125 | ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen); | 125 | ret = sysctl_string(&tbl, oldval, oldlenp, newval, newlen); |
126 | if (ret == 1 && newval && newlen) | 126 | if (ret == 1 && newval && newlen) |
127 | ret = tcp_set_default_congestion_control(val); | 127 | ret = tcp_set_default_congestion_control(val); |
128 | return ret; | 128 | return ret; |
@@ -165,8 +165,8 @@ static int proc_allowed_congestion_control(ctl_table *ctl, | |||
165 | return ret; | 165 | return ret; |
166 | } | 166 | } |
167 | 167 | ||
168 | static int strategy_allowed_congestion_control(ctl_table *table, int __user *name, | 168 | static int strategy_allowed_congestion_control(ctl_table *table, |
169 | int nlen, void __user *oldval, | 169 | void __user *oldval, |
170 | size_t __user *oldlenp, | 170 | size_t __user *oldlenp, |
171 | void __user *newval, | 171 | void __user *newval, |
172 | size_t newlen) | 172 | size_t newlen) |
@@ -179,7 +179,7 @@ static int strategy_allowed_congestion_control(ctl_table *table, int __user *nam | |||
179 | return -ENOMEM; | 179 | return -ENOMEM; |
180 | 180 | ||
181 | tcp_get_available_congestion_control(tbl.data, tbl.maxlen); | 181 | tcp_get_available_congestion_control(tbl.data, tbl.maxlen); |
182 | ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen); | 182 | ret = sysctl_string(&tbl, oldval, oldlenp, newval, newlen); |
183 | if (ret == 1 && newval && newlen) | 183 | if (ret == 1 && newval && newlen) |
184 | ret = tcp_set_allowed_congestion_control(tbl.data); | 184 | ret = tcp_set_allowed_congestion_control(tbl.data); |
185 | kfree(tbl.data); | 185 | kfree(tbl.data); |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 7b6a584b62dd..eea9542728ca 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -3982,7 +3982,6 @@ int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp, | |||
3982 | } | 3982 | } |
3983 | 3983 | ||
3984 | static int addrconf_sysctl_forward_strategy(ctl_table *table, | 3984 | static int addrconf_sysctl_forward_strategy(ctl_table *table, |
3985 | int __user *name, int nlen, | ||
3986 | void __user *oldval, | 3985 | void __user *oldval, |
3987 | size_t __user *oldlenp, | 3986 | size_t __user *oldlenp, |
3988 | void __user *newval, size_t newlen) | 3987 | void __user *newval, size_t newlen) |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 840b15780a36..172438320eec 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1199,7 +1199,7 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1199 | } | 1199 | } |
1200 | neigh->flags |= NTF_ROUTER; | 1200 | neigh->flags |= NTF_ROUTER; |
1201 | } else if (rt) { | 1201 | } else if (rt) { |
1202 | rt->rt6i_flags |= (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); | 1202 | rt->rt6i_flags = (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); |
1203 | } | 1203 | } |
1204 | 1204 | ||
1205 | if (rt) | 1205 | if (rt) |
@@ -1730,9 +1730,8 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f | |||
1730 | return ret; | 1730 | return ret; |
1731 | } | 1731 | } |
1732 | 1732 | ||
1733 | int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name, | 1733 | int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, |
1734 | int nlen, void __user *oldval, | 1734 | void __user *oldval, size_t __user *oldlenp, |
1735 | size_t __user *oldlenp, | ||
1736 | void __user *newval, size_t newlen) | 1735 | void __user *newval, size_t newlen) |
1737 | { | 1736 | { |
1738 | struct net_device *dev = ctl->extra1; | 1737 | struct net_device *dev = ctl->extra1; |
@@ -1745,13 +1744,11 @@ int ndisc_ifinfo_sysctl_strategy(ctl_table *ctl, int __user *name, | |||
1745 | 1744 | ||
1746 | switch (ctl->ctl_name) { | 1745 | switch (ctl->ctl_name) { |
1747 | case NET_NEIGH_REACHABLE_TIME: | 1746 | case NET_NEIGH_REACHABLE_TIME: |
1748 | ret = sysctl_jiffies(ctl, name, nlen, | 1747 | ret = sysctl_jiffies(ctl, oldval, oldlenp, newval, newlen); |
1749 | oldval, oldlenp, newval, newlen); | ||
1750 | break; | 1748 | break; |
1751 | case NET_NEIGH_RETRANS_TIME_MS: | 1749 | case NET_NEIGH_RETRANS_TIME_MS: |
1752 | case NET_NEIGH_REACHABLE_TIME_MS: | 1750 | case NET_NEIGH_REACHABLE_TIME_MS: |
1753 | ret = sysctl_ms_jiffies(ctl, name, nlen, | 1751 | ret = sysctl_ms_jiffies(ctl, oldval, oldlenp, newval, newlen); |
1754 | oldval, oldlenp, newval, newlen); | ||
1755 | break; | 1752 | break; |
1756 | default: | 1753 | default: |
1757 | ret = 0; | 1754 | ret = 0; |
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c index 6b29b03925f1..fd5b3a4e3329 100644 --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | int ip6_route_me_harder(struct sk_buff *skb) | 13 | int ip6_route_me_harder(struct sk_buff *skb) |
14 | { | 14 | { |
15 | struct net *net = dev_net(skb->dst->dev); | ||
15 | struct ipv6hdr *iph = ipv6_hdr(skb); | 16 | struct ipv6hdr *iph = ipv6_hdr(skb); |
16 | struct dst_entry *dst; | 17 | struct dst_entry *dst; |
17 | struct flowi fl = { | 18 | struct flowi fl = { |
@@ -23,7 +24,7 @@ int ip6_route_me_harder(struct sk_buff *skb) | |||
23 | .saddr = iph->saddr, } }, | 24 | .saddr = iph->saddr, } }, |
24 | }; | 25 | }; |
25 | 26 | ||
26 | dst = ip6_route_output(dev_net(skb->dst->dev), skb->sk, &fl); | 27 | dst = ip6_route_output(net, skb->sk, &fl); |
27 | 28 | ||
28 | #ifdef CONFIG_XFRM | 29 | #ifdef CONFIG_XFRM |
29 | if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && | 30 | if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && |
@@ -33,8 +34,7 @@ int ip6_route_me_harder(struct sk_buff *skb) | |||
33 | #endif | 34 | #endif |
34 | 35 | ||
35 | if (dst->error) { | 36 | if (dst->error) { |
36 | IP6_INC_STATS(&init_net, ip6_dst_idev(dst), | 37 | IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); |
37 | IPSTATS_MIB_OUTNOROUTES); | ||
38 | LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n"); | 38 | LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n"); |
39 | dst_release(dst); | 39 | dst_release(dst); |
40 | return -EINVAL; | 40 | return -EINVAL; |
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 2a4515623776..2ad504fc3414 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -545,8 +545,12 @@ static int netdev_notify(struct notifier_block *nb, | |||
545 | 545 | ||
546 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 546 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
547 | 547 | ||
548 | sprintf(buf, "netdev:%s", dev->name); | ||
549 | dir = sdata->debugfsdir; | 548 | dir = sdata->debugfsdir; |
549 | |||
550 | if (!dir) | ||
551 | return 0; | ||
552 | |||
553 | sprintf(buf, "netdev:%s", dev->name); | ||
550 | if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf)) | 554 | if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf)) |
551 | printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs " | 555 | printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs " |
552 | "dir to %s\n", buf); | 556 | "dir to %s\n", buf); |
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c index b9902e425f09..189d0bafa91a 100644 --- a/net/mac80211/debugfs_sta.c +++ b/net/mac80211/debugfs_sta.c | |||
@@ -249,11 +249,22 @@ void ieee80211_sta_debugfs_add(struct sta_info *sta) | |||
249 | DECLARE_MAC_BUF(mbuf); | 249 | DECLARE_MAC_BUF(mbuf); |
250 | u8 *mac; | 250 | u8 *mac; |
251 | 251 | ||
252 | sta->debugfs.add_has_run = true; | ||
253 | |||
252 | if (!stations_dir) | 254 | if (!stations_dir) |
253 | return; | 255 | return; |
254 | 256 | ||
255 | mac = print_mac(mbuf, sta->sta.addr); | 257 | mac = print_mac(mbuf, sta->sta.addr); |
256 | 258 | ||
259 | /* | ||
260 | * This might fail due to a race condition: | ||
261 | * When mac80211 unlinks a station, the debugfs entries | ||
262 | * remain, but it is already possible to link a new | ||
263 | * station with the same address which triggers adding | ||
264 | * it to debugfs; therefore, if the old station isn't | ||
265 | * destroyed quickly enough the old station's debugfs | ||
266 | * dir might still be around. | ||
267 | */ | ||
257 | sta->debugfs.dir = debugfs_create_dir(mac, stations_dir); | 268 | sta->debugfs.dir = debugfs_create_dir(mac, stations_dir); |
258 | if (!sta->debugfs.dir) | 269 | if (!sta->debugfs.dir) |
259 | return; | 270 | return; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 8025b294588b..156e42a003ae 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -816,8 +816,8 @@ struct ieee802_11_elems { | |||
816 | u8 *ext_supp_rates; | 816 | u8 *ext_supp_rates; |
817 | u8 *wmm_info; | 817 | u8 *wmm_info; |
818 | u8 *wmm_param; | 818 | u8 *wmm_param; |
819 | u8 *ht_cap_elem; | 819 | struct ieee80211_ht_cap *ht_cap_elem; |
820 | u8 *ht_info_elem; | 820 | struct ieee80211_ht_addt_info *ht_info_elem; |
821 | u8 *mesh_config; | 821 | u8 *mesh_config; |
822 | u8 *mesh_id; | 822 | u8 *mesh_id; |
823 | u8 *peer_link; | 823 | u8 *peer_link; |
@@ -844,8 +844,6 @@ struct ieee802_11_elems { | |||
844 | u8 ext_supp_rates_len; | 844 | u8 ext_supp_rates_len; |
845 | u8 wmm_info_len; | 845 | u8 wmm_info_len; |
846 | u8 wmm_param_len; | 846 | u8 wmm_param_len; |
847 | u8 ht_cap_elem_len; | ||
848 | u8 ht_info_elem_len; | ||
849 | u8 mesh_config_len; | 847 | u8 mesh_config_len; |
850 | u8 mesh_id_len; | 848 | u8 mesh_id_len; |
851 | u8 peer_link_len; | 849 | u8 peer_link_len; |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 49f86fa56bff..87665d7bb4f9 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1348,10 +1348,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, | |||
1348 | (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) { | 1348 | (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) { |
1349 | struct ieee80211_ht_bss_info bss_info; | 1349 | struct ieee80211_ht_bss_info bss_info; |
1350 | ieee80211_ht_cap_ie_to_ht_info( | 1350 | ieee80211_ht_cap_ie_to_ht_info( |
1351 | (struct ieee80211_ht_cap *) | ||
1352 | elems.ht_cap_elem, &sta->sta.ht_info); | 1351 | elems.ht_cap_elem, &sta->sta.ht_info); |
1353 | ieee80211_ht_addt_info_ie_to_ht_bss_info( | 1352 | ieee80211_ht_addt_info_ie_to_ht_bss_info( |
1354 | (struct ieee80211_ht_addt_info *) | ||
1355 | elems.ht_info_elem, &bss_info); | 1353 | elems.ht_info_elem, &bss_info); |
1356 | ieee80211_handle_ht(local, 1, &sta->sta.ht_info, &bss_info); | 1354 | ieee80211_handle_ht(local, 1, &sta->sta.ht_info, &bss_info); |
1357 | } | 1355 | } |
@@ -1709,7 +1707,6 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, | |||
1709 | struct ieee80211_ht_bss_info bss_info; | 1707 | struct ieee80211_ht_bss_info bss_info; |
1710 | 1708 | ||
1711 | ieee80211_ht_addt_info_ie_to_ht_bss_info( | 1709 | ieee80211_ht_addt_info_ie_to_ht_bss_info( |
1712 | (struct ieee80211_ht_addt_info *) | ||
1713 | elems.ht_info_elem, &bss_info); | 1710 | elems.ht_info_elem, &bss_info); |
1714 | changed |= ieee80211_handle_ht(local, 1, &conf->ht_conf, | 1711 | changed |= ieee80211_handle_ht(local, 1, &conf->ht_conf, |
1715 | &bss_info); | 1712 | &bss_info); |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 8e6685e7ae85..416bb41099f3 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -388,7 +388,8 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, | |||
388 | bss = ieee80211_bss_info_update(sdata->local, rx_status, | 388 | bss = ieee80211_bss_info_update(sdata->local, rx_status, |
389 | mgmt, skb->len, &elems, | 389 | mgmt, skb->len, &elems, |
390 | freq, beacon); | 390 | freq, beacon); |
391 | ieee80211_rx_bss_put(sdata->local, bss); | 391 | if (bss) |
392 | ieee80211_rx_bss_put(sdata->local, bss); | ||
392 | 393 | ||
393 | dev_kfree_skb(skb); | 394 | dev_kfree_skb(skb); |
394 | return RX_QUEUED; | 395 | return RX_QUEUED; |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 9b72d15bc8dc..7fef8ea1f5ec 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -635,7 +635,12 @@ static void sta_info_debugfs_add_work(struct work_struct *work) | |||
635 | 635 | ||
636 | spin_lock_irqsave(&local->sta_lock, flags); | 636 | spin_lock_irqsave(&local->sta_lock, flags); |
637 | list_for_each_entry(tmp, &local->sta_list, list) { | 637 | list_for_each_entry(tmp, &local->sta_list, list) { |
638 | if (!tmp->debugfs.dir) { | 638 | /* |
639 | * debugfs.add_has_run will be set by | ||
640 | * ieee80211_sta_debugfs_add regardless | ||
641 | * of what else it does. | ||
642 | */ | ||
643 | if (!tmp->debugfs.add_has_run) { | ||
639 | sta = tmp; | 644 | sta = tmp; |
640 | __sta_info_pin(sta); | 645 | __sta_info_pin(sta); |
641 | break; | 646 | break; |
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index a6b51862a89d..168a39a298bd 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -300,6 +300,7 @@ struct sta_info { | |||
300 | struct dentry *inactive_ms; | 300 | struct dentry *inactive_ms; |
301 | struct dentry *last_seq_ctrl; | 301 | struct dentry *last_seq_ctrl; |
302 | struct dentry *agg_status; | 302 | struct dentry *agg_status; |
303 | bool add_has_run; | ||
303 | } debugfs; | 304 | } debugfs; |
304 | #endif | 305 | #endif |
305 | 306 | ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index f32561ec224c..cee4884b9d06 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -529,12 +529,12 @@ void ieee802_11_parse_elems(u8 *start, size_t len, | |||
529 | elems->ext_supp_rates_len = elen; | 529 | elems->ext_supp_rates_len = elen; |
530 | break; | 530 | break; |
531 | case WLAN_EID_HT_CAPABILITY: | 531 | case WLAN_EID_HT_CAPABILITY: |
532 | elems->ht_cap_elem = pos; | 532 | if (elen >= sizeof(struct ieee80211_ht_cap)) |
533 | elems->ht_cap_elem_len = elen; | 533 | elems->ht_cap_elem = (void *)pos; |
534 | break; | 534 | break; |
535 | case WLAN_EID_HT_EXTRA_INFO: | 535 | case WLAN_EID_HT_EXTRA_INFO: |
536 | elems->ht_info_elem = pos; | 536 | if (elen >= sizeof(struct ieee80211_ht_addt_info)) |
537 | elems->ht_info_elem_len = elen; | 537 | elems->ht_info_elem = (void *)pos; |
538 | break; | 538 | break; |
539 | case WLAN_EID_MESH_ID: | 539 | case WLAN_EID_MESH_ID: |
540 | elems->mesh_id = pos; | 540 | elems->mesh_id = pos; |
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 7e0d53abde24..742f811ca416 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -775,7 +775,7 @@ static int ieee80211_ioctl_siwfrag(struct net_device *dev, | |||
775 | * configure it here */ | 775 | * configure it here */ |
776 | 776 | ||
777 | if (local->ops->set_frag_threshold) | 777 | if (local->ops->set_frag_threshold) |
778 | local->ops->set_frag_threshold( | 778 | return local->ops->set_frag_threshold( |
779 | local_to_hw(local), | 779 | local_to_hw(local), |
780 | local->fragmentation_threshold); | 780 | local->fragmentation_threshold); |
781 | 781 | ||
diff --git a/net/netfilter/nf_conntrack_acct.c b/net/netfilter/nf_conntrack_acct.c index 03591d37b9cc..b92df5c1dfcf 100644 --- a/net/netfilter/nf_conntrack_acct.c +++ b/net/netfilter/nf_conntrack_acct.c | |||
@@ -115,7 +115,7 @@ int nf_conntrack_acct_init(struct net *net) | |||
115 | 115 | ||
116 | if (net_eq(net, &init_net)) { | 116 | if (net_eq(net, &init_net)) { |
117 | #ifdef CONFIG_NF_CT_ACCT | 117 | #ifdef CONFIG_NF_CT_ACCT |
118 | printk(KERN_WARNING "CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Plase use\n"); | 118 | printk(KERN_WARNING "CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use\n"); |
119 | printk(KERN_WARNING "nf_conntrack.acct=1 kernel paramater, acct=1 nf_conntrack module option or\n"); | 119 | printk(KERN_WARNING "nf_conntrack.acct=1 kernel paramater, acct=1 nf_conntrack module option or\n"); |
120 | printk(KERN_WARNING "sysctl net.netfilter.nf_conntrack_acct=1 to enable it.\n"); | 120 | printk(KERN_WARNING "sysctl net.netfilter.nf_conntrack_acct=1 to enable it.\n"); |
121 | #endif | 121 | #endif |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 27de3c7b006e..622d7c671cb7 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -38,9 +38,16 @@ | |||
38 | #include <net/netfilter/nf_conntrack_core.h> | 38 | #include <net/netfilter/nf_conntrack_core.h> |
39 | #include <net/netfilter/nf_conntrack_extend.h> | 39 | #include <net/netfilter/nf_conntrack_extend.h> |
40 | #include <net/netfilter/nf_conntrack_acct.h> | 40 | #include <net/netfilter/nf_conntrack_acct.h> |
41 | #include <net/netfilter/nf_nat.h> | ||
41 | 42 | ||
42 | #define NF_CONNTRACK_VERSION "0.5.0" | 43 | #define NF_CONNTRACK_VERSION "0.5.0" |
43 | 44 | ||
45 | unsigned int | ||
46 | (*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct, | ||
47 | enum nf_nat_manip_type manip, | ||
48 | struct nlattr *attr) __read_mostly; | ||
49 | EXPORT_SYMBOL_GPL(nfnetlink_parse_nat_setup_hook); | ||
50 | |||
44 | DEFINE_SPINLOCK(nf_conntrack_lock); | 51 | DEFINE_SPINLOCK(nf_conntrack_lock); |
45 | EXPORT_SYMBOL_GPL(nf_conntrack_lock); | 52 | EXPORT_SYMBOL_GPL(nf_conntrack_lock); |
46 | 53 | ||
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index cadfd15b44f6..08e82d64eb6f 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -689,71 +689,6 @@ ctnetlink_parse_tuple(struct nlattr *cda[], struct nf_conntrack_tuple *tuple, | |||
689 | return 0; | 689 | return 0; |
690 | } | 690 | } |
691 | 691 | ||
692 | #ifdef CONFIG_NF_NAT_NEEDED | ||
693 | static const struct nla_policy protonat_nla_policy[CTA_PROTONAT_MAX+1] = { | ||
694 | [CTA_PROTONAT_PORT_MIN] = { .type = NLA_U16 }, | ||
695 | [CTA_PROTONAT_PORT_MAX] = { .type = NLA_U16 }, | ||
696 | }; | ||
697 | |||
698 | static int nfnetlink_parse_nat_proto(struct nlattr *attr, | ||
699 | const struct nf_conn *ct, | ||
700 | struct nf_nat_range *range) | ||
701 | { | ||
702 | struct nlattr *tb[CTA_PROTONAT_MAX+1]; | ||
703 | const struct nf_nat_protocol *npt; | ||
704 | int err; | ||
705 | |||
706 | err = nla_parse_nested(tb, CTA_PROTONAT_MAX, attr, protonat_nla_policy); | ||
707 | if (err < 0) | ||
708 | return err; | ||
709 | |||
710 | npt = nf_nat_proto_find_get(nf_ct_protonum(ct)); | ||
711 | if (npt->nlattr_to_range) | ||
712 | err = npt->nlattr_to_range(tb, range); | ||
713 | nf_nat_proto_put(npt); | ||
714 | return err; | ||
715 | } | ||
716 | |||
717 | static const struct nla_policy nat_nla_policy[CTA_NAT_MAX+1] = { | ||
718 | [CTA_NAT_MINIP] = { .type = NLA_U32 }, | ||
719 | [CTA_NAT_MAXIP] = { .type = NLA_U32 }, | ||
720 | }; | ||
721 | |||
722 | static inline int | ||
723 | nfnetlink_parse_nat(struct nlattr *nat, | ||
724 | const struct nf_conn *ct, struct nf_nat_range *range) | ||
725 | { | ||
726 | struct nlattr *tb[CTA_NAT_MAX+1]; | ||
727 | int err; | ||
728 | |||
729 | memset(range, 0, sizeof(*range)); | ||
730 | |||
731 | err = nla_parse_nested(tb, CTA_NAT_MAX, nat, nat_nla_policy); | ||
732 | if (err < 0) | ||
733 | return err; | ||
734 | |||
735 | if (tb[CTA_NAT_MINIP]) | ||
736 | range->min_ip = nla_get_be32(tb[CTA_NAT_MINIP]); | ||
737 | |||
738 | if (!tb[CTA_NAT_MAXIP]) | ||
739 | range->max_ip = range->min_ip; | ||
740 | else | ||
741 | range->max_ip = nla_get_be32(tb[CTA_NAT_MAXIP]); | ||
742 | |||
743 | if (range->min_ip) | ||
744 | range->flags |= IP_NAT_RANGE_MAP_IPS; | ||
745 | |||
746 | if (!tb[CTA_NAT_PROTO]) | ||
747 | return 0; | ||
748 | |||
749 | err = nfnetlink_parse_nat_proto(tb[CTA_NAT_PROTO], ct, range); | ||
750 | if (err < 0) | ||
751 | return err; | ||
752 | |||
753 | return 0; | ||
754 | } | ||
755 | #endif | ||
756 | |||
757 | static inline int | 692 | static inline int |
758 | ctnetlink_parse_help(struct nlattr *attr, char **helper_name) | 693 | ctnetlink_parse_help(struct nlattr *attr, char **helper_name) |
759 | { | 694 | { |
@@ -879,6 +814,34 @@ out: | |||
879 | } | 814 | } |
880 | 815 | ||
881 | static int | 816 | static int |
817 | ctnetlink_parse_nat_setup(struct nf_conn *ct, | ||
818 | enum nf_nat_manip_type manip, | ||
819 | struct nlattr *attr) | ||
820 | { | ||
821 | typeof(nfnetlink_parse_nat_setup_hook) parse_nat_setup; | ||
822 | |||
823 | parse_nat_setup = rcu_dereference(nfnetlink_parse_nat_setup_hook); | ||
824 | if (!parse_nat_setup) { | ||
825 | #ifdef CONFIG_KMOD | ||
826 | rcu_read_unlock(); | ||
827 | nfnl_unlock(); | ||
828 | if (request_module("nf-nat-ipv4") < 0) { | ||
829 | nfnl_lock(); | ||
830 | rcu_read_lock(); | ||
831 | return -EOPNOTSUPP; | ||
832 | } | ||
833 | nfnl_lock(); | ||
834 | rcu_read_lock(); | ||
835 | if (nfnetlink_parse_nat_setup_hook) | ||
836 | return -EAGAIN; | ||
837 | #endif | ||
838 | return -EOPNOTSUPP; | ||
839 | } | ||
840 | |||
841 | return parse_nat_setup(ct, manip, attr); | ||
842 | } | ||
843 | |||
844 | static int | ||
882 | ctnetlink_change_status(struct nf_conn *ct, struct nlattr *cda[]) | 845 | ctnetlink_change_status(struct nf_conn *ct, struct nlattr *cda[]) |
883 | { | 846 | { |
884 | unsigned long d; | 847 | unsigned long d; |
@@ -897,31 +860,6 @@ ctnetlink_change_status(struct nf_conn *ct, struct nlattr *cda[]) | |||
897 | /* ASSURED bit can only be set */ | 860 | /* ASSURED bit can only be set */ |
898 | return -EBUSY; | 861 | return -EBUSY; |
899 | 862 | ||
900 | if (cda[CTA_NAT_SRC] || cda[CTA_NAT_DST]) { | ||
901 | #ifndef CONFIG_NF_NAT_NEEDED | ||
902 | return -EOPNOTSUPP; | ||
903 | #else | ||
904 | struct nf_nat_range range; | ||
905 | |||
906 | if (cda[CTA_NAT_DST]) { | ||
907 | if (nfnetlink_parse_nat(cda[CTA_NAT_DST], ct, | ||
908 | &range) < 0) | ||
909 | return -EINVAL; | ||
910 | if (nf_nat_initialized(ct, IP_NAT_MANIP_DST)) | ||
911 | return -EEXIST; | ||
912 | nf_nat_setup_info(ct, &range, IP_NAT_MANIP_DST); | ||
913 | } | ||
914 | if (cda[CTA_NAT_SRC]) { | ||
915 | if (nfnetlink_parse_nat(cda[CTA_NAT_SRC], ct, | ||
916 | &range) < 0) | ||
917 | return -EINVAL; | ||
918 | if (nf_nat_initialized(ct, IP_NAT_MANIP_SRC)) | ||
919 | return -EEXIST; | ||
920 | nf_nat_setup_info(ct, &range, IP_NAT_MANIP_SRC); | ||
921 | } | ||
922 | #endif | ||
923 | } | ||
924 | |||
925 | /* Be careful here, modifying NAT bits can screw up things, | 863 | /* Be careful here, modifying NAT bits can screw up things, |
926 | * so don't let users modify them directly if they don't pass | 864 | * so don't let users modify them directly if they don't pass |
927 | * nf_nat_range. */ | 865 | * nf_nat_range. */ |
@@ -929,6 +867,31 @@ ctnetlink_change_status(struct nf_conn *ct, struct nlattr *cda[]) | |||
929 | return 0; | 867 | return 0; |
930 | } | 868 | } |
931 | 869 | ||
870 | static int | ||
871 | ctnetlink_change_nat(struct nf_conn *ct, struct nlattr *cda[]) | ||
872 | { | ||
873 | #ifdef CONFIG_NF_NAT_NEEDED | ||
874 | int ret; | ||
875 | |||
876 | if (cda[CTA_NAT_DST]) { | ||
877 | ret = ctnetlink_parse_nat_setup(ct, | ||
878 | IP_NAT_MANIP_DST, | ||
879 | cda[CTA_NAT_DST]); | ||
880 | if (ret < 0) | ||
881 | return ret; | ||
882 | } | ||
883 | if (cda[CTA_NAT_SRC]) { | ||
884 | ret = ctnetlink_parse_nat_setup(ct, | ||
885 | IP_NAT_MANIP_SRC, | ||
886 | cda[CTA_NAT_SRC]); | ||
887 | if (ret < 0) | ||
888 | return ret; | ||
889 | } | ||
890 | return 0; | ||
891 | #else | ||
892 | return -EOPNOTSUPP; | ||
893 | #endif | ||
894 | } | ||
932 | 895 | ||
933 | static inline int | 896 | static inline int |
934 | ctnetlink_change_helper(struct nf_conn *ct, struct nlattr *cda[]) | 897 | ctnetlink_change_helper(struct nf_conn *ct, struct nlattr *cda[]) |
@@ -1157,6 +1120,14 @@ ctnetlink_create_conntrack(struct nlattr *cda[], | |||
1157 | } | 1120 | } |
1158 | } | 1121 | } |
1159 | 1122 | ||
1123 | if (cda[CTA_NAT_SRC] || cda[CTA_NAT_DST]) { | ||
1124 | err = ctnetlink_change_nat(ct, cda); | ||
1125 | if (err < 0) { | ||
1126 | rcu_read_unlock(); | ||
1127 | goto err; | ||
1128 | } | ||
1129 | } | ||
1130 | |||
1160 | if (cda[CTA_PROTOINFO]) { | 1131 | if (cda[CTA_PROTOINFO]) { |
1161 | err = ctnetlink_change_protoinfo(ct, cda); | 1132 | err = ctnetlink_change_protoinfo(ct, cda); |
1162 | if (err < 0) { | 1133 | if (err < 0) { |
diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c index 373e51e91ce5..1bc3001d1827 100644 --- a/net/netfilter/nf_conntrack_pptp.c +++ b/net/netfilter/nf_conntrack_pptp.c | |||
@@ -65,7 +65,7 @@ void | |||
65 | struct nf_conntrack_expect *exp) __read_mostly; | 65 | struct nf_conntrack_expect *exp) __read_mostly; |
66 | EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_expectfn); | 66 | EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_expectfn); |
67 | 67 | ||
68 | #ifdef DEBUG | 68 | #if defined(DEBUG) || defined(CONFIG_DYNAMIC_PRINTK_DEBUG) |
69 | /* PptpControlMessageType names */ | 69 | /* PptpControlMessageType names */ |
70 | const char *const pptp_msg_name[] = { | 70 | const char *const pptp_msg_name[] = { |
71 | "UNKNOWN_MESSAGE", | 71 | "UNKNOWN_MESSAGE", |
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index b75c9c4a995d..4739f9f961d8 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -44,15 +44,17 @@ static struct sock *nfnl = NULL; | |||
44 | static const struct nfnetlink_subsystem *subsys_table[NFNL_SUBSYS_COUNT]; | 44 | static const struct nfnetlink_subsystem *subsys_table[NFNL_SUBSYS_COUNT]; |
45 | static DEFINE_MUTEX(nfnl_mutex); | 45 | static DEFINE_MUTEX(nfnl_mutex); |
46 | 46 | ||
47 | static inline void nfnl_lock(void) | 47 | void nfnl_lock(void) |
48 | { | 48 | { |
49 | mutex_lock(&nfnl_mutex); | 49 | mutex_lock(&nfnl_mutex); |
50 | } | 50 | } |
51 | EXPORT_SYMBOL_GPL(nfnl_lock); | ||
51 | 52 | ||
52 | static inline void nfnl_unlock(void) | 53 | void nfnl_unlock(void) |
53 | { | 54 | { |
54 | mutex_unlock(&nfnl_mutex); | 55 | mutex_unlock(&nfnl_mutex); |
55 | } | 56 | } |
57 | EXPORT_SYMBOL_GPL(nfnl_unlock); | ||
56 | 58 | ||
57 | int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n) | 59 | int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n) |
58 | { | 60 | { |
@@ -132,6 +134,7 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
132 | return 0; | 134 | return 0; |
133 | 135 | ||
134 | type = nlh->nlmsg_type; | 136 | type = nlh->nlmsg_type; |
137 | replay: | ||
135 | ss = nfnetlink_get_subsys(type); | 138 | ss = nfnetlink_get_subsys(type); |
136 | if (!ss) { | 139 | if (!ss) { |
137 | #ifdef CONFIG_KMOD | 140 | #ifdef CONFIG_KMOD |
@@ -165,7 +168,10 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | |||
165 | } else | 168 | } else |
166 | return -EINVAL; | 169 | return -EINVAL; |
167 | 170 | ||
168 | return nc->call(nfnl, skb, nlh, cda); | 171 | err = nc->call(nfnl, skb, nlh, cda); |
172 | if (err == -EAGAIN) | ||
173 | goto replay; | ||
174 | return err; | ||
169 | } | 175 | } |
170 | } | 176 | } |
171 | 177 | ||
diff --git a/net/wireless/core.c b/net/wireless/core.c index 24fdd4cd22cb..5031db7b275b 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -184,7 +184,8 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, | |||
184 | if (result) | 184 | if (result) |
185 | goto out_unlock; | 185 | goto out_unlock; |
186 | 186 | ||
187 | if (!debugfs_rename(rdev->wiphy.debugfsdir->d_parent, | 187 | if (rdev->wiphy.debugfsdir && |
188 | !debugfs_rename(rdev->wiphy.debugfsdir->d_parent, | ||
188 | rdev->wiphy.debugfsdir, | 189 | rdev->wiphy.debugfsdir, |
189 | rdev->wiphy.debugfsdir->d_parent, | 190 | rdev->wiphy.debugfsdir->d_parent, |
190 | newname)) | 191 | newname)) |
@@ -317,6 +318,8 @@ int wiphy_register(struct wiphy *wiphy) | |||
317 | drv->wiphy.debugfsdir = | 318 | drv->wiphy.debugfsdir = |
318 | debugfs_create_dir(wiphy_name(&drv->wiphy), | 319 | debugfs_create_dir(wiphy_name(&drv->wiphy), |
319 | ieee80211_debugfs_dir); | 320 | ieee80211_debugfs_dir); |
321 | if (IS_ERR(drv->wiphy.debugfsdir)) | ||
322 | drv->wiphy.debugfsdir = NULL; | ||
320 | 323 | ||
321 | res = 0; | 324 | res = 0; |
322 | out_unlock: | 325 | out_unlock: |