aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/802/fc.c1
-rw-r--r--net/802/garp.c1
-rw-r--r--net/802/stp.c1
-rw-r--r--net/8021q/vlan_core.c1
-rw-r--r--net/8021q/vlan_dev.c10
-rw-r--r--net/8021q/vlan_netlink.c1
-rw-r--r--net/appletalk/aarp.c1
-rw-r--r--net/appletalk/atalk_proc.c1
-rw-r--r--net/atm/pvc.c1
-rw-r--r--net/atm/svc.c1
-rw-r--r--net/ax25/ax25_route.c1
-rw-r--r--net/ax25/ax25_uid.c1
-rw-r--r--net/bluetooth/hci_sysfs.c1
-rw-r--r--net/bluetooth/l2cap_sock.c1
-rw-r--r--net/bluetooth/mgmt.c1
-rw-r--r--net/bridge/br_input.c1
-rw-r--r--net/bridge/br_multicast.c6
-rw-r--r--net/bridge/br_stp_if.c1
-rw-r--r--net/bridge/netfilter/ebt_ulog.c7
-rw-r--r--net/caif/caif_dev.c1
-rw-r--r--net/caif/cffrml.c11
-rw-r--r--net/caif/cfpkt_skbuff.c1
-rw-r--r--net/ceph/Kconfig14
-rw-r--r--net/ceph/ceph_common.c47
-rw-r--r--net/ceph/messenger.c131
-rw-r--r--net/ceph/mon_client.c79
-rw-r--r--net/ceph/msgpool.c4
-rw-r--r--net/ceph/osd_client.c34
-rw-r--r--net/compat.c1
-rw-r--r--net/core/dev.c6
-rw-r--r--net/core/dev_addr_lists.c4
-rw-r--r--net/core/fib_rules.c1
-rw-r--r--net/core/neighbour.c11
-rw-r--r--net/core/net-sysfs.c1
-rw-r--r--net/core/net-traces.c1
-rw-r--r--net/core/net_namespace.c1
-rw-r--r--net/core/netevent.c1
-rw-r--r--net/core/netpoll.c1
-rw-r--r--net/core/skbuff.c3
-rw-r--r--net/core/timestamping.c1
-rw-r--r--net/core/user_dma.c1
-rw-r--r--net/dcb/dcbevent.c1
-rw-r--r--net/dcb/dcbnl.c1
-rw-r--r--net/dccp/ackvec.c1
-rw-r--r--net/dccp/ccids/lib/tfrc.c1
-rw-r--r--net/dccp/ipv4.c2
-rw-r--r--net/dccp/timer.c1
-rw-r--r--net/decnet/dn_route.c11
-rw-r--r--net/decnet/dn_rules.c1
-rw-r--r--net/decnet/dn_timer.c17
-rw-r--r--net/dsa/dsa.c1
-rw-r--r--net/ieee802154/nl-mac.c1
-rw-r--r--net/ipv4/ah4.c8
-rw-r--r--net/ipv4/fib_rules.c1
-rw-r--r--net/ipv4/fib_trie.c1
-rw-r--r--net/ipv4/igmp.c3
-rw-r--r--net/ipv4/inet_diag.c14
-rw-r--r--net/ipv4/inet_timewait_sock.c1
-rw-r--r--net/ipv4/ip_forward.c2
-rw-r--r--net/ipv4/ip_options.c4
-rw-r--r--net/ipv4/ipconfig.c1
-rw-r--r--net/ipv4/ipmr.c1
-rw-r--r--net/ipv4/netfilter.c4
-rw-r--r--net/ipv4/netfilter/Kconfig1
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c1
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c4
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c1
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_common.c1
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_icmp.c1
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_sctp.c1
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_tcp.c1
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_udp.c1
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_udplite.c1
-rw-r--r--net/ipv4/netfilter/nf_nat_snmp_basic.c22
-rw-r--r--net/ipv4/ping.c3
-rw-r--r--net/ipv4/proc.c1
-rw-r--r--net/ipv4/raw.c1
-rw-r--r--net/ipv4/route.c153
-rw-r--r--net/ipv4/syncookies.c1
-rw-r--r--net/ipv4/tcp_ipv4.c24
-rw-r--r--net/ipv4/tcp_output.c2
-rw-r--r--net/ipv4/udp.c30
-rw-r--r--net/ipv4/udplite.c14
-rw-r--r--net/ipv4/xfrm4_state.c1
-rw-r--r--net/ipv6/addrconf.c1
-rw-r--r--net/ipv6/addrconf_core.c1
-rw-r--r--net/ipv6/ah6.c8
-rw-r--r--net/ipv6/exthdrs.c1
-rw-r--r--net/ipv6/exthdrs_core.c1
-rw-r--r--net/ipv6/fib6_rules.c1
-rw-r--r--net/ipv6/inet6_connection_sock.c2
-rw-r--r--net/ipv6/ip6_flowlabel.c1
-rw-r--r--net/ipv6/ip6_input.c8
-rw-r--r--net/ipv6/ip6_tunnel.c8
-rw-r--r--net/ipv6/ip6mr.c1
-rw-r--r--net/ipv6/ipv6_sockglue.c2
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/ipv6/netfilter.c14
-rw-r--r--net/ipv6/netfilter/Kconfig1
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c7
-rw-r--r--net/ipv6/proc.c1
-rw-r--r--net/ipv6/raw.c1
-rw-r--r--net/ipv6/reassembly.c1
-rw-r--r--net/ipv6/route.c22
-rw-r--r--net/ipv6/sysctl_net_ipv6.c1
-rw-r--r--net/ipv6/tcp_ipv6.c25
-rw-r--r--net/ipv6/udp.c12
-rw-r--r--net/ipv6/udplite.c14
-rw-r--r--net/ipv6/xfrm6_state.c1
-rw-r--r--net/ipx/ipx_proc.c1
-rw-r--r--net/irda/discovery.c1
-rw-r--r--net/irda/irda_device.c1
-rw-r--r--net/irda/irttp.c1
-rw-r--r--net/irda/qos.c2
-rw-r--r--net/l2tp/l2tp_core.c13
-rw-r--r--net/llc/llc_input.c1
-rw-r--r--net/llc/llc_output.c1
-rw-r--r--net/llc/llc_proc.c1
-rw-r--r--net/mac80211/agg-rx.c1
-rw-r--r--net/mac80211/agg-tx.c1
-rw-r--r--net/mac80211/ht.c1
-rw-r--r--net/mac80211/key.c1
-rw-r--r--net/mac80211/led.c1
-rw-r--r--net/mac80211/mlme.c2
-rw-r--r--net/mac80211/offchannel.c1
-rw-r--r--net/mac80211/rate.c1
-rw-r--r--net/mac80211/rc80211_minstrel_debugfs.c1
-rw-r--r--net/mac80211/rc80211_minstrel_ht_debugfs.c1
-rw-r--r--net/mac80211/rc80211_pid_debugfs.c1
-rw-r--r--net/mac80211/rx.c1
-rw-r--r--net/mac80211/scan.c1
-rw-r--r--net/mac80211/status.c1
-rw-r--r--net/mac80211/tkip.c1
-rw-r--r--net/mac80211/tx.c1
-rw-r--r--net/mac80211/util.c1
-rw-r--r--net/netfilter/Kconfig1
-rw-r--r--net/netfilter/core.c11
-rw-r--r--net/netfilter/ipset/ip_set_core.c4
-rw-r--r--net/netfilter/ipset/ip_set_getport.c1
-rw-r--r--net/netfilter/ipset/ip_set_hash_ipport.c2
-rw-r--r--net/netfilter/ipset/ip_set_hash_ipportip.c2
-rw-r--r--net/netfilter/ipset/ip_set_hash_ipportnet.c2
-rw-r--r--net/netfilter/ipset/pfxlen.c1
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c20
-rw-r--r--net/netfilter/ipvs/ip_vs_ctl.c22
-rw-r--r--net/netfilter/ipvs/ip_vs_dh.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_ftp.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_lblc.c9
-rw-r--r--net/netfilter/ipvs/ip_vs_lblcr.c13
-rw-r--r--net/netfilter/ipvs/ip_vs_nfct.c2
-rw-r--r--net/netfilter/ipvs/ip_vs_proto.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_proto_sctp.c14
-rw-r--r--net/netfilter/ipvs/ip_vs_proto_tcp.c6
-rw-r--r--net/netfilter/ipvs/ip_vs_proto_udp.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_sh.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_wrr.c5
-rw-r--r--net/netfilter/ipvs/ip_vs_xmit.c2
-rw-r--r--net/netfilter/nf_conntrack_acct.c1
-rw-r--r--net/netfilter/nf_conntrack_core.c5
-rw-r--r--net/netfilter/nf_conntrack_ecache.c38
-rw-r--r--net/netfilter/nf_conntrack_expect.c2
-rw-r--r--net/netfilter/nf_conntrack_netlink.c73
-rw-r--r--net/netfilter/nfnetlink_log.c7
-rw-r--r--net/netfilter/x_tables.c1
-rw-r--r--net/netfilter/xt_IDLETIMER.c2
-rw-r--r--net/netfilter/xt_hashlimit.c5
-rw-r--r--net/netfilter/xt_quota.c1
-rw-r--r--net/netfilter/xt_statistic.c1
-rw-r--r--net/netlabel/netlabel_kapi.c26
-rw-r--r--net/netrom/nr_route.c1
-rw-r--r--net/nfc/af_nfc.c1
-rw-r--r--net/nfc/nci/core.c1
-rw-r--r--net/nfc/nfc.h2
-rw-r--r--net/nfc/rawsock.c1
-rw-r--r--net/packet/af_packet.c52
-rw-r--r--net/phonet/datagram.c1
-rw-r--r--net/phonet/pep.c1
-rw-r--r--net/phonet/socket.c1
-rw-r--r--net/rds/Kconfig1
-rw-r--r--net/rds/cong.c1
-rw-r--r--net/rds/connection.c1
-rw-r--r--net/rds/ib.c1
-rw-r--r--net/rds/info.c1
-rw-r--r--net/rds/iw.c1
-rw-r--r--net/rds/message.c1
-rw-r--r--net/rds/page.c1
-rw-r--r--net/rds/rdma_transport.c1
-rw-r--r--net/rds/rds.h8
-rw-r--r--net/rds/recv.c1
-rw-r--r--net/rds/send.c2
-rw-r--r--net/rds/stats.c1
-rw-r--r--net/rds/tcp.c1
-rw-r--r--net/rds/threads.c1
-rw-r--r--net/rfkill/input.c1
-rw-r--r--net/rose/rose_route.c1
-rw-r--r--net/rxrpc/ar-output.c1
-rw-r--r--net/rxrpc/ar-recvmsg.c1
-rw-r--r--net/sched/act_api.c1
-rw-r--r--net/sched/cls_flow.c1
-rw-r--r--net/sched/sch_mq.c1
-rw-r--r--net/sched/sch_mqprio.c1
-rw-r--r--net/sctp/auth.c2
-rw-r--r--net/sctp/proc.c1
-rw-r--r--net/sctp/socket.c1
-rw-r--r--net/sunrpc/addr.c1
-rw-r--r--net/sunrpc/auth_unix.c3
-rw-r--r--net/sunrpc/backchannel_rqst.c1
-rw-r--r--net/sunrpc/rpcb_clnt.c88
-rw-r--r--net/sunrpc/socklib.c1
-rw-r--r--net/sunrpc/sunrpc_syms.c3
-rw-r--r--net/sunrpc/svc.c53
-rw-r--r--net/sunrpc/svc_xprt.c1
-rw-r--r--net/sunrpc/svcsock.c1
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_transport.c1
-rw-r--r--net/sysctl_net.c1
-rw-r--r--net/tipc/core.c2
-rw-r--r--net/tipc/socket.c1
-rw-r--r--net/unix/af_unix.c4
-rw-r--r--net/wanrouter/wanproc.c2
-rw-r--r--net/wimax/op-msg.c1
-rw-r--r--net/wimax/op-reset.c1
-rw-r--r--net/wimax/op-rfkill.c1
-rw-r--r--net/wimax/stack.c1
-rw-r--r--net/wireless/ibss.c1
-rw-r--r--net/wireless/mesh.c1
-rw-r--r--net/wireless/radiotap.c1
-rw-r--r--net/wireless/reg.c2
-rw-r--r--net/wireless/sme.c1
-rw-r--r--net/wireless/util.c1
-rw-r--r--net/wireless/wext-compat.c1
-rw-r--r--net/wireless/wext-core.c1
-rw-r--r--net/wireless/wext-sme.c1
-rw-r--r--net/wireless/wext-spy.c1
-rw-r--r--net/x25/af_x25.c11
-rw-r--r--net/x25/x25_proc.c1
-rw-r--r--net/xfrm/xfrm_policy.c10
-rw-r--r--net/xfrm/xfrm_proc.c1
-rw-r--r--net/xfrm/xfrm_replay.c1
238 files changed, 973 insertions, 543 deletions
diff --git a/net/802/fc.c b/net/802/fc.c
index 1e49f2d4ea96..bd345f3d29f8 100644
--- a/net/802/fc.c
+++ b/net/802/fc.c
@@ -27,6 +27,7 @@
27#include <linux/net.h> 27#include <linux/net.h>
28#include <linux/proc_fs.h> 28#include <linux/proc_fs.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/export.h>
30#include <net/arp.h> 31#include <net/arp.h>
31 32
32/* 33/*
diff --git a/net/802/garp.c b/net/802/garp.c
index 070bf4403bf8..8e21b6db3981 100644
--- a/net/802/garp.c
+++ b/net/802/garp.c
@@ -15,6 +15,7 @@
15#include <linux/rtnetlink.h> 15#include <linux/rtnetlink.h>
16#include <linux/llc.h> 16#include <linux/llc.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/module.h>
18#include <net/llc.h> 19#include <net/llc.h>
19#include <net/llc_pdu.h> 20#include <net/llc_pdu.h>
20#include <net/garp.h> 21#include <net/garp.h>
diff --git a/net/802/stp.c b/net/802/stp.c
index 0e136ef1e4ba..15540b7323cd 100644
--- a/net/802/stp.c
+++ b/net/802/stp.c
@@ -12,6 +12,7 @@
12#include <linux/etherdevice.h> 12#include <linux/etherdevice.h>
13#include <linux/llc.h> 13#include <linux/llc.h>
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/module.h>
15#include <net/llc.h> 16#include <net/llc.h>
16#include <net/llc_pdu.h> 17#include <net/llc_pdu.h>
17#include <net/stp.h> 18#include <net/stp.h>
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 163397f1fd5a..f5ffc02729d6 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -2,6 +2,7 @@
2#include <linux/netdevice.h> 2#include <linux/netdevice.h>
3#include <linux/if_vlan.h> 3#include <linux/if_vlan.h>
4#include <linux/netpoll.h> 4#include <linux/netpoll.h>
5#include <linux/export.h>
5#include "vlan.h" 6#include "vlan.h"
6 7
7bool vlan_do_receive(struct sk_buff **skbp, bool last_handler) 8bool vlan_do_receive(struct sk_buff **skbp, bool last_handler)
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index c8cf9391417e..bc2528624583 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -470,10 +470,12 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
470{ 470{
471 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 471 struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
472 472
473 if (change & IFF_ALLMULTI) 473 if (dev->flags & IFF_UP) {
474 dev_set_allmulti(real_dev, dev->flags & IFF_ALLMULTI ? 1 : -1); 474 if (change & IFF_ALLMULTI)
475 if (change & IFF_PROMISC) 475 dev_set_allmulti(real_dev, dev->flags & IFF_ALLMULTI ? 1 : -1);
476 dev_set_promiscuity(real_dev, dev->flags & IFF_PROMISC ? 1 : -1); 476 if (change & IFF_PROMISC)
477 dev_set_promiscuity(real_dev, dev->flags & IFF_PROMISC ? 1 : -1);
478 }
477} 479}
478 480
479static void vlan_dev_set_rx_mode(struct net_device *vlan_dev) 481static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index be9a5c19a775..235c2197dbb6 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13#include <linux/if_vlan.h> 13#include <linux/if_vlan.h>
14#include <linux/module.h>
14#include <net/net_namespace.h> 15#include <net/net_namespace.h>
15#include <net/netlink.h> 16#include <net/netlink.h>
16#include <net/rtnetlink.h> 17#include <net/rtnetlink.h>
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c
index 1acc69576df8..173a2e82f486 100644
--- a/net/appletalk/aarp.c
+++ b/net/appletalk/aarp.c
@@ -39,6 +39,7 @@
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/proc_fs.h> 40#include <linux/proc_fs.h>
41#include <linux/seq_file.h> 41#include <linux/seq_file.h>
42#include <linux/export.h>
42 43
43int sysctl_aarp_expiry_time = AARP_EXPIRY_TIME; 44int sysctl_aarp_expiry_time = AARP_EXPIRY_TIME;
44int sysctl_aarp_tick_time = AARP_TICK_TIME; 45int sysctl_aarp_tick_time = AARP_TICK_TIME;
diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c
index 6ef0e761e5de..b5b1a221c242 100644
--- a/net/appletalk/atalk_proc.c
+++ b/net/appletalk/atalk_proc.c
@@ -14,6 +14,7 @@
14#include <net/net_namespace.h> 14#include <net/net_namespace.h>
15#include <net/sock.h> 15#include <net/sock.h>
16#include <linux/atalk.h> 16#include <linux/atalk.h>
17#include <linux/export.h>
17 18
18 19
19static __inline__ struct atalk_iface *atalk_get_interface_idx(loff_t pos) 20static __inline__ struct atalk_iface *atalk_get_interface_idx(loff_t pos)
diff --git a/net/atm/pvc.c b/net/atm/pvc.c
index 437ee70c5e62..3a734919c36c 100644
--- a/net/atm/pvc.c
+++ b/net/atm/pvc.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/skbuff.h> 12#include <linux/skbuff.h>
13#include <linux/bitops.h> 13#include <linux/bitops.h>
14#include <linux/export.h>
14#include <net/sock.h> /* for sock_no_* */ 15#include <net/sock.h> /* for sock_no_* */
15 16
16#include "resources.h" /* devs and vccs */ 17#include "resources.h" /* devs and vccs */
diff --git a/net/atm/svc.c b/net/atm/svc.c
index 754ee4791d96..1281049c135f 100644
--- a/net/atm/svc.c
+++ b/net/atm/svc.c
@@ -20,6 +20,7 @@
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21#include <net/sock.h> /* for sock_no_* */ 21#include <net/sock.h> /* for sock_no_* */
22#include <linux/uaccess.h> 22#include <linux/uaccess.h>
23#include <linux/export.h>
23 24
24#include "resources.h" 25#include "resources.h"
25#include "common.h" /* common for PVCs and SVCs */ 26#include "common.h" /* common for PVCs and SVCs */
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index a1690845dc6e..87fddab22e0f 100644
--- a/net/ax25/ax25_route.c
+++ b/net/ax25/ax25_route.c
@@ -38,6 +38,7 @@
38#include <linux/interrupt.h> 38#include <linux/interrupt.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/seq_file.h> 40#include <linux/seq_file.h>
41#include <linux/export.h>
41 42
42static ax25_route *ax25_route_list; 43static ax25_route *ax25_route_list;
43static DEFINE_RWLOCK(ax25_route_lock); 44static DEFINE_RWLOCK(ax25_route_lock);
diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c
index d349be9578f5..4c83137b5954 100644
--- a/net/ax25/ax25_uid.c
+++ b/net/ax25/ax25_uid.c
@@ -37,6 +37,7 @@
37#include <linux/stat.h> 37#include <linux/stat.h>
38#include <linux/netfilter.h> 38#include <linux/netfilter.h>
39#include <linux/sysctl.h> 39#include <linux/sysctl.h>
40#include <linux/export.h>
40#include <net/ip.h> 41#include <net/ip.h>
41#include <net/arp.h> 42#include <net/arp.h>
42 43
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 22f1a6c87035..661b461cf0b0 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -5,6 +5,7 @@
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/debugfs.h> 6#include <linux/debugfs.h>
7#include <linux/seq_file.h> 7#include <linux/seq_file.h>
8#include <linux/module.h>
8 9
9#include <net/bluetooth/bluetooth.h> 10#include <net/bluetooth/bluetooth.h>
10#include <net/bluetooth/hci_core.h> 11#include <net/bluetooth/hci_core.h>
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index e8292369cdcf..5c406d3136f7 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -27,6 +27,7 @@
27/* Bluetooth L2CAP sockets. */ 27/* Bluetooth L2CAP sockets. */
28 28
29#include <linux/security.h> 29#include <linux/security.h>
30#include <linux/export.h>
30 31
31#include <net/bluetooth/bluetooth.h> 32#include <net/bluetooth/bluetooth.h>
32#include <net/bluetooth/hci_core.h> 33#include <net/bluetooth/hci_core.h>
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 5caff4d47596..2c7634296866 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -23,6 +23,7 @@
23/* Bluetooth HCI Management interface */ 23/* Bluetooth HCI Management interface */
24 24
25#include <linux/uaccess.h> 25#include <linux/uaccess.h>
26#include <linux/module.h>
26#include <asm/unaligned.h> 27#include <asm/unaligned.h>
27 28
28#include <net/bluetooth/bluetooth.h> 29#include <net/bluetooth/bluetooth.h>
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 6f9f8c014725..5a31731be4d0 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -16,6 +16,7 @@
16#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <linux/etherdevice.h> 17#include <linux/etherdevice.h>
18#include <linux/netfilter_bridge.h> 18#include <linux/netfilter_bridge.h>
19#include <linux/export.h>
19#include "br_private.h" 20#include "br_private.h"
20 21
21/* Bridge group multicast address 802.1d (pg 51). */ 22/* Bridge group multicast address 802.1d (pg 51). */
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 995cbe0ac0b2..a5f4e5769809 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -1501,6 +1501,8 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
1501 1501
1502 __skb_pull(skb2, offset); 1502 __skb_pull(skb2, offset);
1503 skb_reset_transport_header(skb2); 1503 skb_reset_transport_header(skb2);
1504 skb_postpull_rcsum(skb2, skb_network_header(skb2),
1505 skb_network_header_len(skb2));
1504 1506
1505 icmp6_type = icmp6_hdr(skb2)->icmp6_type; 1507 icmp6_type = icmp6_hdr(skb2)->icmp6_type;
1506 1508
@@ -1770,7 +1772,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val)
1770 int err = 0; 1772 int err = 0;
1771 struct net_bridge_mdb_htable *mdb; 1773 struct net_bridge_mdb_htable *mdb;
1772 1774
1773 spin_lock(&br->multicast_lock); 1775 spin_lock_bh(&br->multicast_lock);
1774 if (br->multicast_disabled == !val) 1776 if (br->multicast_disabled == !val)
1775 goto unlock; 1777 goto unlock;
1776 1778
@@ -1806,7 +1808,7 @@ rollback:
1806 } 1808 }
1807 1809
1808unlock: 1810unlock:
1809 spin_unlock(&br->multicast_lock); 1811 spin_unlock_bh(&br->multicast_lock);
1810 1812
1811 return err; 1813 return err;
1812} 1814}
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 10eda3cd1d71..19308e305d85 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/kmod.h>
15#include <linux/etherdevice.h> 16#include <linux/etherdevice.h>
16#include <linux/rtnetlink.h> 17#include <linux/rtnetlink.h>
17 18
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c
index bf2a333ca7c7..5449294bdd5e 100644
--- a/net/bridge/netfilter/ebt_ulog.c
+++ b/net/bridge/netfilter/ebt_ulog.c
@@ -102,16 +102,15 @@ static struct sk_buff *ulog_alloc_skb(unsigned int size)
102 unsigned int n; 102 unsigned int n;
103 103
104 n = max(size, nlbufsiz); 104 n = max(size, nlbufsiz);
105 skb = alloc_skb(n, GFP_ATOMIC); 105 skb = alloc_skb(n, GFP_ATOMIC | __GFP_NOWARN);
106 if (!skb) { 106 if (!skb) {
107 pr_debug("cannot alloc whole buffer of size %ub!\n", n);
108 if (n > size) { 107 if (n > size) {
109 /* try to allocate only as much as we need for 108 /* try to allocate only as much as we need for
110 * current packet */ 109 * current packet */
111 skb = alloc_skb(size, GFP_ATOMIC); 110 skb = alloc_skb(size, GFP_ATOMIC);
112 if (!skb) 111 if (!skb)
113 pr_debug("cannot even allocate " 112 pr_debug("cannot even allocate buffer of size %ub\n",
114 "buffer of size %ub\n", size); 113 size);
115 } 114 }
116 } 115 }
117 116
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index 47fc8f3a47cf..f1fa1f6e658d 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -16,6 +16,7 @@
16#include <linux/net.h> 16#include <linux/net.h>
17#include <linux/netdevice.h> 17#include <linux/netdevice.h>
18#include <linux/mutex.h> 18#include <linux/mutex.h>
19#include <linux/module.h>
19#include <net/netns/generic.h> 20#include <net/netns/generic.h>
20#include <net/net_namespace.h> 21#include <net/net_namespace.h>
21#include <net/pkt_sched.h> 22#include <net/pkt_sched.h>
diff --git a/net/caif/cffrml.c b/net/caif/cffrml.c
index f39921171d0d..d3ca87bf23b7 100644
--- a/net/caif/cffrml.c
+++ b/net/caif/cffrml.c
@@ -136,20 +136,21 @@ static int cffrml_receive(struct cflayer *layr, struct cfpkt *pkt)
136 136
137static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt) 137static int cffrml_transmit(struct cflayer *layr, struct cfpkt *pkt)
138{ 138{
139 int tmp;
140 u16 chks; 139 u16 chks;
141 u16 len; 140 u16 len;
141 __le16 data;
142
142 struct cffrml *this = container_obj(layr); 143 struct cffrml *this = container_obj(layr);
143 if (this->dofcs) { 144 if (this->dofcs) {
144 chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff); 145 chks = cfpkt_iterate(pkt, cffrml_checksum, 0xffff);
145 tmp = cpu_to_le16(chks); 146 data = cpu_to_le16(chks);
146 cfpkt_add_trail(pkt, &tmp, 2); 147 cfpkt_add_trail(pkt, &data, 2);
147 } else { 148 } else {
148 cfpkt_pad_trail(pkt, 2); 149 cfpkt_pad_trail(pkt, 2);
149 } 150 }
150 len = cfpkt_getlen(pkt); 151 len = cfpkt_getlen(pkt);
151 tmp = cpu_to_le16(len); 152 data = cpu_to_le16(len);
152 cfpkt_add_head(pkt, &tmp, 2); 153 cfpkt_add_head(pkt, &data, 2);
153 cfpkt_info(pkt)->hdr_len += 2; 154 cfpkt_info(pkt)->hdr_len += 2;
154 if (cfpkt_erroneous(pkt)) { 155 if (cfpkt_erroneous(pkt)) {
155 pr_err("Packet is erroneous!\n"); 156 pr_err("Packet is erroneous!\n");
diff --git a/net/caif/cfpkt_skbuff.c b/net/caif/cfpkt_skbuff.c
index 75d4bfae1a78..df08c47183d4 100644
--- a/net/caif/cfpkt_skbuff.c
+++ b/net/caif/cfpkt_skbuff.c
@@ -9,6 +9,7 @@
9#include <linux/string.h> 9#include <linux/string.h>
10#include <linux/skbuff.h> 10#include <linux/skbuff.h>
11#include <linux/hardirq.h> 11#include <linux/hardirq.h>
12#include <linux/export.h>
12#include <net/caif/cfpkt.h> 13#include <net/caif/cfpkt.h>
13 14
14#define PKT_PREFIX 48 15#define PKT_PREFIX 48
diff --git a/net/ceph/Kconfig b/net/ceph/Kconfig
index be683f2d401f..cc04dd667a10 100644
--- a/net/ceph/Kconfig
+++ b/net/ceph/Kconfig
@@ -27,3 +27,17 @@ config CEPH_LIB_PRETTYDEBUG
27 27
28 If unsure, say N. 28 If unsure, say N.
29 29
30config CEPH_LIB_USE_DNS_RESOLVER
31 bool "Use in-kernel support for DNS lookup"
32 depends on CEPH_LIB
33 select DNS_RESOLVER
34 default n
35 help
36 If you say Y here, hostnames (e.g. monitor addresses) will
37 be resolved using the CONFIG_DNS_RESOLVER facility.
38
39 For information on how to use CONFIG_DNS_RESOLVER consult
40 Documentation/networking/dns_resolver.txt
41
42 If unsure, say N.
43
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 2883ea01e680..97f70e50ad3b 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -432,9 +432,12 @@ EXPORT_SYMBOL(ceph_client_id);
432/* 432/*
433 * create a fresh client instance 433 * create a fresh client instance
434 */ 434 */
435struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) 435struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private,
436 unsigned supported_features,
437 unsigned required_features)
436{ 438{
437 struct ceph_client *client; 439 struct ceph_client *client;
440 struct ceph_entity_addr *myaddr = NULL;
438 int err = -ENOMEM; 441 int err = -ENOMEM;
439 442
440 client = kzalloc(sizeof(*client), GFP_KERNEL); 443 client = kzalloc(sizeof(*client), GFP_KERNEL);
@@ -449,15 +452,27 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private)
449 client->auth_err = 0; 452 client->auth_err = 0;
450 453
451 client->extra_mon_dispatch = NULL; 454 client->extra_mon_dispatch = NULL;
452 client->supported_features = CEPH_FEATURE_SUPPORTED_DEFAULT; 455 client->supported_features = CEPH_FEATURE_SUPPORTED_DEFAULT |
453 client->required_features = CEPH_FEATURE_REQUIRED_DEFAULT; 456 supported_features;
454 457 client->required_features = CEPH_FEATURE_REQUIRED_DEFAULT |
455 client->msgr = NULL; 458 required_features;
459
460 /* msgr */
461 if (ceph_test_opt(client, MYIP))
462 myaddr = &client->options->my_addr;
463 client->msgr = ceph_messenger_create(myaddr,
464 client->supported_features,
465 client->required_features);
466 if (IS_ERR(client->msgr)) {
467 err = PTR_ERR(client->msgr);
468 goto fail;
469 }
470 client->msgr->nocrc = ceph_test_opt(client, NOCRC);
456 471
457 /* subsystems */ 472 /* subsystems */
458 err = ceph_monc_init(&client->monc, client); 473 err = ceph_monc_init(&client->monc, client);
459 if (err < 0) 474 if (err < 0)
460 goto fail; 475 goto fail_msgr;
461 err = ceph_osdc_init(&client->osdc, client); 476 err = ceph_osdc_init(&client->osdc, client);
462 if (err < 0) 477 if (err < 0)
463 goto fail_monc; 478 goto fail_monc;
@@ -466,6 +481,8 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private)
466 481
467fail_monc: 482fail_monc:
468 ceph_monc_stop(&client->monc); 483 ceph_monc_stop(&client->monc);
484fail_msgr:
485 ceph_messenger_destroy(client->msgr);
469fail: 486fail:
470 kfree(client); 487 kfree(client);
471 return ERR_PTR(err); 488 return ERR_PTR(err);
@@ -490,8 +507,7 @@ void ceph_destroy_client(struct ceph_client *client)
490 507
491 ceph_debugfs_client_cleanup(client); 508 ceph_debugfs_client_cleanup(client);
492 509
493 if (client->msgr) 510 ceph_messenger_destroy(client->msgr);
494 ceph_messenger_destroy(client->msgr);
495 511
496 ceph_destroy_options(client->options); 512 ceph_destroy_options(client->options);
497 513
@@ -514,24 +530,9 @@ static int have_mon_and_osd_map(struct ceph_client *client)
514 */ 530 */
515int __ceph_open_session(struct ceph_client *client, unsigned long started) 531int __ceph_open_session(struct ceph_client *client, unsigned long started)
516{ 532{
517 struct ceph_entity_addr *myaddr = NULL;
518 int err; 533 int err;
519 unsigned long timeout = client->options->mount_timeout * HZ; 534 unsigned long timeout = client->options->mount_timeout * HZ;
520 535
521 /* initialize the messenger */
522 if (client->msgr == NULL) {
523 if (ceph_test_opt(client, MYIP))
524 myaddr = &client->options->my_addr;
525 client->msgr = ceph_messenger_create(myaddr,
526 client->supported_features,
527 client->required_features);
528 if (IS_ERR(client->msgr)) {
529 client->msgr = NULL;
530 return PTR_ERR(client->msgr);
531 }
532 client->msgr->nocrc = ceph_test_opt(client, NOCRC);
533 }
534
535 /* open session, and wait for mon and osd maps */ 536 /* open session, and wait for mon and osd maps */
536 err = ceph_monc_open_session(&client->monc); 537 err = ceph_monc_open_session(&client->monc);
537 if (err < 0) 538 if (err < 0)
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 9918e9eb276e..ad5b70801f37 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -11,12 +11,14 @@
11#include <linux/string.h> 11#include <linux/string.h>
12#include <linux/bio.h> 12#include <linux/bio.h>
13#include <linux/blkdev.h> 13#include <linux/blkdev.h>
14#include <linux/dns_resolver.h>
14#include <net/tcp.h> 15#include <net/tcp.h>
15 16
16#include <linux/ceph/libceph.h> 17#include <linux/ceph/libceph.h>
17#include <linux/ceph/messenger.h> 18#include <linux/ceph/messenger.h>
18#include <linux/ceph/decode.h> 19#include <linux/ceph/decode.h>
19#include <linux/ceph/pagelist.h> 20#include <linux/ceph/pagelist.h>
21#include <linux/export.h>
20 22
21/* 23/*
22 * Ceph uses the messenger to exchange ceph_msg messages with other 24 * Ceph uses the messenger to exchange ceph_msg messages with other
@@ -1078,6 +1080,101 @@ static void addr_set_port(struct sockaddr_storage *ss, int p)
1078} 1080}
1079 1081
1080/* 1082/*
1083 * Unlike other *_pton function semantics, zero indicates success.
1084 */
1085static int ceph_pton(const char *str, size_t len, struct sockaddr_storage *ss,
1086 char delim, const char **ipend)
1087{
1088 struct sockaddr_in *in4 = (void *)ss;
1089 struct sockaddr_in6 *in6 = (void *)ss;
1090
1091 memset(ss, 0, sizeof(*ss));
1092
1093 if (in4_pton(str, len, (u8 *)&in4->sin_addr.s_addr, delim, ipend)) {
1094 ss->ss_family = AF_INET;
1095 return 0;
1096 }
1097
1098 if (in6_pton(str, len, (u8 *)&in6->sin6_addr.s6_addr, delim, ipend)) {
1099 ss->ss_family = AF_INET6;
1100 return 0;
1101 }
1102
1103 return -EINVAL;
1104}
1105
1106/*
1107 * Extract hostname string and resolve using kernel DNS facility.
1108 */
1109#ifdef CONFIG_CEPH_LIB_USE_DNS_RESOLVER
1110static int ceph_dns_resolve_name(const char *name, size_t namelen,
1111 struct sockaddr_storage *ss, char delim, const char **ipend)
1112{
1113 const char *end, *delim_p;
1114 char *colon_p, *ip_addr = NULL;
1115 int ip_len, ret;
1116
1117 /*
1118 * The end of the hostname occurs immediately preceding the delimiter or
1119 * the port marker (':') where the delimiter takes precedence.
1120 */
1121 delim_p = memchr(name, delim, namelen);
1122 colon_p = memchr(name, ':', namelen);
1123
1124 if (delim_p && colon_p)
1125 end = delim_p < colon_p ? delim_p : colon_p;
1126 else if (!delim_p && colon_p)
1127 end = colon_p;
1128 else {
1129 end = delim_p;
1130 if (!end) /* case: hostname:/ */
1131 end = name + namelen;
1132 }
1133
1134 if (end <= name)
1135 return -EINVAL;
1136
1137 /* do dns_resolve upcall */
1138 ip_len = dns_query(NULL, name, end - name, NULL, &ip_addr, NULL);
1139 if (ip_len > 0)
1140 ret = ceph_pton(ip_addr, ip_len, ss, -1, NULL);
1141 else
1142 ret = -ESRCH;
1143
1144 kfree(ip_addr);
1145
1146 *ipend = end;
1147
1148 pr_info("resolve '%.*s' (ret=%d): %s\n", (int)(end - name), name,
1149 ret, ret ? "failed" : ceph_pr_addr(ss));
1150
1151 return ret;
1152}
1153#else
1154static inline int ceph_dns_resolve_name(const char *name, size_t namelen,
1155 struct sockaddr_storage *ss, char delim, const char **ipend)
1156{
1157 return -EINVAL;
1158}
1159#endif
1160
1161/*
1162 * Parse a server name (IP or hostname). If a valid IP address is not found
1163 * then try to extract a hostname to resolve using userspace DNS upcall.
1164 */
1165static int ceph_parse_server_name(const char *name, size_t namelen,
1166 struct sockaddr_storage *ss, char delim, const char **ipend)
1167{
1168 int ret;
1169
1170 ret = ceph_pton(name, namelen, ss, delim, ipend);
1171 if (ret)
1172 ret = ceph_dns_resolve_name(name, namelen, ss, delim, ipend);
1173
1174 return ret;
1175}
1176
1177/*
1081 * Parse an ip[:port] list into an addr array. Use the default 1178 * Parse an ip[:port] list into an addr array. Use the default
1082 * monitor port if a port isn't specified. 1179 * monitor port if a port isn't specified.
1083 */ 1180 */
@@ -1085,15 +1182,13 @@ int ceph_parse_ips(const char *c, const char *end,
1085 struct ceph_entity_addr *addr, 1182 struct ceph_entity_addr *addr,
1086 int max_count, int *count) 1183 int max_count, int *count)
1087{ 1184{
1088 int i; 1185 int i, ret = -EINVAL;
1089 const char *p = c; 1186 const char *p = c;
1090 1187
1091 dout("parse_ips on '%.*s'\n", (int)(end-c), c); 1188 dout("parse_ips on '%.*s'\n", (int)(end-c), c);
1092 for (i = 0; i < max_count; i++) { 1189 for (i = 0; i < max_count; i++) {
1093 const char *ipend; 1190 const char *ipend;
1094 struct sockaddr_storage *ss = &addr[i].in_addr; 1191 struct sockaddr_storage *ss = &addr[i].in_addr;
1095 struct sockaddr_in *in4 = (void *)ss;
1096 struct sockaddr_in6 *in6 = (void *)ss;
1097 int port; 1192 int port;
1098 char delim = ','; 1193 char delim = ',';
1099 1194
@@ -1102,15 +1197,11 @@ int ceph_parse_ips(const char *c, const char *end,
1102 p++; 1197 p++;
1103 } 1198 }
1104 1199
1105 memset(ss, 0, sizeof(*ss)); 1200 ret = ceph_parse_server_name(p, end - p, ss, delim, &ipend);
1106 if (in4_pton(p, end - p, (u8 *)&in4->sin_addr.s_addr, 1201 if (ret)
1107 delim, &ipend))
1108 ss->ss_family = AF_INET;
1109 else if (in6_pton(p, end - p, (u8 *)&in6->sin6_addr.s6_addr,
1110 delim, &ipend))
1111 ss->ss_family = AF_INET6;
1112 else
1113 goto bad; 1202 goto bad;
1203 ret = -EINVAL;
1204
1114 p = ipend; 1205 p = ipend;
1115 1206
1116 if (delim == ']') { 1207 if (delim == ']') {
@@ -1155,7 +1246,7 @@ int ceph_parse_ips(const char *c, const char *end,
1155 1246
1156bad: 1247bad:
1157 pr_err("parse_ips bad ip '%.*s'\n", (int)(end - c), c); 1248 pr_err("parse_ips bad ip '%.*s'\n", (int)(end - c), c);
1158 return -EINVAL; 1249 return ret;
1159} 1250}
1160EXPORT_SYMBOL(ceph_parse_ips); 1251EXPORT_SYMBOL(ceph_parse_ips);
1161 1252
@@ -2281,7 +2372,8 @@ EXPORT_SYMBOL(ceph_con_keepalive);
2281 * construct a new message with given type, size 2372 * construct a new message with given type, size
2282 * the new msg has a ref count of 1. 2373 * the new msg has a ref count of 1.
2283 */ 2374 */
2284struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags) 2375struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
2376 bool can_fail)
2285{ 2377{
2286 struct ceph_msg *m; 2378 struct ceph_msg *m;
2287 2379
@@ -2333,7 +2425,7 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags)
2333 m->front.iov_base = kmalloc(front_len, flags); 2425 m->front.iov_base = kmalloc(front_len, flags);
2334 } 2426 }
2335 if (m->front.iov_base == NULL) { 2427 if (m->front.iov_base == NULL) {
2336 pr_err("msg_new can't allocate %d bytes\n", 2428 dout("ceph_msg_new can't allocate %d bytes\n",
2337 front_len); 2429 front_len);
2338 goto out2; 2430 goto out2;
2339 } 2431 }
@@ -2348,7 +2440,14 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags)
2348out2: 2440out2:
2349 ceph_msg_put(m); 2441 ceph_msg_put(m);
2350out: 2442out:
2351 pr_err("msg_new can't create type %d front %d\n", type, front_len); 2443 if (!can_fail) {
2444 pr_err("msg_new can't create type %d front %d\n", type,
2445 front_len);
2446 WARN_ON(1);
2447 } else {
2448 dout("msg_new can't create type %d front %d\n", type,
2449 front_len);
2450 }
2352 return NULL; 2451 return NULL;
2353} 2452}
2354EXPORT_SYMBOL(ceph_msg_new); 2453EXPORT_SYMBOL(ceph_msg_new);
@@ -2398,7 +2497,7 @@ static struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con,
2398 } 2497 }
2399 if (!msg) { 2498 if (!msg) {
2400 *skip = 0; 2499 *skip = 0;
2401 msg = ceph_msg_new(type, front_len, GFP_NOFS); 2500 msg = ceph_msg_new(type, front_len, GFP_NOFS, false);
2402 if (!msg) { 2501 if (!msg) {
2403 pr_err("unable to allocate msg type %d len %d\n", 2502 pr_err("unable to allocate msg type %d len %d\n",
2404 type, front_len); 2503 type, front_len);
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index cbe31fa45508..0b62deae42bd 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -116,14 +116,12 @@ static void __send_prepared_auth_request(struct ceph_mon_client *monc, int len)
116 */ 116 */
117static void __close_session(struct ceph_mon_client *monc) 117static void __close_session(struct ceph_mon_client *monc)
118{ 118{
119 if (monc->con) { 119 dout("__close_session closing mon%d\n", monc->cur_mon);
120 dout("__close_session closing mon%d\n", monc->cur_mon); 120 ceph_con_revoke(monc->con, monc->m_auth);
121 ceph_con_revoke(monc->con, monc->m_auth); 121 ceph_con_close(monc->con);
122 ceph_con_close(monc->con); 122 monc->cur_mon = -1;
123 monc->cur_mon = -1; 123 monc->pending_auth = 0;
124 monc->pending_auth = 0; 124 ceph_auth_reset(monc->auth);
125 ceph_auth_reset(monc->auth);
126 }
127} 125}
128 126
129/* 127/*
@@ -302,15 +300,6 @@ void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc)
302 */ 300 */
303int ceph_monc_open_session(struct ceph_mon_client *monc) 301int ceph_monc_open_session(struct ceph_mon_client *monc)
304{ 302{
305 if (!monc->con) {
306 monc->con = kmalloc(sizeof(*monc->con), GFP_KERNEL);
307 if (!monc->con)
308 return -ENOMEM;
309 ceph_con_init(monc->client->msgr, monc->con);
310 monc->con->private = monc;
311 monc->con->ops = &mon_con_ops;
312 }
313
314 mutex_lock(&monc->mutex); 303 mutex_lock(&monc->mutex);
315 __open_session(monc); 304 __open_session(monc);
316 __schedule_delayed(monc); 305 __schedule_delayed(monc);
@@ -528,10 +517,12 @@ int ceph_monc_do_statfs(struct ceph_mon_client *monc, struct ceph_statfs *buf)
528 init_completion(&req->completion); 517 init_completion(&req->completion);
529 518
530 err = -ENOMEM; 519 err = -ENOMEM;
531 req->request = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), GFP_NOFS); 520 req->request = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), GFP_NOFS,
521 true);
532 if (!req->request) 522 if (!req->request)
533 goto out; 523 goto out;
534 req->reply = ceph_msg_new(CEPH_MSG_STATFS_REPLY, 1024, GFP_NOFS); 524 req->reply = ceph_msg_new(CEPH_MSG_STATFS_REPLY, 1024, GFP_NOFS,
525 true);
535 if (!req->reply) 526 if (!req->reply)
536 goto out; 527 goto out;
537 528
@@ -626,10 +617,12 @@ int ceph_monc_do_poolop(struct ceph_mon_client *monc, u32 op,
626 init_completion(&req->completion); 617 init_completion(&req->completion);
627 618
628 err = -ENOMEM; 619 err = -ENOMEM;
629 req->request = ceph_msg_new(CEPH_MSG_POOLOP, sizeof(*h), GFP_NOFS); 620 req->request = ceph_msg_new(CEPH_MSG_POOLOP, sizeof(*h), GFP_NOFS,
621 true);
630 if (!req->request) 622 if (!req->request)
631 goto out; 623 goto out;
632 req->reply = ceph_msg_new(CEPH_MSG_POOLOP_REPLY, 1024, GFP_NOFS); 624 req->reply = ceph_msg_new(CEPH_MSG_POOLOP_REPLY, 1024, GFP_NOFS,
625 true);
633 if (!req->reply) 626 if (!req->reply)
634 goto out; 627 goto out;
635 628
@@ -755,13 +748,21 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
755 if (err) 748 if (err)
756 goto out; 749 goto out;
757 750
758 monc->con = NULL; 751 /* connection */
752 monc->con = kmalloc(sizeof(*monc->con), GFP_KERNEL);
753 if (!monc->con)
754 goto out_monmap;
755 ceph_con_init(monc->client->msgr, monc->con);
756 monc->con->private = monc;
757 monc->con->ops = &mon_con_ops;
759 758
760 /* authentication */ 759 /* authentication */
761 monc->auth = ceph_auth_init(cl->options->name, 760 monc->auth = ceph_auth_init(cl->options->name,
762 cl->options->key); 761 cl->options->key);
763 if (IS_ERR(monc->auth)) 762 if (IS_ERR(monc->auth)) {
764 return PTR_ERR(monc->auth); 763 err = PTR_ERR(monc->auth);
764 goto out_con;
765 }
765 monc->auth->want_keys = 766 monc->auth->want_keys =
766 CEPH_ENTITY_TYPE_AUTH | CEPH_ENTITY_TYPE_MON | 767 CEPH_ENTITY_TYPE_AUTH | CEPH_ENTITY_TYPE_MON |
767 CEPH_ENTITY_TYPE_OSD | CEPH_ENTITY_TYPE_MDS; 768 CEPH_ENTITY_TYPE_OSD | CEPH_ENTITY_TYPE_MDS;
@@ -770,19 +771,21 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
770 err = -ENOMEM; 771 err = -ENOMEM;
771 monc->m_subscribe_ack = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE_ACK, 772 monc->m_subscribe_ack = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE_ACK,
772 sizeof(struct ceph_mon_subscribe_ack), 773 sizeof(struct ceph_mon_subscribe_ack),
773 GFP_NOFS); 774 GFP_NOFS, true);
774 if (!monc->m_subscribe_ack) 775 if (!monc->m_subscribe_ack)
775 goto out_monmap; 776 goto out_auth;
776 777
777 monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS); 778 monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS,
779 true);
778 if (!monc->m_subscribe) 780 if (!monc->m_subscribe)
779 goto out_subscribe_ack; 781 goto out_subscribe_ack;
780 782
781 monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096, GFP_NOFS); 783 monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096, GFP_NOFS,
784 true);
782 if (!monc->m_auth_reply) 785 if (!monc->m_auth_reply)
783 goto out_subscribe; 786 goto out_subscribe;
784 787
785 monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, GFP_NOFS); 788 monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, GFP_NOFS, true);
786 monc->pending_auth = 0; 789 monc->pending_auth = 0;
787 if (!monc->m_auth) 790 if (!monc->m_auth)
788 goto out_auth_reply; 791 goto out_auth_reply;
@@ -808,6 +811,10 @@ out_subscribe:
808 ceph_msg_put(monc->m_subscribe); 811 ceph_msg_put(monc->m_subscribe);
809out_subscribe_ack: 812out_subscribe_ack:
810 ceph_msg_put(monc->m_subscribe_ack); 813 ceph_msg_put(monc->m_subscribe_ack);
814out_auth:
815 ceph_auth_destroy(monc->auth);
816out_con:
817 monc->con->ops->put(monc->con);
811out_monmap: 818out_monmap:
812 kfree(monc->monmap); 819 kfree(monc->monmap);
813out: 820out:
@@ -822,11 +829,11 @@ void ceph_monc_stop(struct ceph_mon_client *monc)
822 829
823 mutex_lock(&monc->mutex); 830 mutex_lock(&monc->mutex);
824 __close_session(monc); 831 __close_session(monc);
825 if (monc->con) { 832
826 monc->con->private = NULL; 833 monc->con->private = NULL;
827 monc->con->ops->put(monc->con); 834 monc->con->ops->put(monc->con);
828 monc->con = NULL; 835 monc->con = NULL;
829 } 836
830 mutex_unlock(&monc->mutex); 837 mutex_unlock(&monc->mutex);
831 838
832 ceph_auth_destroy(monc->auth); 839 ceph_auth_destroy(monc->auth);
@@ -973,7 +980,7 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
973 case CEPH_MSG_MON_MAP: 980 case CEPH_MSG_MON_MAP:
974 case CEPH_MSG_MDS_MAP: 981 case CEPH_MSG_MDS_MAP:
975 case CEPH_MSG_OSD_MAP: 982 case CEPH_MSG_OSD_MAP:
976 m = ceph_msg_new(type, front_len, GFP_NOFS); 983 m = ceph_msg_new(type, front_len, GFP_NOFS, false);
977 break; 984 break;
978 } 985 }
979 986
@@ -1000,7 +1007,7 @@ static void mon_fault(struct ceph_connection *con)
1000 if (!con->private) 1007 if (!con->private)
1001 goto out; 1008 goto out;
1002 1009
1003 if (monc->con && !monc->hunting) 1010 if (!monc->hunting)
1004 pr_info("mon%d %s session lost, " 1011 pr_info("mon%d %s session lost, "
1005 "hunting for new mon\n", monc->cur_mon, 1012 "hunting for new mon\n", monc->cur_mon,
1006 ceph_pr_addr(&monc->con->peer_addr.in_addr)); 1013 ceph_pr_addr(&monc->con->peer_addr.in_addr));
diff --git a/net/ceph/msgpool.c b/net/ceph/msgpool.c
index 1f4cb30a42c5..11d5f4196a73 100644
--- a/net/ceph/msgpool.c
+++ b/net/ceph/msgpool.c
@@ -12,7 +12,7 @@ static void *msgpool_alloc(gfp_t gfp_mask, void *arg)
12 struct ceph_msgpool *pool = arg; 12 struct ceph_msgpool *pool = arg;
13 struct ceph_msg *msg; 13 struct ceph_msg *msg;
14 14
15 msg = ceph_msg_new(0, pool->front_len, gfp_mask); 15 msg = ceph_msg_new(0, pool->front_len, gfp_mask, true);
16 if (!msg) { 16 if (!msg) {
17 dout("msgpool_alloc %s failed\n", pool->name); 17 dout("msgpool_alloc %s failed\n", pool->name);
18 } else { 18 } else {
@@ -61,7 +61,7 @@ struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool,
61 WARN_ON(1); 61 WARN_ON(1);
62 62
63 /* try to alloc a fresh message */ 63 /* try to alloc a fresh message */
64 return ceph_msg_new(0, front_len, GFP_NOFS); 64 return ceph_msg_new(0, front_len, GFP_NOFS, false);
65 } 65 }
66 66
67 msg = mempool_alloc(pool->pool, GFP_NOFS); 67 msg = mempool_alloc(pool->pool, GFP_NOFS);
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 88ad8a2501b5..733e46008b89 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -227,7 +227,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
227 msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0); 227 msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0);
228 else 228 else
229 msg = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, 229 msg = ceph_msg_new(CEPH_MSG_OSD_OPREPLY,
230 OSD_OPREPLY_FRONT_LEN, gfp_flags); 230 OSD_OPREPLY_FRONT_LEN, gfp_flags, true);
231 if (!msg) { 231 if (!msg) {
232 ceph_osdc_put_request(req); 232 ceph_osdc_put_request(req);
233 return NULL; 233 return NULL;
@@ -250,7 +250,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
250 if (use_mempool) 250 if (use_mempool)
251 msg = ceph_msgpool_get(&osdc->msgpool_op, 0); 251 msg = ceph_msgpool_get(&osdc->msgpool_op, 0);
252 else 252 else
253 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, gfp_flags); 253 msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, gfp_flags, true);
254 if (!msg) { 254 if (!msg) {
255 ceph_osdc_put_request(req); 255 ceph_osdc_put_request(req);
256 return NULL; 256 return NULL;
@@ -943,7 +943,7 @@ EXPORT_SYMBOL(ceph_osdc_set_request_linger);
943 * Caller should hold map_sem for read and request_mutex. 943 * Caller should hold map_sem for read and request_mutex.
944 */ 944 */
945static int __map_request(struct ceph_osd_client *osdc, 945static int __map_request(struct ceph_osd_client *osdc,
946 struct ceph_osd_request *req) 946 struct ceph_osd_request *req, int force_resend)
947{ 947{
948 struct ceph_osd_request_head *reqhead = req->r_request->front.iov_base; 948 struct ceph_osd_request_head *reqhead = req->r_request->front.iov_base;
949 struct ceph_pg pgid; 949 struct ceph_pg pgid;
@@ -967,7 +967,8 @@ static int __map_request(struct ceph_osd_client *osdc,
967 num = err; 967 num = err;
968 } 968 }
969 969
970 if ((req->r_osd && req->r_osd->o_osd == o && 970 if ((!force_resend &&
971 req->r_osd && req->r_osd->o_osd == o &&
971 req->r_sent >= req->r_osd->o_incarnation && 972 req->r_sent >= req->r_osd->o_incarnation &&
972 req->r_num_pg_osds == num && 973 req->r_num_pg_osds == num &&
973 memcmp(req->r_pg_osds, acting, sizeof(acting[0])*num) == 0) || 974 memcmp(req->r_pg_osds, acting, sizeof(acting[0])*num) == 0) ||
@@ -1289,18 +1290,18 @@ static void reset_changed_osds(struct ceph_osd_client *osdc)
1289 * 1290 *
1290 * Caller should hold map_sem for read and request_mutex. 1291 * Caller should hold map_sem for read and request_mutex.
1291 */ 1292 */
1292static void kick_requests(struct ceph_osd_client *osdc) 1293static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
1293{ 1294{
1294 struct ceph_osd_request *req, *nreq; 1295 struct ceph_osd_request *req, *nreq;
1295 struct rb_node *p; 1296 struct rb_node *p;
1296 int needmap = 0; 1297 int needmap = 0;
1297 int err; 1298 int err;
1298 1299
1299 dout("kick_requests\n"); 1300 dout("kick_requests %s\n", force_resend ? " (force resend)" : "");
1300 mutex_lock(&osdc->request_mutex); 1301 mutex_lock(&osdc->request_mutex);
1301 for (p = rb_first(&osdc->requests); p; p = rb_next(p)) { 1302 for (p = rb_first(&osdc->requests); p; p = rb_next(p)) {
1302 req = rb_entry(p, struct ceph_osd_request, r_node); 1303 req = rb_entry(p, struct ceph_osd_request, r_node);
1303 err = __map_request(osdc, req); 1304 err = __map_request(osdc, req, force_resend);
1304 if (err < 0) 1305 if (err < 0)
1305 continue; /* error */ 1306 continue; /* error */
1306 if (req->r_osd == NULL) { 1307 if (req->r_osd == NULL) {
@@ -1318,7 +1319,7 @@ static void kick_requests(struct ceph_osd_client *osdc)
1318 r_linger_item) { 1319 r_linger_item) {
1319 dout("linger req=%p req->r_osd=%p\n", req, req->r_osd); 1320 dout("linger req=%p req->r_osd=%p\n", req, req->r_osd);
1320 1321
1321 err = __map_request(osdc, req); 1322 err = __map_request(osdc, req, force_resend);
1322 if (err == 0) 1323 if (err == 0)
1323 continue; /* no change and no osd was specified */ 1324 continue; /* no change and no osd was specified */
1324 if (err < 0) 1325 if (err < 0)
@@ -1395,7 +1396,7 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg)
1395 ceph_osdmap_destroy(osdc->osdmap); 1396 ceph_osdmap_destroy(osdc->osdmap);
1396 osdc->osdmap = newmap; 1397 osdc->osdmap = newmap;
1397 } 1398 }
1398 kick_requests(osdc); 1399 kick_requests(osdc, 0);
1399 reset_changed_osds(osdc); 1400 reset_changed_osds(osdc);
1400 } else { 1401 } else {
1401 dout("ignoring incremental map %u len %d\n", 1402 dout("ignoring incremental map %u len %d\n",
@@ -1423,6 +1424,8 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg)
1423 "older than our %u\n", epoch, maplen, 1424 "older than our %u\n", epoch, maplen,
1424 osdc->osdmap->epoch); 1425 osdc->osdmap->epoch);
1425 } else { 1426 } else {
1427 int skipped_map = 0;
1428
1426 dout("taking full map %u len %d\n", epoch, maplen); 1429 dout("taking full map %u len %d\n", epoch, maplen);
1427 newmap = osdmap_decode(&p, p+maplen); 1430 newmap = osdmap_decode(&p, p+maplen);
1428 if (IS_ERR(newmap)) { 1431 if (IS_ERR(newmap)) {
@@ -1432,9 +1435,12 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg)
1432 BUG_ON(!newmap); 1435 BUG_ON(!newmap);
1433 oldmap = osdc->osdmap; 1436 oldmap = osdc->osdmap;
1434 osdc->osdmap = newmap; 1437 osdc->osdmap = newmap;
1435 if (oldmap) 1438 if (oldmap) {
1439 if (oldmap->epoch + 1 < newmap->epoch)
1440 skipped_map = 1;
1436 ceph_osdmap_destroy(oldmap); 1441 ceph_osdmap_destroy(oldmap);
1437 kick_requests(osdc); 1442 }
1443 kick_requests(osdc, skipped_map);
1438 } 1444 }
1439 p += maplen; 1445 p += maplen;
1440 nr_maps--; 1446 nr_maps--;
@@ -1707,7 +1713,7 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
1707 * the request still han't been touched yet. 1713 * the request still han't been touched yet.
1708 */ 1714 */
1709 if (req->r_sent == 0) { 1715 if (req->r_sent == 0) {
1710 rc = __map_request(osdc, req); 1716 rc = __map_request(osdc, req, 0);
1711 if (rc < 0) { 1717 if (rc < 0) {
1712 if (nofail) { 1718 if (nofail) {
1713 dout("osdc_start_request failed map, " 1719 dout("osdc_start_request failed map, "
@@ -2032,7 +2038,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
2032 if (front > req->r_reply->front.iov_len) { 2038 if (front > req->r_reply->front.iov_len) {
2033 pr_warning("get_reply front %d > preallocated %d\n", 2039 pr_warning("get_reply front %d > preallocated %d\n",
2034 front, (int)req->r_reply->front.iov_len); 2040 front, (int)req->r_reply->front.iov_len);
2035 m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front, GFP_NOFS); 2041 m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front, GFP_NOFS, false);
2036 if (!m) 2042 if (!m)
2037 goto out; 2043 goto out;
2038 ceph_msg_put(req->r_reply); 2044 ceph_msg_put(req->r_reply);
@@ -2080,7 +2086,7 @@ static struct ceph_msg *alloc_msg(struct ceph_connection *con,
2080 switch (type) { 2086 switch (type) {
2081 case CEPH_MSG_OSD_MAP: 2087 case CEPH_MSG_OSD_MAP:
2082 case CEPH_MSG_WATCH_NOTIFY: 2088 case CEPH_MSG_WATCH_NOTIFY:
2083 return ceph_msg_new(type, front, GFP_NOFS); 2089 return ceph_msg_new(type, front, GFP_NOFS, false);
2084 case CEPH_MSG_OSD_OPREPLY: 2090 case CEPH_MSG_OSD_OPREPLY:
2085 return get_reply(con, hdr, skip); 2091 return get_reply(con, hdr, skip);
2086 default: 2092 default:
diff --git a/net/compat.c b/net/compat.c
index c578d9382e19..6def90e0a112 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -22,6 +22,7 @@
22#include <linux/filter.h> 22#include <linux/filter.h>
23#include <linux/compat.h> 23#include <linux/compat.h>
24#include <linux/security.h> 24#include <linux/security.h>
25#include <linux/export.h>
25 26
26#include <net/scm.h> 27#include <net/scm.h>
27#include <net/sock.h> 28#include <net/sock.h>
diff --git a/net/core/dev.c b/net/core/dev.c
index 6ba50a1e404c..1482eea0bbf0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4282,6 +4282,12 @@ static int dev_seq_open(struct inode *inode, struct file *file)
4282 sizeof(struct dev_iter_state)); 4282 sizeof(struct dev_iter_state));
4283} 4283}
4284 4284
4285int dev_seq_open_ops(struct inode *inode, struct file *file,
4286 const struct seq_operations *ops)
4287{
4288 return seq_open_net(inode, file, ops, sizeof(struct dev_iter_state));
4289}
4290
4285static const struct file_operations dev_seq_fops = { 4291static const struct file_operations dev_seq_fops = {
4286 .owner = THIS_MODULE, 4292 .owner = THIS_MODULE,
4287 .open = dev_seq_open, 4293 .open = dev_seq_open,
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index 283d1b863876..febba516db62 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/netdevice.h> 14#include <linux/netdevice.h>
15#include <linux/rtnetlink.h> 15#include <linux/rtnetlink.h>
16#include <linux/export.h>
16#include <linux/list.h> 17#include <linux/list.h>
17#include <linux/proc_fs.h> 18#include <linux/proc_fs.h>
18 19
@@ -695,8 +696,7 @@ static const struct seq_operations dev_mc_seq_ops = {
695 696
696static int dev_mc_seq_open(struct inode *inode, struct file *file) 697static int dev_mc_seq_open(struct inode *inode, struct file *file)
697{ 698{
698 return seq_open_net(inode, file, &dev_mc_seq_ops, 699 return dev_seq_open_ops(inode, file, &dev_mc_seq_ops);
699 sizeof(struct seq_net_private));
700} 700}
701 701
702static const struct file_operations dev_mc_seq_fops = { 702static const struct file_operations dev_mc_seq_fops = {
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 57e8f95110e6..c02e63c908da 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -12,6 +12,7 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/list.h> 14#include <linux/list.h>
15#include <linux/module.h>
15#include <net/net_namespace.h> 16#include <net/net_namespace.h>
16#include <net/sock.h> 17#include <net/sock.h>
17#include <net/fib_rules.h> 18#include <net/fib_rules.h>
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 909ecb3c2a33..5ac07d31fbc9 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -872,12 +872,8 @@ static void neigh_timer_handler(unsigned long arg)
872 now = jiffies; 872 now = jiffies;
873 next = now + HZ; 873 next = now + HZ;
874 874
875 if (!(state & NUD_IN_TIMER)) { 875 if (!(state & NUD_IN_TIMER))
876#ifndef CONFIG_SMP
877 printk(KERN_WARNING "neigh: timer & !nud_in_timer\n");
878#endif
879 goto out; 876 goto out;
880 }
881 877
882 if (state & NUD_REACHABLE) { 878 if (state & NUD_REACHABLE) {
883 if (time_before_eq(now, 879 if (time_before_eq(now,
@@ -2401,7 +2397,10 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq,
2401 struct net *net = seq_file_net(seq); 2397 struct net *net = seq_file_net(seq);
2402 struct neigh_table *tbl = state->tbl; 2398 struct neigh_table *tbl = state->tbl;
2403 2399
2404 pn = pn->next; 2400 do {
2401 pn = pn->next;
2402 } while (pn && !net_eq(pneigh_net(pn), net));
2403
2405 while (!pn) { 2404 while (!pn) {
2406 if (++state->bucket > PNEIGH_HASHMASK) 2405 if (++state->bucket > PNEIGH_HASHMASK)
2407 break; 2406 break;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 7604a635376b..c71c434a4c05 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -20,6 +20,7 @@
20#include <linux/rtnetlink.h> 20#include <linux/rtnetlink.h>
21#include <linux/wireless.h> 21#include <linux/wireless.h>
22#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
23#include <linux/export.h>
23#include <net/wext.h> 24#include <net/wext.h>
24 25
25#include "net-sysfs.h" 26#include "net-sysfs.h"
diff --git a/net/core/net-traces.c b/net/core/net-traces.c
index 52380b1d552a..ba3c0120786c 100644
--- a/net/core/net-traces.c
+++ b/net/core/net-traces.c
@@ -11,6 +11,7 @@
11#include <linux/inetdevice.h> 11#include <linux/inetdevice.h>
12#include <linux/inet.h> 12#include <linux/inet.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/export.h>
14#include <linux/netpoll.h> 15#include <linux/netpoll.h>
15#include <linux/sched.h> 16#include <linux/sched.h>
16#include <linux/delay.h> 17#include <linux/delay.h>
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 5bbdbf0d3664..aefcd7acbffa 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -10,6 +10,7 @@
10#include <linux/nsproxy.h> 10#include <linux/nsproxy.h>
11#include <linux/proc_fs.h> 11#include <linux/proc_fs.h>
12#include <linux/file.h> 12#include <linux/file.h>
13#include <linux/export.h>
13#include <net/net_namespace.h> 14#include <net/net_namespace.h>
14#include <net/netns/generic.h> 15#include <net/netns/generic.h>
15 16
diff --git a/net/core/netevent.c b/net/core/netevent.c
index 865f0ceb81fb..f17ccd291d39 100644
--- a/net/core/netevent.c
+++ b/net/core/netevent.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/rtnetlink.h> 16#include <linux/rtnetlink.h>
17#include <linux/notifier.h> 17#include <linux/notifier.h>
18#include <linux/export.h>
18#include <net/netevent.h> 19#include <net/netevent.h>
19 20
20static ATOMIC_NOTIFIER_HEAD(netevent_notif_chain); 21static ATOMIC_NOTIFIER_HEAD(netevent_notif_chain);
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index f57d94627a2a..cf64c1ffa4cd 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -23,6 +23,7 @@
23#include <linux/rcupdate.h> 23#include <linux/rcupdate.h>
24#include <linux/workqueue.h> 24#include <linux/workqueue.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/export.h>
26#include <net/tcp.h> 27#include <net/tcp.h>
27#include <net/udp.h> 28#include <net/udp.h>
28#include <asm/unaligned.h> 29#include <asm/unaligned.h>
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index ca4db40e75b8..3c30ee4a5710 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -189,6 +189,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
189 * aligned memory blocks, unless SLUB/SLAB debug is enabled. 189 * aligned memory blocks, unless SLUB/SLAB debug is enabled.
190 * Both skb->head and skb_shared_info are cache line aligned. 190 * Both skb->head and skb_shared_info are cache line aligned.
191 */ 191 */
192 size = SKB_DATA_ALIGN(size);
192 size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); 193 size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
193 data = kmalloc_node_track_caller(size, gfp_mask, node); 194 data = kmalloc_node_track_caller(size, gfp_mask, node);
194 if (!data) 195 if (!data)
@@ -2229,7 +2230,7 @@ static int skb_prepare_for_shift(struct sk_buff *skb)
2229 * @shiftlen: shift up to this many bytes 2230 * @shiftlen: shift up to this many bytes
2230 * 2231 *
2231 * Attempts to shift up to shiftlen worth of bytes, which may be less than 2232 * Attempts to shift up to shiftlen worth of bytes, which may be less than
2232 * the length of the skb, from tgt to skb. Returns number bytes shifted. 2233 * the length of the skb, from skb to tgt. Returns number bytes shifted.
2233 * It's up to caller to free skb if everything was shifted. 2234 * It's up to caller to free skb if everything was shifted.
2234 * 2235 *
2235 * If @tgt runs out of frags, the whole operation is aborted. 2236 * If @tgt runs out of frags, the whole operation is aborted.
diff --git a/net/core/timestamping.c b/net/core/timestamping.c
index 82fb28857b64..661b5a40ec10 100644
--- a/net/core/timestamping.c
+++ b/net/core/timestamping.c
@@ -21,6 +21,7 @@
21#include <linux/phy.h> 21#include <linux/phy.h>
22#include <linux/ptp_classify.h> 22#include <linux/ptp_classify.h>
23#include <linux/skbuff.h> 23#include <linux/skbuff.h>
24#include <linux/export.h>
24 25
25static struct sock_filter ptp_filter[] = { 26static struct sock_filter ptp_filter[] = {
26 PTP_FILTER 27 PTP_FILTER
diff --git a/net/core/user_dma.c b/net/core/user_dma.c
index 2d7cf3d52b4c..1b5fefdb8198 100644
--- a/net/core/user_dma.c
+++ b/net/core/user_dma.c
@@ -27,6 +27,7 @@
27 27
28#include <linux/dmaengine.h> 28#include <linux/dmaengine.h>
29#include <linux/socket.h> 29#include <linux/socket.h>
30#include <linux/export.h>
30#include <net/tcp.h> 31#include <net/tcp.h>
31#include <net/netdma.h> 32#include <net/netdma.h>
32 33
diff --git a/net/dcb/dcbevent.c b/net/dcb/dcbevent.c
index 665a8802105a..1d9eb7c60a68 100644
--- a/net/dcb/dcbevent.c
+++ b/net/dcb/dcbevent.c
@@ -19,6 +19,7 @@
19 19
20#include <linux/rtnetlink.h> 20#include <linux/rtnetlink.h>
21#include <linux/notifier.h> 21#include <linux/notifier.h>
22#include <linux/export.h>
22 23
23static ATOMIC_NOTIFIER_HEAD(dcbevent_notif_chain); 24static ATOMIC_NOTIFIER_HEAD(dcbevent_notif_chain);
24 25
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 9bfbc1d1b50c..d86053002c16 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -25,6 +25,7 @@
25#include <linux/dcbnl.h> 25#include <linux/dcbnl.h>
26#include <net/dcbevent.h> 26#include <net/dcbevent.h>
27#include <linux/rtnetlink.h> 27#include <linux/rtnetlink.h>
28#include <linux/module.h>
28#include <net/sock.h> 29#include <net/sock.h>
29 30
30/** 31/**
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c
index 25b7a8d1ad58..ba07824af4c0 100644
--- a/net/dccp/ackvec.c
+++ b/net/dccp/ackvec.c
@@ -12,6 +12,7 @@
12#include "dccp.h" 12#include "dccp.h"
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/export.h>
15 16
16static struct kmem_cache *dccp_ackvec_slab; 17static struct kmem_cache *dccp_ackvec_slab;
17static struct kmem_cache *dccp_ackvec_record_slab; 18static struct kmem_cache *dccp_ackvec_record_slab;
diff --git a/net/dccp/ccids/lib/tfrc.c b/net/dccp/ccids/lib/tfrc.c
index 4902029854d8..1f94b7e01d39 100644
--- a/net/dccp/ccids/lib/tfrc.c
+++ b/net/dccp/ccids/lib/tfrc.c
@@ -4,6 +4,7 @@
4 * Copyright (c) 2007 The University of Aberdeen, Scotland, UK 4 * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
5 * Copyright (c) 2007 Arnaldo Carvalho de Melo <acme@redhat.com> 5 * Copyright (c) 2007 Arnaldo Carvalho de Melo <acme@redhat.com>
6 */ 6 */
7#include <linux/moduleparam.h>
7#include "tfrc.h" 8#include "tfrc.h"
8 9
9#ifdef CONFIG_IP_DCCP_TFRC_DEBUG 10#ifdef CONFIG_IP_DCCP_TFRC_DEBUG
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 332639b56f4d..3f4e5414c8e5 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -111,6 +111,7 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
111 rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, 111 rt = ip_route_newports(fl4, rt, orig_sport, orig_dport,
112 inet->inet_sport, inet->inet_dport, sk); 112 inet->inet_sport, inet->inet_dport, sk);
113 if (IS_ERR(rt)) { 113 if (IS_ERR(rt)) {
114 err = PTR_ERR(rt);
114 rt = NULL; 115 rt = NULL;
115 goto failure; 116 goto failure;
116 } 117 }
@@ -433,6 +434,7 @@ exit:
433 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); 434 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
434 return NULL; 435 return NULL;
435put_and_exit: 436put_and_exit:
437 bh_unlock_sock(newsk);
436 sock_put(newsk); 438 sock_put(newsk);
437 goto exit; 439 goto exit;
438} 440}
diff --git a/net/dccp/timer.c b/net/dccp/timer.c
index 7587870b7040..16f0b223102e 100644
--- a/net/dccp/timer.c
+++ b/net/dccp/timer.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/dccp.h> 13#include <linux/dccp.h>
14#include <linux/skbuff.h> 14#include <linux/skbuff.h>
15#include <linux/export.h>
15 16
16#include "dccp.h" 17#include "dccp.h"
17 18
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 43450c100226..94f4ec036669 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -77,6 +77,7 @@
77#include <linux/netfilter_decnet.h> 77#include <linux/netfilter_decnet.h>
78#include <linux/rcupdate.h> 78#include <linux/rcupdate.h>
79#include <linux/times.h> 79#include <linux/times.h>
80#include <linux/export.h>
80#include <asm/errno.h> 81#include <asm/errno.h>
81#include <net/net_namespace.h> 82#include <net/net_namespace.h>
82#include <net/netlink.h> 83#include <net/netlink.h>
@@ -111,7 +112,7 @@ static unsigned long dn_rt_deadline;
111static int dn_dst_gc(struct dst_ops *ops); 112static int dn_dst_gc(struct dst_ops *ops);
112static struct dst_entry *dn_dst_check(struct dst_entry *, __u32); 113static struct dst_entry *dn_dst_check(struct dst_entry *, __u32);
113static unsigned int dn_dst_default_advmss(const struct dst_entry *dst); 114static unsigned int dn_dst_default_advmss(const struct dst_entry *dst);
114static unsigned int dn_dst_default_mtu(const struct dst_entry *dst); 115static unsigned int dn_dst_mtu(const struct dst_entry *dst);
115static void dn_dst_destroy(struct dst_entry *); 116static void dn_dst_destroy(struct dst_entry *);
116static struct dst_entry *dn_dst_negative_advice(struct dst_entry *); 117static struct dst_entry *dn_dst_negative_advice(struct dst_entry *);
117static void dn_dst_link_failure(struct sk_buff *); 118static void dn_dst_link_failure(struct sk_buff *);
@@ -134,7 +135,7 @@ static struct dst_ops dn_dst_ops = {
134 .gc = dn_dst_gc, 135 .gc = dn_dst_gc,
135 .check = dn_dst_check, 136 .check = dn_dst_check,
136 .default_advmss = dn_dst_default_advmss, 137 .default_advmss = dn_dst_default_advmss,
137 .default_mtu = dn_dst_default_mtu, 138 .mtu = dn_dst_mtu,
138 .cow_metrics = dst_cow_metrics_generic, 139 .cow_metrics = dst_cow_metrics_generic,
139 .destroy = dn_dst_destroy, 140 .destroy = dn_dst_destroy,
140 .negative_advice = dn_dst_negative_advice, 141 .negative_advice = dn_dst_negative_advice,
@@ -824,9 +825,11 @@ static unsigned int dn_dst_default_advmss(const struct dst_entry *dst)
824 return dn_mss_from_pmtu(dst->dev, dst_mtu(dst)); 825 return dn_mss_from_pmtu(dst->dev, dst_mtu(dst));
825} 826}
826 827
827static unsigned int dn_dst_default_mtu(const struct dst_entry *dst) 828static unsigned int dn_dst_mtu(const struct dst_entry *dst)
828{ 829{
829 return dst->dev->mtu; 830 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
831
832 return mtu ? : dst->dev->mtu;
830} 833}
831 834
832static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr) 835static struct neighbour *dn_dst_neigh_lookup(const struct dst_entry *dst, const void *daddr)
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index f0efb0ccfeca..f65c9ddaee41 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -23,6 +23,7 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/list.h> 24#include <linux/list.h>
25#include <linux/rcupdate.h> 25#include <linux/rcupdate.h>
26#include <linux/export.h>
26#include <net/neighbour.h> 27#include <net/neighbour.h>
27#include <net/dst.h> 28#include <net/dst.h>
28#include <net/flow.h> 29#include <net/flow.h>
diff --git a/net/decnet/dn_timer.c b/net/decnet/dn_timer.c
index 67f691bd4acf..d9c150cc59a9 100644
--- a/net/decnet/dn_timer.c
+++ b/net/decnet/dn_timer.c
@@ -36,16 +36,13 @@ static void dn_slow_timer(unsigned long arg);
36 36
37void dn_start_slow_timer(struct sock *sk) 37void dn_start_slow_timer(struct sock *sk)
38{ 38{
39 sk->sk_timer.expires = jiffies + SLOW_INTERVAL; 39 setup_timer(&sk->sk_timer, dn_slow_timer, (unsigned long)sk);
40 sk->sk_timer.function = dn_slow_timer; 40 sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL);
41 sk->sk_timer.data = (unsigned long)sk;
42
43 add_timer(&sk->sk_timer);
44} 41}
45 42
46void dn_stop_slow_timer(struct sock *sk) 43void dn_stop_slow_timer(struct sock *sk)
47{ 44{
48 del_timer(&sk->sk_timer); 45 sk_stop_timer(sk, &sk->sk_timer);
49} 46}
50 47
51static void dn_slow_timer(unsigned long arg) 48static void dn_slow_timer(unsigned long arg)
@@ -53,12 +50,10 @@ static void dn_slow_timer(unsigned long arg)
53 struct sock *sk = (struct sock *)arg; 50 struct sock *sk = (struct sock *)arg;
54 struct dn_scp *scp = DN_SK(sk); 51 struct dn_scp *scp = DN_SK(sk);
55 52
56 sock_hold(sk);
57 bh_lock_sock(sk); 53 bh_lock_sock(sk);
58 54
59 if (sock_owned_by_user(sk)) { 55 if (sock_owned_by_user(sk)) {
60 sk->sk_timer.expires = jiffies + HZ / 10; 56 sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ / 10);
61 add_timer(&sk->sk_timer);
62 goto out; 57 goto out;
63 } 58 }
64 59
@@ -100,9 +95,7 @@ static void dn_slow_timer(unsigned long arg)
100 scp->keepalive_fxn(sk); 95 scp->keepalive_fxn(sk);
101 } 96 }
102 97
103 sk->sk_timer.expires = jiffies + SLOW_INTERVAL; 98 sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL);
104
105 add_timer(&sk->sk_timer);
106out: 99out:
107 bh_unlock_sock(sk); 100 bh_unlock_sock(sk);
108 sock_put(sk); 101 sock_put(sk);
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 3fb14b7c13cf..0dc1589343c3 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -12,6 +12,7 @@
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/module.h>
15#include <net/dsa.h> 16#include <net/dsa.h>
16#include "dsa_priv.h" 17#include "dsa_priv.h"
17 18
diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
index 71ee1108d4f8..adaf46214905 100644
--- a/net/ieee802154/nl-mac.c
+++ b/net/ieee802154/nl-mac.c
@@ -30,6 +30,7 @@
30#include <net/genetlink.h> 30#include <net/genetlink.h>
31#include <net/sock.h> 31#include <net/sock.h>
32#include <linux/nl802154.h> 32#include <linux/nl802154.h>
33#include <linux/export.h>
33#include <net/af_ieee802154.h> 34#include <net/af_ieee802154.h>
34#include <net/nl802154.h> 35#include <net/nl802154.h>
35#include <net/ieee802154.h> 36#include <net/ieee802154.h>
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index c1f4154552fc..36d14406261e 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -136,8 +136,6 @@ static void ah_output_done(struct crypto_async_request *base, int err)
136 memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr)); 136 memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr));
137 } 137 }
138 138
139 err = ah->nexthdr;
140
141 kfree(AH_SKB_CB(skb)->tmp); 139 kfree(AH_SKB_CB(skb)->tmp);
142 xfrm_output_resume(skb, err); 140 xfrm_output_resume(skb, err);
143} 141}
@@ -264,12 +262,12 @@ static void ah_input_done(struct crypto_async_request *base, int err)
264 if (err) 262 if (err)
265 goto out; 263 goto out;
266 264
265 err = ah->nexthdr;
266
267 skb->network_header += ah_hlen; 267 skb->network_header += ah_hlen;
268 memcpy(skb_network_header(skb), work_iph, ihl); 268 memcpy(skb_network_header(skb), work_iph, ihl);
269 __skb_pull(skb, ah_hlen + ihl); 269 __skb_pull(skb, ah_hlen + ihl);
270 skb_set_transport_header(skb, -ihl); 270 skb_set_transport_header(skb, -ihl);
271
272 err = ah->nexthdr;
273out: 271out:
274 kfree(AH_SKB_CB(skb)->tmp); 272 kfree(AH_SKB_CB(skb)->tmp);
275 xfrm_input_resume(skb, err); 273 xfrm_input_resume(skb, err);
@@ -371,8 +369,6 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
371 if (err == -EINPROGRESS) 369 if (err == -EINPROGRESS)
372 goto out; 370 goto out;
373 371
374 if (err == -EBUSY)
375 err = NET_XMIT_DROP;
376 goto out_free; 372 goto out_free;
377 } 373 }
378 374
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index a53bb1b5b118..46339ba7a2d3 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -26,6 +26,7 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/rcupdate.h> 28#include <linux/rcupdate.h>
29#include <linux/export.h>
29#include <net/ip.h> 30#include <net/ip.h>
30#include <net/route.h> 31#include <net/route.h>
31#include <net/tcp.h> 32#include <net/tcp.h>
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 89d6f71a6a99..37b671185c81 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -73,6 +73,7 @@
73#include <linux/list.h> 73#include <linux/list.h>
74#include <linux/slab.h> 74#include <linux/slab.h>
75#include <linux/prefetch.h> 75#include <linux/prefetch.h>
76#include <linux/export.h>
76#include <net/net_namespace.h> 77#include <net/net_namespace.h>
77#include <net/ip.h> 78#include <net/ip.h>
78#include <net/protocol.h> 79#include <net/protocol.h>
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index c7472eff2d51..b2ca095cb9da 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1716,7 +1716,8 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
1716 if (err) { 1716 if (err) {
1717 int j; 1717 int j;
1718 1718
1719 pmc->sfcount[sfmode]--; 1719 if (!delta)
1720 pmc->sfcount[sfmode]--;
1720 for (j=0; j<i; j++) 1721 for (j=0; j<i; j++)
1721 (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]); 1722 (void) ip_mc_del1_src(pmc, sfmode, &psfsrc[j]);
1722 } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) { 1723 } else if (isexclude != (pmc->sfcount[MCAST_EXCLUDE] != 0)) {
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index f5e2bdaef949..ccee270a9b65 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -108,9 +108,6 @@ static int inet_csk_diag_fill(struct sock *sk,
108 icsk->icsk_ca_ops->name); 108 icsk->icsk_ca_ops->name);
109 } 109 }
110 110
111 if ((ext & (1 << (INET_DIAG_TOS - 1))) && (sk->sk_family != AF_INET6))
112 RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos);
113
114 r->idiag_family = sk->sk_family; 111 r->idiag_family = sk->sk_family;
115 r->idiag_state = sk->sk_state; 112 r->idiag_state = sk->sk_state;
116 r->idiag_timer = 0; 113 r->idiag_timer = 0;
@@ -125,16 +122,23 @@ static int inet_csk_diag_fill(struct sock *sk,
125 r->id.idiag_src[0] = inet->inet_rcv_saddr; 122 r->id.idiag_src[0] = inet->inet_rcv_saddr;
126 r->id.idiag_dst[0] = inet->inet_daddr; 123 r->id.idiag_dst[0] = inet->inet_daddr;
127 124
125 /* IPv6 dual-stack sockets use inet->tos for IPv4 connections,
126 * hence this needs to be included regardless of socket family.
127 */
128 if (ext & (1 << (INET_DIAG_TOS - 1)))
129 RTA_PUT_U8(skb, INET_DIAG_TOS, inet->tos);
130
128#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 131#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
129 if (r->idiag_family == AF_INET6) { 132 if (r->idiag_family == AF_INET6) {
130 const struct ipv6_pinfo *np = inet6_sk(sk); 133 const struct ipv6_pinfo *np = inet6_sk(sk);
131 134
135 if (ext & (1 << (INET_DIAG_TCLASS - 1)))
136 RTA_PUT_U8(skb, INET_DIAG_TCLASS, np->tclass);
137
132 ipv6_addr_copy((struct in6_addr *)r->id.idiag_src, 138 ipv6_addr_copy((struct in6_addr *)r->id.idiag_src,
133 &np->rcv_saddr); 139 &np->rcv_saddr);
134 ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst, 140 ipv6_addr_copy((struct in6_addr *)r->id.idiag_dst,
135 &np->daddr); 141 &np->daddr);
136 if (ext & (1 << (INET_DIAG_TOS - 1)))
137 RTA_PUT_U8(skb, INET_DIAG_TOS, np->tclass);
138 } 142 }
139#endif 143#endif
140 144
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index 44d65d546e30..89168c6351ff 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/kmemcheck.h> 12#include <linux/kmemcheck.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/module.h>
14#include <net/inet_hashtables.h> 15#include <net/inet_hashtables.h>
15#include <net/inet_timewait_sock.h> 16#include <net/inet_timewait_sock.h>
16#include <net/ip.h> 17#include <net/ip.h>
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 3b34d1c86270..29a07b6c7168 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -84,7 +84,7 @@ int ip_forward(struct sk_buff *skb)
84 84
85 rt = skb_rtable(skb); 85 rt = skb_rtable(skb);
86 86
87 if (opt->is_strictroute && ip_hdr(skb)->daddr != rt->rt_gateway) 87 if (opt->is_strictroute && opt->nexthop != rt->rt_gateway)
88 goto sr_failed; 88 goto sr_failed;
89 89
90 if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) && 90 if (unlikely(skb->len > dst_mtu(&rt->dst) && !skb_is_gso(skb) &&
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index ec93335901dd..1e60f7679075 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -568,12 +568,13 @@ void ip_forward_options(struct sk_buff *skb)
568 ) { 568 ) {
569 if (srrptr + 3 > srrspace) 569 if (srrptr + 3 > srrspace)
570 break; 570 break;
571 if (memcmp(&ip_hdr(skb)->daddr, &optptr[srrptr-1], 4) == 0) 571 if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0)
572 break; 572 break;
573 } 573 }
574 if (srrptr + 3 <= srrspace) { 574 if (srrptr + 3 <= srrspace) {
575 opt->is_changed = 1; 575 opt->is_changed = 1;
576 ip_rt_get_source(&optptr[srrptr-1], skb, rt); 576 ip_rt_get_source(&optptr[srrptr-1], skb, rt);
577 ip_hdr(skb)->daddr = opt->nexthop;
577 optptr[2] = srrptr+4; 578 optptr[2] = srrptr+4;
578 } else if (net_ratelimit()) 579 } else if (net_ratelimit())
579 printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n"); 580 printk(KERN_CRIT "ip_forward(): Argh! Destination lost!\n");
@@ -640,6 +641,7 @@ int ip_options_rcv_srr(struct sk_buff *skb)
640 } 641 }
641 if (srrptr <= srrspace) { 642 if (srrptr <= srrspace) {
642 opt->srr_is_hit = 1; 643 opt->srr_is_hit = 1;
644 opt->nexthop = nexthop;
643 opt->is_changed = 1; 645 opt->is_changed = 1;
644 } 646 }
645 return 0; 647 return 0;
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 472a8c4f1dc0..0da2afc97f32 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -54,6 +54,7 @@
54#include <linux/delay.h> 54#include <linux/delay.h>
55#include <linux/nfs_fs.h> 55#include <linux/nfs_fs.h>
56#include <linux/slab.h> 56#include <linux/slab.h>
57#include <linux/export.h>
57#include <net/net_namespace.h> 58#include <net/net_namespace.h>
58#include <net/arp.h> 59#include <net/arp.h>
59#include <net/ip.h> 60#include <net/ip.h>
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 6164e982e0ef..76a7f07b38b6 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -61,6 +61,7 @@
61#include <linux/if_arp.h> 61#include <linux/if_arp.h>
62#include <linux/netfilter_ipv4.h> 62#include <linux/netfilter_ipv4.h>
63#include <linux/compat.h> 63#include <linux/compat.h>
64#include <linux/export.h>
64#include <net/ipip.h> 65#include <net/ipip.h>
65#include <net/checksum.h> 66#include <net/checksum.h>
66#include <net/netlink.h> 67#include <net/netlink.h>
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index 929b27bdeb79..4f47e064e262 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -5,6 +5,7 @@
5#include <linux/ip.h> 5#include <linux/ip.h>
6#include <linux/skbuff.h> 6#include <linux/skbuff.h>
7#include <linux/gfp.h> 7#include <linux/gfp.h>
8#include <linux/export.h>
8#include <net/route.h> 9#include <net/route.h>
9#include <net/xfrm.h> 10#include <net/xfrm.h>
10#include <net/ip.h> 11#include <net/ip.h>
@@ -63,7 +64,8 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type)
63 /* Change in oif may mean change in hh_len. */ 64 /* Change in oif may mean change in hh_len. */
64 hh_len = skb_dst(skb)->dev->hard_header_len; 65 hh_len = skb_dst(skb)->dev->hard_header_len;
65 if (skb_headroom(skb) < hh_len && 66 if (skb_headroom(skb) < hh_len &&
66 pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC)) 67 pskb_expand_head(skb, HH_DATA_ALIGN(hh_len - skb_headroom(skb)),
68 0, GFP_ATOMIC))
67 return -1; 69 return -1;
68 70
69 return 0; 71 return 0;
diff --git a/net/ipv4/netfilter/Kconfig b/net/ipv4/netfilter/Kconfig
index 1dfc18a03fd4..f19f2182894c 100644
--- a/net/ipv4/netfilter/Kconfig
+++ b/net/ipv4/netfilter/Kconfig
@@ -325,7 +325,6 @@ config IP_NF_TARGET_TTL
325# raw + specific targets 325# raw + specific targets
326config IP_NF_RAW 326config IP_NF_RAW
327 tristate 'raw table support (required for NOTRACK/TRACE)' 327 tristate 'raw table support (required for NOTRACK/TRACE)'
328 depends on NETFILTER_ADVANCED
329 help 328 help
330 This option adds a `raw' table to iptables. This table is the very 329 This option adds a `raw' table to iptables. This table is the very
331 first in the netfilter framework and hooks in at the PREROUTING 330 first in the netfilter framework and hooks in at the PREROUTING
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index db8d22db425f..a639967eb727 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -395,7 +395,6 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par)
395 config = clusterip_config_init(cipinfo, 395 config = clusterip_config_init(cipinfo,
396 e->ip.dst.s_addr, dev); 396 e->ip.dst.s_addr, dev);
397 if (!config) { 397 if (!config) {
398 pr_info("cannot allocate config\n");
399 dev_put(dev); 398 dev_put(dev);
400 return -ENOMEM; 399 return -ENOMEM;
401 } 400 }
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index 446e0f467a17..b5508151e547 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -135,10 +135,8 @@ static struct sk_buff *ulog_alloc_skb(unsigned int size)
135 * due to slab allocator restrictions */ 135 * due to slab allocator restrictions */
136 136
137 n = max(size, nlbufsiz); 137 n = max(size, nlbufsiz);
138 skb = alloc_skb(n, GFP_ATOMIC); 138 skb = alloc_skb(n, GFP_ATOMIC | __GFP_NOWARN);
139 if (!skb) { 139 if (!skb) {
140 pr_debug("cannot alloc whole buffer %ub!\n", n);
141
142 if (n > size) { 140 if (n > size) {
143 /* try to allocate only as much as we need for 141 /* try to allocate only as much as we need for
144 * current packet */ 142 * current packet */
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
index 5585980fce2e..9682b36df38c 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
@@ -21,6 +21,7 @@
21#include <net/netfilter/nf_conntrack_expect.h> 21#include <net/netfilter/nf_conntrack_expect.h>
22#include <net/netfilter/nf_conntrack_acct.h> 22#include <net/netfilter/nf_conntrack_acct.h>
23#include <linux/rculist_nulls.h> 23#include <linux/rculist_nulls.h>
24#include <linux/export.h>
24 25
25struct ct_iter_state { 26struct ct_iter_state {
26 struct seq_net_private p; 27 struct seq_net_private p;
diff --git a/net/ipv4/netfilter/nf_nat_proto_common.c b/net/ipv4/netfilter/nf_nat_proto_common.c
index f52d41ea0690..a3d997618602 100644
--- a/net/ipv4/netfilter/nf_nat_proto_common.c
+++ b/net/ipv4/netfilter/nf_nat_proto_common.c
@@ -12,6 +12,7 @@
12#include <linux/ip.h> 12#include <linux/ip.h>
13 13
14#include <linux/netfilter.h> 14#include <linux/netfilter.h>
15#include <linux/export.h>
15#include <net/secure_seq.h> 16#include <net/secure_seq.h>
16#include <net/netfilter/nf_nat.h> 17#include <net/netfilter/nf_nat.h>
17#include <net/netfilter/nf_nat_core.h> 18#include <net/netfilter/nf_nat_core.h>
diff --git a/net/ipv4/netfilter/nf_nat_proto_icmp.c b/net/ipv4/netfilter/nf_nat_proto_icmp.c
index 5744c3ec847c..9f4dc1235dc7 100644
--- a/net/ipv4/netfilter/nf_nat_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_nat_proto_icmp.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/export.h>
11#include <linux/ip.h> 12#include <linux/ip.h>
12#include <linux/icmp.h> 13#include <linux/icmp.h>
13 14
diff --git a/net/ipv4/netfilter/nf_nat_proto_sctp.c b/net/ipv4/netfilter/nf_nat_proto_sctp.c
index 756331d42661..bd5a80a62a5b 100644
--- a/net/ipv4/netfilter/nf_nat_proto_sctp.c
+++ b/net/ipv4/netfilter/nf_nat_proto_sctp.c
@@ -10,6 +10,7 @@
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/ip.h> 11#include <linux/ip.h>
12#include <linux/sctp.h> 12#include <linux/sctp.h>
13#include <linux/module.h>
13#include <net/sctp/checksum.h> 14#include <net/sctp/checksum.h>
14 15
15#include <net/netfilter/nf_nat_protocol.h> 16#include <net/netfilter/nf_nat_protocol.h>
diff --git a/net/ipv4/netfilter/nf_nat_proto_tcp.c b/net/ipv4/netfilter/nf_nat_proto_tcp.c
index aa460a595d5d..0d67bb80130f 100644
--- a/net/ipv4/netfilter/nf_nat_proto_tcp.c
+++ b/net/ipv4/netfilter/nf_nat_proto_tcp.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/export.h>
11#include <linux/ip.h> 12#include <linux/ip.h>
12#include <linux/tcp.h> 13#include <linux/tcp.h>
13 14
diff --git a/net/ipv4/netfilter/nf_nat_proto_udp.c b/net/ipv4/netfilter/nf_nat_proto_udp.c
index dfe65c7e2925..0b1b8601cba7 100644
--- a/net/ipv4/netfilter/nf_nat_proto_udp.c
+++ b/net/ipv4/netfilter/nf_nat_proto_udp.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/export.h>
10#include <linux/init.h> 11#include <linux/init.h>
11#include <linux/ip.h> 12#include <linux/ip.h>
12#include <linux/udp.h> 13#include <linux/udp.h>
diff --git a/net/ipv4/netfilter/nf_nat_proto_udplite.c b/net/ipv4/netfilter/nf_nat_proto_udplite.c
index 3cc8c8af39ef..f83ef23e2ab7 100644
--- a/net/ipv4/netfilter/nf_nat_proto_udplite.c
+++ b/net/ipv4/netfilter/nf_nat_proto_udplite.c
@@ -13,6 +13,7 @@
13#include <linux/udp.h> 13#include <linux/udp.h>
14 14
15#include <linux/netfilter.h> 15#include <linux/netfilter.h>
16#include <linux/module.h>
16#include <net/netfilter/nf_nat.h> 17#include <net/netfilter/nf_nat.h>
17#include <net/netfilter/nf_nat_protocol.h> 18#include <net/netfilter/nf_nat_protocol.h>
18 19
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
index d1cb412c18e0..2133c30a4a5f 100644
--- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
@@ -400,11 +400,8 @@ static unsigned char asn1_octets_decode(struct asn1_ctx *ctx,
400 *len = 0; 400 *len = 0;
401 401
402 *octets = kmalloc(eoc - ctx->pointer, GFP_ATOMIC); 402 *octets = kmalloc(eoc - ctx->pointer, GFP_ATOMIC);
403 if (*octets == NULL) { 403 if (*octets == NULL)
404 if (net_ratelimit())
405 pr_notice("OOM in bsalg (%d)\n", __LINE__);
406 return 0; 404 return 0;
407 }
408 405
409 ptr = *octets; 406 ptr = *octets;
410 while (ctx->pointer < eoc) { 407 while (ctx->pointer < eoc) {
@@ -451,11 +448,8 @@ static unsigned char asn1_oid_decode(struct asn1_ctx *ctx,
451 return 0; 448 return 0;
452 449
453 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC); 450 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
454 if (*oid == NULL) { 451 if (*oid == NULL)
455 if (net_ratelimit())
456 pr_notice("OOM in bsalg (%d)\n", __LINE__);
457 return 0; 452 return 0;
458 }
459 453
460 optr = *oid; 454 optr = *oid;
461 455
@@ -728,8 +722,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
728 *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); 722 *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
729 if (*obj == NULL) { 723 if (*obj == NULL) {
730 kfree(id); 724 kfree(id);
731 if (net_ratelimit())
732 pr_notice("OOM in bsalg (%d)\n", __LINE__);
733 return 0; 725 return 0;
734 } 726 }
735 (*obj)->syntax.l[0] = l; 727 (*obj)->syntax.l[0] = l;
@@ -744,8 +736,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
744 if (*obj == NULL) { 736 if (*obj == NULL) {
745 kfree(p); 737 kfree(p);
746 kfree(id); 738 kfree(id);
747 if (net_ratelimit())
748 pr_notice("OOM in bsalg (%d)\n", __LINE__);
749 return 0; 739 return 0;
750 } 740 }
751 memcpy((*obj)->syntax.c, p, len); 741 memcpy((*obj)->syntax.c, p, len);
@@ -759,8 +749,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
759 *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC); 749 *obj = kmalloc(sizeof(struct snmp_object), GFP_ATOMIC);
760 if (*obj == NULL) { 750 if (*obj == NULL) {
761 kfree(id); 751 kfree(id);
762 if (net_ratelimit())
763 pr_notice("OOM in bsalg (%d)\n", __LINE__);
764 return 0; 752 return 0;
765 } 753 }
766 if (!asn1_null_decode(ctx, end)) { 754 if (!asn1_null_decode(ctx, end)) {
@@ -780,8 +768,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
780 if (*obj == NULL) { 768 if (*obj == NULL) {
781 kfree(lp); 769 kfree(lp);
782 kfree(id); 770 kfree(id);
783 if (net_ratelimit())
784 pr_notice("OOM in bsalg (%d)\n", __LINE__);
785 return 0; 771 return 0;
786 } 772 }
787 memcpy((*obj)->syntax.ul, lp, len); 773 memcpy((*obj)->syntax.ul, lp, len);
@@ -801,8 +787,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
801 if (*obj == NULL) { 787 if (*obj == NULL) {
802 kfree(p); 788 kfree(p);
803 kfree(id); 789 kfree(id);
804 if (net_ratelimit())
805 pr_notice("OOM in bsalg (%d)\n", __LINE__);
806 return 0; 790 return 0;
807 } 791 }
808 memcpy((*obj)->syntax.uc, p, len); 792 memcpy((*obj)->syntax.uc, p, len);
@@ -819,8 +803,6 @@ static unsigned char snmp_object_decode(struct asn1_ctx *ctx,
819 *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC); 803 *obj = kmalloc(sizeof(struct snmp_object) + len, GFP_ATOMIC);
820 if (*obj == NULL) { 804 if (*obj == NULL) {
821 kfree(id); 805 kfree(id);
822 if (net_ratelimit())
823 pr_notice("OOM in bsalg (%d)\n", __LINE__);
824 return 0; 806 return 0;
825 } 807 }
826 (*obj)->syntax.ul[0] = ul; 808 (*obj)->syntax.ul[0] = ul;
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 39b403f854c6..43d4c3b22369 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -39,6 +39,7 @@
39#include <net/protocol.h> 39#include <net/protocol.h>
40#include <linux/skbuff.h> 40#include <linux/skbuff.h>
41#include <linux/proc_fs.h> 41#include <linux/proc_fs.h>
42#include <linux/export.h>
42#include <net/sock.h> 43#include <net/sock.h>
43#include <net/ping.h> 44#include <net/ping.h>
44#include <net/udp.h> 45#include <net/udp.h>
@@ -338,7 +339,6 @@ void ping_err(struct sk_buff *skb, u32 info)
338 sk = ping_v4_lookup(net, iph->daddr, iph->saddr, 339 sk = ping_v4_lookup(net, iph->daddr, iph->saddr,
339 ntohs(icmph->un.echo.id), skb->dev->ifindex); 340 ntohs(icmph->un.echo.id), skb->dev->ifindex);
340 if (sk == NULL) { 341 if (sk == NULL) {
341 ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
342 pr_debug("no socket, dropping\n"); 342 pr_debug("no socket, dropping\n");
343 return; /* No socket for error */ 343 return; /* No socket for error */
344 } 344 }
@@ -678,7 +678,6 @@ static int ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
678 pr_debug("ping_queue_rcv_skb(sk=%p,sk->num=%d,skb=%p)\n", 678 pr_debug("ping_queue_rcv_skb(sk=%p,sk->num=%d,skb=%p)\n",
679 inet_sk(sk), inet_sk(sk)->inet_num, skb); 679 inet_sk(sk), inet_sk(sk)->inet_num, skb);
680 if (sock_queue_rcv_skb(sk, skb) < 0) { 680 if (sock_queue_rcv_skb(sk, skb) < 0) {
681 ICMP_INC_STATS_BH(sock_net(sk), ICMP_MIB_INERRORS);
682 kfree_skb(skb); 681 kfree_skb(skb);
683 pr_debug("ping_queue_rcv_skb -> failed\n"); 682 pr_debug("ping_queue_rcv_skb -> failed\n");
684 return -1; 683 return -1;
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 4bfad5da94f4..466ea8bb7a4d 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -42,6 +42,7 @@
42#include <linux/inetdevice.h> 42#include <linux/inetdevice.h>
43#include <linux/proc_fs.h> 43#include <linux/proc_fs.h>
44#include <linux/seq_file.h> 44#include <linux/seq_file.h>
45#include <linux/export.h>
45#include <net/sock.h> 46#include <net/sock.h>
46#include <net/raw.h> 47#include <net/raw.h>
47 48
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 61714bd52925..007e2eb769d3 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -48,6 +48,7 @@
48#include <linux/errno.h> 48#include <linux/errno.h>
49#include <linux/aio.h> 49#include <linux/aio.h>
50#include <linux/kernel.h> 50#include <linux/kernel.h>
51#include <linux/export.h>
51#include <linux/spinlock.h> 52#include <linux/spinlock.h>
52#include <linux/sockios.h> 53#include <linux/sockios.h>
53#include <linux/socket.h> 54#include <linux/socket.h>
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 155138d8ec8b..5c2847247f51 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -131,6 +131,7 @@ static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ;
131static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; 131static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20;
132static int ip_rt_min_advmss __read_mostly = 256; 132static int ip_rt_min_advmss __read_mostly = 256;
133static int rt_chain_length_max __read_mostly = 20; 133static int rt_chain_length_max __read_mostly = 20;
134static int redirect_genid;
134 135
135/* 136/*
136 * Interface to generic destination cache. 137 * Interface to generic destination cache.
@@ -138,7 +139,7 @@ static int rt_chain_length_max __read_mostly = 20;
138 139
139static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie); 140static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie);
140static unsigned int ipv4_default_advmss(const struct dst_entry *dst); 141static unsigned int ipv4_default_advmss(const struct dst_entry *dst);
141static unsigned int ipv4_default_mtu(const struct dst_entry *dst); 142static unsigned int ipv4_mtu(const struct dst_entry *dst);
142static void ipv4_dst_destroy(struct dst_entry *dst); 143static void ipv4_dst_destroy(struct dst_entry *dst);
143static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); 144static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
144static void ipv4_link_failure(struct sk_buff *skb); 145static void ipv4_link_failure(struct sk_buff *skb);
@@ -193,7 +194,7 @@ static struct dst_ops ipv4_dst_ops = {
193 .gc = rt_garbage_collect, 194 .gc = rt_garbage_collect,
194 .check = ipv4_dst_check, 195 .check = ipv4_dst_check,
195 .default_advmss = ipv4_default_advmss, 196 .default_advmss = ipv4_default_advmss,
196 .default_mtu = ipv4_default_mtu, 197 .mtu = ipv4_mtu,
197 .cow_metrics = ipv4_cow_metrics, 198 .cow_metrics = ipv4_cow_metrics,
198 .destroy = ipv4_dst_destroy, 199 .destroy = ipv4_dst_destroy,
199 .ifdown = ipv4_dst_ifdown, 200 .ifdown = ipv4_dst_ifdown,
@@ -837,6 +838,7 @@ static void rt_cache_invalidate(struct net *net)
837 838
838 get_random_bytes(&shuffle, sizeof(shuffle)); 839 get_random_bytes(&shuffle, sizeof(shuffle));
839 atomic_add(shuffle + 1U, &net->ipv4.rt_genid); 840 atomic_add(shuffle + 1U, &net->ipv4.rt_genid);
841 redirect_genid++;
840} 842}
841 843
842/* 844/*
@@ -1304,16 +1306,42 @@ static void rt_del(unsigned hash, struct rtable *rt)
1304 spin_unlock_bh(rt_hash_lock_addr(hash)); 1306 spin_unlock_bh(rt_hash_lock_addr(hash));
1305} 1307}
1306 1308
1309static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer)
1310{
1311 struct rtable *rt = (struct rtable *) dst;
1312 __be32 orig_gw = rt->rt_gateway;
1313 struct neighbour *n, *old_n;
1314
1315 dst_confirm(&rt->dst);
1316
1317 rt->rt_gateway = peer->redirect_learned.a4;
1318
1319 n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway);
1320 if (IS_ERR(n))
1321 return PTR_ERR(n);
1322 old_n = xchg(&rt->dst._neighbour, n);
1323 if (old_n)
1324 neigh_release(old_n);
1325 if (!n || !(n->nud_state & NUD_VALID)) {
1326 if (n)
1327 neigh_event_send(n, NULL);
1328 rt->rt_gateway = orig_gw;
1329 return -EAGAIN;
1330 } else {
1331 rt->rt_flags |= RTCF_REDIRECTED;
1332 call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n);
1333 }
1334 return 0;
1335}
1336
1307/* called in rcu_read_lock() section */ 1337/* called in rcu_read_lock() section */
1308void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, 1338void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1309 __be32 saddr, struct net_device *dev) 1339 __be32 saddr, struct net_device *dev)
1310{ 1340{
1311 int s, i; 1341 int s, i;
1312 struct in_device *in_dev = __in_dev_get_rcu(dev); 1342 struct in_device *in_dev = __in_dev_get_rcu(dev);
1313 struct rtable *rt;
1314 __be32 skeys[2] = { saddr, 0 }; 1343 __be32 skeys[2] = { saddr, 0 };
1315 int ikeys[2] = { dev->ifindex, 0 }; 1344 int ikeys[2] = { dev->ifindex, 0 };
1316 struct flowi4 fl4;
1317 struct inet_peer *peer; 1345 struct inet_peer *peer;
1318 struct net *net; 1346 struct net *net;
1319 1347
@@ -1336,33 +1364,44 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1336 goto reject_redirect; 1364 goto reject_redirect;
1337 } 1365 }
1338 1366
1339 memset(&fl4, 0, sizeof(fl4));
1340 fl4.daddr = daddr;
1341 for (s = 0; s < 2; s++) { 1367 for (s = 0; s < 2; s++) {
1342 for (i = 0; i < 2; i++) { 1368 for (i = 0; i < 2; i++) {
1343 fl4.flowi4_oif = ikeys[i]; 1369 unsigned int hash;
1344 fl4.saddr = skeys[s]; 1370 struct rtable __rcu **rthp;
1345 rt = __ip_route_output_key(net, &fl4); 1371 struct rtable *rt;
1346 if (IS_ERR(rt)) 1372
1347 continue; 1373 hash = rt_hash(daddr, skeys[s], ikeys[i], rt_genid(net));
1348 1374
1349 if (rt->dst.error || rt->dst.dev != dev || 1375 rthp = &rt_hash_table[hash].chain;
1350 rt->rt_gateway != old_gw) { 1376
1351 ip_rt_put(rt); 1377 while ((rt = rcu_dereference(*rthp)) != NULL) {
1352 continue; 1378 rthp = &rt->dst.rt_next;
1353 } 1379
1354 1380 if (rt->rt_key_dst != daddr ||
1355 if (!rt->peer) 1381 rt->rt_key_src != skeys[s] ||
1356 rt_bind_peer(rt, rt->rt_dst, 1); 1382 rt->rt_oif != ikeys[i] ||
1383 rt_is_input_route(rt) ||
1384 rt_is_expired(rt) ||
1385 !net_eq(dev_net(rt->dst.dev), net) ||
1386 rt->dst.error ||
1387 rt->dst.dev != dev ||
1388 rt->rt_gateway != old_gw)
1389 continue;
1357 1390
1358 peer = rt->peer; 1391 if (!rt->peer)
1359 if (peer) { 1392 rt_bind_peer(rt, rt->rt_dst, 1);
1360 peer->redirect_learned.a4 = new_gw; 1393
1361 atomic_inc(&__rt_peer_genid); 1394 peer = rt->peer;
1395 if (peer) {
1396 if (peer->redirect_learned.a4 != new_gw ||
1397 peer->redirect_genid != redirect_genid) {
1398 peer->redirect_learned.a4 = new_gw;
1399 peer->redirect_genid = redirect_genid;
1400 atomic_inc(&__rt_peer_genid);
1401 }
1402 check_peer_redir(&rt->dst, peer);
1403 }
1362 } 1404 }
1363
1364 ip_rt_put(rt);
1365 return;
1366 } 1405 }
1367 } 1406 }
1368 return; 1407 return;
@@ -1649,33 +1688,6 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
1649 } 1688 }
1650} 1689}
1651 1690
1652static int check_peer_redir(struct dst_entry *dst, struct inet_peer *peer)
1653{
1654 struct rtable *rt = (struct rtable *) dst;
1655 __be32 orig_gw = rt->rt_gateway;
1656 struct neighbour *n, *old_n;
1657
1658 dst_confirm(&rt->dst);
1659
1660 rt->rt_gateway = peer->redirect_learned.a4;
1661
1662 n = ipv4_neigh_lookup(&rt->dst, &rt->rt_gateway);
1663 if (IS_ERR(n))
1664 return PTR_ERR(n);
1665 old_n = xchg(&rt->dst._neighbour, n);
1666 if (old_n)
1667 neigh_release(old_n);
1668 if (!n || !(n->nud_state & NUD_VALID)) {
1669 if (n)
1670 neigh_event_send(n, NULL);
1671 rt->rt_gateway = orig_gw;
1672 return -EAGAIN;
1673 } else {
1674 rt->rt_flags |= RTCF_REDIRECTED;
1675 call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, n);
1676 }
1677 return 0;
1678}
1679 1691
1680static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) 1692static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
1681{ 1693{
@@ -1693,6 +1705,8 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
1693 if (peer) { 1705 if (peer) {
1694 check_peer_pmtu(dst, peer); 1706 check_peer_pmtu(dst, peer);
1695 1707
1708 if (peer->redirect_genid != redirect_genid)
1709 peer->redirect_learned.a4 = 0;
1696 if (peer->redirect_learned.a4 && 1710 if (peer->redirect_learned.a4 &&
1697 peer->redirect_learned.a4 != rt->rt_gateway) { 1711 peer->redirect_learned.a4 != rt->rt_gateway) {
1698 if (check_peer_redir(dst, peer)) 1712 if (check_peer_redir(dst, peer))
@@ -1806,12 +1820,17 @@ static unsigned int ipv4_default_advmss(const struct dst_entry *dst)
1806 return advmss; 1820 return advmss;
1807} 1821}
1808 1822
1809static unsigned int ipv4_default_mtu(const struct dst_entry *dst) 1823static unsigned int ipv4_mtu(const struct dst_entry *dst)
1810{ 1824{
1811 unsigned int mtu = dst->dev->mtu; 1825 const struct rtable *rt = (const struct rtable *) dst;
1826 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
1827
1828 if (mtu && rt_is_output_route(rt))
1829 return mtu;
1830
1831 mtu = dst->dev->mtu;
1812 1832
1813 if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { 1833 if (unlikely(dst_metric_locked(dst, RTAX_MTU))) {
1814 const struct rtable *rt = (const struct rtable *) dst;
1815 1834
1816 if (rt->rt_gateway != rt->rt_dst && mtu > 576) 1835 if (rt->rt_gateway != rt->rt_dst && mtu > 576)
1817 mtu = 576; 1836 mtu = 576;
@@ -1844,6 +1863,8 @@ static void rt_init_metrics(struct rtable *rt, const struct flowi4 *fl4,
1844 dst_init_metrics(&rt->dst, peer->metrics, false); 1863 dst_init_metrics(&rt->dst, peer->metrics, false);
1845 1864
1846 check_peer_pmtu(&rt->dst, peer); 1865 check_peer_pmtu(&rt->dst, peer);
1866 if (peer->redirect_genid != redirect_genid)
1867 peer->redirect_learned.a4 = 0;
1847 if (peer->redirect_learned.a4 && 1868 if (peer->redirect_learned.a4 &&
1848 peer->redirect_learned.a4 != rt->rt_gateway) { 1869 peer->redirect_learned.a4 != rt->rt_gateway) {
1849 rt->rt_gateway = peer->redirect_learned.a4; 1870 rt->rt_gateway = peer->redirect_learned.a4;
@@ -2747,9 +2768,11 @@ static struct dst_entry *ipv4_blackhole_dst_check(struct dst_entry *dst, u32 coo
2747 return NULL; 2768 return NULL;
2748} 2769}
2749 2770
2750static unsigned int ipv4_blackhole_default_mtu(const struct dst_entry *dst) 2771static unsigned int ipv4_blackhole_mtu(const struct dst_entry *dst)
2751{ 2772{
2752 return 0; 2773 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
2774
2775 return mtu ? : dst->dev->mtu;
2753} 2776}
2754 2777
2755static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) 2778static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
@@ -2767,7 +2790,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = {
2767 .protocol = cpu_to_be16(ETH_P_IP), 2790 .protocol = cpu_to_be16(ETH_P_IP),
2768 .destroy = ipv4_dst_destroy, 2791 .destroy = ipv4_dst_destroy,
2769 .check = ipv4_blackhole_dst_check, 2792 .check = ipv4_blackhole_dst_check,
2770 .default_mtu = ipv4_blackhole_default_mtu, 2793 .mtu = ipv4_blackhole_mtu,
2771 .default_advmss = ipv4_default_advmss, 2794 .default_advmss = ipv4_default_advmss,
2772 .update_pmtu = ipv4_rt_blackhole_update_pmtu, 2795 .update_pmtu = ipv4_rt_blackhole_update_pmtu,
2773 .cow_metrics = ipv4_rt_blackhole_cow_metrics, 2796 .cow_metrics = ipv4_rt_blackhole_cow_metrics,
@@ -2845,7 +2868,7 @@ static int rt_fill_info(struct net *net,
2845 struct rtable *rt = skb_rtable(skb); 2868 struct rtable *rt = skb_rtable(skb);
2846 struct rtmsg *r; 2869 struct rtmsg *r;
2847 struct nlmsghdr *nlh; 2870 struct nlmsghdr *nlh;
2848 long expires = 0; 2871 unsigned long expires = 0;
2849 const struct inet_peer *peer = rt->peer; 2872 const struct inet_peer *peer = rt->peer;
2850 u32 id = 0, ts = 0, tsage = 0, error; 2873 u32 id = 0, ts = 0, tsage = 0, error;
2851 2874
@@ -2902,8 +2925,12 @@ static int rt_fill_info(struct net *net,
2902 tsage = get_seconds() - peer->tcp_ts_stamp; 2925 tsage = get_seconds() - peer->tcp_ts_stamp;
2903 } 2926 }
2904 expires = ACCESS_ONCE(peer->pmtu_expires); 2927 expires = ACCESS_ONCE(peer->pmtu_expires);
2905 if (expires) 2928 if (expires) {
2906 expires -= jiffies; 2929 if (time_before(jiffies, expires))
2930 expires -= jiffies;
2931 else
2932 expires = 0;
2933 }
2907 } 2934 }
2908 2935
2909 if (rt_is_input_route(rt)) { 2936 if (rt_is_input_route(rt)) {
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index d7b89b12f6d8..90f6544c13e2 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -15,6 +15,7 @@
15#include <linux/random.h> 15#include <linux/random.h>
16#include <linux/cryptohash.h> 16#include <linux/cryptohash.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/export.h>
18#include <net/tcp.h> 19#include <net/tcp.h>
19#include <net/route.h> 20#include <net/route.h>
20 21
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 0ea10eefa60f..a9db4b1a2215 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1510,6 +1510,8 @@ exit:
1510 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); 1510 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS);
1511 return NULL; 1511 return NULL;
1512put_and_exit: 1512put_and_exit:
1513 tcp_clear_xmit_timers(newsk);
1514 bh_unlock_sock(newsk);
1513 sock_put(newsk); 1515 sock_put(newsk);
1514 goto exit; 1516 goto exit;
1515} 1517}
@@ -2339,7 +2341,7 @@ static void tcp_seq_stop(struct seq_file *seq, void *v)
2339 } 2341 }
2340} 2342}
2341 2343
2342static int tcp_seq_open(struct inode *inode, struct file *file) 2344int tcp_seq_open(struct inode *inode, struct file *file)
2343{ 2345{
2344 struct tcp_seq_afinfo *afinfo = PDE(inode)->data; 2346 struct tcp_seq_afinfo *afinfo = PDE(inode)->data;
2345 struct tcp_iter_state *s; 2347 struct tcp_iter_state *s;
@@ -2355,23 +2357,19 @@ static int tcp_seq_open(struct inode *inode, struct file *file)
2355 s->last_pos = 0; 2357 s->last_pos = 0;
2356 return 0; 2358 return 0;
2357} 2359}
2360EXPORT_SYMBOL(tcp_seq_open);
2358 2361
2359int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo) 2362int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo)
2360{ 2363{
2361 int rc = 0; 2364 int rc = 0;
2362 struct proc_dir_entry *p; 2365 struct proc_dir_entry *p;
2363 2366
2364 afinfo->seq_fops.open = tcp_seq_open;
2365 afinfo->seq_fops.read = seq_read;
2366 afinfo->seq_fops.llseek = seq_lseek;
2367 afinfo->seq_fops.release = seq_release_net;
2368
2369 afinfo->seq_ops.start = tcp_seq_start; 2367 afinfo->seq_ops.start = tcp_seq_start;
2370 afinfo->seq_ops.next = tcp_seq_next; 2368 afinfo->seq_ops.next = tcp_seq_next;
2371 afinfo->seq_ops.stop = tcp_seq_stop; 2369 afinfo->seq_ops.stop = tcp_seq_stop;
2372 2370
2373 p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net, 2371 p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,
2374 &afinfo->seq_fops, afinfo); 2372 afinfo->seq_fops, afinfo);
2375 if (!p) 2373 if (!p)
2376 rc = -ENOMEM; 2374 rc = -ENOMEM;
2377 return rc; 2375 return rc;
@@ -2520,12 +2518,18 @@ out:
2520 return 0; 2518 return 0;
2521} 2519}
2522 2520
2521static const struct file_operations tcp_afinfo_seq_fops = {
2522 .owner = THIS_MODULE,
2523 .open = tcp_seq_open,
2524 .read = seq_read,
2525 .llseek = seq_lseek,
2526 .release = seq_release_net
2527};
2528
2523static struct tcp_seq_afinfo tcp4_seq_afinfo = { 2529static struct tcp_seq_afinfo tcp4_seq_afinfo = {
2524 .name = "tcp", 2530 .name = "tcp",
2525 .family = AF_INET, 2531 .family = AF_INET,
2526 .seq_fops = { 2532 .seq_fops = &tcp_afinfo_seq_fops,
2527 .owner = THIS_MODULE,
2528 },
2529 .seq_ops = { 2533 .seq_ops = {
2530 .show = tcp4_seq_show, 2534 .show = tcp4_seq_show,
2531 }, 2535 },
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 980b98f6288c..63170e297540 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1382,7 +1382,7 @@ static inline int tcp_minshall_check(const struct tcp_sock *tp)
1382/* Return 0, if packet can be sent now without violation Nagle's rules: 1382/* Return 0, if packet can be sent now without violation Nagle's rules:
1383 * 1. It is full sized. 1383 * 1. It is full sized.
1384 * 2. Or it contains FIN. (already checked by caller) 1384 * 2. Or it contains FIN. (already checked by caller)
1385 * 3. Or TCP_NODELAY was set. 1385 * 3. Or TCP_CORK is not set, and TCP_NODELAY is set.
1386 * 4. Or TCP_CORK is not set, and all sent packets are ACKed. 1386 * 4. Or TCP_CORK is not set, and all sent packets are ACKed.
1387 * With Minshall's modification: all sent small packets are ACKed. 1387 * With Minshall's modification: all sent small packets are ACKed.
1388 */ 1388 */
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index ebaa96bd3464..ab0966df1e2a 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1397,6 +1397,8 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1397 nf_reset(skb); 1397 nf_reset(skb);
1398 1398
1399 if (up->encap_type) { 1399 if (up->encap_type) {
1400 int (*encap_rcv)(struct sock *sk, struct sk_buff *skb);
1401
1400 /* 1402 /*
1401 * This is an encapsulation socket so pass the skb to 1403 * This is an encapsulation socket so pass the skb to
1402 * the socket's udp_encap_rcv() hook. Otherwise, just 1404 * the socket's udp_encap_rcv() hook. Otherwise, just
@@ -1409,11 +1411,11 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1409 */ 1411 */
1410 1412
1411 /* if we're overly short, let UDP handle it */ 1413 /* if we're overly short, let UDP handle it */
1412 if (skb->len > sizeof(struct udphdr) && 1414 encap_rcv = ACCESS_ONCE(up->encap_rcv);
1413 up->encap_rcv != NULL) { 1415 if (skb->len > sizeof(struct udphdr) && encap_rcv != NULL) {
1414 int ret; 1416 int ret;
1415 1417
1416 ret = (*up->encap_rcv)(sk, skb); 1418 ret = encap_rcv(sk, skb);
1417 if (ret <= 0) { 1419 if (ret <= 0) {
1418 UDP_INC_STATS_BH(sock_net(sk), 1420 UDP_INC_STATS_BH(sock_net(sk),
1419 UDP_MIB_INDATAGRAMS, 1421 UDP_MIB_INDATAGRAMS,
@@ -2037,7 +2039,7 @@ static void udp_seq_stop(struct seq_file *seq, void *v)
2037 spin_unlock_bh(&state->udp_table->hash[state->bucket].lock); 2039 spin_unlock_bh(&state->udp_table->hash[state->bucket].lock);
2038} 2040}
2039 2041
2040static int udp_seq_open(struct inode *inode, struct file *file) 2042int udp_seq_open(struct inode *inode, struct file *file)
2041{ 2043{
2042 struct udp_seq_afinfo *afinfo = PDE(inode)->data; 2044 struct udp_seq_afinfo *afinfo = PDE(inode)->data;
2043 struct udp_iter_state *s; 2045 struct udp_iter_state *s;
@@ -2053,6 +2055,7 @@ static int udp_seq_open(struct inode *inode, struct file *file)
2053 s->udp_table = afinfo->udp_table; 2055 s->udp_table = afinfo->udp_table;
2054 return err; 2056 return err;
2055} 2057}
2058EXPORT_SYMBOL(udp_seq_open);
2056 2059
2057/* ------------------------------------------------------------------------ */ 2060/* ------------------------------------------------------------------------ */
2058int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo) 2061int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
@@ -2060,17 +2063,12 @@ int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo)
2060 struct proc_dir_entry *p; 2063 struct proc_dir_entry *p;
2061 int rc = 0; 2064 int rc = 0;
2062 2065
2063 afinfo->seq_fops.open = udp_seq_open;
2064 afinfo->seq_fops.read = seq_read;
2065 afinfo->seq_fops.llseek = seq_lseek;
2066 afinfo->seq_fops.release = seq_release_net;
2067
2068 afinfo->seq_ops.start = udp_seq_start; 2066 afinfo->seq_ops.start = udp_seq_start;
2069 afinfo->seq_ops.next = udp_seq_next; 2067 afinfo->seq_ops.next = udp_seq_next;
2070 afinfo->seq_ops.stop = udp_seq_stop; 2068 afinfo->seq_ops.stop = udp_seq_stop;
2071 2069
2072 p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net, 2070 p = proc_create_data(afinfo->name, S_IRUGO, net->proc_net,
2073 &afinfo->seq_fops, afinfo); 2071 afinfo->seq_fops, afinfo);
2074 if (!p) 2072 if (!p)
2075 rc = -ENOMEM; 2073 rc = -ENOMEM;
2076 return rc; 2074 return rc;
@@ -2120,14 +2118,20 @@ int udp4_seq_show(struct seq_file *seq, void *v)
2120 return 0; 2118 return 0;
2121} 2119}
2122 2120
2121static const struct file_operations udp_afinfo_seq_fops = {
2122 .owner = THIS_MODULE,
2123 .open = udp_seq_open,
2124 .read = seq_read,
2125 .llseek = seq_lseek,
2126 .release = seq_release_net
2127};
2128
2123/* ------------------------------------------------------------------------ */ 2129/* ------------------------------------------------------------------------ */
2124static struct udp_seq_afinfo udp4_seq_afinfo = { 2130static struct udp_seq_afinfo udp4_seq_afinfo = {
2125 .name = "udp", 2131 .name = "udp",
2126 .family = AF_INET, 2132 .family = AF_INET,
2127 .udp_table = &udp_table, 2133 .udp_table = &udp_table,
2128 .seq_fops = { 2134 .seq_fops = &udp_afinfo_seq_fops,
2129 .owner = THIS_MODULE,
2130 },
2131 .seq_ops = { 2135 .seq_ops = {
2132 .show = udp4_seq_show, 2136 .show = udp4_seq_show,
2133 }, 2137 },
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index aee9963f7f5a..12e9499a1a6c 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -10,6 +10,7 @@
10 * as published by the Free Software Foundation; either version 10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 */ 12 */
13#include <linux/export.h>
13#include "udp_impl.h" 14#include "udp_impl.h"
14 15
15struct udp_table udplite_table __read_mostly; 16struct udp_table udplite_table __read_mostly;
@@ -71,13 +72,20 @@ static struct inet_protosw udplite4_protosw = {
71}; 72};
72 73
73#ifdef CONFIG_PROC_FS 74#ifdef CONFIG_PROC_FS
75
76static const struct file_operations udplite_afinfo_seq_fops = {
77 .owner = THIS_MODULE,
78 .open = udp_seq_open,
79 .read = seq_read,
80 .llseek = seq_lseek,
81 .release = seq_release_net
82};
83
74static struct udp_seq_afinfo udplite4_seq_afinfo = { 84static struct udp_seq_afinfo udplite4_seq_afinfo = {
75 .name = "udplite", 85 .name = "udplite",
76 .family = AF_INET, 86 .family = AF_INET,
77 .udp_table = &udplite_table, 87 .udp_table = &udplite_table,
78 .seq_fops = { 88 .seq_fops = &udplite_afinfo_seq_fops,
79 .owner = THIS_MODULE,
80 },
81 .seq_ops = { 89 .seq_ops = {
82 .show = udp4_seq_show, 90 .show = udp4_seq_show,
83 }, 91 },
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c
index d9ac0a0058b5..9258e751baba 100644
--- a/net/ipv4/xfrm4_state.c
+++ b/net/ipv4/xfrm4_state.c
@@ -12,6 +12,7 @@
12#include <linux/pfkeyv2.h> 12#include <linux/pfkeyv2.h>
13#include <linux/ipsec.h> 13#include <linux/ipsec.h>
14#include <linux/netfilter_ipv4.h> 14#include <linux/netfilter_ipv4.h>
15#include <linux/export.h>
15 16
16static int xfrm4_init_flags(struct xfrm_state *x) 17static int xfrm4_init_flags(struct xfrm_state *x)
17{ 18{
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d0611a5de45f..cf88df82e2c2 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -87,6 +87,7 @@
87 87
88#include <linux/proc_fs.h> 88#include <linux/proc_fs.h>
89#include <linux/seq_file.h> 89#include <linux/seq_file.h>
90#include <linux/export.h>
90 91
91/* Set to 3 to get tracing... */ 92/* Set to 3 to get tracing... */
92#define ACONF_DEBUG 2 93#define ACONF_DEBUG 2
diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c
index 6b03826552e1..399287e595d7 100644
--- a/net/ipv6/addrconf_core.c
+++ b/net/ipv6/addrconf_core.c
@@ -3,6 +3,7 @@
3 * not configured or static. 3 * not configured or static.
4 */ 4 */
5 5
6#include <linux/export.h>
6#include <net/ipv6.h> 7#include <net/ipv6.h>
7 8
8#define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16) 9#define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16)
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 2195ae651923..4c0f894d0843 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -324,8 +324,6 @@ static void ah6_output_done(struct crypto_async_request *base, int err)
324#endif 324#endif
325 } 325 }
326 326
327 err = ah->nexthdr;
328
329 kfree(AH_SKB_CB(skb)->tmp); 327 kfree(AH_SKB_CB(skb)->tmp);
330 xfrm_output_resume(skb, err); 328 xfrm_output_resume(skb, err);
331} 329}
@@ -466,12 +464,12 @@ static void ah6_input_done(struct crypto_async_request *base, int err)
466 if (err) 464 if (err)
467 goto out; 465 goto out;
468 466
467 err = ah->nexthdr;
468
469 skb->network_header += ah_hlen; 469 skb->network_header += ah_hlen;
470 memcpy(skb_network_header(skb), work_iph, hdr_len); 470 memcpy(skb_network_header(skb), work_iph, hdr_len);
471 __skb_pull(skb, ah_hlen + hdr_len); 471 __skb_pull(skb, ah_hlen + hdr_len);
472 skb_set_transport_header(skb, -hdr_len); 472 skb_set_transport_header(skb, -hdr_len);
473
474 err = ah->nexthdr;
475out: 473out:
476 kfree(AH_SKB_CB(skb)->tmp); 474 kfree(AH_SKB_CB(skb)->tmp);
477 xfrm_input_resume(skb, err); 475 xfrm_input_resume(skb, err);
@@ -583,8 +581,6 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
583 if (err == -EINPROGRESS) 581 if (err == -EINPROGRESS)
584 goto out; 582 goto out;
585 583
586 if (err == -EBUSY)
587 err = NET_XMIT_DROP;
588 goto out_free; 584 goto out_free;
589 } 585 }
590 586
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 1318de4c3e8d..bf22a225f422 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -30,6 +30,7 @@
30#include <linux/in6.h> 30#include <linux/in6.h>
31#include <linux/icmpv6.h> 31#include <linux/icmpv6.h>
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/export.h>
33 34
34#include <net/dst.h> 35#include <net/dst.h>
35#include <net/sock.h> 36#include <net/sock.h>
diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c
index 14ed0a955b56..37f548b7f6dc 100644
--- a/net/ipv6/exthdrs_core.c
+++ b/net/ipv6/exthdrs_core.c
@@ -2,6 +2,7 @@
2 * IPv6 library code, needed by static components when full IPv6 support is 2 * IPv6 library code, needed by static components when full IPv6 support is
3 * not configured or static. 3 * not configured or static.
4 */ 4 */
5#include <linux/export.h>
5#include <net/ipv6.h> 6#include <net/ipv6.h>
6 7
7/* 8/*
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 34d244df907d..295571576f83 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <linux/export.h>
17 18
18#include <net/fib_rules.h> 19#include <net/fib_rules.h>
19#include <net/ipv6.h> 20#include <net/ipv6.h>
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index fee46d5a2f12..1567fb120392 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -85,7 +85,7 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk,
85 * request_sock (formerly open request) hash tables. 85 * request_sock (formerly open request) hash tables.
86 */ 86 */
87static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, 87static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport,
88 const u32 rnd, const u16 synq_hsize) 88 const u32 rnd, const u32 synq_hsize)
89{ 89{
90 u32 c; 90 u32 c;
91 91
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 543039450193..4566dbd916d3 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -21,6 +21,7 @@
21#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
22#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/export.h>
24 25
25#include <net/net_namespace.h> 26#include <net/net_namespace.h>
26#include <net/sock.h> 27#include <net/sock.h>
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 027c7ff6f1e5..a46c64eb0a66 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -111,6 +111,14 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
111 ipv6_addr_loopback(&hdr->daddr)) 111 ipv6_addr_loopback(&hdr->daddr))
112 goto err; 112 goto err;
113 113
114 /*
115 * RFC4291 2.7
116 * Multicast addresses must not be used as source addresses in IPv6
117 * packets or appear in any Routing header.
118 */
119 if (ipv6_addr_is_multicast(&hdr->saddr))
120 goto err;
121
114 skb->transport_header = skb->network_header + sizeof(*hdr); 122 skb->transport_header = skb->network_header + sizeof(*hdr);
115 IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); 123 IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);
116 124
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index bdc15c9003d7..4e2e9ff67ef2 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -289,6 +289,8 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct ip6_tnl_parm *p)
289 if ((err = register_netdevice(dev)) < 0) 289 if ((err = register_netdevice(dev)) < 0)
290 goto failed_free; 290 goto failed_free;
291 291
292 strcpy(t->parms.name, dev->name);
293
292 dev_hold(dev); 294 dev_hold(dev);
293 ip6_tnl_link(ip6n, t); 295 ip6_tnl_link(ip6n, t);
294 return t; 296 return t;
@@ -1407,7 +1409,6 @@ ip6_tnl_dev_init_gen(struct net_device *dev)
1407 struct ip6_tnl *t = netdev_priv(dev); 1409 struct ip6_tnl *t = netdev_priv(dev);
1408 1410
1409 t->dev = dev; 1411 t->dev = dev;
1410 strcpy(t->parms.name, dev->name);
1411 dev->tstats = alloc_percpu(struct pcpu_tstats); 1412 dev->tstats = alloc_percpu(struct pcpu_tstats);
1412 if (!dev->tstats) 1413 if (!dev->tstats)
1413 return -ENOMEM; 1414 return -ENOMEM;
@@ -1487,6 +1488,7 @@ static void __net_exit ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n)
1487static int __net_init ip6_tnl_init_net(struct net *net) 1488static int __net_init ip6_tnl_init_net(struct net *net)
1488{ 1489{
1489 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); 1490 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
1491 struct ip6_tnl *t = NULL;
1490 int err; 1492 int err;
1491 1493
1492 ip6n->tnls[0] = ip6n->tnls_wc; 1494 ip6n->tnls[0] = ip6n->tnls_wc;
@@ -1507,6 +1509,10 @@ static int __net_init ip6_tnl_init_net(struct net *net)
1507 err = register_netdev(ip6n->fb_tnl_dev); 1509 err = register_netdev(ip6n->fb_tnl_dev);
1508 if (err < 0) 1510 if (err < 0)
1509 goto err_register; 1511 goto err_register;
1512
1513 t = netdev_priv(ip6n->fb_tnl_dev);
1514
1515 strcpy(t->parms.name, ip6n->fb_tnl_dev->name);
1510 return 0; 1516 return 0;
1511 1517
1512err_register: 1518err_register:
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index def0538e2413..449a9185b8f2 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -51,6 +51,7 @@
51#include <linux/pim.h> 51#include <linux/pim.h>
52#include <net/addrconf.h> 52#include <net/addrconf.h>
53#include <linux/netfilter_ipv6.h> 53#include <linux/netfilter_ipv6.h>
54#include <linux/export.h>
54#include <net/ip6_checksum.h> 55#include <net/ip6_checksum.h>
55 56
56struct mr6_table { 57struct mr6_table {
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index c99e3ee9781f..26cb08c84b74 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -503,7 +503,7 @@ done:
503 goto e_inval; 503 goto e_inval;
504 if (val > 255 || val < -1) 504 if (val > 255 || val < -1)
505 goto e_inval; 505 goto e_inval;
506 np->mcast_hops = val; 506 np->mcast_hops = (val == -1 ? IPV6_DEFAULT_MCASTHOPS : val);
507 retv = 0; 507 retv = 0;
508 break; 508 break;
509 509
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 44e5b7f2a6c1..0cb78d7ddaf5 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1571,7 +1571,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1571 } 1571 }
1572 if (!rt->rt6i_peer) 1572 if (!rt->rt6i_peer)
1573 rt6_bind_peer(rt, 1); 1573 rt6_bind_peer(rt, 1);
1574 if (inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) 1574 if (!inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ))
1575 goto release; 1575 goto release;
1576 1576
1577 if (dev->addr_len) { 1577 if (dev->addr_len) {
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index 30fcee465448..db31561cc8df 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -3,6 +3,7 @@
3#include <linux/ipv6.h> 3#include <linux/ipv6.h>
4#include <linux/netfilter.h> 4#include <linux/netfilter.h>
5#include <linux/netfilter_ipv6.h> 5#include <linux/netfilter_ipv6.h>
6#include <linux/export.h>
6#include <net/dst.h> 7#include <net/dst.h>
7#include <net/ipv6.h> 8#include <net/ipv6.h>
8#include <net/ip6_route.h> 9#include <net/ip6_route.h>
@@ -100,9 +101,16 @@ static int nf_ip6_route(struct net *net, struct dst_entry **dst,
100 .pinet6 = (struct ipv6_pinfo *) &fake_pinfo, 101 .pinet6 = (struct ipv6_pinfo *) &fake_pinfo,
101 }; 102 };
102 const void *sk = strict ? &fake_sk : NULL; 103 const void *sk = strict ? &fake_sk : NULL;
103 104 struct dst_entry *result;
104 *dst = ip6_route_output(net, sk, &fl->u.ip6); 105 int err;
105 return (*dst)->error; 106
107 result = ip6_route_output(net, sk, &fl->u.ip6);
108 err = result->error;
109 if (err)
110 dst_release(result);
111 else
112 *dst = result;
113 return err;
106} 114}
107 115
108__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, 116__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig
index 448464844a25..f792b34cbe9c 100644
--- a/net/ipv6/netfilter/Kconfig
+++ b/net/ipv6/netfilter/Kconfig
@@ -186,7 +186,6 @@ config IP6_NF_MANGLE
186 186
187config IP6_NF_RAW 187config IP6_NF_RAW
188 tristate 'raw table support (required for TRACE)' 188 tristate 'raw table support (required for TRACE)'
189 depends on NETFILTER_ADVANCED
190 help 189 help
191 This option adds a `raw' table to ip6tables. This table is the very 190 This option adds a `raw' table to ip6tables. This table is the very
192 first in the netfilter framework and hooks in at the PREROUTING 191 first in the netfilter framework and hooks in at the PREROUTING
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index e8762c73b170..38f00b0298d3 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -182,7 +182,6 @@ fq_find(__be32 id, u32 user, struct in6_addr *src, struct in6_addr *dst)
182 return container_of(q, struct nf_ct_frag6_queue, q); 182 return container_of(q, struct nf_ct_frag6_queue, q);
183 183
184oom: 184oom:
185 pr_debug("Can't alloc new queue\n");
186 return NULL; 185 return NULL;
187} 186}
188 187
@@ -370,10 +369,10 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
370 struct sk_buff *clone; 369 struct sk_buff *clone;
371 int i, plen = 0; 370 int i, plen = 0;
372 371
373 if ((clone = alloc_skb(0, GFP_ATOMIC)) == NULL) { 372 clone = alloc_skb(0, GFP_ATOMIC);
374 pr_debug("Can't alloc skb\n"); 373 if (clone == NULL)
375 goto out_oom; 374 goto out_oom;
376 } 375
377 clone->next = head->next; 376 clone->next = head->next;
378 head->next = clone; 377 head->next = clone;
379 skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list; 378 skb_shinfo(clone)->frag_list = skb_shinfo(head)->frag_list;
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 18ff5df7ec02..1008ce94bc33 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -21,6 +21,7 @@
21#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
22#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/stddef.h> 23#include <linux/stddef.h>
24#include <linux/export.h>
24#include <net/net_namespace.h> 25#include <net/net_namespace.h>
25#include <net/ip.h> 26#include <net/ip.h>
26#include <net/sock.h> 27#include <net/sock.h>
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 6f7824e1cea4..331af3b882ac 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -61,6 +61,7 @@
61 61
62#include <linux/proc_fs.h> 62#include <linux/proc_fs.h>
63#include <linux/seq_file.h> 63#include <linux/seq_file.h>
64#include <linux/export.h>
64 65
65static struct raw_hashinfo raw_v6_hashinfo = { 66static struct raw_hashinfo raw_v6_hashinfo = {
66 .lock = __RW_LOCK_UNLOCKED(raw_v6_hashinfo.lock), 67 .lock = __RW_LOCK_UNLOCKED(raw_v6_hashinfo.lock),
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index cc22099ac8b6..dfb164e9051a 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -42,6 +42,7 @@
42#include <linux/jhash.h> 42#include <linux/jhash.h>
43#include <linux/skbuff.h> 43#include <linux/skbuff.h>
44#include <linux/slab.h> 44#include <linux/slab.h>
45#include <linux/export.h>
45 46
46#include <net/sock.h> 47#include <net/sock.h>
47#include <net/snmp.h> 48#include <net/snmp.h>
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 57b82dc1ae91..3399dd326287 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -26,6 +26,7 @@
26 26
27#include <linux/capability.h> 27#include <linux/capability.h>
28#include <linux/errno.h> 28#include <linux/errno.h>
29#include <linux/export.h>
29#include <linux/types.h> 30#include <linux/types.h>
30#include <linux/times.h> 31#include <linux/times.h>
31#include <linux/socket.h> 32#include <linux/socket.h>
@@ -76,7 +77,7 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort,
76 const struct in6_addr *dest); 77 const struct in6_addr *dest);
77static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); 78static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie);
78static unsigned int ip6_default_advmss(const struct dst_entry *dst); 79static unsigned int ip6_default_advmss(const struct dst_entry *dst);
79static unsigned int ip6_default_mtu(const struct dst_entry *dst); 80static unsigned int ip6_mtu(const struct dst_entry *dst);
80static struct dst_entry *ip6_negative_advice(struct dst_entry *); 81static struct dst_entry *ip6_negative_advice(struct dst_entry *);
81static void ip6_dst_destroy(struct dst_entry *); 82static void ip6_dst_destroy(struct dst_entry *);
82static void ip6_dst_ifdown(struct dst_entry *, 83static void ip6_dst_ifdown(struct dst_entry *,
@@ -143,7 +144,7 @@ static struct dst_ops ip6_dst_ops_template = {
143 .gc_thresh = 1024, 144 .gc_thresh = 1024,
144 .check = ip6_dst_check, 145 .check = ip6_dst_check,
145 .default_advmss = ip6_default_advmss, 146 .default_advmss = ip6_default_advmss,
146 .default_mtu = ip6_default_mtu, 147 .mtu = ip6_mtu,
147 .cow_metrics = ipv6_cow_metrics, 148 .cow_metrics = ipv6_cow_metrics,
148 .destroy = ip6_dst_destroy, 149 .destroy = ip6_dst_destroy,
149 .ifdown = ip6_dst_ifdown, 150 .ifdown = ip6_dst_ifdown,
@@ -154,9 +155,11 @@ static struct dst_ops ip6_dst_ops_template = {
154 .neigh_lookup = ip6_neigh_lookup, 155 .neigh_lookup = ip6_neigh_lookup,
155}; 156};
156 157
157static unsigned int ip6_blackhole_default_mtu(const struct dst_entry *dst) 158static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst)
158{ 159{
159 return 0; 160 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
161
162 return mtu ? : dst->dev->mtu;
160} 163}
161 164
162static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) 165static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
@@ -174,7 +177,7 @@ static struct dst_ops ip6_dst_blackhole_ops = {
174 .protocol = cpu_to_be16(ETH_P_IPV6), 177 .protocol = cpu_to_be16(ETH_P_IPV6),
175 .destroy = ip6_dst_destroy, 178 .destroy = ip6_dst_destroy,
176 .check = ip6_dst_check, 179 .check = ip6_dst_check,
177 .default_mtu = ip6_blackhole_default_mtu, 180 .mtu = ip6_blackhole_mtu,
178 .default_advmss = ip6_default_advmss, 181 .default_advmss = ip6_default_advmss,
179 .update_pmtu = ip6_rt_blackhole_update_pmtu, 182 .update_pmtu = ip6_rt_blackhole_update_pmtu,
180 .cow_metrics = ip6_rt_blackhole_cow_metrics, 183 .cow_metrics = ip6_rt_blackhole_cow_metrics,
@@ -1040,10 +1043,15 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst)
1040 return mtu; 1043 return mtu;
1041} 1044}
1042 1045
1043static unsigned int ip6_default_mtu(const struct dst_entry *dst) 1046static unsigned int ip6_mtu(const struct dst_entry *dst)
1044{ 1047{
1045 unsigned int mtu = IPV6_MIN_MTU;
1046 struct inet6_dev *idev; 1048 struct inet6_dev *idev;
1049 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
1050
1051 if (mtu)
1052 return mtu;
1053
1054 mtu = IPV6_MIN_MTU;
1047 1055
1048 rcu_read_lock(); 1056 rcu_read_lock();
1049 idev = __in6_dev_get(dst->dev); 1057 idev = __in6_dev_get(dst->dev);
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 6dcf5e7d661b..166a57c47d39 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -10,6 +10,7 @@
10#include <linux/in6.h> 10#include <linux/in6.h>
11#include <linux/ipv6.h> 11#include <linux/ipv6.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/export.h>
13#include <net/ndisc.h> 14#include <net/ndisc.h>
14#include <net/ipv6.h> 15#include <net/ipv6.h>
15#include <net/addrconf.h> 16#include <net/addrconf.h>
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 10b2b3165a1a..2dea4bb7b54a 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1255,6 +1255,13 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1255 if (!want_cookie || tmp_opt.tstamp_ok) 1255 if (!want_cookie || tmp_opt.tstamp_ok)
1256 TCP_ECN_create_request(req, tcp_hdr(skb)); 1256 TCP_ECN_create_request(req, tcp_hdr(skb));
1257 1257
1258 treq->iif = sk->sk_bound_dev_if;
1259
1260 /* So that link locals have meaning */
1261 if (!sk->sk_bound_dev_if &&
1262 ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL)
1263 treq->iif = inet6_iif(skb);
1264
1258 if (!isn) { 1265 if (!isn) {
1259 struct inet_peer *peer = NULL; 1266 struct inet_peer *peer = NULL;
1260 1267
@@ -1264,12 +1271,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
1264 atomic_inc(&skb->users); 1271 atomic_inc(&skb->users);
1265 treq->pktopts = skb; 1272 treq->pktopts = skb;
1266 } 1273 }
1267 treq->iif = sk->sk_bound_dev_if;
1268
1269 /* So that link locals have meaning */
1270 if (!sk->sk_bound_dev_if &&
1271 ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL)
1272 treq->iif = inet6_iif(skb);
1273 1274
1274 if (want_cookie) { 1275 if (want_cookie) {
1275 isn = cookie_v6_init_sequence(sk, skb, &req->mss); 1276 isn = cookie_v6_init_sequence(sk, skb, &req->mss);
@@ -2161,12 +2162,18 @@ out:
2161 return 0; 2162 return 0;
2162} 2163}
2163 2164
2165static const struct file_operations tcp6_afinfo_seq_fops = {
2166 .owner = THIS_MODULE,
2167 .open = tcp_seq_open,
2168 .read = seq_read,
2169 .llseek = seq_lseek,
2170 .release = seq_release_net
2171};
2172
2164static struct tcp_seq_afinfo tcp6_seq_afinfo = { 2173static struct tcp_seq_afinfo tcp6_seq_afinfo = {
2165 .name = "tcp6", 2174 .name = "tcp6",
2166 .family = AF_INET6, 2175 .family = AF_INET6,
2167 .seq_fops = { 2176 .seq_fops = &tcp6_afinfo_seq_fops,
2168 .owner = THIS_MODULE,
2169 },
2170 .seq_ops = { 2177 .seq_ops = {
2171 .show = tcp6_seq_show, 2178 .show = tcp6_seq_show,
2172 }, 2179 },
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index f4ca0a5b3457..846f4757eb8d 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1424,13 +1424,19 @@ int udp6_seq_show(struct seq_file *seq, void *v)
1424 return 0; 1424 return 0;
1425} 1425}
1426 1426
1427static const struct file_operations udp6_afinfo_seq_fops = {
1428 .owner = THIS_MODULE,
1429 .open = udp_seq_open,
1430 .read = seq_read,
1431 .llseek = seq_lseek,
1432 .release = seq_release_net
1433};
1434
1427static struct udp_seq_afinfo udp6_seq_afinfo = { 1435static struct udp_seq_afinfo udp6_seq_afinfo = {
1428 .name = "udp6", 1436 .name = "udp6",
1429 .family = AF_INET6, 1437 .family = AF_INET6,
1430 .udp_table = &udp_table, 1438 .udp_table = &udp_table,
1431 .seq_fops = { 1439 .seq_fops = &udp6_afinfo_seq_fops,
1432 .owner = THIS_MODULE,
1433 },
1434 .seq_ops = { 1440 .seq_ops = {
1435 .show = udp6_seq_show, 1441 .show = udp6_seq_show,
1436 }, 1442 },
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 986c4de5292e..1d08e21d9f69 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -11,6 +11,7 @@
11 * as published by the Free Software Foundation; either version 11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14#include <linux/export.h>
14#include "udp_impl.h" 15#include "udp_impl.h"
15 16
16static int udplitev6_rcv(struct sk_buff *skb) 17static int udplitev6_rcv(struct sk_buff *skb)
@@ -93,13 +94,20 @@ void udplitev6_exit(void)
93} 94}
94 95
95#ifdef CONFIG_PROC_FS 96#ifdef CONFIG_PROC_FS
97
98static const struct file_operations udplite6_afinfo_seq_fops = {
99 .owner = THIS_MODULE,
100 .open = udp_seq_open,
101 .read = seq_read,
102 .llseek = seq_lseek,
103 .release = seq_release_net
104};
105
96static struct udp_seq_afinfo udplite6_seq_afinfo = { 106static struct udp_seq_afinfo udplite6_seq_afinfo = {
97 .name = "udplite6", 107 .name = "udplite6",
98 .family = AF_INET6, 108 .family = AF_INET6,
99 .udp_table = &udplite_table, 109 .udp_table = &udplite_table,
100 .seq_fops = { 110 .seq_fops = &udplite6_afinfo_seq_fops,
101 .owner = THIS_MODULE,
102 },
103 .seq_ops = { 111 .seq_ops = {
104 .show = udp6_seq_show, 112 .show = udp6_seq_show,
105 }, 113 },
diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c
index 248f0b2a7ee9..f2d72b8a3faa 100644
--- a/net/ipv6/xfrm6_state.c
+++ b/net/ipv6/xfrm6_state.c
@@ -15,6 +15,7 @@
15#include <linux/pfkeyv2.h> 15#include <linux/pfkeyv2.h>
16#include <linux/ipsec.h> 16#include <linux/ipsec.h>
17#include <linux/netfilter_ipv6.h> 17#include <linux/netfilter_ipv6.h>
18#include <linux/export.h>
18#include <net/dsfield.h> 19#include <net/dsfield.h>
19#include <net/ipv6.h> 20#include <net/ipv6.h>
20#include <net/addrconf.h> 21#include <net/addrconf.h>
diff --git a/net/ipx/ipx_proc.c b/net/ipx/ipx_proc.c
index 26b5bfcf1d03..f8ba30dfecae 100644
--- a/net/ipx/ipx_proc.c
+++ b/net/ipx/ipx_proc.c
@@ -9,6 +9,7 @@
9#include <linux/proc_fs.h> 9#include <linux/proc_fs.h>
10#include <linux/spinlock.h> 10#include <linux/spinlock.h>
11#include <linux/seq_file.h> 11#include <linux/seq_file.h>
12#include <linux/export.h>
12#include <net/net_namespace.h> 13#include <net/net_namespace.h>
13#include <net/tcp_states.h> 14#include <net/tcp_states.h>
14#include <net/ipx.h> 15#include <net/ipx.h>
diff --git a/net/irda/discovery.c b/net/irda/discovery.c
index 36c3f037f172..b0b56a339a83 100644
--- a/net/irda/discovery.c
+++ b/net/irda/discovery.c
@@ -35,6 +35,7 @@
35#include <linux/fs.h> 35#include <linux/fs.h>
36#include <linux/seq_file.h> 36#include <linux/seq_file.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/export.h>
38 39
39#include <net/irda/irda.h> 40#include <net/irda/irda.h>
40#include <net/irda/irlmp.h> 41#include <net/irda/irlmp.h>
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c
index 3eca35faf2a8..14653b8d664d 100644
--- a/net/irda/irda_device.c
+++ b/net/irda/irda_device.c
@@ -42,6 +42,7 @@
42#include <linux/kmod.h> 42#include <linux/kmod.h>
43#include <linux/spinlock.h> 43#include <linux/spinlock.h>
44#include <linux/slab.h> 44#include <linux/slab.h>
45#include <linux/export.h>
45 46
46#include <asm/ioctls.h> 47#include <asm/ioctls.h>
47#include <asm/uaccess.h> 48#include <asm/uaccess.h>
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 285ccd623ae5..32e3bb026110 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -29,6 +29,7 @@
29#include <linux/fs.h> 29#include <linux/fs.h>
30#include <linux/seq_file.h> 30#include <linux/seq_file.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/export.h>
32 33
33#include <asm/byteorder.h> 34#include <asm/byteorder.h>
34#include <asm/unaligned.h> 35#include <asm/unaligned.h>
diff --git a/net/irda/qos.c b/net/irda/qos.c
index 4369f7f41bcb..798ffd9a705e 100644
--- a/net/irda/qos.c
+++ b/net/irda/qos.c
@@ -30,6 +30,8 @@
30 * 30 *
31 ********************************************************************/ 31 ********************************************************************/
32 32
33#include <linux/export.h>
34
33#include <asm/byteorder.h> 35#include <asm/byteorder.h>
34 36
35#include <net/irda/irda.h> 37#include <net/irda/irda.h>
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 34b2ddeacb67..89ff8c67943e 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -397,6 +397,7 @@ static void l2tp_recv_dequeue(struct l2tp_session *session)
397 * expect to send up next, dequeue it and any other 397 * expect to send up next, dequeue it and any other
398 * in-sequence packets behind it. 398 * in-sequence packets behind it.
399 */ 399 */
400start:
400 spin_lock_bh(&session->reorder_q.lock); 401 spin_lock_bh(&session->reorder_q.lock);
401 skb_queue_walk_safe(&session->reorder_q, skb, tmp) { 402 skb_queue_walk_safe(&session->reorder_q, skb, tmp) {
402 if (time_after(jiffies, L2TP_SKB_CB(skb)->expires)) { 403 if (time_after(jiffies, L2TP_SKB_CB(skb)->expires)) {
@@ -433,7 +434,7 @@ static void l2tp_recv_dequeue(struct l2tp_session *session)
433 */ 434 */
434 spin_unlock_bh(&session->reorder_q.lock); 435 spin_unlock_bh(&session->reorder_q.lock);
435 l2tp_recv_dequeue_skb(session, skb); 436 l2tp_recv_dequeue_skb(session, skb);
436 spin_lock_bh(&session->reorder_q.lock); 437 goto start;
437 } 438 }
438 439
439out: 440out:
@@ -755,9 +756,6 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb,
755 goto error; 756 goto error;
756 } 757 }
757 758
758 /* Point to L2TP header */
759 optr = ptr = skb->data;
760
761 /* Trace packet contents, if enabled */ 759 /* Trace packet contents, if enabled */
762 if (tunnel->debug & L2TP_MSG_DATA) { 760 if (tunnel->debug & L2TP_MSG_DATA) {
763 length = min(32u, skb->len); 761 length = min(32u, skb->len);
@@ -768,12 +766,15 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb,
768 766
769 offset = 0; 767 offset = 0;
770 do { 768 do {
771 printk(" %02X", ptr[offset]); 769 printk(" %02X", skb->data[offset]);
772 } while (++offset < length); 770 } while (++offset < length);
773 771
774 printk("\n"); 772 printk("\n");
775 } 773 }
776 774
775 /* Point to L2TP header */
776 optr = ptr = skb->data;
777
777 /* Get L2TP header flags */ 778 /* Get L2TP header flags */
778 hdrflags = ntohs(*(__be16 *) ptr); 779 hdrflags = ntohs(*(__be16 *) ptr);
779 780
@@ -1071,7 +1072,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb, int hdr_len
1071 1072
1072 /* Get routing info from the tunnel socket */ 1073 /* Get routing info from the tunnel socket */
1073 skb_dst_drop(skb); 1074 skb_dst_drop(skb);
1074 skb_dst_set(skb, dst_clone(__sk_dst_get(sk))); 1075 skb_dst_set(skb, dst_clone(__sk_dst_check(sk, 0)));
1075 1076
1076 inet = inet_sk(sk); 1077 inet = inet_sk(sk);
1077 fl = &inet->cork.fl; 1078 fl = &inet->cork.fl;
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c
index 903242111317..e32cab44ea95 100644
--- a/net/llc/llc_input.c
+++ b/net/llc/llc_input.c
@@ -13,6 +13,7 @@
13 */ 13 */
14#include <linux/netdevice.h> 14#include <linux/netdevice.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/export.h>
16#include <net/net_namespace.h> 17#include <net/net_namespace.h>
17#include <net/llc.h> 18#include <net/llc.h>
18#include <net/llc_pdu.h> 19#include <net/llc_pdu.h>
diff --git a/net/llc/llc_output.c b/net/llc/llc_output.c
index b38a1079a98e..b658cba89fdd 100644
--- a/net/llc/llc_output.c
+++ b/net/llc/llc_output.c
@@ -18,6 +18,7 @@
18#include <linux/netdevice.h> 18#include <linux/netdevice.h>
19#include <linux/trdevice.h> 19#include <linux/trdevice.h>
20#include <linux/skbuff.h> 20#include <linux/skbuff.h>
21#include <linux/export.h>
21#include <net/llc.h> 22#include <net/llc.h>
22#include <net/llc_pdu.h> 23#include <net/llc_pdu.h>
23 24
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
index 7af1ff2d1f19..a1839c004357 100644
--- a/net/llc/llc_proc.c
+++ b/net/llc/llc_proc.c
@@ -17,6 +17,7 @@
17#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include <linux/export.h>
20#include <net/net_namespace.h> 21#include <net/net_namespace.h>
21#include <net/sock.h> 22#include <net/sock.h>
22#include <net/llc.h> 23#include <net/llc.h>
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index 97f33588b65f..93b243422659 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -38,6 +38,7 @@
38 38
39#include <linux/ieee80211.h> 39#include <linux/ieee80211.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/export.h>
41#include <net/mac80211.h> 42#include <net/mac80211.h>
42#include "ieee80211_i.h" 43#include "ieee80211_i.h"
43#include "driver-ops.h" 44#include "driver-ops.h"
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
index 331472ce038c..b064e4df12c6 100644
--- a/net/mac80211/agg-tx.c
+++ b/net/mac80211/agg-tx.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/ieee80211.h> 16#include <linux/ieee80211.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/export.h>
18#include <net/mac80211.h> 19#include <net/mac80211.h>
19#include "ieee80211_i.h" 20#include "ieee80211_i.h"
20#include "driver-ops.h" 21#include "driver-ops.h"
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index f80a35c0d000..f0fb737efa86 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <linux/ieee80211.h> 16#include <linux/ieee80211.h>
17#include <linux/export.h>
17#include <net/mac80211.h> 18#include <net/mac80211.h>
18#include "ieee80211_i.h" 19#include "ieee80211_i.h"
19#include "rate.h" 20#include "rate.h"
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 756b157c2edd..fb02ea52d2c2 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -15,6 +15,7 @@
15#include <linux/rcupdate.h> 15#include <linux/rcupdate.h>
16#include <linux/rtnetlink.h> 16#include <linux/rtnetlink.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/export.h>
18#include <net/mac80211.h> 19#include <net/mac80211.h>
19#include "ieee80211_i.h" 20#include "ieee80211_i.h"
20#include "driver-ops.h" 21#include "driver-ops.h"
diff --git a/net/mac80211/led.c b/net/mac80211/led.c
index 14590332c81c..1bf7903496f8 100644
--- a/net/mac80211/led.c
+++ b/net/mac80211/led.c
@@ -9,6 +9,7 @@
9/* just for IFNAMSIZ */ 9/* just for IFNAMSIZ */
10#include <linux/if.h> 10#include <linux/if.h>
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/export.h>
12#include "led.h" 13#include "led.h"
13 14
14void ieee80211_led_rx(struct ieee80211_local *local) 15void ieee80211_led_rx(struct ieee80211_local *local)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 40db011da580..b1b1bb368f70 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -16,10 +16,12 @@
16#include <linux/skbuff.h> 16#include <linux/skbuff.h>
17#include <linux/if_arp.h> 17#include <linux/if_arp.h>
18#include <linux/etherdevice.h> 18#include <linux/etherdevice.h>
19#include <linux/moduleparam.h>
19#include <linux/rtnetlink.h> 20#include <linux/rtnetlink.h>
20#include <linux/pm_qos.h> 21#include <linux/pm_qos.h>
21#include <linux/crc32.h> 22#include <linux/crc32.h>
22#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/export.h>
23#include <net/mac80211.h> 25#include <net/mac80211.h>
24#include <asm/unaligned.h> 26#include <asm/unaligned.h>
25 27
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index 13427b194ced..3d414411a96e 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -12,6 +12,7 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15#include <linux/export.h>
15#include <net/mac80211.h> 16#include <net/mac80211.h>
16#include "ieee80211_i.h" 17#include "ieee80211_i.h"
17#include "driver-trace.h" 18#include "driver-trace.h"
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index ff5c3aa48a15..5a5a7767d541 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/rtnetlink.h> 12#include <linux/rtnetlink.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/module.h>
14#include "rate.h" 15#include "rate.h"
15#include "ieee80211_i.h" 16#include "ieee80211_i.h"
16#include "debugfs.h" 17#include "debugfs.h"
diff --git a/net/mac80211/rc80211_minstrel_debugfs.c b/net/mac80211/rc80211_minstrel_debugfs.c
index a290ad231d77..d5a56226e675 100644
--- a/net/mac80211/rc80211_minstrel_debugfs.c
+++ b/net/mac80211/rc80211_minstrel_debugfs.c
@@ -50,6 +50,7 @@
50#include <linux/debugfs.h> 50#include <linux/debugfs.h>
51#include <linux/ieee80211.h> 51#include <linux/ieee80211.h>
52#include <linux/slab.h> 52#include <linux/slab.h>
53#include <linux/export.h>
53#include <net/mac80211.h> 54#include <net/mac80211.h>
54#include "rc80211_minstrel.h" 55#include "rc80211_minstrel.h"
55 56
diff --git a/net/mac80211/rc80211_minstrel_ht_debugfs.c b/net/mac80211/rc80211_minstrel_ht_debugfs.c
index cefcb5d2dae6..e788f76a1dfe 100644
--- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
+++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
@@ -10,6 +10,7 @@
10#include <linux/skbuff.h> 10#include <linux/skbuff.h>
11#include <linux/debugfs.h> 11#include <linux/debugfs.h>
12#include <linux/ieee80211.h> 12#include <linux/ieee80211.h>
13#include <linux/export.h>
13#include <net/mac80211.h> 14#include <net/mac80211.h>
14#include "rc80211_minstrel.h" 15#include "rc80211_minstrel.h"
15#include "rc80211_minstrel_ht.h" 16#include "rc80211_minstrel_ht.h"
diff --git a/net/mac80211/rc80211_pid_debugfs.c b/net/mac80211/rc80211_pid_debugfs.c
index 4851e9e2daed..c97a0657c043 100644
--- a/net/mac80211/rc80211_pid_debugfs.c
+++ b/net/mac80211/rc80211_pid_debugfs.c
@@ -13,6 +13,7 @@
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/skbuff.h> 14#include <linux/skbuff.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/export.h>
16 17
17#include <net/mac80211.h> 18#include <net/mac80211.h>
18#include "rate.h" 19#include "rate.h"
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 097b42d286e2..fb123e2e081a 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -16,6 +16,7 @@
16#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <linux/etherdevice.h> 17#include <linux/etherdevice.h>
18#include <linux/rcupdate.h> 18#include <linux/rcupdate.h>
19#include <linux/export.h>
19#include <net/mac80211.h> 20#include <net/mac80211.h>
20#include <net/ieee80211_radiotap.h> 21#include <net/ieee80211_radiotap.h>
21 22
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 83a0b050b374..105436dbb90d 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -17,6 +17,7 @@
17#include <linux/pm_qos.h> 17#include <linux/pm_qos.h>
18#include <net/sch_generic.h> 18#include <net/sch_generic.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/export.h>
20#include <net/mac80211.h> 21#include <net/mac80211.h>
21 22
22#include "ieee80211_i.h" 23#include "ieee80211_i.h"
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 5533a74e9bb3..16518f386117 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -9,6 +9,7 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/export.h>
12#include <net/mac80211.h> 13#include <net/mac80211.h>
13#include "ieee80211_i.h" 14#include "ieee80211_i.h"
14#include "rate.h" 15#include "rate.h"
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
index f49d00a4c7fd..51077a956a83 100644
--- a/net/mac80211/tkip.c
+++ b/net/mac80211/tkip.c
@@ -10,6 +10,7 @@
10#include <linux/bitops.h> 10#include <linux/bitops.h>
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/netdevice.h> 12#include <linux/netdevice.h>
13#include <linux/export.h>
13#include <asm/unaligned.h> 14#include <asm/unaligned.h>
14 15
15#include <net/mac80211.h> 16#include <net/mac80211.h>
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 48bbb96d8edb..1f8b120146d1 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -18,6 +18,7 @@
18#include <linux/etherdevice.h> 18#include <linux/etherdevice.h>
19#include <linux/bitmap.h> 19#include <linux/bitmap.h>
20#include <linux/rcupdate.h> 20#include <linux/rcupdate.h>
21#include <linux/export.h>
21#include <net/net_namespace.h> 22#include <net/net_namespace.h>
22#include <net/ieee80211_radiotap.h> 23#include <net/ieee80211_radiotap.h>
23#include <net/cfg80211.h> 24#include <net/cfg80211.h>
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 0c9490722aa5..eca0fad09709 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -13,6 +13,7 @@
13 13
14#include <net/mac80211.h> 14#include <net/mac80211.h>
15#include <linux/netdevice.h> 15#include <linux/netdevice.h>
16#include <linux/export.h>
16#include <linux/types.h> 17#include <linux/types.h>
17#include <linux/slab.h> 18#include <linux/slab.h>
18#include <linux/skbuff.h> 19#include <linux/skbuff.h>
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index 8260b13d93c9..e8f379692294 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -542,7 +542,6 @@ config NETFILTER_XT_TARGET_NOTRACK
542 tristate '"NOTRACK" target support' 542 tristate '"NOTRACK" target support'
543 depends on IP_NF_RAW || IP6_NF_RAW 543 depends on IP_NF_RAW || IP6_NF_RAW
544 depends on NF_CONNTRACK 544 depends on NF_CONNTRACK
545 depends on NETFILTER_ADVANCED
546 help 545 help
547 The NOTRACK target allows a select rule to specify 546 The NOTRACK target allows a select rule to specify
548 which packets *not* to enter the conntrack/NAT 547 which packets *not* to enter the conntrack/NAT
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 3346829ea07f..afca6c78948c 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -180,17 +180,16 @@ next_hook:
180 if (ret == 0) 180 if (ret == 0)
181 ret = -EPERM; 181 ret = -EPERM;
182 } else if ((verdict & NF_VERDICT_MASK) == NF_QUEUE) { 182 } else if ((verdict & NF_VERDICT_MASK) == NF_QUEUE) {
183 ret = nf_queue(skb, elem, pf, hook, indev, outdev, okfn, 183 int err = nf_queue(skb, elem, pf, hook, indev, outdev, okfn,
184 verdict >> NF_VERDICT_QBITS); 184 verdict >> NF_VERDICT_QBITS);
185 if (ret < 0) { 185 if (err < 0) {
186 if (ret == -ECANCELED) 186 if (err == -ECANCELED)
187 goto next_hook; 187 goto next_hook;
188 if (ret == -ESRCH && 188 if (err == -ESRCH &&
189 (verdict & NF_VERDICT_FLAG_QUEUE_BYPASS)) 189 (verdict & NF_VERDICT_FLAG_QUEUE_BYPASS))
190 goto next_hook; 190 goto next_hook;
191 kfree_skb(skb); 191 kfree_skb(skb);
192 } 192 }
193 ret = 0;
194 } 193 }
195 rcu_read_unlock(); 194 rcu_read_unlock();
196 return ret; 195 return ret;
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index d7e86ef9d23a..86137b558f45 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -1699,10 +1699,8 @@ ip_set_init(void)
1699 1699
1700 ip_set_list = kzalloc(sizeof(struct ip_set *) * ip_set_max, 1700 ip_set_list = kzalloc(sizeof(struct ip_set *) * ip_set_max,
1701 GFP_KERNEL); 1701 GFP_KERNEL);
1702 if (!ip_set_list) { 1702 if (!ip_set_list)
1703 pr_err("ip_set: Unable to create ip_set_list\n");
1704 return -ENOMEM; 1703 return -ENOMEM;
1705 }
1706 1704
1707 ret = nfnetlink_subsys_register(&ip_set_netlink_subsys); 1705 ret = nfnetlink_subsys_register(&ip_set_netlink_subsys);
1708 if (ret != 0) { 1706 if (ret != 0) {
diff --git a/net/netfilter/ipset/ip_set_getport.c b/net/netfilter/ipset/ip_set_getport.c
index 757143b2240a..052579fe389a 100644
--- a/net/netfilter/ipset/ip_set_getport.c
+++ b/net/netfilter/ipset/ip_set_getport.c
@@ -17,6 +17,7 @@
17#include <net/ipv6.h> 17#include <net/ipv6.h>
18 18
19#include <linux/netfilter/ipset/ip_set_getport.h> 19#include <linux/netfilter/ipset/ip_set_getport.h>
20#include <linux/export.h>
20 21
21/* We must handle non-linear skbs */ 22/* We must handle non-linear skbs */
22static bool 23static bool
diff --git a/net/netfilter/ipset/ip_set_hash_ipport.c b/net/netfilter/ipset/ip_set_hash_ipport.c
index 6ee10f5d59bd..37d667e3f6f8 100644
--- a/net/netfilter/ipset/ip_set_hash_ipport.c
+++ b/net/netfilter/ipset/ip_set_hash_ipport.c
@@ -158,7 +158,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
158 const struct ip_set_hash *h = set->data; 158 const struct ip_set_hash *h = set->data;
159 ipset_adtfn adtfn = set->variant->adt[adt]; 159 ipset_adtfn adtfn = set->variant->adt[adt];
160 struct hash_ipport4_elem data = { }; 160 struct hash_ipport4_elem data = { };
161 u32 ip, ip_to, p = 0, port, port_to; 161 u32 ip, ip_to = 0, p = 0, port, port_to;
162 u32 timeout = h->timeout; 162 u32 timeout = h->timeout;
163 bool with_ports = false; 163 bool with_ports = false;
164 int ret; 164 int ret;
diff --git a/net/netfilter/ipset/ip_set_hash_ipportip.c b/net/netfilter/ipset/ip_set_hash_ipportip.c
index fb90e344e907..e69e2718fbe1 100644
--- a/net/netfilter/ipset/ip_set_hash_ipportip.c
+++ b/net/netfilter/ipset/ip_set_hash_ipportip.c
@@ -162,7 +162,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
162 const struct ip_set_hash *h = set->data; 162 const struct ip_set_hash *h = set->data;
163 ipset_adtfn adtfn = set->variant->adt[adt]; 163 ipset_adtfn adtfn = set->variant->adt[adt];
164 struct hash_ipportip4_elem data = { }; 164 struct hash_ipportip4_elem data = { };
165 u32 ip, ip_to, p = 0, port, port_to; 165 u32 ip, ip_to = 0, p = 0, port, port_to;
166 u32 timeout = h->timeout; 166 u32 timeout = h->timeout;
167 bool with_ports = false; 167 bool with_ports = false;
168 int ret; 168 int ret;
diff --git a/net/netfilter/ipset/ip_set_hash_ipportnet.c b/net/netfilter/ipset/ip_set_hash_ipportnet.c
index deb3e3dfa5fc..64199b4e93c9 100644
--- a/net/netfilter/ipset/ip_set_hash_ipportnet.c
+++ b/net/netfilter/ipset/ip_set_hash_ipportnet.c
@@ -184,7 +184,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
184 const struct ip_set_hash *h = set->data; 184 const struct ip_set_hash *h = set->data;
185 ipset_adtfn adtfn = set->variant->adt[adt]; 185 ipset_adtfn adtfn = set->variant->adt[adt];
186 struct hash_ipportnet4_elem data = { .cidr = HOST_MASK }; 186 struct hash_ipportnet4_elem data = { .cidr = HOST_MASK };
187 u32 ip, ip_to, p = 0, port, port_to; 187 u32 ip, ip_to = 0, p = 0, port, port_to;
188 u32 ip2_from = 0, ip2_to, ip2_last, ip2; 188 u32 ip2_from = 0, ip2_to, ip2_last, ip2;
189 u32 timeout = h->timeout; 189 u32 timeout = h->timeout;
190 bool with_ports = false; 190 bool with_ports = false;
diff --git a/net/netfilter/ipset/pfxlen.c b/net/netfilter/ipset/pfxlen.c
index bd13d66220f1..4f29fa97044b 100644
--- a/net/netfilter/ipset/pfxlen.c
+++ b/net/netfilter/ipset/pfxlen.c
@@ -1,3 +1,4 @@
1#include <linux/export.h>
1#include <linux/netfilter/ipset/pfxlen.h> 2#include <linux/netfilter/ipset/pfxlen.h>
2 3
3/* 4/*
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 4f77bb16d22a..093cc327020f 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -188,14 +188,13 @@ ip_vs_conn_stats(struct ip_vs_conn *cp, struct ip_vs_service *svc)
188} 188}
189 189
190 190
191static inline int 191static inline void
192ip_vs_set_state(struct ip_vs_conn *cp, int direction, 192ip_vs_set_state(struct ip_vs_conn *cp, int direction,
193 const struct sk_buff *skb, 193 const struct sk_buff *skb,
194 struct ip_vs_proto_data *pd) 194 struct ip_vs_proto_data *pd)
195{ 195{
196 if (unlikely(!pd->pp->state_transition)) 196 if (likely(pd->pp->state_transition))
197 return 0; 197 pd->pp->state_transition(cp, direction, skb, pd);
198 return pd->pp->state_transition(cp, direction, skb, pd);
199} 198}
200 199
201static inline int 200static inline int
@@ -530,7 +529,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
530 a cache_bypass connection entry */ 529 a cache_bypass connection entry */
531 ipvs = net_ipvs(net); 530 ipvs = net_ipvs(net);
532 if (ipvs->sysctl_cache_bypass && svc->fwmark && unicast) { 531 if (ipvs->sysctl_cache_bypass && svc->fwmark && unicast) {
533 int ret, cs; 532 int ret;
534 struct ip_vs_conn *cp; 533 struct ip_vs_conn *cp;
535 unsigned int flags = (svc->flags & IP_VS_SVC_F_ONEPACKET && 534 unsigned int flags = (svc->flags & IP_VS_SVC_F_ONEPACKET &&
536 iph.protocol == IPPROTO_UDP)? 535 iph.protocol == IPPROTO_UDP)?
@@ -557,7 +556,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
557 ip_vs_in_stats(cp, skb); 556 ip_vs_in_stats(cp, skb);
558 557
559 /* set state */ 558 /* set state */
560 cs = ip_vs_set_state(cp, IP_VS_DIR_INPUT, skb, pd); 559 ip_vs_set_state(cp, IP_VS_DIR_INPUT, skb, pd);
561 560
562 /* transmit the first SYN packet */ 561 /* transmit the first SYN packet */
563 ret = cp->packet_xmit(skb, cp, pd->pp); 562 ret = cp->packet_xmit(skb, cp, pd->pp);
@@ -1490,7 +1489,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
1490 struct ip_vs_protocol *pp; 1489 struct ip_vs_protocol *pp;
1491 struct ip_vs_proto_data *pd; 1490 struct ip_vs_proto_data *pd;
1492 struct ip_vs_conn *cp; 1491 struct ip_vs_conn *cp;
1493 int ret, restart, pkts; 1492 int ret, pkts;
1494 struct netns_ipvs *ipvs; 1493 struct netns_ipvs *ipvs;
1495 1494
1496 /* Already marked as IPVS request or reply? */ 1495 /* Already marked as IPVS request or reply? */
@@ -1591,7 +1590,7 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
1591 } 1590 }
1592 1591
1593 ip_vs_in_stats(cp, skb); 1592 ip_vs_in_stats(cp, skb);
1594 restart = ip_vs_set_state(cp, IP_VS_DIR_INPUT, skb, pd); 1593 ip_vs_set_state(cp, IP_VS_DIR_INPUT, skb, pd);
1595 if (cp->packet_xmit) 1594 if (cp->packet_xmit)
1596 ret = cp->packet_xmit(skb, cp, pp); 1595 ret = cp->packet_xmit(skb, cp, pp);
1597 /* do not touch skb anymore */ 1596 /* do not touch skb anymore */
@@ -1878,10 +1877,9 @@ static int __net_init __ip_vs_init(struct net *net)
1878 struct netns_ipvs *ipvs; 1877 struct netns_ipvs *ipvs;
1879 1878
1880 ipvs = net_generic(net, ip_vs_net_id); 1879 ipvs = net_generic(net, ip_vs_net_id);
1881 if (ipvs == NULL) { 1880 if (ipvs == NULL)
1882 pr_err("%s(): no memory.\n", __func__);
1883 return -ENOMEM; 1881 return -ENOMEM;
1884 } 1882
1885 /* Hold the beast until a service is registerd */ 1883 /* Hold the beast until a service is registerd */
1886 ipvs->enable = 0; 1884 ipvs->enable = 0;
1887 ipvs->net = net; 1885 ipvs->net = net;
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index e3be48bf4dcd..008bf97cc91a 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -856,15 +856,12 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
856 } 856 }
857 857
858 dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL); 858 dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL);
859 if (dest == NULL) { 859 if (dest == NULL)
860 pr_err("%s(): no memory.\n", __func__);
861 return -ENOMEM; 860 return -ENOMEM;
862 } 861
863 dest->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); 862 dest->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
864 if (!dest->stats.cpustats) { 863 if (!dest->stats.cpustats)
865 pr_err("%s() alloc_percpu failed\n", __func__);
866 goto err_alloc; 864 goto err_alloc;
867 }
868 865
869 dest->af = svc->af; 866 dest->af = svc->af;
870 dest->protocol = svc->protocol; 867 dest->protocol = svc->protocol;
@@ -1168,10 +1165,8 @@ ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u,
1168 goto out_err; 1165 goto out_err;
1169 } 1166 }
1170 svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); 1167 svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
1171 if (!svc->stats.cpustats) { 1168 if (!svc->stats.cpustats)
1172 pr_err("%s() alloc_percpu failed\n", __func__);
1173 goto out_err; 1169 goto out_err;
1174 }
1175 1170
1176 /* I'm the first user of the service */ 1171 /* I'm the first user of the service */
1177 atomic_set(&svc->usecnt, 0); 1172 atomic_set(&svc->usecnt, 0);
@@ -3326,10 +3321,8 @@ static int ip_vs_genl_set_cmd(struct sk_buff *skb, struct genl_info *info)
3326 int ret = 0, cmd; 3321 int ret = 0, cmd;
3327 int need_full_svc = 0, need_full_dest = 0; 3322 int need_full_svc = 0, need_full_dest = 0;
3328 struct net *net; 3323 struct net *net;
3329 struct netns_ipvs *ipvs;
3330 3324
3331 net = skb_sknet(skb); 3325 net = skb_sknet(skb);
3332 ipvs = net_ipvs(net);
3333 cmd = info->genlhdr->cmd; 3326 cmd = info->genlhdr->cmd;
3334 3327
3335 mutex_lock(&__ip_vs_mutex); 3328 mutex_lock(&__ip_vs_mutex);
@@ -3421,10 +3414,8 @@ static int ip_vs_genl_get_cmd(struct sk_buff *skb, struct genl_info *info)
3421 void *reply; 3414 void *reply;
3422 int ret, cmd, reply_cmd; 3415 int ret, cmd, reply_cmd;
3423 struct net *net; 3416 struct net *net;
3424 struct netns_ipvs *ipvs;
3425 3417
3426 net = skb_sknet(skb); 3418 net = skb_sknet(skb);
3427 ipvs = net_ipvs(net);
3428 cmd = info->genlhdr->cmd; 3419 cmd = info->genlhdr->cmd;
3429 3420
3430 if (cmd == IPVS_CMD_GET_SERVICE) 3421 if (cmd == IPVS_CMD_GET_SERVICE)
@@ -3720,10 +3711,9 @@ int __net_init ip_vs_control_net_init(struct net *net)
3720 3711
3721 /* procfs stats */ 3712 /* procfs stats */
3722 ipvs->tot_stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); 3713 ipvs->tot_stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
3723 if (!ipvs->tot_stats.cpustats) { 3714 if (!ipvs->tot_stats.cpustats)
3724 pr_err("%s(): alloc_percpu.\n", __func__);
3725 return -ENOMEM; 3715 return -ENOMEM;
3726 } 3716
3727 spin_lock_init(&ipvs->tot_stats.lock); 3717 spin_lock_init(&ipvs->tot_stats.lock);
3728 3718
3729 proc_net_fops_create(net, "ip_vs", 0, &ip_vs_info_fops); 3719 proc_net_fops_create(net, "ip_vs", 0, &ip_vs_info_fops);
diff --git a/net/netfilter/ipvs/ip_vs_dh.c b/net/netfilter/ipvs/ip_vs_dh.c
index 95fd0d14200b..1c269e56200a 100644
--- a/net/netfilter/ipvs/ip_vs_dh.c
+++ b/net/netfilter/ipvs/ip_vs_dh.c
@@ -150,10 +150,9 @@ static int ip_vs_dh_init_svc(struct ip_vs_service *svc)
150 /* allocate the DH table for this service */ 150 /* allocate the DH table for this service */
151 tbl = kmalloc(sizeof(struct ip_vs_dh_bucket)*IP_VS_DH_TAB_SIZE, 151 tbl = kmalloc(sizeof(struct ip_vs_dh_bucket)*IP_VS_DH_TAB_SIZE,
152 GFP_ATOMIC); 152 GFP_ATOMIC);
153 if (tbl == NULL) { 153 if (tbl == NULL)
154 pr_err("%s(): no memory\n", __func__);
155 return -ENOMEM; 154 return -ENOMEM;
156 } 155
157 svc->sched_data = tbl; 156 svc->sched_data = tbl;
158 IP_VS_DBG(6, "DH hash table (memory=%Zdbytes) allocated for " 157 IP_VS_DBG(6, "DH hash table (memory=%Zdbytes) allocated for "
159 "current service\n", 158 "current service\n",
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
index 4490a32ad5b2..538d74ee4f68 100644
--- a/net/netfilter/ipvs/ip_vs_ftp.c
+++ b/net/netfilter/ipvs/ip_vs_ftp.c
@@ -52,8 +52,9 @@
52 * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper 52 * List of ports (up to IP_VS_APP_MAX_PORTS) to be handled by helper
53 * First port is set to the default port. 53 * First port is set to the default port.
54 */ 54 */
55static unsigned int ports_count = 1;
55static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0}; 56static unsigned short ports[IP_VS_APP_MAX_PORTS] = {21, 0};
56module_param_array(ports, ushort, NULL, 0); 57module_param_array(ports, ushort, &ports_count, 0444);
57MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands"); 58MODULE_PARM_DESC(ports, "Ports to monitor for FTP control commands");
58 59
59 60
@@ -449,7 +450,7 @@ static int __net_init __ip_vs_ftp_init(struct net *net)
449 if (ret) 450 if (ret)
450 goto err_exit; 451 goto err_exit;
451 452
452 for (i=0; i<IP_VS_APP_MAX_PORTS; i++) { 453 for (i = 0; i < ports_count; i++) {
453 if (!ports[i]) 454 if (!ports[i])
454 continue; 455 continue;
455 ret = register_ip_vs_app_inc(net, app, app->protocol, ports[i]); 456 ret = register_ip_vs_app_inc(net, app, app->protocol, ports[i]);
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c
index 87e40ea77a95..0f16283fd058 100644
--- a/net/netfilter/ipvs/ip_vs_lblc.c
+++ b/net/netfilter/ipvs/ip_vs_lblc.c
@@ -202,10 +202,8 @@ ip_vs_lblc_new(struct ip_vs_lblc_table *tbl, const union nf_inet_addr *daddr,
202 en = ip_vs_lblc_get(dest->af, tbl, daddr); 202 en = ip_vs_lblc_get(dest->af, tbl, daddr);
203 if (!en) { 203 if (!en) {
204 en = kmalloc(sizeof(*en), GFP_ATOMIC); 204 en = kmalloc(sizeof(*en), GFP_ATOMIC);
205 if (!en) { 205 if (!en)
206 pr_err("%s(): no memory\n", __func__);
207 return NULL; 206 return NULL;
208 }
209 207
210 en->af = dest->af; 208 en->af = dest->af;
211 ip_vs_addr_copy(dest->af, &en->addr, daddr); 209 ip_vs_addr_copy(dest->af, &en->addr, daddr);
@@ -345,10 +343,9 @@ static int ip_vs_lblc_init_svc(struct ip_vs_service *svc)
345 * Allocate the ip_vs_lblc_table for this service 343 * Allocate the ip_vs_lblc_table for this service
346 */ 344 */
347 tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC); 345 tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC);
348 if (tbl == NULL) { 346 if (tbl == NULL)
349 pr_err("%s(): no memory\n", __func__);
350 return -ENOMEM; 347 return -ENOMEM;
351 } 348
352 svc->sched_data = tbl; 349 svc->sched_data = tbl;
353 IP_VS_DBG(6, "LBLC hash table (memory=%Zdbytes) allocated for " 350 IP_VS_DBG(6, "LBLC hash table (memory=%Zdbytes) allocated for "
354 "current service\n", sizeof(*tbl)); 351 "current service\n", sizeof(*tbl));
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c
index 90f618ab6dda..eec797f8cce7 100644
--- a/net/netfilter/ipvs/ip_vs_lblcr.c
+++ b/net/netfilter/ipvs/ip_vs_lblcr.c
@@ -112,10 +112,8 @@ ip_vs_dest_set_insert(struct ip_vs_dest_set *set, struct ip_vs_dest *dest)
112 } 112 }
113 113
114 e = kmalloc(sizeof(*e), GFP_ATOMIC); 114 e = kmalloc(sizeof(*e), GFP_ATOMIC);
115 if (e == NULL) { 115 if (e == NULL)
116 pr_err("%s(): no memory\n", __func__);
117 return NULL; 116 return NULL;
118 }
119 117
120 atomic_inc(&dest->refcnt); 118 atomic_inc(&dest->refcnt);
121 e->dest = dest; 119 e->dest = dest;
@@ -373,10 +371,8 @@ ip_vs_lblcr_new(struct ip_vs_lblcr_table *tbl, const union nf_inet_addr *daddr,
373 en = ip_vs_lblcr_get(dest->af, tbl, daddr); 371 en = ip_vs_lblcr_get(dest->af, tbl, daddr);
374 if (!en) { 372 if (!en) {
375 en = kmalloc(sizeof(*en), GFP_ATOMIC); 373 en = kmalloc(sizeof(*en), GFP_ATOMIC);
376 if (!en) { 374 if (!en)
377 pr_err("%s(): no memory\n", __func__);
378 return NULL; 375 return NULL;
379 }
380 376
381 en->af = dest->af; 377 en->af = dest->af;
382 ip_vs_addr_copy(dest->af, &en->addr, daddr); 378 ip_vs_addr_copy(dest->af, &en->addr, daddr);
@@ -516,10 +512,9 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
516 * Allocate the ip_vs_lblcr_table for this service 512 * Allocate the ip_vs_lblcr_table for this service
517 */ 513 */
518 tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC); 514 tbl = kmalloc(sizeof(*tbl), GFP_ATOMIC);
519 if (tbl == NULL) { 515 if (tbl == NULL)
520 pr_err("%s(): no memory\n", __func__);
521 return -ENOMEM; 516 return -ENOMEM;
522 } 517
523 svc->sched_data = tbl; 518 svc->sched_data = tbl;
524 IP_VS_DBG(6, "LBLCR hash table (memory=%Zdbytes) allocated for " 519 IP_VS_DBG(6, "LBLCR hash table (memory=%Zdbytes) allocated for "
525 "current service\n", sizeof(*tbl)); 520 "current service\n", sizeof(*tbl));
diff --git a/net/netfilter/ipvs/ip_vs_nfct.c b/net/netfilter/ipvs/ip_vs_nfct.c
index f454c80df0a7..022e77e1e766 100644
--- a/net/netfilter/ipvs/ip_vs_nfct.c
+++ b/net/netfilter/ipvs/ip_vs_nfct.c
@@ -127,7 +127,7 @@ ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, int outin)
127 nf_conntrack_alter_reply(ct, &new_tuple); 127 nf_conntrack_alter_reply(ct, &new_tuple);
128} 128}
129 129
130int ip_vs_confirm_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp) 130int ip_vs_confirm_conntrack(struct sk_buff *skb)
131{ 131{
132 return nf_conntrack_confirm(skb); 132 return nf_conntrack_confirm(skb);
133} 133}
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c
index 52d073c105e9..85312939695f 100644
--- a/net/netfilter/ipvs/ip_vs_proto.c
+++ b/net/netfilter/ipvs/ip_vs_proto.c
@@ -74,10 +74,9 @@ register_ip_vs_proto_netns(struct net *net, struct ip_vs_protocol *pp)
74 struct ip_vs_proto_data *pd = 74 struct ip_vs_proto_data *pd =
75 kzalloc(sizeof(struct ip_vs_proto_data), GFP_ATOMIC); 75 kzalloc(sizeof(struct ip_vs_proto_data), GFP_ATOMIC);
76 76
77 if (!pd) { 77 if (!pd)
78 pr_err("%s(): no memory.\n", __func__);
79 return -ENOMEM; 78 return -ENOMEM;
80 } 79
81 pd->pp = pp; /* For speed issues */ 80 pd->pp = pp; /* For speed issues */
82 pd->next = ipvs->proto_data_table[hash]; 81 pd->next = ipvs->proto_data_table[hash];
83 ipvs->proto_data_table[hash] = pd; 82 ipvs->proto_data_table[hash] = pd;
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c
index d12ed53ec95f..1fbf7a2816f5 100644
--- a/net/netfilter/ipvs/ip_vs_proto_sctp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c
@@ -906,7 +906,7 @@ static const char *sctp_state_name(int state)
906 return "?"; 906 return "?";
907} 907}
908 908
909static inline int 909static inline void
910set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, 910set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
911 int direction, const struct sk_buff *skb) 911 int direction, const struct sk_buff *skb)
912{ 912{
@@ -924,7 +924,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
924 sch = skb_header_pointer(skb, ihl + sizeof(sctp_sctphdr_t), 924 sch = skb_header_pointer(skb, ihl + sizeof(sctp_sctphdr_t),
925 sizeof(_sctpch), &_sctpch); 925 sizeof(_sctpch), &_sctpch);
926 if (sch == NULL) 926 if (sch == NULL)
927 return 0; 927 return;
928 928
929 chunk_type = sch->type; 929 chunk_type = sch->type;
930 /* 930 /*
@@ -993,21 +993,15 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
993 cp->timeout = pd->timeout_table[cp->state = next_state]; 993 cp->timeout = pd->timeout_table[cp->state = next_state];
994 else /* What to do ? */ 994 else /* What to do ? */
995 cp->timeout = sctp_timeouts[cp->state = next_state]; 995 cp->timeout = sctp_timeouts[cp->state = next_state];
996
997 return 1;
998} 996}
999 997
1000static int 998static void
1001sctp_state_transition(struct ip_vs_conn *cp, int direction, 999sctp_state_transition(struct ip_vs_conn *cp, int direction,
1002 const struct sk_buff *skb, struct ip_vs_proto_data *pd) 1000 const struct sk_buff *skb, struct ip_vs_proto_data *pd)
1003{ 1001{
1004 int ret = 0;
1005
1006 spin_lock(&cp->lock); 1002 spin_lock(&cp->lock);
1007 ret = set_sctp_state(pd, cp, direction, skb); 1003 set_sctp_state(pd, cp, direction, skb);
1008 spin_unlock(&cp->lock); 1004 spin_unlock(&cp->lock);
1009
1010 return ret;
1011} 1005}
1012 1006
1013static inline __u16 sctp_app_hashkey(__be16 port) 1007static inline __u16 sctp_app_hashkey(__be16 port)
diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c
index c0cc341b840d..ef8641f7af83 100644
--- a/net/netfilter/ipvs/ip_vs_proto_tcp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c
@@ -546,7 +546,7 @@ set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
546/* 546/*
547 * Handle state transitions 547 * Handle state transitions
548 */ 548 */
549static int 549static void
550tcp_state_transition(struct ip_vs_conn *cp, int direction, 550tcp_state_transition(struct ip_vs_conn *cp, int direction,
551 const struct sk_buff *skb, 551 const struct sk_buff *skb,
552 struct ip_vs_proto_data *pd) 552 struct ip_vs_proto_data *pd)
@@ -561,13 +561,11 @@ tcp_state_transition(struct ip_vs_conn *cp, int direction,
561 561
562 th = skb_header_pointer(skb, ihl, sizeof(_tcph), &_tcph); 562 th = skb_header_pointer(skb, ihl, sizeof(_tcph), &_tcph);
563 if (th == NULL) 563 if (th == NULL)
564 return 0; 564 return;
565 565
566 spin_lock(&cp->lock); 566 spin_lock(&cp->lock);
567 set_tcp_state(pd, cp, direction, th); 567 set_tcp_state(pd, cp, direction, th);
568 spin_unlock(&cp->lock); 568 spin_unlock(&cp->lock);
569
570 return 1;
571} 569}
572 570
573static inline __u16 tcp_app_hashkey(__be16 port) 571static inline __u16 tcp_app_hashkey(__be16 port)
diff --git a/net/netfilter/ipvs/ip_vs_proto_udp.c b/net/netfilter/ipvs/ip_vs_proto_udp.c
index f1282cbe6fe3..f4b7262896bb 100644
--- a/net/netfilter/ipvs/ip_vs_proto_udp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_udp.c
@@ -454,18 +454,17 @@ static const char * udp_state_name(int state)
454 return udp_state_name_table[state] ? udp_state_name_table[state] : "?"; 454 return udp_state_name_table[state] ? udp_state_name_table[state] : "?";
455} 455}
456 456
457static int 457static void
458udp_state_transition(struct ip_vs_conn *cp, int direction, 458udp_state_transition(struct ip_vs_conn *cp, int direction,
459 const struct sk_buff *skb, 459 const struct sk_buff *skb,
460 struct ip_vs_proto_data *pd) 460 struct ip_vs_proto_data *pd)
461{ 461{
462 if (unlikely(!pd)) { 462 if (unlikely(!pd)) {
463 pr_err("UDP no ns data\n"); 463 pr_err("UDP no ns data\n");
464 return 0; 464 return;
465 } 465 }
466 466
467 cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL]; 467 cp->timeout = pd->timeout_table[IP_VS_UDP_S_NORMAL];
468 return 1;
469} 468}
470 469
471static void __udp_init(struct net *net, struct ip_vs_proto_data *pd) 470static void __udp_init(struct net *net, struct ip_vs_proto_data *pd)
diff --git a/net/netfilter/ipvs/ip_vs_sh.c b/net/netfilter/ipvs/ip_vs_sh.c
index b5e2556c581a..33815f4fb451 100644
--- a/net/netfilter/ipvs/ip_vs_sh.c
+++ b/net/netfilter/ipvs/ip_vs_sh.c
@@ -147,10 +147,9 @@ static int ip_vs_sh_init_svc(struct ip_vs_service *svc)
147 /* allocate the SH table for this service */ 147 /* allocate the SH table for this service */
148 tbl = kmalloc(sizeof(struct ip_vs_sh_bucket)*IP_VS_SH_TAB_SIZE, 148 tbl = kmalloc(sizeof(struct ip_vs_sh_bucket)*IP_VS_SH_TAB_SIZE,
149 GFP_ATOMIC); 149 GFP_ATOMIC);
150 if (tbl == NULL) { 150 if (tbl == NULL)
151 pr_err("%s(): no memory\n", __func__);
152 return -ENOMEM; 151 return -ENOMEM;
153 } 152
154 svc->sched_data = tbl; 153 svc->sched_data = tbl;
155 IP_VS_DBG(6, "SH hash table (memory=%Zdbytes) allocated for " 154 IP_VS_DBG(6, "SH hash table (memory=%Zdbytes) allocated for "
156 "current service\n", 155 "current service\n",
diff --git a/net/netfilter/ipvs/ip_vs_wrr.c b/net/netfilter/ipvs/ip_vs_wrr.c
index 1ef41f50723c..fd0d4e09876a 100644
--- a/net/netfilter/ipvs/ip_vs_wrr.c
+++ b/net/netfilter/ipvs/ip_vs_wrr.c
@@ -85,10 +85,9 @@ static int ip_vs_wrr_init_svc(struct ip_vs_service *svc)
85 * Allocate the mark variable for WRR scheduling 85 * Allocate the mark variable for WRR scheduling
86 */ 86 */
87 mark = kmalloc(sizeof(struct ip_vs_wrr_mark), GFP_ATOMIC); 87 mark = kmalloc(sizeof(struct ip_vs_wrr_mark), GFP_ATOMIC);
88 if (mark == NULL) { 88 if (mark == NULL)
89 pr_err("%s(): no memory\n", __func__);
90 return -ENOMEM; 89 return -ENOMEM;
91 } 90
92 mark->cl = &svc->destinations; 91 mark->cl = &svc->destinations;
93 mark->cw = 0; 92 mark->cw = 0;
94 mark->mw = ip_vs_wrr_max_weight(svc); 93 mark->mw = ip_vs_wrr_max_weight(svc);
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index ee319a4338b0..aa2d7206ee8a 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -339,7 +339,7 @@ ip_vs_dst_reset(struct ip_vs_dest *dest)
339 \ 339 \
340 (skb)->ipvs_property = 1; \ 340 (skb)->ipvs_property = 1; \
341 if (unlikely((cp)->flags & IP_VS_CONN_F_NFCT)) \ 341 if (unlikely((cp)->flags & IP_VS_CONN_F_NFCT)) \
342 __ret = ip_vs_confirm_conntrack(skb, cp); \ 342 __ret = ip_vs_confirm_conntrack(skb); \
343 if (__ret == NF_ACCEPT) { \ 343 if (__ret == NF_ACCEPT) { \
344 nf_reset(skb); \ 344 nf_reset(skb); \
345 skb_forward_csum(skb); \ 345 skb_forward_csum(skb); \
diff --git a/net/netfilter/nf_conntrack_acct.c b/net/netfilter/nf_conntrack_acct.c
index 5178c691ecbf..369df3f08d42 100644
--- a/net/netfilter/nf_conntrack_acct.c
+++ b/net/netfilter/nf_conntrack_acct.c
@@ -12,6 +12,7 @@
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/moduleparam.h> 14#include <linux/moduleparam.h>
15#include <linux/export.h>
15 16
16#include <net/netfilter/nf_conntrack.h> 17#include <net/netfilter/nf_conntrack.h>
17#include <net/netfilter/nf_conntrack_extend.h> 18#include <net/netfilter/nf_conntrack_extend.h>
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 5acfaf59a9c3..7202b0631cd6 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -661,7 +661,6 @@ __nf_conntrack_alloc(struct net *net, u16 zone,
661 */ 661 */
662 ct = kmem_cache_alloc(net->ct.nf_conntrack_cachep, gfp); 662 ct = kmem_cache_alloc(net->ct.nf_conntrack_cachep, gfp);
663 if (ct == NULL) { 663 if (ct == NULL) {
664 pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n");
665 atomic_dec(&net->ct.count); 664 atomic_dec(&net->ct.count);
666 return ERR_PTR(-ENOMEM); 665 return ERR_PTR(-ENOMEM);
667 } 666 }
@@ -749,10 +748,8 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
749 748
750 ct = __nf_conntrack_alloc(net, zone, tuple, &repl_tuple, GFP_ATOMIC, 749 ct = __nf_conntrack_alloc(net, zone, tuple, &repl_tuple, GFP_ATOMIC,
751 hash); 750 hash);
752 if (IS_ERR(ct)) { 751 if (IS_ERR(ct))
753 pr_debug("Can't allocate conntrack.\n");
754 return (struct nf_conntrack_tuple_hash *)ct; 752 return (struct nf_conntrack_tuple_hash *)ct;
755 }
756 753
757 if (!l4proto->new(ct, skb, dataoff)) { 754 if (!l4proto->new(ct, skb, dataoff)) {
758 nf_conntrack_free(ct); 755 nf_conntrack_free(ct);
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c
index 3add99439059..b62c4148b921 100644
--- a/net/netfilter/nf_conntrack_ecache.c
+++ b/net/netfilter/nf_conntrack_ecache.c
@@ -19,6 +19,7 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/netdevice.h> 20#include <linux/netdevice.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/export.h>
22 23
23#include <net/netfilter/nf_conntrack.h> 24#include <net/netfilter/nf_conntrack.h>
24#include <net/netfilter/nf_conntrack_core.h> 25#include <net/netfilter/nf_conntrack_core.h>
@@ -26,22 +27,17 @@
26 27
27static DEFINE_MUTEX(nf_ct_ecache_mutex); 28static DEFINE_MUTEX(nf_ct_ecache_mutex);
28 29
29struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb __read_mostly;
30EXPORT_SYMBOL_GPL(nf_conntrack_event_cb);
31
32struct nf_exp_event_notifier __rcu *nf_expect_event_cb __read_mostly;
33EXPORT_SYMBOL_GPL(nf_expect_event_cb);
34
35/* deliver cached events and clear cache entry - must be called with locally 30/* deliver cached events and clear cache entry - must be called with locally
36 * disabled softirqs */ 31 * disabled softirqs */
37void nf_ct_deliver_cached_events(struct nf_conn *ct) 32void nf_ct_deliver_cached_events(struct nf_conn *ct)
38{ 33{
34 struct net *net = nf_ct_net(ct);
39 unsigned long events; 35 unsigned long events;
40 struct nf_ct_event_notifier *notify; 36 struct nf_ct_event_notifier *notify;
41 struct nf_conntrack_ecache *e; 37 struct nf_conntrack_ecache *e;
42 38
43 rcu_read_lock(); 39 rcu_read_lock();
44 notify = rcu_dereference(nf_conntrack_event_cb); 40 notify = rcu_dereference(net->ct.nf_conntrack_event_cb);
45 if (notify == NULL) 41 if (notify == NULL)
46 goto out_unlock; 42 goto out_unlock;
47 43
@@ -82,19 +78,20 @@ out_unlock:
82} 78}
83EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events); 79EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events);
84 80
85int nf_conntrack_register_notifier(struct nf_ct_event_notifier *new) 81int nf_conntrack_register_notifier(struct net *net,
82 struct nf_ct_event_notifier *new)
86{ 83{
87 int ret = 0; 84 int ret = 0;
88 struct nf_ct_event_notifier *notify; 85 struct nf_ct_event_notifier *notify;
89 86
90 mutex_lock(&nf_ct_ecache_mutex); 87 mutex_lock(&nf_ct_ecache_mutex);
91 notify = rcu_dereference_protected(nf_conntrack_event_cb, 88 notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb,
92 lockdep_is_held(&nf_ct_ecache_mutex)); 89 lockdep_is_held(&nf_ct_ecache_mutex));
93 if (notify != NULL) { 90 if (notify != NULL) {
94 ret = -EBUSY; 91 ret = -EBUSY;
95 goto out_unlock; 92 goto out_unlock;
96 } 93 }
97 RCU_INIT_POINTER(nf_conntrack_event_cb, new); 94 RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, new);
98 mutex_unlock(&nf_ct_ecache_mutex); 95 mutex_unlock(&nf_ct_ecache_mutex);
99 return ret; 96 return ret;
100 97
@@ -104,32 +101,34 @@ out_unlock:
104} 101}
105EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier); 102EXPORT_SYMBOL_GPL(nf_conntrack_register_notifier);
106 103
107void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *new) 104void nf_conntrack_unregister_notifier(struct net *net,
105 struct nf_ct_event_notifier *new)
108{ 106{
109 struct nf_ct_event_notifier *notify; 107 struct nf_ct_event_notifier *notify;
110 108
111 mutex_lock(&nf_ct_ecache_mutex); 109 mutex_lock(&nf_ct_ecache_mutex);
112 notify = rcu_dereference_protected(nf_conntrack_event_cb, 110 notify = rcu_dereference_protected(net->ct.nf_conntrack_event_cb,
113 lockdep_is_held(&nf_ct_ecache_mutex)); 111 lockdep_is_held(&nf_ct_ecache_mutex));
114 BUG_ON(notify != new); 112 BUG_ON(notify != new);
115 RCU_INIT_POINTER(nf_conntrack_event_cb, NULL); 113 RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, NULL);
116 mutex_unlock(&nf_ct_ecache_mutex); 114 mutex_unlock(&nf_ct_ecache_mutex);
117} 115}
118EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier); 116EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier);
119 117
120int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *new) 118int nf_ct_expect_register_notifier(struct net *net,
119 struct nf_exp_event_notifier *new)
121{ 120{
122 int ret = 0; 121 int ret = 0;
123 struct nf_exp_event_notifier *notify; 122 struct nf_exp_event_notifier *notify;
124 123
125 mutex_lock(&nf_ct_ecache_mutex); 124 mutex_lock(&nf_ct_ecache_mutex);
126 notify = rcu_dereference_protected(nf_expect_event_cb, 125 notify = rcu_dereference_protected(net->ct.nf_expect_event_cb,
127 lockdep_is_held(&nf_ct_ecache_mutex)); 126 lockdep_is_held(&nf_ct_ecache_mutex));
128 if (notify != NULL) { 127 if (notify != NULL) {
129 ret = -EBUSY; 128 ret = -EBUSY;
130 goto out_unlock; 129 goto out_unlock;
131 } 130 }
132 RCU_INIT_POINTER(nf_expect_event_cb, new); 131 RCU_INIT_POINTER(net->ct.nf_expect_event_cb, new);
133 mutex_unlock(&nf_ct_ecache_mutex); 132 mutex_unlock(&nf_ct_ecache_mutex);
134 return ret; 133 return ret;
135 134
@@ -139,15 +138,16 @@ out_unlock:
139} 138}
140EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier); 139EXPORT_SYMBOL_GPL(nf_ct_expect_register_notifier);
141 140
142void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *new) 141void nf_ct_expect_unregister_notifier(struct net *net,
142 struct nf_exp_event_notifier *new)
143{ 143{
144 struct nf_exp_event_notifier *notify; 144 struct nf_exp_event_notifier *notify;
145 145
146 mutex_lock(&nf_ct_ecache_mutex); 146 mutex_lock(&nf_ct_ecache_mutex);
147 notify = rcu_dereference_protected(nf_expect_event_cb, 147 notify = rcu_dereference_protected(net->ct.nf_expect_event_cb,
148 lockdep_is_held(&nf_ct_ecache_mutex)); 148 lockdep_is_held(&nf_ct_ecache_mutex));
149 BUG_ON(notify != new); 149 BUG_ON(notify != new);
150 RCU_INIT_POINTER(nf_expect_event_cb, NULL); 150 RCU_INIT_POINTER(net->ct.nf_expect_event_cb, NULL);
151 mutex_unlock(&nf_ct_ecache_mutex); 151 mutex_unlock(&nf_ct_ecache_mutex);
152} 152}
153EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier); 153EXPORT_SYMBOL_GPL(nf_ct_expect_unregister_notifier);
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index cd1e8e0970f2..340c80d968d4 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -20,6 +20,8 @@
20#include <linux/percpu.h> 20#include <linux/percpu.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/jhash.h> 22#include <linux/jhash.h>
23#include <linux/moduleparam.h>
24#include <linux/export.h>
23#include <net/net_namespace.h> 25#include <net/net_namespace.h>
24 26
25#include <net/netfilter/nf_conntrack.h> 27#include <net/netfilter/nf_conntrack.h>
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index e58aa9b1fe8a..ef21b221f036 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -4,7 +4,7 @@
4 * (C) 2001 by Jay Schulist <jschlst@samba.org> 4 * (C) 2001 by Jay Schulist <jschlst@samba.org>
5 * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org> 5 * (C) 2002-2006 by Harald Welte <laforge@gnumonks.org>
6 * (C) 2003 by Patrick Mchardy <kaber@trash.net> 6 * (C) 2003 by Patrick Mchardy <kaber@trash.net>
7 * (C) 2005-2008 by Pablo Neira Ayuso <pablo@netfilter.org> 7 * (C) 2005-2011 by Pablo Neira Ayuso <pablo@netfilter.org>
8 * 8 *
9 * Initial connection tracking via netlink development funded and 9 * Initial connection tracking via netlink development funded and
10 * generally made possible by Network Robots, Inc. (www.networkrobots.com) 10 * generally made possible by Network Robots, Inc. (www.networkrobots.com)
@@ -2163,6 +2163,54 @@ MODULE_ALIAS("ip_conntrack_netlink");
2163MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK); 2163MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK);
2164MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK_EXP); 2164MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_CTNETLINK_EXP);
2165 2165
2166static int __net_init ctnetlink_net_init(struct net *net)
2167{
2168#ifdef CONFIG_NF_CONNTRACK_EVENTS
2169 int ret;
2170
2171 ret = nf_conntrack_register_notifier(net, &ctnl_notifier);
2172 if (ret < 0) {
2173 pr_err("ctnetlink_init: cannot register notifier.\n");
2174 goto err_out;
2175 }
2176
2177 ret = nf_ct_expect_register_notifier(net, &ctnl_notifier_exp);
2178 if (ret < 0) {
2179 pr_err("ctnetlink_init: cannot expect register notifier.\n");
2180 goto err_unreg_notifier;
2181 }
2182#endif
2183 return 0;
2184
2185#ifdef CONFIG_NF_CONNTRACK_EVENTS
2186err_unreg_notifier:
2187 nf_conntrack_unregister_notifier(net, &ctnl_notifier);
2188err_out:
2189 return ret;
2190#endif
2191}
2192
2193static void ctnetlink_net_exit(struct net *net)
2194{
2195#ifdef CONFIG_NF_CONNTRACK_EVENTS
2196 nf_ct_expect_unregister_notifier(net, &ctnl_notifier_exp);
2197 nf_conntrack_unregister_notifier(net, &ctnl_notifier);
2198#endif
2199}
2200
2201static void __net_exit ctnetlink_net_exit_batch(struct list_head *net_exit_list)
2202{
2203 struct net *net;
2204
2205 list_for_each_entry(net, net_exit_list, exit_list)
2206 ctnetlink_net_exit(net);
2207}
2208
2209static struct pernet_operations ctnetlink_net_ops = {
2210 .init = ctnetlink_net_init,
2211 .exit_batch = ctnetlink_net_exit_batch,
2212};
2213
2166static int __init ctnetlink_init(void) 2214static int __init ctnetlink_init(void)
2167{ 2215{
2168 int ret; 2216 int ret;
@@ -2180,28 +2228,15 @@ static int __init ctnetlink_init(void)
2180 goto err_unreg_subsys; 2228 goto err_unreg_subsys;
2181 } 2229 }
2182 2230
2183#ifdef CONFIG_NF_CONNTRACK_EVENTS 2231 if (register_pernet_subsys(&ctnetlink_net_ops)) {
2184 ret = nf_conntrack_register_notifier(&ctnl_notifier); 2232 pr_err("ctnetlink_init: cannot register pernet operations\n");
2185 if (ret < 0) {
2186 pr_err("ctnetlink_init: cannot register notifier.\n");
2187 goto err_unreg_exp_subsys; 2233 goto err_unreg_exp_subsys;
2188 } 2234 }
2189 2235
2190 ret = nf_ct_expect_register_notifier(&ctnl_notifier_exp);
2191 if (ret < 0) {
2192 pr_err("ctnetlink_init: cannot expect register notifier.\n");
2193 goto err_unreg_notifier;
2194 }
2195#endif
2196
2197 return 0; 2236 return 0;
2198 2237
2199#ifdef CONFIG_NF_CONNTRACK_EVENTS
2200err_unreg_notifier:
2201 nf_conntrack_unregister_notifier(&ctnl_notifier);
2202err_unreg_exp_subsys: 2238err_unreg_exp_subsys:
2203 nfnetlink_subsys_unregister(&ctnl_exp_subsys); 2239 nfnetlink_subsys_unregister(&ctnl_exp_subsys);
2204#endif
2205err_unreg_subsys: 2240err_unreg_subsys:
2206 nfnetlink_subsys_unregister(&ctnl_subsys); 2241 nfnetlink_subsys_unregister(&ctnl_subsys);
2207err_out: 2242err_out:
@@ -2213,11 +2248,7 @@ static void __exit ctnetlink_exit(void)
2213 pr_info("ctnetlink: unregistering from nfnetlink.\n"); 2248 pr_info("ctnetlink: unregistering from nfnetlink.\n");
2214 2249
2215 nf_ct_remove_userspace_expectations(); 2250 nf_ct_remove_userspace_expectations();
2216#ifdef CONFIG_NF_CONNTRACK_EVENTS 2251 unregister_pernet_subsys(&ctnetlink_net_ops);
2217 nf_ct_expect_unregister_notifier(&ctnl_notifier_exp);
2218 nf_conntrack_unregister_notifier(&ctnl_notifier);
2219#endif
2220
2221 nfnetlink_subsys_unregister(&ctnl_exp_subsys); 2252 nfnetlink_subsys_unregister(&ctnl_exp_subsys);
2222 nfnetlink_subsys_unregister(&ctnl_subsys); 2253 nfnetlink_subsys_unregister(&ctnl_subsys);
2223} 2254}
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 2d8158acf6fa..66b2c54c544f 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -307,17 +307,14 @@ nfulnl_alloc_skb(unsigned int inst_size, unsigned int pkt_size)
307 n = max(inst_size, pkt_size); 307 n = max(inst_size, pkt_size);
308 skb = alloc_skb(n, GFP_ATOMIC); 308 skb = alloc_skb(n, GFP_ATOMIC);
309 if (!skb) { 309 if (!skb) {
310 pr_notice("nfnetlink_log: can't alloc whole buffer (%u bytes)\n",
311 inst_size);
312
313 if (n > pkt_size) { 310 if (n > pkt_size) {
314 /* try to allocate only as much as we need for current 311 /* try to allocate only as much as we need for current
315 * packet */ 312 * packet */
316 313
317 skb = alloc_skb(pkt_size, GFP_ATOMIC); 314 skb = alloc_skb(pkt_size, GFP_ATOMIC);
318 if (!skb) 315 if (!skb)
319 pr_err("nfnetlink_log: can't even alloc %u " 316 pr_err("nfnetlink_log: can't even alloc %u bytes\n",
320 "bytes\n", pkt_size); 317 pkt_size);
321 } 318 }
322 } 319 }
323 320
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 71441b934ffd..8d987c3573fd 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -14,6 +14,7 @@
14 */ 14 */
15#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 15#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/module.h>
17#include <linux/socket.h> 18#include <linux/socket.h>
18#include <linux/net.h> 19#include <linux/net.h>
19#include <linux/proc_fs.h> 20#include <linux/proc_fs.h>
diff --git a/net/netfilter/xt_IDLETIMER.c b/net/netfilter/xt_IDLETIMER.c
index 3bdd443aaf15..f407ebc13481 100644
--- a/net/netfilter/xt_IDLETIMER.c
+++ b/net/netfilter/xt_IDLETIMER.c
@@ -122,14 +122,12 @@ static int idletimer_tg_create(struct idletimer_tg_info *info)
122 122
123 info->timer = kmalloc(sizeof(*info->timer), GFP_KERNEL); 123 info->timer = kmalloc(sizeof(*info->timer), GFP_KERNEL);
124 if (!info->timer) { 124 if (!info->timer) {
125 pr_debug("couldn't alloc timer\n");
126 ret = -ENOMEM; 125 ret = -ENOMEM;
127 goto out; 126 goto out;
128 } 127 }
129 128
130 info->timer->attr.attr.name = kstrdup(info->label, GFP_KERNEL); 129 info->timer->attr.attr.name = kstrdup(info->label, GFP_KERNEL);
131 if (!info->timer->attr.attr.name) { 130 if (!info->timer->attr.attr.name) {
132 pr_debug("couldn't alloc attribute name\n");
133 ret = -ENOMEM; 131 ret = -ENOMEM;
134 goto out_free_timer; 132 goto out_free_timer;
135 } 133 }
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 9228ee0dc11a..dfd52bad1523 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -176,10 +176,7 @@ dsthash_alloc_init(struct xt_hashlimit_htable *ht,
176 ent = NULL; 176 ent = NULL;
177 } else 177 } else
178 ent = kmem_cache_alloc(hashlimit_cachep, GFP_ATOMIC); 178 ent = kmem_cache_alloc(hashlimit_cachep, GFP_ATOMIC);
179 if (!ent) { 179 if (ent) {
180 if (net_ratelimit())
181 pr_err("cannot allocate dsthash_ent\n");
182 } else {
183 memcpy(&ent->dst, dst, sizeof(ent->dst)); 180 memcpy(&ent->dst, dst, sizeof(ent->dst));
184 spin_lock_init(&ent->lock); 181 spin_lock_init(&ent->lock);
185 182
diff --git a/net/netfilter/xt_quota.c b/net/netfilter/xt_quota.c
index 70eb2b4984dd..44c8eb4c9d66 100644
--- a/net/netfilter/xt_quota.c
+++ b/net/netfilter/xt_quota.c
@@ -9,6 +9,7 @@
9 9
10#include <linux/netfilter/x_tables.h> 10#include <linux/netfilter/x_tables.h>
11#include <linux/netfilter/xt_quota.h> 11#include <linux/netfilter/xt_quota.h>
12#include <linux/module.h>
12 13
13struct xt_quota_priv { 14struct xt_quota_priv {
14 spinlock_t lock; 15 spinlock_t lock;
diff --git a/net/netfilter/xt_statistic.c b/net/netfilter/xt_statistic.c
index 42ecb71d445f..4fe4fb4276d0 100644
--- a/net/netfilter/xt_statistic.c
+++ b/net/netfilter/xt_statistic.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/netfilter/xt_statistic.h> 17#include <linux/netfilter/xt_statistic.h>
18#include <linux/netfilter/x_tables.h> 18#include <linux/netfilter/x_tables.h>
19#include <linux/module.h>
19 20
20struct xt_statistic_priv { 21struct xt_statistic_priv {
21 atomic_t count; 22 atomic_t count;
diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c
index 9c24de10a657..824f184f7a9b 100644
--- a/net/netlabel/netlabel_kapi.c
+++ b/net/netlabel/netlabel_kapi.c
@@ -111,8 +111,6 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
111 struct netlbl_domaddr_map *addrmap = NULL; 111 struct netlbl_domaddr_map *addrmap = NULL;
112 struct netlbl_domaddr4_map *map4 = NULL; 112 struct netlbl_domaddr4_map *map4 = NULL;
113 struct netlbl_domaddr6_map *map6 = NULL; 113 struct netlbl_domaddr6_map *map6 = NULL;
114 const struct in_addr *addr4, *mask4;
115 const struct in6_addr *addr6, *mask6;
116 114
117 entry = kzalloc(sizeof(*entry), GFP_ATOMIC); 115 entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
118 if (entry == NULL) 116 if (entry == NULL)
@@ -133,9 +131,9 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
133 INIT_LIST_HEAD(&addrmap->list6); 131 INIT_LIST_HEAD(&addrmap->list6);
134 132
135 switch (family) { 133 switch (family) {
136 case AF_INET: 134 case AF_INET: {
137 addr4 = addr; 135 const struct in_addr *addr4 = addr;
138 mask4 = mask; 136 const struct in_addr *mask4 = mask;
139 map4 = kzalloc(sizeof(*map4), GFP_ATOMIC); 137 map4 = kzalloc(sizeof(*map4), GFP_ATOMIC);
140 if (map4 == NULL) 138 if (map4 == NULL)
141 goto cfg_unlbl_map_add_failure; 139 goto cfg_unlbl_map_add_failure;
@@ -148,9 +146,11 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
148 if (ret_val != 0) 146 if (ret_val != 0)
149 goto cfg_unlbl_map_add_failure; 147 goto cfg_unlbl_map_add_failure;
150 break; 148 break;
151 case AF_INET6: 149 }
152 addr6 = addr; 150#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
153 mask6 = mask; 151 case AF_INET6: {
152 const struct in6_addr *addr6 = addr;
153 const struct in6_addr *mask6 = mask;
154 map6 = kzalloc(sizeof(*map6), GFP_ATOMIC); 154 map6 = kzalloc(sizeof(*map6), GFP_ATOMIC);
155 if (map6 == NULL) 155 if (map6 == NULL)
156 goto cfg_unlbl_map_add_failure; 156 goto cfg_unlbl_map_add_failure;
@@ -162,11 +162,13 @@ int netlbl_cfg_unlbl_map_add(const char *domain,
162 map6->list.addr.s6_addr32[3] &= mask6->s6_addr32[3]; 162 map6->list.addr.s6_addr32[3] &= mask6->s6_addr32[3];
163 ipv6_addr_copy(&map6->list.mask, mask6); 163 ipv6_addr_copy(&map6->list.mask, mask6);
164 map6->list.valid = 1; 164 map6->list.valid = 1;
165 ret_val = netlbl_af4list_add(&map4->list, 165 ret_val = netlbl_af6list_add(&map6->list,
166 &addrmap->list4); 166 &addrmap->list6);
167 if (ret_val != 0) 167 if (ret_val != 0)
168 goto cfg_unlbl_map_add_failure; 168 goto cfg_unlbl_map_add_failure;
169 break; 169 break;
170 }
171#endif /* IPv6 */
170 default: 172 default:
171 goto cfg_unlbl_map_add_failure; 173 goto cfg_unlbl_map_add_failure;
172 break; 174 break;
@@ -225,9 +227,11 @@ int netlbl_cfg_unlbl_static_add(struct net *net,
225 case AF_INET: 227 case AF_INET:
226 addr_len = sizeof(struct in_addr); 228 addr_len = sizeof(struct in_addr);
227 break; 229 break;
230#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
228 case AF_INET6: 231 case AF_INET6:
229 addr_len = sizeof(struct in6_addr); 232 addr_len = sizeof(struct in6_addr);
230 break; 233 break;
234#endif /* IPv6 */
231 default: 235 default:
232 return -EPFNOSUPPORT; 236 return -EPFNOSUPPORT;
233 } 237 }
@@ -266,9 +270,11 @@ int netlbl_cfg_unlbl_static_del(struct net *net,
266 case AF_INET: 270 case AF_INET:
267 addr_len = sizeof(struct in_addr); 271 addr_len = sizeof(struct in_addr);
268 break; 272 break;
273#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
269 case AF_INET6: 274 case AF_INET6:
270 addr_len = sizeof(struct in6_addr); 275 addr_len = sizeof(struct in6_addr);
271 break; 276 break;
277#endif /* IPv6 */
272 default: 278 default:
273 return -EPFNOSUPPORT; 279 return -EPFNOSUPPORT;
274 } 280 }
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index cd5ddb2ebc43..915a87ba23e1 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -37,6 +37,7 @@
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <net/netrom.h> 38#include <net/netrom.h>
39#include <linux/seq_file.h> 39#include <linux/seq_file.h>
40#include <linux/export.h>
40 41
41static unsigned int nr_neigh_no = 1; 42static unsigned int nr_neigh_no = 1;
42 43
diff --git a/net/nfc/af_nfc.c b/net/nfc/af_nfc.c
index e982cef8f49d..da67756425ce 100644
--- a/net/nfc/af_nfc.c
+++ b/net/nfc/af_nfc.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/nfc.h> 24#include <linux/nfc.h>
25#include <linux/module.h>
25 26
26#include "nfc.h" 27#include "nfc.h"
27 28
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 4047e29acb3b..3925c6578767 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -28,6 +28,7 @@
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/workqueue.h> 29#include <linux/workqueue.h>
30#include <linux/completion.h> 30#include <linux/completion.h>
31#include <linux/export.h>
31#include <linux/sched.h> 32#include <linux/sched.h>
32#include <linux/bitops.h> 33#include <linux/bitops.h>
33#include <linux/skbuff.h> 34#include <linux/skbuff.h>
diff --git a/net/nfc/nfc.h b/net/nfc/nfc.h
index b6753f45624e..d86583f4831d 100644
--- a/net/nfc/nfc.h
+++ b/net/nfc/nfc.h
@@ -27,7 +27,7 @@
27#include <net/nfc/nfc.h> 27#include <net/nfc/nfc.h>
28#include <net/sock.h> 28#include <net/sock.h>
29 29
30__attribute__((format (printf, 2, 3))) 30__printf(2, 3)
31int nfc_printk(const char *level, const char *fmt, ...); 31int nfc_printk(const char *level, const char *fmt, ...);
32 32
33#define nfc_info(fmt, arg...) nfc_printk(KERN_INFO, fmt, ##arg) 33#define nfc_info(fmt, arg...) nfc_printk(KERN_INFO, fmt, ##arg)
diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c
index 9fd652a51424..ee7b2b365ef2 100644
--- a/net/nfc/rawsock.c
+++ b/net/nfc/rawsock.c
@@ -23,6 +23,7 @@
23 23
24#include <net/tcp_states.h> 24#include <net/tcp_states.h>
25#include <linux/nfc.h> 25#include <linux/nfc.h>
26#include <linux/export.h>
26 27
27#include "nfc.h" 28#include "nfc.h"
28 29
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 03bb45adf2fc..82a6f34d39d0 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -335,7 +335,7 @@ struct packet_skb_cb {
335 (((x)->kactive_blk_num < ((x)->knum_blocks-1)) ? \ 335 (((x)->kactive_blk_num < ((x)->knum_blocks-1)) ? \
336 ((x)->kactive_blk_num+1) : 0) 336 ((x)->kactive_blk_num+1) : 0)
337 337
338static inline struct packet_sock *pkt_sk(struct sock *sk) 338static struct packet_sock *pkt_sk(struct sock *sk)
339{ 339{
340 return (struct packet_sock *)sk; 340 return (struct packet_sock *)sk;
341} 341}
@@ -477,7 +477,7 @@ static void *packet_lookup_frame(struct packet_sock *po,
477 return h.raw; 477 return h.raw;
478} 478}
479 479
480static inline void *packet_current_frame(struct packet_sock *po, 480static void *packet_current_frame(struct packet_sock *po,
481 struct packet_ring_buffer *rb, 481 struct packet_ring_buffer *rb,
482 int status) 482 int status)
483{ 483{
@@ -715,7 +715,7 @@ out:
715 spin_unlock(&po->sk.sk_receive_queue.lock); 715 spin_unlock(&po->sk.sk_receive_queue.lock);
716} 716}
717 717
718static inline void prb_flush_block(struct tpacket_kbdq_core *pkc1, 718static void prb_flush_block(struct tpacket_kbdq_core *pkc1,
719 struct tpacket_block_desc *pbd1, __u32 status) 719 struct tpacket_block_desc *pbd1, __u32 status)
720{ 720{
721 /* Flush everything minus the block header */ 721 /* Flush everything minus the block header */
@@ -793,7 +793,7 @@ static void prb_close_block(struct tpacket_kbdq_core *pkc1,
793 pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1); 793 pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1);
794} 794}
795 795
796static inline void prb_thaw_queue(struct tpacket_kbdq_core *pkc) 796static void prb_thaw_queue(struct tpacket_kbdq_core *pkc)
797{ 797{
798 pkc->reset_pending_on_curr_blk = 0; 798 pkc->reset_pending_on_curr_blk = 0;
799} 799}
@@ -869,7 +869,7 @@ static void prb_open_block(struct tpacket_kbdq_core *pkc1,
869 * case and __packet_lookup_frame_in_block will check if block-0 869 * case and __packet_lookup_frame_in_block will check if block-0
870 * is free and can now be re-used. 870 * is free and can now be re-used.
871 */ 871 */
872static inline void prb_freeze_queue(struct tpacket_kbdq_core *pkc, 872static void prb_freeze_queue(struct tpacket_kbdq_core *pkc,
873 struct packet_sock *po) 873 struct packet_sock *po)
874{ 874{
875 pkc->reset_pending_on_curr_blk = 1; 875 pkc->reset_pending_on_curr_blk = 1;
@@ -940,36 +940,36 @@ static void prb_retire_current_block(struct tpacket_kbdq_core *pkc,
940 BUG(); 940 BUG();
941} 941}
942 942
943static inline int prb_curr_blk_in_use(struct tpacket_kbdq_core *pkc, 943static int prb_curr_blk_in_use(struct tpacket_kbdq_core *pkc,
944 struct tpacket_block_desc *pbd) 944 struct tpacket_block_desc *pbd)
945{ 945{
946 return TP_STATUS_USER & BLOCK_STATUS(pbd); 946 return TP_STATUS_USER & BLOCK_STATUS(pbd);
947} 947}
948 948
949static inline int prb_queue_frozen(struct tpacket_kbdq_core *pkc) 949static int prb_queue_frozen(struct tpacket_kbdq_core *pkc)
950{ 950{
951 return pkc->reset_pending_on_curr_blk; 951 return pkc->reset_pending_on_curr_blk;
952} 952}
953 953
954static inline void prb_clear_blk_fill_status(struct packet_ring_buffer *rb) 954static void prb_clear_blk_fill_status(struct packet_ring_buffer *rb)
955{ 955{
956 struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(rb); 956 struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(rb);
957 atomic_dec(&pkc->blk_fill_in_prog); 957 atomic_dec(&pkc->blk_fill_in_prog);
958} 958}
959 959
960static inline void prb_fill_rxhash(struct tpacket_kbdq_core *pkc, 960static void prb_fill_rxhash(struct tpacket_kbdq_core *pkc,
961 struct tpacket3_hdr *ppd) 961 struct tpacket3_hdr *ppd)
962{ 962{
963 ppd->hv1.tp_rxhash = skb_get_rxhash(pkc->skb); 963 ppd->hv1.tp_rxhash = skb_get_rxhash(pkc->skb);
964} 964}
965 965
966static inline void prb_clear_rxhash(struct tpacket_kbdq_core *pkc, 966static void prb_clear_rxhash(struct tpacket_kbdq_core *pkc,
967 struct tpacket3_hdr *ppd) 967 struct tpacket3_hdr *ppd)
968{ 968{
969 ppd->hv1.tp_rxhash = 0; 969 ppd->hv1.tp_rxhash = 0;
970} 970}
971 971
972static inline void prb_fill_vlan_info(struct tpacket_kbdq_core *pkc, 972static void prb_fill_vlan_info(struct tpacket_kbdq_core *pkc,
973 struct tpacket3_hdr *ppd) 973 struct tpacket3_hdr *ppd)
974{ 974{
975 if (vlan_tx_tag_present(pkc->skb)) { 975 if (vlan_tx_tag_present(pkc->skb)) {
@@ -991,7 +991,7 @@ static void prb_run_all_ft_ops(struct tpacket_kbdq_core *pkc,
991 prb_clear_rxhash(pkc, ppd); 991 prb_clear_rxhash(pkc, ppd);
992} 992}
993 993
994static inline void prb_fill_curr_block(char *curr, 994static void prb_fill_curr_block(char *curr,
995 struct tpacket_kbdq_core *pkc, 995 struct tpacket_kbdq_core *pkc,
996 struct tpacket_block_desc *pbd, 996 struct tpacket_block_desc *pbd,
997 unsigned int len) 997 unsigned int len)
@@ -1071,7 +1071,7 @@ static void *__packet_lookup_frame_in_block(struct packet_sock *po,
1071 return NULL; 1071 return NULL;
1072} 1072}
1073 1073
1074static inline void *packet_current_rx_frame(struct packet_sock *po, 1074static void *packet_current_rx_frame(struct packet_sock *po,
1075 struct sk_buff *skb, 1075 struct sk_buff *skb,
1076 int status, unsigned int len) 1076 int status, unsigned int len)
1077{ 1077{
@@ -1091,7 +1091,7 @@ static inline void *packet_current_rx_frame(struct packet_sock *po,
1091 } 1091 }
1092} 1092}
1093 1093
1094static inline void *prb_lookup_block(struct packet_sock *po, 1094static void *prb_lookup_block(struct packet_sock *po,
1095 struct packet_ring_buffer *rb, 1095 struct packet_ring_buffer *rb,
1096 unsigned int previous, 1096 unsigned int previous,
1097 int status) 1097 int status)
@@ -1104,7 +1104,7 @@ static inline void *prb_lookup_block(struct packet_sock *po,
1104 return pbd; 1104 return pbd;
1105} 1105}
1106 1106
1107static inline int prb_previous_blk_num(struct packet_ring_buffer *rb) 1107static int prb_previous_blk_num(struct packet_ring_buffer *rb)
1108{ 1108{
1109 unsigned int prev; 1109 unsigned int prev;
1110 if (rb->prb_bdqc.kactive_blk_num) 1110 if (rb->prb_bdqc.kactive_blk_num)
@@ -1115,7 +1115,7 @@ static inline int prb_previous_blk_num(struct packet_ring_buffer *rb)
1115} 1115}
1116 1116
1117/* Assumes caller has held the rx_queue.lock */ 1117/* Assumes caller has held the rx_queue.lock */
1118static inline void *__prb_previous_block(struct packet_sock *po, 1118static void *__prb_previous_block(struct packet_sock *po,
1119 struct packet_ring_buffer *rb, 1119 struct packet_ring_buffer *rb,
1120 int status) 1120 int status)
1121{ 1121{
@@ -1123,7 +1123,7 @@ static inline void *__prb_previous_block(struct packet_sock *po,
1123 return prb_lookup_block(po, rb, previous, status); 1123 return prb_lookup_block(po, rb, previous, status);
1124} 1124}
1125 1125
1126static inline void *packet_previous_rx_frame(struct packet_sock *po, 1126static void *packet_previous_rx_frame(struct packet_sock *po,
1127 struct packet_ring_buffer *rb, 1127 struct packet_ring_buffer *rb,
1128 int status) 1128 int status)
1129{ 1129{
@@ -1133,7 +1133,7 @@ static inline void *packet_previous_rx_frame(struct packet_sock *po,
1133 return __prb_previous_block(po, rb, status); 1133 return __prb_previous_block(po, rb, status);
1134} 1134}
1135 1135
1136static inline void packet_increment_rx_head(struct packet_sock *po, 1136static void packet_increment_rx_head(struct packet_sock *po,
1137 struct packet_ring_buffer *rb) 1137 struct packet_ring_buffer *rb)
1138{ 1138{
1139 switch (po->tp_version) { 1139 switch (po->tp_version) {
@@ -1148,7 +1148,7 @@ static inline void packet_increment_rx_head(struct packet_sock *po,
1148 } 1148 }
1149} 1149}
1150 1150
1151static inline void *packet_previous_frame(struct packet_sock *po, 1151static void *packet_previous_frame(struct packet_sock *po,
1152 struct packet_ring_buffer *rb, 1152 struct packet_ring_buffer *rb,
1153 int status) 1153 int status)
1154{ 1154{
@@ -1156,7 +1156,7 @@ static inline void *packet_previous_frame(struct packet_sock *po,
1156 return packet_lookup_frame(po, rb, previous, status); 1156 return packet_lookup_frame(po, rb, previous, status);
1157} 1157}
1158 1158
1159static inline void packet_increment_head(struct packet_ring_buffer *buff) 1159static void packet_increment_head(struct packet_ring_buffer *buff)
1160{ 1160{
1161 buff->head = buff->head != buff->frame_max ? buff->head+1 : 0; 1161 buff->head = buff->head != buff->frame_max ? buff->head+1 : 0;
1162} 1162}
@@ -1558,7 +1558,7 @@ out_free:
1558 return err; 1558 return err;
1559} 1559}
1560 1560
1561static inline unsigned int run_filter(const struct sk_buff *skb, 1561static unsigned int run_filter(const struct sk_buff *skb,
1562 const struct sock *sk, 1562 const struct sock *sk,
1563 unsigned int res) 1563 unsigned int res)
1564{ 1564{
@@ -2167,10 +2167,10 @@ out:
2167 return err; 2167 return err;
2168} 2168}
2169 2169
2170static inline struct sk_buff *packet_alloc_skb(struct sock *sk, size_t prepad, 2170static struct sk_buff *packet_alloc_skb(struct sock *sk, size_t prepad,
2171 size_t reserve, size_t len, 2171 size_t reserve, size_t len,
2172 size_t linear, int noblock, 2172 size_t linear, int noblock,
2173 int *err) 2173 int *err)
2174{ 2174{
2175 struct sk_buff *skb; 2175 struct sk_buff *skb;
2176 2176
@@ -3494,7 +3494,7 @@ static void free_pg_vec(struct pgv *pg_vec, unsigned int order,
3494 kfree(pg_vec); 3494 kfree(pg_vec);
3495} 3495}
3496 3496
3497static inline char *alloc_one_pg_vec_page(unsigned long order) 3497static char *alloc_one_pg_vec_page(unsigned long order)
3498{ 3498{
3499 char *buffer = NULL; 3499 char *buffer = NULL;
3500 gfp_t gfp_flags = GFP_KERNEL | __GFP_COMP | 3500 gfp_t gfp_flags = GFP_KERNEL | __GFP_COMP |
diff --git a/net/phonet/datagram.c b/net/phonet/datagram.c
index 2f032381bd45..bf35b4e1a14c 100644
--- a/net/phonet/datagram.c
+++ b/net/phonet/datagram.c
@@ -30,6 +30,7 @@
30#include <net/sock.h> 30#include <net/sock.h>
31 31
32#include <linux/phonet.h> 32#include <linux/phonet.h>
33#include <linux/export.h>
33#include <net/phonet/phonet.h> 34#include <net/phonet/phonet.h>
34 35
35static int pn_backlog_rcv(struct sock *sk, struct sk_buff *skb); 36static int pn_backlog_rcv(struct sock *sk, struct sk_buff *skb);
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index f17fd841f948..2ba6e9fb4cbc 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -30,6 +30,7 @@
30#include <asm/ioctls.h> 30#include <asm/ioctls.h>
31 31
32#include <linux/phonet.h> 32#include <linux/phonet.h>
33#include <linux/module.h>
33#include <net/phonet/phonet.h> 34#include <net/phonet/phonet.h>
34#include <net/phonet/pep.h> 35#include <net/phonet/pep.h>
35#include <net/phonet/gprs.h> 36#include <net/phonet/gprs.h>
diff --git a/net/phonet/socket.c b/net/phonet/socket.c
index 676d18dc75b7..3f8d0b1603b9 100644
--- a/net/phonet/socket.c
+++ b/net/phonet/socket.c
@@ -31,6 +31,7 @@
31#include <net/tcp_states.h> 31#include <net/tcp_states.h>
32 32
33#include <linux/phonet.h> 33#include <linux/phonet.h>
34#include <linux/export.h>
34#include <net/phonet/phonet.h> 35#include <net/phonet/phonet.h>
35#include <net/phonet/pep.h> 36#include <net/phonet/pep.h>
36#include <net/phonet/pn_dev.h> 37#include <net/phonet/pn_dev.h>
diff --git a/net/rds/Kconfig b/net/rds/Kconfig
index 4cf6dc7910e4..ec753b3ae72a 100644
--- a/net/rds/Kconfig
+++ b/net/rds/Kconfig
@@ -9,7 +9,6 @@ config RDS
9 9
10config RDS_RDMA 10config RDS_RDMA
11 tristate "RDS over Infiniband and iWARP" 11 tristate "RDS over Infiniband and iWARP"
12 select LLIST
13 depends on RDS && INFINIBAND && INFINIBAND_ADDR_TRANS 12 depends on RDS && INFINIBAND && INFINIBAND_ADDR_TRANS
14 ---help--- 13 ---help---
15 Allow RDS to use Infiniband and iWARP as a transport. 14 Allow RDS to use Infiniband and iWARP as a transport.
diff --git a/net/rds/cong.c b/net/rds/cong.c
index 6daaa49d133f..e5b65acd650b 100644
--- a/net/rds/cong.c
+++ b/net/rds/cong.c
@@ -34,6 +34,7 @@
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/rbtree.h> 35#include <linux/rbtree.h>
36#include <linux/bitops.h> 36#include <linux/bitops.h>
37#include <linux/export.h>
37 38
38#include "rds.h" 39#include "rds.h"
39 40
diff --git a/net/rds/connection.c b/net/rds/connection.c
index 9334d892366e..9e07c756d1f9 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -33,6 +33,7 @@
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/list.h> 34#include <linux/list.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/export.h>
36#include <net/inet_hashtables.h> 37#include <net/inet_hashtables.h>
37 38
38#include "rds.h" 39#include "rds.h"
diff --git a/net/rds/ib.c b/net/rds/ib.c
index 3b83086bcc30..b4c8b0022fee 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -38,6 +38,7 @@
38#include <linux/if_arp.h> 38#include <linux/if_arp.h>
39#include <linux/delay.h> 39#include <linux/delay.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/module.h>
41 42
42#include "rds.h" 43#include "rds.h"
43#include "ib.h" 44#include "ib.h"
diff --git a/net/rds/info.c b/net/rds/info.c
index 4fdf1b6e84ff..f1c016c4146e 100644
--- a/net/rds/info.c
+++ b/net/rds/info.c
@@ -34,6 +34,7 @@
34#include <linux/seq_file.h> 34#include <linux/seq_file.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/proc_fs.h> 36#include <linux/proc_fs.h>
37#include <linux/export.h>
37 38
38#include "rds.h" 39#include "rds.h"
39 40
diff --git a/net/rds/iw.c b/net/rds/iw.c
index f7474844f096..7826d46baa70 100644
--- a/net/rds/iw.c
+++ b/net/rds/iw.c
@@ -38,6 +38,7 @@
38#include <linux/if_arp.h> 38#include <linux/if_arp.h>
39#include <linux/delay.h> 39#include <linux/delay.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/module.h>
41 42
42#include "rds.h" 43#include "rds.h"
43#include "iw.h" 44#include "iw.h"
diff --git a/net/rds/message.c b/net/rds/message.c
index 1fd3d29023d7..f0a4658f3273 100644
--- a/net/rds/message.c
+++ b/net/rds/message.c
@@ -32,6 +32,7 @@
32 */ 32 */
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/export.h>
35 36
36#include "rds.h" 37#include "rds.h"
37 38
diff --git a/net/rds/page.c b/net/rds/page.c
index b82d63e77b03..2499cd108421 100644
--- a/net/rds/page.c
+++ b/net/rds/page.c
@@ -33,6 +33,7 @@
33#include <linux/highmem.h> 33#include <linux/highmem.h>
34#include <linux/gfp.h> 34#include <linux/gfp.h>
35#include <linux/cpu.h> 35#include <linux/cpu.h>
36#include <linux/export.h>
36 37
37#include "rds.h" 38#include "rds.h"
38 39
diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c
index f8760e1b6688..c2be901d19ee 100644
--- a/net/rds/rdma_transport.c
+++ b/net/rds/rdma_transport.c
@@ -30,6 +30,7 @@
30 * SOFTWARE. 30 * SOFTWARE.
31 * 31 *
32 */ 32 */
33#include <linux/module.h>
33#include <rdma/rdma_cm.h> 34#include <rdma/rdma_cm.h>
34 35
35#include "rdma_transport.h" 36#include "rdma_transport.h"
diff --git a/net/rds/rds.h b/net/rds/rds.h
index da8adac2bf06..7eaba1831f0d 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -36,8 +36,8 @@
36#define rdsdebug(fmt, args...) pr_debug("%s(): " fmt, __func__ , ##args) 36#define rdsdebug(fmt, args...) pr_debug("%s(): " fmt, __func__ , ##args)
37#else 37#else
38/* sigh, pr_debug() causes unused variable warnings */ 38/* sigh, pr_debug() causes unused variable warnings */
39static inline void __attribute__ ((format (printf, 1, 2))) 39static inline __printf(1, 2)
40rdsdebug(char *fmt, ...) 40void rdsdebug(char *fmt, ...)
41{ 41{
42} 42}
43#endif 43#endif
@@ -625,8 +625,8 @@ void rds_for_each_conn_info(struct socket *sock, unsigned int len,
625 struct rds_info_lengths *lens, 625 struct rds_info_lengths *lens,
626 int (*visitor)(struct rds_connection *, void *), 626 int (*visitor)(struct rds_connection *, void *),
627 size_t item_len); 627 size_t item_len);
628void __rds_conn_error(struct rds_connection *conn, const char *, ...) 628__printf(2, 3)
629 __attribute__ ((format (printf, 2, 3))); 629void __rds_conn_error(struct rds_connection *conn, const char *, ...);
630#define rds_conn_error(conn, fmt...) \ 630#define rds_conn_error(conn, fmt...) \
631 __rds_conn_error(conn, KERN_WARNING "RDS: " fmt) 631 __rds_conn_error(conn, KERN_WARNING "RDS: " fmt)
632 632
diff --git a/net/rds/recv.c b/net/rds/recv.c
index 596689e59272..bc3f8cd6d070 100644
--- a/net/rds/recv.c
+++ b/net/rds/recv.c
@@ -34,6 +34,7 @@
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <net/sock.h> 35#include <net/sock.h>
36#include <linux/in.h> 36#include <linux/in.h>
37#include <linux/export.h>
37 38
38#include "rds.h" 39#include "rds.h"
39 40
diff --git a/net/rds/send.c b/net/rds/send.c
index aa57e22539ef..e2d63c59e7c2 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -31,11 +31,13 @@
31 * 31 *
32 */ 32 */
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/moduleparam.h>
34#include <linux/gfp.h> 35#include <linux/gfp.h>
35#include <net/sock.h> 36#include <net/sock.h>
36#include <linux/in.h> 37#include <linux/in.h>
37#include <linux/list.h> 38#include <linux/list.h>
38#include <linux/ratelimit.h> 39#include <linux/ratelimit.h>
40#include <linux/export.h>
39 41
40#include "rds.h" 42#include "rds.h"
41 43
diff --git a/net/rds/stats.c b/net/rds/stats.c
index 10c759ccac0c..7be790d60b90 100644
--- a/net/rds/stats.c
+++ b/net/rds/stats.c
@@ -33,6 +33,7 @@
33#include <linux/percpu.h> 33#include <linux/percpu.h>
34#include <linux/seq_file.h> 34#include <linux/seq_file.h>
35#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
36#include <linux/export.h>
36 37
37#include "rds.h" 38#include "rds.h"
38 39
diff --git a/net/rds/tcp.c b/net/rds/tcp.c
index 8e0a32001c90..edac9ef2bc8b 100644
--- a/net/rds/tcp.c
+++ b/net/rds/tcp.c
@@ -33,6 +33,7 @@
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/in.h> 35#include <linux/in.h>
36#include <linux/module.h>
36#include <net/tcp.h> 37#include <net/tcp.h>
37 38
38#include "rds.h" 39#include "rds.h"
diff --git a/net/rds/threads.c b/net/rds/threads.c
index 0fd90f8c5f59..65eaefcab241 100644
--- a/net/rds/threads.c
+++ b/net/rds/threads.c
@@ -32,6 +32,7 @@
32 */ 32 */
33#include <linux/kernel.h> 33#include <linux/kernel.h>
34#include <linux/random.h> 34#include <linux/random.h>
35#include <linux/export.h>
35 36
36#include "rds.h" 37#include "rds.h"
37 38
diff --git a/net/rfkill/input.c b/net/rfkill/input.c
index 1bca6d49ec96..24c55c53e6a2 100644
--- a/net/rfkill/input.c
+++ b/net/rfkill/input.c
@@ -15,6 +15,7 @@
15 15
16#include <linux/input.h> 16#include <linux/input.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/moduleparam.h>
18#include <linux/workqueue.h> 19#include <linux/workqueue.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/rfkill.h> 21#include <linux/rfkill.h>
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index d389de197089..cd9b7ee60f3e 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -36,6 +36,7 @@
36#include <linux/init.h> 36#include <linux/init.h>
37#include <net/rose.h> 37#include <net/rose.h>
38#include <linux/seq_file.h> 38#include <linux/seq_file.h>
39#include <linux/export.h>
39 40
40static unsigned int rose_neigh_no = 1; 41static unsigned int rose_neigh_no = 1;
41 42
diff --git a/net/rxrpc/ar-output.c b/net/rxrpc/ar-output.c
index 5f22e263eda7..338d793c7113 100644
--- a/net/rxrpc/ar-output.c
+++ b/net/rxrpc/ar-output.c
@@ -13,6 +13,7 @@
13#include <linux/gfp.h> 13#include <linux/gfp.h>
14#include <linux/skbuff.h> 14#include <linux/skbuff.h>
15#include <linux/circ_buf.h> 15#include <linux/circ_buf.h>
16#include <linux/export.h>
16#include <net/sock.h> 17#include <net/sock.h>
17#include <net/af_rxrpc.h> 18#include <net/af_rxrpc.h>
18#include "ar-internal.h" 19#include "ar-internal.h"
diff --git a/net/rxrpc/ar-recvmsg.c b/net/rxrpc/ar-recvmsg.c
index 0c65013e3bfe..4b48687c3890 100644
--- a/net/rxrpc/ar-recvmsg.c
+++ b/net/rxrpc/ar-recvmsg.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/net.h> 12#include <linux/net.h>
13#include <linux/skbuff.h> 13#include <linux/skbuff.h>
14#include <linux/export.h>
14#include <net/sock.h> 15#include <net/sock.h>
15#include <net/af_rxrpc.h> 16#include <net/af_rxrpc.h>
16#include "ar-internal.h" 17#include "ar-internal.h"
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index f2fb67e701a3..93fdf131bd75 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/kmod.h> 21#include <linux/kmod.h>
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/module.h>
23#include <net/net_namespace.h> 24#include <net/net_namespace.h>
24#include <net/sock.h> 25#include <net/sock.h>
25#include <net/sch_generic.h> 26#include <net/sch_generic.h>
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
index 9e087d885675..7b582300d051 100644
--- a/net/sched/cls_flow.c
+++ b/net/sched/cls_flow.c
@@ -21,6 +21,7 @@
21#include <linux/ipv6.h> 21#include <linux/ipv6.h>
22#include <linux/if_vlan.h> 22#include <linux/if_vlan.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/module.h>
24 25
25#include <net/pkt_cls.h> 26#include <net/pkt_cls.h>
26#include <net/ip.h> 27#include <net/ip.h>
diff --git a/net/sched/sch_mq.c b/net/sched/sch_mq.c
index ec5cbc848963..0a4b2f9a0094 100644
--- a/net/sched/sch_mq.c
+++ b/net/sched/sch_mq.c
@@ -11,6 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/export.h>
14#include <linux/string.h> 15#include <linux/string.h>
15#include <linux/errno.h> 16#include <linux/errno.h>
16#include <linux/skbuff.h> 17#include <linux/skbuff.h>
diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c
index ea17cbed29ef..f88256cbacbf 100644
--- a/net/sched/sch_mqprio.c
+++ b/net/sched/sch_mqprio.c
@@ -14,6 +14,7 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/skbuff.h> 16#include <linux/skbuff.h>
17#include <linux/module.h>
17#include <net/netlink.h> 18#include <net/netlink.h>
18#include <net/pkt_sched.h> 19#include <net/pkt_sched.h>
19#include <net/sch_generic.h> 20#include <net/sch_generic.h>
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 865e68fef21c..bf812048cf6f 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -82,7 +82,7 @@ static struct sctp_auth_bytes *sctp_auth_create_key(__u32 key_len, gfp_t gfp)
82 struct sctp_auth_bytes *key; 82 struct sctp_auth_bytes *key;
83 83
84 /* Verify that we are not going to overflow INT_MAX */ 84 /* Verify that we are not going to overflow INT_MAX */
85 if ((INT_MAX - key_len) < sizeof(struct sctp_auth_bytes)) 85 if (key_len > (INT_MAX - sizeof(struct sctp_auth_bytes)))
86 return NULL; 86 return NULL;
87 87
88 /* Allocate the shared key */ 88 /* Allocate the shared key */
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index 05a6ce214714..1e2eee88c3ea 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -37,6 +37,7 @@
37#include <linux/types.h> 37#include <linux/types.h>
38#include <linux/seq_file.h> 38#include <linux/seq_file.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/export.h>
40#include <net/sctp/sctp.h> 41#include <net/sctp/sctp.h>
41#include <net/ip.h> /* for snmp_fold_field */ 42#include <net/ip.h> /* for snmp_fold_field */
42 43
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 836aa63ee121..13bf5fcdbff1 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -78,6 +78,7 @@
78#include <net/inet_common.h> 78#include <net/inet_common.h>
79 79
80#include <linux/socket.h> /* for sa_family_t */ 80#include <linux/socket.h> /* for sa_family_t */
81#include <linux/export.h>
81#include <net/sock.h> 82#include <net/sock.h>
82#include <net/sctp/sctp.h> 83#include <net/sctp/sctp.h>
83#include <net/sctp/sm.h> 84#include <net/sctp/sm.h>
diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c
index 4548757c9871..67a655ee82a9 100644
--- a/net/sunrpc/addr.c
+++ b/net/sunrpc/addr.c
@@ -19,6 +19,7 @@
19#include <net/ipv6.h> 19#include <net/ipv6.h>
20#include <linux/sunrpc/clnt.h> 20#include <linux/sunrpc/clnt.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/export.h>
22 23
23#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 24#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
24 25
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
index 4cb70dc6e7ad..e50502d8ceb7 100644
--- a/net/sunrpc/auth_unix.c
+++ b/net/sunrpc/auth_unix.c
@@ -129,6 +129,9 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
129 for (i = 0; i < groups ; i++) 129 for (i = 0; i < groups ; i++)
130 if (cred->uc_gids[i] != GROUP_AT(acred->group_info, i)) 130 if (cred->uc_gids[i] != GROUP_AT(acred->group_info, i))
131 return 0; 131 return 0;
132 if (groups < NFS_NGROUPS &&
133 cred->uc_gids[groups] != NOGROUP)
134 return 0;
132 return 1; 135 return 1;
133} 136}
134 137
diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c
index 91eaa26e4c42..3ad435a14ada 100644
--- a/net/sunrpc/backchannel_rqst.c
+++ b/net/sunrpc/backchannel_rqst.c
@@ -24,6 +24,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24#include <linux/tcp.h> 24#include <linux/tcp.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/sunrpc/xprt.h> 26#include <linux/sunrpc/xprt.h>
27#include <linux/export.h>
27 28
28#ifdef RPC_DEBUG 29#ifdef RPC_DEBUG
29#define RPCDBG_FACILITY RPCDBG_TRANS 30#define RPCDBG_FACILITY RPCDBG_TRANS
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
index f588b852d41c..8761bf8e36fc 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -114,6 +114,9 @@ static struct rpc_program rpcb_program;
114static struct rpc_clnt * rpcb_local_clnt; 114static struct rpc_clnt * rpcb_local_clnt;
115static struct rpc_clnt * rpcb_local_clnt4; 115static struct rpc_clnt * rpcb_local_clnt4;
116 116
117DEFINE_SPINLOCK(rpcb_clnt_lock);
118unsigned int rpcb_users;
119
117struct rpcbind_args { 120struct rpcbind_args {
118 struct rpc_xprt * r_xprt; 121 struct rpc_xprt * r_xprt;
119 122
@@ -161,6 +164,56 @@ static void rpcb_map_release(void *data)
161 kfree(map); 164 kfree(map);
162} 165}
163 166
167static int rpcb_get_local(void)
168{
169 int cnt;
170
171 spin_lock(&rpcb_clnt_lock);
172 if (rpcb_users)
173 rpcb_users++;
174 cnt = rpcb_users;
175 spin_unlock(&rpcb_clnt_lock);
176
177 return cnt;
178}
179
180void rpcb_put_local(void)
181{
182 struct rpc_clnt *clnt = rpcb_local_clnt;
183 struct rpc_clnt *clnt4 = rpcb_local_clnt4;
184 int shutdown;
185
186 spin_lock(&rpcb_clnt_lock);
187 if (--rpcb_users == 0) {
188 rpcb_local_clnt = NULL;
189 rpcb_local_clnt4 = NULL;
190 }
191 shutdown = !rpcb_users;
192 spin_unlock(&rpcb_clnt_lock);
193
194 if (shutdown) {
195 /*
196 * cleanup_rpcb_clnt - remove xprtsock's sysctls, unregister
197 */
198 if (clnt4)
199 rpc_shutdown_client(clnt4);
200 if (clnt)
201 rpc_shutdown_client(clnt);
202 }
203}
204
205static void rpcb_set_local(struct rpc_clnt *clnt, struct rpc_clnt *clnt4)
206{
207 /* Protected by rpcb_create_local_mutex */
208 rpcb_local_clnt = clnt;
209 rpcb_local_clnt4 = clnt4;
210 smp_wmb();
211 rpcb_users = 1;
212 dprintk("RPC: created new rpcb local clients (rpcb_local_clnt: "
213 "%p, rpcb_local_clnt4: %p)\n", rpcb_local_clnt,
214 rpcb_local_clnt4);
215}
216
164/* 217/*
165 * Returns zero on success, otherwise a negative errno value 218 * Returns zero on success, otherwise a negative errno value
166 * is returned. 219 * is returned.
@@ -205,9 +258,7 @@ static int rpcb_create_local_unix(void)
205 clnt4 = NULL; 258 clnt4 = NULL;
206 } 259 }
207 260
208 /* Protected by rpcb_create_local_mutex */ 261 rpcb_set_local(clnt, clnt4);
209 rpcb_local_clnt = clnt;
210 rpcb_local_clnt4 = clnt4;
211 262
212out: 263out:
213 return result; 264 return result;
@@ -259,9 +310,7 @@ static int rpcb_create_local_net(void)
259 clnt4 = NULL; 310 clnt4 = NULL;
260 } 311 }
261 312
262 /* Protected by rpcb_create_local_mutex */ 313 rpcb_set_local(clnt, clnt4);
263 rpcb_local_clnt = clnt;
264 rpcb_local_clnt4 = clnt4;
265 314
266out: 315out:
267 return result; 316 return result;
@@ -271,16 +320,16 @@ out:
271 * Returns zero on success, otherwise a negative errno value 320 * Returns zero on success, otherwise a negative errno value
272 * is returned. 321 * is returned.
273 */ 322 */
274static int rpcb_create_local(void) 323int rpcb_create_local(void)
275{ 324{
276 static DEFINE_MUTEX(rpcb_create_local_mutex); 325 static DEFINE_MUTEX(rpcb_create_local_mutex);
277 int result = 0; 326 int result = 0;
278 327
279 if (rpcb_local_clnt) 328 if (rpcb_get_local())
280 return result; 329 return result;
281 330
282 mutex_lock(&rpcb_create_local_mutex); 331 mutex_lock(&rpcb_create_local_mutex);
283 if (rpcb_local_clnt) 332 if (rpcb_get_local())
284 goto out; 333 goto out;
285 334
286 if (rpcb_create_local_unix() != 0) 335 if (rpcb_create_local_unix() != 0)
@@ -382,11 +431,6 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port)
382 struct rpc_message msg = { 431 struct rpc_message msg = {
383 .rpc_argp = &map, 432 .rpc_argp = &map,
384 }; 433 };
385 int error;
386
387 error = rpcb_create_local();
388 if (error)
389 return error;
390 434
391 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " 435 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local "
392 "rpcbind\n", (port ? "" : "un"), 436 "rpcbind\n", (port ? "" : "un"),
@@ -522,11 +566,7 @@ int rpcb_v4_register(const u32 program, const u32 version,
522 struct rpc_message msg = { 566 struct rpc_message msg = {
523 .rpc_argp = &map, 567 .rpc_argp = &map,
524 }; 568 };
525 int error;
526 569
527 error = rpcb_create_local();
528 if (error)
529 return error;
530 if (rpcb_local_clnt4 == NULL) 570 if (rpcb_local_clnt4 == NULL)
531 return -EPROTONOSUPPORT; 571 return -EPROTONOSUPPORT;
532 572
@@ -1060,15 +1100,3 @@ static struct rpc_program rpcb_program = {
1060 .version = rpcb_version, 1100 .version = rpcb_version,
1061 .stats = &rpcb_stats, 1101 .stats = &rpcb_stats,
1062}; 1102};
1063
1064/**
1065 * cleanup_rpcb_clnt - remove xprtsock's sysctls, unregister
1066 *
1067 */
1068void cleanup_rpcb_clnt(void)
1069{
1070 if (rpcb_local_clnt4)
1071 rpc_shutdown_client(rpcb_local_clnt4);
1072 if (rpcb_local_clnt)
1073 rpc_shutdown_client(rpcb_local_clnt);
1074}
diff --git a/net/sunrpc/socklib.c b/net/sunrpc/socklib.c
index 10b4319ebbca..145e6784f508 100644
--- a/net/sunrpc/socklib.c
+++ b/net/sunrpc/socklib.c
@@ -14,6 +14,7 @@
14#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15#include <linux/udp.h> 15#include <linux/udp.h>
16#include <linux/sunrpc/xdr.h> 16#include <linux/sunrpc/xdr.h>
17#include <linux/export.h>
17 18
18 19
19/** 20/**
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index 9d0809160994..8ec9778c3f4a 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -61,8 +61,6 @@ static struct pernet_operations sunrpc_net_ops = {
61 61
62extern struct cache_detail unix_gid_cache; 62extern struct cache_detail unix_gid_cache;
63 63
64extern void cleanup_rpcb_clnt(void);
65
66static int __init 64static int __init
67init_sunrpc(void) 65init_sunrpc(void)
68{ 66{
@@ -102,7 +100,6 @@ out:
102static void __exit 100static void __exit
103cleanup_sunrpc(void) 101cleanup_sunrpc(void)
104{ 102{
105 cleanup_rpcb_clnt();
106 rpcauth_remove_module(); 103 rpcauth_remove_module();
107 cleanup_socket_xprt(); 104 cleanup_socket_xprt();
108 svc_cleanup_xprt_sock(); 105 svc_cleanup_xprt_sock();
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 30d70abb4e2c..6e038884ae0c 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -366,6 +366,42 @@ svc_pool_for_cpu(struct svc_serv *serv, int cpu)
366 return &serv->sv_pools[pidx % serv->sv_nrpools]; 366 return &serv->sv_pools[pidx % serv->sv_nrpools];
367} 367}
368 368
369static int svc_rpcb_setup(struct svc_serv *serv)
370{
371 int err;
372
373 err = rpcb_create_local();
374 if (err)
375 return err;
376
377 /* Remove any stale portmap registrations */
378 svc_unregister(serv);
379 return 0;
380}
381
382void svc_rpcb_cleanup(struct svc_serv *serv)
383{
384 svc_unregister(serv);
385 rpcb_put_local();
386}
387EXPORT_SYMBOL_GPL(svc_rpcb_cleanup);
388
389static int svc_uses_rpcbind(struct svc_serv *serv)
390{
391 struct svc_program *progp;
392 unsigned int i;
393
394 for (progp = serv->sv_program; progp; progp = progp->pg_next) {
395 for (i = 0; i < progp->pg_nvers; i++) {
396 if (progp->pg_vers[i] == NULL)
397 continue;
398 if (progp->pg_vers[i]->vs_hidden == 0)
399 return 1;
400 }
401 }
402
403 return 0;
404}
369 405
370/* 406/*
371 * Create an RPC service 407 * Create an RPC service
@@ -431,8 +467,15 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools,
431 spin_lock_init(&pool->sp_lock); 467 spin_lock_init(&pool->sp_lock);
432 } 468 }
433 469
434 /* Remove any stale portmap registrations */ 470 if (svc_uses_rpcbind(serv)) {
435 svc_unregister(serv); 471 if (svc_rpcb_setup(serv) < 0) {
472 kfree(serv->sv_pools);
473 kfree(serv);
474 return NULL;
475 }
476 if (!serv->sv_shutdown)
477 serv->sv_shutdown = svc_rpcb_cleanup;
478 }
436 479
437 return serv; 480 return serv;
438} 481}
@@ -500,7 +543,6 @@ svc_destroy(struct svc_serv *serv)
500 if (svc_serv_is_pooled(serv)) 543 if (svc_serv_is_pooled(serv))
501 svc_pool_map_put(); 544 svc_pool_map_put();
502 545
503 svc_unregister(serv);
504 kfree(serv->sv_pools); 546 kfree(serv->sv_pools);
505 kfree(serv); 547 kfree(serv);
506} 548}
@@ -971,9 +1013,8 @@ static void svc_unregister(const struct svc_serv *serv)
971/* 1013/*
972 * Printk the given error with the address of the client that caused it. 1014 * Printk the given error with the address of the client that caused it.
973 */ 1015 */
974static int 1016static __printf(2, 3)
975__attribute__ ((format (printf, 2, 3))) 1017int svc_printk(struct svc_rqst *rqstp, const char *fmt, ...)
976svc_printk(struct svc_rqst *rqstp, const char *fmt, ...)
977{ 1018{
978 va_list args; 1019 va_list args;
979 int r; 1020 int r;
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index d86bb673e1f6..447cd0eb415c 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -14,6 +14,7 @@
14#include <linux/sunrpc/svc_xprt.h> 14#include <linux/sunrpc/svc_xprt.h>
15#include <linux/sunrpc/svcsock.h> 15#include <linux/sunrpc/svcsock.h>
16#include <linux/sunrpc/xprt.h> 16#include <linux/sunrpc/xprt.h>
17#include <linux/module.h>
17 18
18#define RPCDBG_FACILITY RPCDBG_SVCXPRT 19#define RPCDBG_FACILITY RPCDBG_SVCXPRT
19 20
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index dfd686eb0b7f..71bed1c1c77a 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -21,6 +21,7 @@
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sched.h> 23#include <linux/sched.h>
24#include <linux/module.h>
24#include <linux/errno.h> 25#include <linux/errno.h>
25#include <linux/fcntl.h> 26#include <linux/fcntl.h>
26#include <linux/net.h> 27#include <linux/net.h>
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
index a385430c722a..ba1296d88de0 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
@@ -50,6 +50,7 @@
50#include <rdma/ib_verbs.h> 50#include <rdma/ib_verbs.h>
51#include <rdma/rdma_cm.h> 51#include <rdma/rdma_cm.h>
52#include <linux/sunrpc/svc_rdma.h> 52#include <linux/sunrpc/svc_rdma.h>
53#include <linux/export.h>
53 54
54#define RPCDBG_FACILITY RPCDBG_SVCXPRT 55#define RPCDBG_FACILITY RPCDBG_SVCXPRT
55 56
diff --git a/net/sysctl_net.c b/net/sysctl_net.c
index ca84212cfbfe..e75813904f26 100644
--- a/net/sysctl_net.c
+++ b/net/sysctl_net.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/export.h>
15#include <linux/sysctl.h> 16#include <linux/sysctl.h>
16#include <linux/nsproxy.h> 17#include <linux/nsproxy.h>
17 18
diff --git a/net/tipc/core.c b/net/tipc/core.c
index 943b6af84265..c21331d58fdb 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -34,6 +34,8 @@
34 * POSSIBILITY OF SUCH DAMAGE. 34 * POSSIBILITY OF SUCH DAMAGE.
35 */ 35 */
36 36
37#include <linux/module.h>
38
37#include "core.h" 39#include "core.h"
38#include "ref.h" 40#include "ref.h"
39#include "name_table.h" 41#include "name_table.h"
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 9440a3d48ca0..42b8324ff2ee 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -34,6 +34,7 @@
34 * POSSIBILITY OF SUCH DAMAGE. 34 * POSSIBILITY OF SUCH DAMAGE.
35 */ 35 */
36 36
37#include <linux/export.h>
37#include <net/sock.h> 38#include <net/sock.h>
38 39
39#include "core.h" 40#include "core.h"
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 466fbcc5cf77..b595a3d8679f 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1957,6 +1957,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1957 if ((UNIXCB(skb).pid != siocb->scm->pid) || 1957 if ((UNIXCB(skb).pid != siocb->scm->pid) ||
1958 (UNIXCB(skb).cred != siocb->scm->cred)) { 1958 (UNIXCB(skb).cred != siocb->scm->cred)) {
1959 skb_queue_head(&sk->sk_receive_queue, skb); 1959 skb_queue_head(&sk->sk_receive_queue, skb);
1960 sk->sk_data_ready(sk, skb->len);
1960 break; 1961 break;
1961 } 1962 }
1962 } else { 1963 } else {
@@ -1974,6 +1975,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1974 chunk = min_t(unsigned int, skb->len, size); 1975 chunk = min_t(unsigned int, skb->len, size);
1975 if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) { 1976 if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) {
1976 skb_queue_head(&sk->sk_receive_queue, skb); 1977 skb_queue_head(&sk->sk_receive_queue, skb);
1978 sk->sk_data_ready(sk, skb->len);
1977 if (copied == 0) 1979 if (copied == 0)
1978 copied = -EFAULT; 1980 copied = -EFAULT;
1979 break; 1981 break;
@@ -1991,6 +1993,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1991 /* put the skb back if we didn't use it up.. */ 1993 /* put the skb back if we didn't use it up.. */
1992 if (skb->len) { 1994 if (skb->len) {
1993 skb_queue_head(&sk->sk_receive_queue, skb); 1995 skb_queue_head(&sk->sk_receive_queue, skb);
1996 sk->sk_data_ready(sk, skb->len);
1994 break; 1997 break;
1995 } 1998 }
1996 1999
@@ -2006,6 +2009,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
2006 2009
2007 /* put message back and return */ 2010 /* put message back and return */
2008 skb_queue_head(&sk->sk_receive_queue, skb); 2011 skb_queue_head(&sk->sk_receive_queue, skb);
2012 sk->sk_data_ready(sk, skb->len);
2009 break; 2013 break;
2010 } 2014 }
2011 } while (size); 2015 } while (size);
diff --git a/net/wanrouter/wanproc.c b/net/wanrouter/wanproc.c
index f346395314ba..c43612ee96bb 100644
--- a/net/wanrouter/wanproc.c
+++ b/net/wanrouter/wanproc.c
@@ -81,7 +81,6 @@ static struct proc_dir_entry *proc_router;
81 * Iterator 81 * Iterator
82 */ 82 */
83static void *r_start(struct seq_file *m, loff_t *pos) 83static void *r_start(struct seq_file *m, loff_t *pos)
84 __acquires(kernel_lock)
85{ 84{
86 struct wan_device *wandev; 85 struct wan_device *wandev;
87 loff_t l = *pos; 86 loff_t l = *pos;
@@ -103,7 +102,6 @@ static void *r_next(struct seq_file *m, void *v, loff_t *pos)
103} 102}
104 103
105static void r_stop(struct seq_file *m, void *v) 104static void r_stop(struct seq_file *m, void *v)
106 __releases(kernel_lock)
107{ 105{
108 mutex_unlock(&config_mutex); 106 mutex_unlock(&config_mutex);
109} 107}
diff --git a/net/wimax/op-msg.c b/net/wimax/op-msg.c
index d5b7c3779c43..0694d62e4dbc 100644
--- a/net/wimax/op-msg.c
+++ b/net/wimax/op-msg.c
@@ -77,6 +77,7 @@
77#include <linux/netdevice.h> 77#include <linux/netdevice.h>
78#include <linux/wimax.h> 78#include <linux/wimax.h>
79#include <linux/security.h> 79#include <linux/security.h>
80#include <linux/export.h>
80#include "wimax-internal.h" 81#include "wimax-internal.h"
81 82
82 83
diff --git a/net/wimax/op-reset.c b/net/wimax/op-reset.c
index 68bedf3e5443..7ceffe39d70e 100644
--- a/net/wimax/op-reset.c
+++ b/net/wimax/op-reset.c
@@ -32,6 +32,7 @@
32#include <net/genetlink.h> 32#include <net/genetlink.h>
33#include <linux/wimax.h> 33#include <linux/wimax.h>
34#include <linux/security.h> 34#include <linux/security.h>
35#include <linux/export.h>
35#include "wimax-internal.h" 36#include "wimax-internal.h"
36 37
37#define D_SUBMODULE op_reset 38#define D_SUBMODULE op_reset
diff --git a/net/wimax/op-rfkill.c b/net/wimax/op-rfkill.c
index 2609e445fe7d..7ab60babdd22 100644
--- a/net/wimax/op-rfkill.c
+++ b/net/wimax/op-rfkill.c
@@ -65,6 +65,7 @@
65#include <linux/wimax.h> 65#include <linux/wimax.h>
66#include <linux/security.h> 66#include <linux/security.h>
67#include <linux/rfkill.h> 67#include <linux/rfkill.h>
68#include <linux/export.h>
68#include "wimax-internal.h" 69#include "wimax-internal.h"
69 70
70#define D_SUBMODULE op_rfkill 71#define D_SUBMODULE op_rfkill
diff --git a/net/wimax/stack.c b/net/wimax/stack.c
index ee99e7dfcdba..3c65eae701c4 100644
--- a/net/wimax/stack.c
+++ b/net/wimax/stack.c
@@ -55,6 +55,7 @@
55#include <net/genetlink.h> 55#include <net/genetlink.h>
56#include <linux/netdevice.h> 56#include <linux/netdevice.h>
57#include <linux/wimax.h> 57#include <linux/wimax.h>
58#include <linux/module.h>
58#include "wimax-internal.h" 59#include "wimax-internal.h"
59 60
60 61
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index f33fbb79437c..30f20fe4a5fe 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -7,6 +7,7 @@
7#include <linux/etherdevice.h> 7#include <linux/etherdevice.h>
8#include <linux/if_arp.h> 8#include <linux/if_arp.h>
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/export.h>
10#include <net/cfg80211.h> 11#include <net/cfg80211.h>
11#include "wext-compat.h" 12#include "wext-compat.h"
12#include "nl80211.h" 13#include "nl80211.h"
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index 4423e64c7d98..b7b7868f4128 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -1,4 +1,5 @@
1#include <linux/ieee80211.h> 1#include <linux/ieee80211.h>
2#include <linux/export.h>
2#include <net/cfg80211.h> 3#include <net/cfg80211.h>
3#include "nl80211.h" 4#include "nl80211.h"
4#include "core.h" 5#include "core.h"
diff --git a/net/wireless/radiotap.c b/net/wireless/radiotap.c
index dbe35e138e94..c4ad7958af52 100644
--- a/net/wireless/radiotap.c
+++ b/net/wireless/radiotap.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/export.h>
18#include <net/cfg80211.h> 19#include <net/cfg80211.h>
19#include <net/ieee80211_radiotap.h> 20#include <net/ieee80211_radiotap.h>
20#include <asm/unaligned.h> 21#include <asm/unaligned.h>
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 186b7f2a27b6..77e926738014 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -36,12 +36,14 @@
36#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 36#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
37 37
38#include <linux/kernel.h> 38#include <linux/kernel.h>
39#include <linux/export.h>
39#include <linux/slab.h> 40#include <linux/slab.h>
40#include <linux/list.h> 41#include <linux/list.h>
41#include <linux/random.h> 42#include <linux/random.h>
42#include <linux/ctype.h> 43#include <linux/ctype.h>
43#include <linux/nl80211.h> 44#include <linux/nl80211.h>
44#include <linux/platform_device.h> 45#include <linux/platform_device.h>
46#include <linux/moduleparam.h>
45#include <net/cfg80211.h> 47#include <net/cfg80211.h>
46#include "core.h" 48#include "core.h"
47#include "reg.h" 49#include "reg.h"
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 6e86d5acf145..0acfdc9beacf 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -10,6 +10,7 @@
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/workqueue.h> 11#include <linux/workqueue.h>
12#include <linux/wireless.h> 12#include <linux/wireless.h>
13#include <linux/export.h>
13#include <net/iw_handler.h> 14#include <net/iw_handler.h>
14#include <net/cfg80211.h> 15#include <net/cfg80211.h>
15#include <net/rtnetlink.h> 16#include <net/rtnetlink.h>
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 2f178f73943f..4dde429441d2 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright 2007-2009 Johannes Berg <johannes@sipsolutions.net> 4 * Copyright 2007-2009 Johannes Berg <johannes@sipsolutions.net>
5 */ 5 */
6#include <linux/export.h>
6#include <linux/bitops.h> 7#include <linux/bitops.h>
7#include <linux/etherdevice.h> 8#include <linux/etherdevice.h>
8#include <linux/slab.h> 9#include <linux/slab.h>
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 62f121d1d9cb..6897436b1d3f 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -8,6 +8,7 @@
8 * Copyright 2008-2009 Johannes Berg <johannes@sipsolutions.net> 8 * Copyright 2008-2009 Johannes Berg <johannes@sipsolutions.net>
9 */ 9 */
10 10
11#include <linux/export.h>
11#include <linux/wireless.h> 12#include <linux/wireless.h>
12#include <linux/nl80211.h> 13#include <linux/nl80211.h>
13#include <linux/if_arp.h> 14#include <linux/if_arp.h>
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
index fdbc23c10d8c..0af7f54e4f61 100644
--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -13,6 +13,7 @@
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/wireless.h> 14#include <linux/wireless.h>
15#include <linux/uaccess.h> 15#include <linux/uaccess.h>
16#include <linux/export.h>
16#include <net/cfg80211.h> 17#include <net/cfg80211.h>
17#include <net/iw_handler.h> 18#include <net/iw_handler.h>
18#include <net/netlink.h> 19#include <net/netlink.h>
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index 0d4b8c3033ff..326750b99151 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -5,6 +5,7 @@
5 * Copyright (C) 2009 Intel Corporation. All rights reserved. 5 * Copyright (C) 2009 Intel Corporation. All rights reserved.
6 */ 6 */
7 7
8#include <linux/export.h>
8#include <linux/etherdevice.h> 9#include <linux/etherdevice.h>
9#include <linux/if_arp.h> 10#include <linux/if_arp.h>
10#include <linux/slab.h> 11#include <linux/slab.h>
diff --git a/net/wireless/wext-spy.c b/net/wireless/wext-spy.c
index 6dcfe65a2d1a..5d643a548feb 100644
--- a/net/wireless/wext-spy.c
+++ b/net/wireless/wext-spy.c
@@ -10,6 +10,7 @@
10#include <linux/wireless.h> 10#include <linux/wireless.h>
11#include <linux/netdevice.h> 11#include <linux/netdevice.h>
12#include <linux/etherdevice.h> 12#include <linux/etherdevice.h>
13#include <linux/export.h>
13#include <net/iw_handler.h> 14#include <net/iw_handler.h>
14#include <net/arp.h> 15#include <net/arp.h>
15#include <net/wext.h> 16#include <net/wext.h>
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 5f03e4ea65bf..3e16c6abde4f 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -1261,14 +1261,19 @@ static int x25_recvmsg(struct kiocb *iocb, struct socket *sock,
1261 struct x25_sock *x25 = x25_sk(sk); 1261 struct x25_sock *x25 = x25_sk(sk);
1262 struct sockaddr_x25 *sx25 = (struct sockaddr_x25 *)msg->msg_name; 1262 struct sockaddr_x25 *sx25 = (struct sockaddr_x25 *)msg->msg_name;
1263 size_t copied; 1263 size_t copied;
1264 int qbit, header_len = x25->neighbour->extended ? 1264 int qbit, header_len;
1265 X25_EXT_MIN_LEN : X25_STD_MIN_LEN;
1266
1267 struct sk_buff *skb; 1265 struct sk_buff *skb;
1268 unsigned char *asmptr; 1266 unsigned char *asmptr;
1269 int rc = -ENOTCONN; 1267 int rc = -ENOTCONN;
1270 1268
1271 lock_sock(sk); 1269 lock_sock(sk);
1270
1271 if (x25->neighbour == NULL)
1272 goto out;
1273
1274 header_len = x25->neighbour->extended ?
1275 X25_EXT_MIN_LEN : X25_STD_MIN_LEN;
1276
1272 /* 1277 /*
1273 * This works for seqpacket too. The receiver has ordered the queue for 1278 * This works for seqpacket too. The receiver has ordered the queue for
1274 * us! We do one quick check first though 1279 * us! We do one quick check first though
diff --git a/net/x25/x25_proc.c b/net/x25/x25_proc.c
index 7ff373792324..2ffde4631ae2 100644
--- a/net/x25/x25_proc.c
+++ b/net/x25/x25_proc.c
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
22#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/export.h>
23#include <net/net_namespace.h> 24#include <net/net_namespace.h>
24#include <net/sock.h> 25#include <net/sock.h>
25#include <net/x25.h> 26#include <net/x25.h>
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 552df27dcf53..2118d6446630 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2382,9 +2382,11 @@ static unsigned int xfrm_default_advmss(const struct dst_entry *dst)
2382 return dst_metric_advmss(dst->path); 2382 return dst_metric_advmss(dst->path);
2383} 2383}
2384 2384
2385static unsigned int xfrm_default_mtu(const struct dst_entry *dst) 2385static unsigned int xfrm_mtu(const struct dst_entry *dst)
2386{ 2386{
2387 return dst_mtu(dst->path); 2387 unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);
2388
2389 return mtu ? : dst_mtu(dst->path);
2388} 2390}
2389 2391
2390static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr) 2392static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst, const void *daddr)
@@ -2411,8 +2413,8 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
2411 dst_ops->check = xfrm_dst_check; 2413 dst_ops->check = xfrm_dst_check;
2412 if (likely(dst_ops->default_advmss == NULL)) 2414 if (likely(dst_ops->default_advmss == NULL))
2413 dst_ops->default_advmss = xfrm_default_advmss; 2415 dst_ops->default_advmss = xfrm_default_advmss;
2414 if (likely(dst_ops->default_mtu == NULL)) 2416 if (likely(dst_ops->mtu == NULL))
2415 dst_ops->default_mtu = xfrm_default_mtu; 2417 dst_ops->mtu = xfrm_mtu;
2416 if (likely(dst_ops->negative_advice == NULL)) 2418 if (likely(dst_ops->negative_advice == NULL))
2417 dst_ops->negative_advice = xfrm_negative_advice; 2419 dst_ops->negative_advice = xfrm_negative_advice;
2418 if (likely(dst_ops->link_failure == NULL)) 2420 if (likely(dst_ops->link_failure == NULL))
diff --git a/net/xfrm/xfrm_proc.c b/net/xfrm/xfrm_proc.c
index 58d9ae005597..d0a1af8ed584 100644
--- a/net/xfrm/xfrm_proc.c
+++ b/net/xfrm/xfrm_proc.c
@@ -12,6 +12,7 @@
12 */ 12 */
13#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
14#include <linux/seq_file.h> 14#include <linux/seq_file.h>
15#include <linux/export.h>
15#include <net/snmp.h> 16#include <net/snmp.h>
16#include <net/xfrm.h> 17#include <net/xfrm.h>
17 18
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
index 6ca357406ea8..39e02c54ed26 100644
--- a/net/xfrm/xfrm_replay.c
+++ b/net/xfrm/xfrm_replay.c
@@ -18,6 +18,7 @@
18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 */ 19 */
20 20
21#include <linux/export.h>
21#include <net/xfrm.h> 22#include <net/xfrm.h>
22 23
23u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq) 24u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq)