aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/rapidio.tmpl6
-rw-r--r--Documentation/filesystems/proc.txt5
-rw-r--r--Documentation/networking/xfrm_proc.txt8
-rw-r--r--MAINTAINERS6
-rw-r--r--arch/m68knommu/Kconfig4
-rw-r--r--arch/m68knommu/Makefile22
-rw-r--r--arch/m68knommu/kernel/time.c81
-rw-r--r--arch/m68knommu/platform/5206/config.c76
-rw-r--r--arch/m68knommu/platform/5206e/config.c80
-rw-r--r--arch/m68knommu/platform/520x/config.c101
-rw-r--r--arch/m68knommu/platform/523x/config.c75
-rw-r--r--arch/m68knommu/platform/5249/config.c77
-rw-r--r--arch/m68knommu/platform/5272/config.c85
-rw-r--r--arch/m68knommu/platform/527x/config.c87
-rw-r--r--arch/m68knommu/platform/528x/config.c86
-rw-r--r--arch/m68knommu/platform/5307/Makefile14
-rw-r--r--arch/m68knommu/platform/5307/config.c85
-rw-r--r--arch/m68knommu/platform/532x/config.c94
-rw-r--r--arch/m68knommu/platform/5407/config.c83
-rw-r--r--arch/m68knommu/platform/68328/timers.c56
-rw-r--r--arch/m68knommu/platform/68360/config.c5
-rw-r--r--arch/m68knommu/platform/coldfire/Makefile32
-rw-r--r--arch/m68knommu/platform/coldfire/dma.c39
-rw-r--r--arch/m68knommu/platform/coldfire/entry.S (renamed from arch/m68knommu/platform/5307/entry.S)0
-rw-r--r--arch/m68knommu/platform/coldfire/head.S (renamed from arch/m68knommu/platform/5307/head.S)0
-rw-r--r--arch/m68knommu/platform/coldfire/pit.c (renamed from arch/m68knommu/platform/5307/pit.c)86
-rw-r--r--arch/m68knommu/platform/coldfire/timers.c (renamed from arch/m68knommu/platform/5307/timers.c)68
-rw-r--r--arch/m68knommu/platform/coldfire/vectors.c (renamed from arch/m68knommu/platform/5307/vectors.c)0
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c2
-rw-r--r--arch/sparc/lib/rwsem.S2
-rw-r--r--arch/sparc64/lib/GENbzero.S2
-rw-r--r--arch/sparc64/lib/NGbzero.S2
-rw-r--r--arch/sparc64/lib/rwsem.S2
-rw-r--r--arch/x86/Makefile2
-rw-r--r--drivers/net/bnx2.c213
-rw-r--r--drivers/net/bnx2.h39
-rw-r--r--drivers/net/bnx2_fw.h1499
-rw-r--r--drivers/net/bnx2_fw2.h464
-rw-r--r--drivers/net/dl2k.h4
-rw-r--r--drivers/net/macvlan.c2
-rw-r--r--drivers/net/usb/asix.c3
-rw-r--r--drivers/net/usb/cdc_ether.c13
-rw-r--r--drivers/net/usb/cdc_subset.c3
-rw-r--r--drivers/net/usb/dm9601.c3
-rw-r--r--drivers/net/usb/gl620a.c3
-rw-r--r--drivers/net/usb/mcs7830.c3
-rw-r--r--drivers/net/usb/net1080.c3
-rw-r--r--drivers/net/usb/plusb.c3
-rw-r--r--drivers/net/usb/rndis_host.c303
-rw-r--r--drivers/net/usb/usbnet.c6
-rw-r--r--drivers/net/usb/zaurus.c3
-rw-r--r--drivers/net/wireless/Kconfig28
-rw-r--r--drivers/net/wireless/Makefile2
-rw-r--r--drivers/net/wireless/ath5k/base.c10
-rw-r--r--drivers/net/wireless/ath5k/debug.c124
-rw-r--r--drivers/net/wireless/ath5k/debug.h18
-rw-r--r--drivers/net/wireless/b43/dma.c30
-rw-r--r--drivers/net/wireless/b43/main.c19
-rw-r--r--drivers/net/wireless/b43/xmit.c23
-rw-r--r--drivers/net/wireless/b43/xmit.h10
-rw-r--r--drivers/net/wireless/b43legacy/b43legacy.h31
-rw-r--r--drivers/net/wireless/b43legacy/main.c133
-rw-r--r--drivers/net/wireless/b43legacy/phy.c14
-rw-r--r--drivers/net/wireless/b43legacy/pio.c6
-rw-r--r--drivers/net/wireless/b43legacy/radio.c16
-rw-r--r--drivers/net/wireless/hostap/hostap_80211.h5
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-hw.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-hw.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-helpers.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c86
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c84
-rw-r--r--drivers/net/wireless/libertas/assoc.c6
-rw-r--r--drivers/net/wireless/libertas/dev.h2
-rw-r--r--drivers/net/wireless/libertas/if_cs.c6
-rw-r--r--drivers/net/wireless/rndis_wlan.c2757
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c3
-rw-r--r--drivers/net/wireless/rtl8180_dev.c1
-rw-r--r--drivers/serial/68328serial.c2
-rw-r--r--drivers/serial/Kconfig24
-rw-r--r--drivers/serial/Makefile1
-rw-r--r--drivers/serial/mcf.c20
-rw-r--r--include/asm-alpha/socket.h2
-rw-r--r--include/asm-arm/socket.h2
-rw-r--r--include/asm-avr32/socket.h2
-rw-r--r--include/asm-blackfin/socket.h3
-rw-r--r--include/asm-cris/socket.h2
-rw-r--r--include/asm-frv/socket.h2
-rw-r--r--include/asm-h8300/socket.h2
-rw-r--r--include/asm-ia64/socket.h2
-rw-r--r--include/asm-m32r/socket.h2
-rw-r--r--include/asm-m68k/socket.h2
-rw-r--r--include/asm-m68knommu/cacheflush.h2
-rw-r--r--include/asm-m68knommu/mcfcache.h2
-rw-r--r--include/asm-m68knommu/mcfuart.h3
-rw-r--r--include/asm-mips/socket.h2
-rw-r--r--include/asm-parisc/socket.h2
-rw-r--r--include/asm-powerpc/socket.h2
-rw-r--r--include/asm-s390/socket.h2
-rw-r--r--include/asm-sh/socket.h2
-rw-r--r--include/asm-sparc/socket.h2
-rw-r--r--include/asm-sparc64/socket.h1
-rw-r--r--include/asm-v850/socket.h2
-rw-r--r--include/asm-x86/socket.h2
-rw-r--r--include/asm-xtensa/socket.h2
-rw-r--r--include/linux/inetdevice.h2
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/ipv6.h12
-rw-r--r--include/linux/netdevice.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_pptp.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h6
-rw-r--r--include/linux/netfilter/x_tables.h28
-rw-r--r--include/linux/netfilter/xt_conntrack.h30
-rw-r--r--include/linux/netfilter/xt_hashlimit.h37
-rw-r--r--include/linux/netfilter/xt_owner.h4
-rw-r--r--include/linux/netfilter_arp/arp_tables.h5
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h5
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h5
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/linux/pfkeyv2.h6
-rw-r--r--include/linux/pkt_cls.h50
-rw-r--r--include/linux/pkt_sched.h5
-rw-r--r--include/linux/rfkill.h2
-rw-r--r--include/linux/skbuff.h3
-rw-r--r--include/linux/snmp.h3
-rw-r--r--include/linux/sysctl.h4
-rw-r--r--include/linux/types.h2
-rw-r--r--include/linux/usb/rndis_host.h274
-rw-r--r--include/linux/usb/usbnet.h (renamed from drivers/net/usb/usbnet.h)12
-rw-r--r--include/linux/xfrm.h8
-rw-r--r--include/net/arp.h8
-rw-r--r--include/net/esp.h54
-rw-r--r--include/net/inet6_hashtables.h17
-rw-r--r--include/net/inet_hashtables.h55
-rw-r--r--include/net/ip_fib.h4
-rw-r--r--include/net/net_namespace.h4
-rw-r--r--include/net/netfilter/nf_conntrack.h15
-rw-r--r--include/net/netfilter/nf_conntrack_core.h6
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h2
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h4
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h4
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h25
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h17
-rw-r--r--include/net/netfilter/nf_log.h2
-rw-r--r--include/net/netns/ipv4.h6
-rw-r--r--include/net/netns/ipv6.h5
-rw-r--r--include/net/netns/x_tables.h10
-rw-r--r--include/net/pkt_cls.h6
-rw-r--r--include/net/raw.h5
-rw-r--r--include/net/route.h3
-rw-r--r--include/net/sock.h2
-rw-r--r--include/net/xfrm.h16
-rw-r--r--kernel/audit.c10
-rw-r--r--net/802/tr.c2
-rw-r--r--net/8021q/vlan_dev.c7
-rw-r--r--net/9p/conv.c5
-rw-r--r--net/ax25/af_ax25.c13
-rw-r--r--net/bluetooth/hci_sysfs.c52
-rw-r--r--net/bridge/br_netfilter.c4
-rw-r--r--net/bridge/netfilter/ebt_802_3.c10
-rw-r--r--net/bridge/netfilter/ebt_among.c27
-rw-r--r--net/bridge/netfilter/ebt_arp.c17
-rw-r--r--net/bridge/netfilter/ebt_arpreply.c17
-rw-r--r--net/bridge/netfilter/ebt_dnat.c8
-rw-r--r--net/bridge/netfilter/ebt_ip.c14
-rw-r--r--net/bridge/netfilter/ebt_limit.c6
-rw-r--r--net/bridge/netfilter/ebt_log.c19
-rw-r--r--net/bridge/netfilter/ebt_mark.c8
-rw-r--r--net/bridge/netfilter/ebt_mark_m.c8
-rw-r--r--net/bridge/netfilter/ebt_pkttype.c8
-rw-r--r--net/bridge/netfilter/ebt_redirect.c8
-rw-r--r--net/bridge/netfilter/ebt_snat.c11
-rw-r--r--net/bridge/netfilter/ebt_stp.c28
-rw-r--r--net/bridge/netfilter/ebt_ulog.c9
-rw-r--r--net/bridge/netfilter/ebt_vlan.c12
-rw-r--r--net/core/dev.c96
-rw-r--r--net/core/dev_mcast.c39
-rw-r--r--net/core/pktgen.c3
-rw-r--r--net/core/sock.c11
-rw-r--r--net/dccp/ipv4.c6
-rw-r--r--net/dccp/ipv6.c8
-rw-r--r--net/ipv4/Kconfig1
-rw-r--r--net/ipv4/ah4.c2
-rw-r--r--net/ipv4/arp.c9
-rw-r--r--net/ipv4/devinet.c37
-rw-r--r--net/ipv4/esp4.c554
-rw-r--r--net/ipv4/fib_frontend.c14
-rw-r--r--net/ipv4/fib_hash.c47
-rw-r--r--net/ipv4/fib_semantics.c116
-rw-r--r--net/ipv4/fib_trie.c104
-rw-r--r--net/ipv4/inet_connection_sock.c8
-rw-r--r--net/ipv4/inet_diag.c15
-rw-r--r--net/ipv4/inet_hashtables.c69
-rw-r--r--net/ipv4/ip_output.c7
-rw-r--r--net/ipv4/ipcomp.c7
-rw-r--r--net/ipv4/netfilter/arp_tables.c102
-rw-r--r--net/ipv4/netfilter/arptable_filter.c31
-rw-r--r--net/ipv4/netfilter/ip_queue.c18
-rw-r--r--net/ipv4/netfilter/ip_tables.c112
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c7
-rw-r--r--net/ipv4/netfilter/ipt_recent.c6
-rw-r--r--net/ipv4/netfilter/iptable_filter.c33
-rw-r--r--net/ipv4/netfilter/iptable_mangle.c33
-rw-r--r--net/ipv4/netfilter/iptable_raw.c33
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c14
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c40
-rw-r--r--net/ipv4/netfilter/nf_conntrack_proto_icmp.c22
-rw-r--r--net/ipv4/netfilter/nf_nat_core.c42
-rw-r--r--net/ipv4/netfilter/nf_nat_h323.c5
-rw-r--r--net/ipv4/netfilter/nf_nat_helper.c3
-rw-r--r--net/ipv4/netfilter/nf_nat_pptp.c10
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_gre.c16
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_icmp.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_tcp.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_proto_udp.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_rule.c16
-rw-r--r--net/ipv4/netfilter/nf_nat_sip.c4
-rw-r--r--net/ipv4/netfilter/nf_nat_snmp_basic.c2
-rw-r--r--net/ipv4/netfilter/nf_nat_tftp.c2
-rw-r--r--net/ipv4/raw.c42
-rw-r--r--net/ipv4/route.c211
-rw-r--r--net/ipv4/sysctl_net_ipv4.c2
-rw-r--r--net/ipv4/tcp_input.c2
-rw-r--r--net/ipv4/tcp_ipv4.c15
-rw-r--r--net/ipv4/tcp_output.c1
-rw-r--r--net/ipv4/udp.c25
-rw-r--r--net/ipv4/xfrm4_policy.c1
-rw-r--r--net/ipv4/xfrm4_tunnel.c4
-rw-r--r--net/ipv6/Kconfig1
-rw-r--r--net/ipv6/ah6.c2
-rw-r--r--net/ipv6/esp6.c515
-rw-r--r--net/ipv6/inet6_hashtables.c135
-rw-r--r--net/ipv6/ip6_output.c6
-rw-r--r--net/ipv6/ipcomp6.c7
-rw-r--r--net/ipv6/mip6.c4
-rw-r--r--net/ipv6/netfilter/ip6_queue.c18
-rw-r--r--net/ipv6/netfilter/ip6_tables.c113
-rw-r--r--net/ipv6/netfilter/ip6table_filter.c33
-rw-r--r--net/ipv6/netfilter/ip6table_mangle.c33
-rw-r--r--net/ipv6/netfilter/ip6table_raw.c31
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c7
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c22
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c16
-rw-r--r--net/ipv6/raw.c5
-rw-r--r--net/ipv6/route.c5
-rw-r--r--net/ipv6/tcp_ipv6.c19
-rw-r--r--net/ipv6/udp.c10
-rw-r--r--net/ipv6/xfrm6_policy.c1
-rw-r--r--net/ipv6/xfrm6_tunnel.c2
-rw-r--r--net/mac80211/rx.c48
-rw-r--r--net/netfilter/nf_conntrack_core.c234
-rw-r--r--net/netfilter/nf_conntrack_expect.c53
-rw-r--r--net/netfilter/nf_conntrack_h323_asn1.c156
-rw-r--r--net/netfilter/nf_conntrack_h323_main.c23
-rw-r--r--net/netfilter/nf_conntrack_h323_types.c346
-rw-r--r--net/netfilter/nf_conntrack_helper.c60
-rw-r--r--net/netfilter/nf_conntrack_irc.c2
-rw-r--r--net/netfilter/nf_conntrack_netlink.c68
-rw-r--r--net/netfilter/nf_conntrack_pptp.c14
-rw-r--r--net/netfilter/nf_conntrack_proto_generic.c6
-rw-r--r--net/netfilter/nf_conntrack_proto_gre.c6
-rw-r--r--net/netfilter/nf_conntrack_proto_sctp.c6
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c192
-rw-r--r--net/netfilter/nf_conntrack_proto_udp.c19
-rw-r--r--net/netfilter/nf_conntrack_proto_udplite.c19
-rw-r--r--net/netfilter/nf_conntrack_sane.c9
-rw-r--r--net/netfilter/nf_conntrack_sip.c29
-rw-r--r--net/netfilter/nf_conntrack_standalone.c66
-rw-r--r--net/netfilter/nf_conntrack_tftp.c5
-rw-r--r--net/netfilter/nf_log.c2
-rw-r--r--net/netfilter/nfnetlink_log.c4
-rw-r--r--net/netfilter/nfnetlink_queue.c6
-rw-r--r--net/netfilter/x_tables.c313
-rw-r--r--net/netfilter/xt_TCPMSS.c62
-rw-r--r--net/netfilter/xt_connlimit.c6
-rw-r--r--net/netfilter/xt_conntrack.c50
-rw-r--r--net/netfilter/xt_hashlimit.c326
-rw-r--r--net/netfilter/xt_iprange.c2
-rw-r--r--net/netfilter/xt_owner.c14
-rw-r--r--net/netlink/af_netlink.c52
-rw-r--r--net/rfkill/rfkill-input.c9
-rw-r--r--net/rfkill/rfkill.c3
-rw-r--r--net/rxrpc/ar-call.c2
-rw-r--r--net/rxrpc/ar-internal.h6
-rw-r--r--net/rxrpc/ar-proc.c6
-rw-r--r--net/sched/Kconfig13
-rw-r--r--net/sched/Makefile1
-rw-r--r--net/sched/cls_api.c6
-rw-r--r--net/sched/cls_basic.c2
-rw-r--r--net/sched/cls_flow.c660
-rw-r--r--net/sched/cls_fw.c2
-rw-r--r--net/sched/cls_route.c2
-rw-r--r--net/sched/cls_tcindex.c2
-rw-r--r--net/sched/cls_u32.c2
-rw-r--r--net/sched/sch_ingress.c79
-rw-r--r--net/sched/sch_sfq.c134
-rw-r--r--net/sched/sch_teql.c2
-rw-r--r--net/sctp/sm_make_chunk.c2
-rw-r--r--net/x25/af_x25.c2
-rw-r--r--net/xfrm/xfrm_algo.c144
-rw-r--r--net/xfrm/xfrm_input.c5
-rw-r--r--net/xfrm/xfrm_output.c1
-rw-r--r--net/xfrm/xfrm_proc.c3
-rw-r--r--net/xfrm/xfrm_state.c18
-rw-r--r--net/xfrm/xfrm_user.c71
-rw-r--r--security/selinux/ss/services.c1
310 files changed, 10495 insertions, 4448 deletions
diff --git a/Documentation/DocBook/rapidio.tmpl b/Documentation/DocBook/rapidio.tmpl
index 1becf27ba27e..a8b88c47e809 100644
--- a/Documentation/DocBook/rapidio.tmpl
+++ b/Documentation/DocBook/rapidio.tmpl
@@ -133,9 +133,9 @@
133!Idrivers/rapidio/rio-sysfs.c 133!Idrivers/rapidio/rio-sysfs.c
134 </sect1> 134 </sect1>
135 <sect1><title>PPC32 support</title> 135 <sect1><title>PPC32 support</title>
136!Iarch/ppc/kernel/rio.c 136!Iarch/powerpc/kernel/rio.c
137!Earch/ppc/syslib/ppc85xx_rio.c 137!Earch/powerpc/sysdev/fsl_rio.c
138!Iarch/ppc/syslib/ppc85xx_rio.c 138!Iarch/powerpc/sysdev/fsl_rio.c
139 </sect1> 139 </sect1>
140 </chapter> 140 </chapter>
141 141
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 4413a2d4646f..11fe51c036bf 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1919,11 +1919,6 @@ max_size
1919Maximum size of the routing cache. Old entries will be purged once the cache 1919Maximum size of the routing cache. Old entries will be purged once the cache
1920reached has this size. 1920reached has this size.
1921 1921
1922max_delay, min_delay
1923--------------------
1924
1925Delays for flushing the routing cache.
1926
1927redirect_load, redirect_number 1922redirect_load, redirect_number
1928------------------------------ 1923------------------------------
1929 1924
diff --git a/Documentation/networking/xfrm_proc.txt b/Documentation/networking/xfrm_proc.txt
index 53c1a58b02f1..d0d8bafa9016 100644
--- a/Documentation/networking/xfrm_proc.txt
+++ b/Documentation/networking/xfrm_proc.txt
@@ -26,8 +26,9 @@ XfrmInStateProtoError:
26 e.g. SA key is wrong 26 e.g. SA key is wrong
27XfrmInStateModeError: 27XfrmInStateModeError:
28 Transformation mode specific error 28 Transformation mode specific error
29XfrmInSeqOutOfWindow: 29XfrmInStateSeqError:
30 Sequence out of window 30 Sequence error
31 i.e. Sequence number is out of window
31XfrmInStateExpired: 32XfrmInStateExpired:
32 State is expired 33 State is expired
33XfrmInStateMismatch: 34XfrmInStateMismatch:
@@ -60,6 +61,9 @@ XfrmOutStateProtoError:
60 Transformation protocol specific error 61 Transformation protocol specific error
61XfrmOutStateModeError: 62XfrmOutStateModeError:
62 Transformation mode specific error 63 Transformation mode specific error
64XfrmOutStateSeqError:
65 Sequence error
66 i.e. Sequence number overflow
63XfrmOutStateExpired: 67XfrmOutStateExpired:
64 State is expired 68 State is expired
65XfrmOutPolBlock: 69XfrmOutPolBlock:
diff --git a/MAINTAINERS b/MAINTAINERS
index 093cf04e9ca6..91082e60d289 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4085,6 +4085,12 @@ L: video4linux-list@redhat.com
4085W: http://www.linux-projects.org 4085W: http://www.linux-projects.org
4086S: Maintained 4086S: Maintained
4087 4087
4088USB WIRELESS RNDIS DRIVER (rndis_wlan)
4089P: Jussi Kivilinna
4090M: jussi.kivilinna@mbnet.fi
4091L: linux-wireless@vger.kernel.org
4092S: Maintained
4093
4088USB ZC0301 DRIVER 4094USB ZC0301 DRIVER
4089P: Luca Risolia 4095P: Luca Risolia
4090M: luca.risolia@studio.unibo.it 4096M: luca.risolia@studio.unibo.it
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index f4b582cbb567..bd9213749ac2 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -53,6 +53,10 @@ config GENERIC_CALIBRATE_DELAY
53 bool 53 bool
54 default y 54 default y
55 55
56config GENERIC_TIME
57 bool
58 default y
59
56config TIME_LOW_RES 60config TIME_LOW_RES
57 bool 61 bool
58 default y 62 default y
diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile
index 30aa2553693d..e0b5f62e395c 100644
--- a/arch/m68knommu/Makefile
+++ b/arch/m68knommu/Makefile
@@ -61,17 +61,17 @@ MODEL := $(model-y)
61# for the selected cpu. ONLY need to define this for the non-base member 61# for the selected cpu. ONLY need to define this for the non-base member
62# of the family. 62# of the family.
63# 63#
64cpuclass-$(CONFIG_M5206) := 5307 64cpuclass-$(CONFIG_M5206) := coldfire
65cpuclass-$(CONFIG_M5206e) := 5307 65cpuclass-$(CONFIG_M5206e) := coldfire
66cpuclass-$(CONFIG_M520x) := 5307 66cpuclass-$(CONFIG_M520x) := coldfire
67cpuclass-$(CONFIG_M523x) := 5307 67cpuclass-$(CONFIG_M523x) := coldfire
68cpuclass-$(CONFIG_M5249) := 5307 68cpuclass-$(CONFIG_M5249) := coldfire
69cpuclass-$(CONFIG_M527x) := 5307 69cpuclass-$(CONFIG_M527x) := coldfire
70cpuclass-$(CONFIG_M5272) := 5307 70cpuclass-$(CONFIG_M5272) := coldfire
71cpuclass-$(CONFIG_M528x) := 5307 71cpuclass-$(CONFIG_M528x) := coldfire
72cpuclass-$(CONFIG_M5307) := 5307 72cpuclass-$(CONFIG_M5307) := coldfire
73cpuclass-$(CONFIG_M532x) := 5307 73cpuclass-$(CONFIG_M532x) := coldfire
74cpuclass-$(CONFIG_M5407) := 5307 74cpuclass-$(CONFIG_M5407) := coldfire
75cpuclass-$(CONFIG_M68328) := 68328 75cpuclass-$(CONFIG_M68328) := 68328
76cpuclass-$(CONFIG_M68EZ328) := 68328 76cpuclass-$(CONFIG_M68EZ328) := 68328
77cpuclass-$(CONFIG_M68VZ328) := 68328 77cpuclass-$(CONFIG_M68VZ328) := 68328
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index 77e5375a2dd5..89cdbcaeb45f 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -22,7 +22,6 @@
22#include <linux/timex.h> 22#include <linux/timex.h>
23 23
24#include <asm/machdep.h> 24#include <asm/machdep.h>
25#include <asm/io.h>
26#include <asm/irq_regs.h> 25#include <asm/irq_regs.h>
27 26
28#define TICK_SIZE (tick_nsec / 1000) 27#define TICK_SIZE (tick_nsec / 1000)
@@ -66,29 +65,6 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
66 else 65 else
67 last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ 66 last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
68 } 67 }
69#ifdef CONFIG_HEARTBEAT
70 /* use power LED as a heartbeat instead -- much more useful
71 for debugging -- based on the version for PReP by Cort */
72 /* acts like an actual heart beat -- ie thump-thump-pause... */
73 if (mach_heartbeat) {
74 static unsigned cnt = 0, period = 0, dist = 0;
75
76 if (cnt == 0 || cnt == dist)
77 mach_heartbeat( 1 );
78 else if (cnt == 7 || cnt == dist+7)
79 mach_heartbeat( 0 );
80
81 if (++cnt > period) {
82 cnt = 0;
83 /* The hyperbolic function below modifies the heartbeat period
84 * length in dependency of the current (5min) load. It goes
85 * through the points f(0)=126, f(1)=86, f(5)=51,
86 * f(inf)->30. */
87 period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30;
88 dist = period / 4;
89 }
90 }
91#endif /* CONFIG_HEARTBEAT */
92 68
93 write_sequnlock(&xtime_lock); 69 write_sequnlock(&xtime_lock);
94 return(IRQ_HANDLED); 70 return(IRQ_HANDLED);
@@ -112,60 +88,3 @@ void time_init(void)
112 hw_timer_init(); 88 hw_timer_init();
113} 89}
114 90
115/*
116 * This version of gettimeofday has near microsecond resolution.
117 */
118void do_gettimeofday(struct timeval *tv)
119{
120 unsigned long flags;
121 unsigned long seq;
122 unsigned long usec, sec;
123
124 do {
125 seq = read_seqbegin_irqsave(&xtime_lock, flags);
126 usec = hw_timer_offset();
127 sec = xtime.tv_sec;
128 usec += (xtime.tv_nsec / 1000);
129 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
130
131 while (usec >= 1000000) {
132 usec -= 1000000;
133 sec++;
134 }
135
136 tv->tv_sec = sec;
137 tv->tv_usec = usec;
138}
139
140EXPORT_SYMBOL(do_gettimeofday);
141
142int do_settimeofday(struct timespec *tv)
143{
144 time_t wtm_sec, sec = tv->tv_sec;
145 long wtm_nsec, nsec = tv->tv_nsec;
146
147 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
148 return -EINVAL;
149
150 write_seqlock_irq(&xtime_lock);
151 /*
152 * This is revolting. We need to set the xtime.tv_usec
153 * correctly. However, the value in this location is
154 * is value at the last tick.
155 * Discover what correction gettimeofday
156 * would have done, and then undo it!
157 */
158 nsec -= (hw_timer_offset() * 1000);
159
160 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
161 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
162
163 set_normalized_timespec(&xtime, sec, nsec);
164 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
165
166 ntp_clear();
167 write_sequnlock_irq(&xtime_lock);
168 clock_was_set();
169 return 0;
170}
171EXPORT_SYMBOL(do_settimeofday);
diff --git a/arch/m68knommu/platform/5206/config.c b/arch/m68knommu/platform/5206/config.c
index b3c4dd4cc135..53a5920c2b71 100644
--- a/arch/m68knommu/platform/5206/config.c
+++ b/arch/m68knommu/platform/5206/config.c
@@ -13,12 +13,11 @@
13#include <linux/param.h> 13#include <linux/param.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <asm/dma.h> 16#include <linux/io.h>
17#include <asm/machdep.h> 17#include <asm/machdep.h>
18#include <asm/coldfire.h> 18#include <asm/coldfire.h>
19#include <asm/mcftimer.h>
20#include <asm/mcfsim.h> 19#include <asm/mcfsim.h>
21#include <asm/mcfdma.h> 20#include <asm/mcfuart.h>
22 21
23/***************************************************************************/ 22/***************************************************************************/
24 23
@@ -26,15 +25,51 @@ void coldfire_reset(void);
26 25
27/***************************************************************************/ 26/***************************************************************************/
28 27
29/* 28static struct mcf_platform_uart m5206_uart_platform[] = {
30 * DMA channel base address table. 29 {
31 */ 30 .mapbase = MCF_MBAR + MCFUART_BASE1,
32unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { 31 .irq = 73,
33 MCF_MBAR + MCFDMA_BASE0, 32 },
34 MCF_MBAR + MCFDMA_BASE1, 33 {
34 .mapbase = MCF_MBAR + MCFUART_BASE2,
35 .irq = 74,
36 },
37 { },
38};
39
40static struct platform_device m5206_uart = {
41 .name = "mcfuart",
42 .id = 0,
43 .dev.platform_data = m5206_uart_platform,
44};
45
46static struct platform_device *m5206_devices[] __initdata = {
47 &m5206_uart,
35}; 48};
36 49
37unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; 50/***************************************************************************/
51
52static void __init m5206_uart_init_line(int line, int irq)
53{
54 if (line == 0) {
55 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
56 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
57 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
58 } else if (line == 1) {
59 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
60 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
61 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
62 }
63}
64
65static void __init m5206_uarts_init(void)
66{
67 const int nrlines = ARRAY_SIZE(m5206_uart_platform);
68 int line;
69
70 for (line = 0; (line < nrlines); line++)
71 m5206_uart_init_line(line, m5206_uart_platform[line].irq);
72}
38 73
39/***************************************************************************/ 74/***************************************************************************/
40 75
@@ -74,24 +109,21 @@ void mcf_settimericr(unsigned int timer, unsigned int level)
74 109
75/***************************************************************************/ 110/***************************************************************************/
76 111
77int mcf_timerirqpending(int timer) 112void __init config_BSP(char *commandp, int size)
78{ 113{
79 unsigned int imr = 0; 114 mcf_setimr(MCFSIM_IMR_MASKALL);
80 115 mach_reset = coldfire_reset;
81 switch (timer) {
82 case 1: imr = MCFSIM_IMR_TIMER1; break;
83 case 2: imr = MCFSIM_IMR_TIMER2; break;
84 default: break;
85 }
86 return (mcf_getipr() & imr);
87} 116}
88 117
89/***************************************************************************/ 118/***************************************************************************/
90 119
91void config_BSP(char *commandp, int size) 120static int __init init_BSP(void)
92{ 121{
93 mcf_setimr(MCFSIM_IMR_MASKALL); 122 m5206_uarts_init();
94 mach_reset = coldfire_reset; 123 platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices));
124 return 0;
95} 125}
96 126
127arch_initcall(init_BSP);
128
97/***************************************************************************/ 129/***************************************************************************/
diff --git a/arch/m68knommu/platform/5206e/config.c b/arch/m68knommu/platform/5206e/config.c
index f84a4aea8cb6..a6692e958f6b 100644
--- a/arch/m68knommu/platform/5206e/config.c
+++ b/arch/m68knommu/platform/5206e/config.c
@@ -10,8 +10,9 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/param.h> 12#include <linux/param.h>
13#include <linux/init.h>
13#include <linux/interrupt.h> 14#include <linux/interrupt.h>
14#include <asm/dma.h> 15#include <linux/io.h>
15#include <asm/machdep.h> 16#include <asm/machdep.h>
16#include <asm/coldfire.h> 17#include <asm/coldfire.h>
17#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
@@ -23,15 +24,51 @@ void coldfire_reset(void);
23 24
24/***************************************************************************/ 25/***************************************************************************/
25 26
26/* 27static struct mcf_platform_uart m5206e_uart_platform[] = {
27 * DMA channel base address table. 28 {
28 */ 29 .mapbase = MCF_MBAR + MCFUART_BASE1,
29unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { 30 .irq = 73,
30 MCF_MBAR + MCFDMA_BASE0, 31 },
31 MCF_MBAR + MCFDMA_BASE1, 32 {
33 .mapbase = MCF_MBAR + MCFUART_BASE2,
34 .irq = 74,
35 },
36 { },
37};
38
39static struct platform_device m5206e_uart = {
40 .name = "mcfuart",
41 .id = 0,
42 .dev.platform_data = m5206e_uart_platform,
32}; 43};
33 44
34unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; 45static struct platform_device *m5206e_devices[] __initdata = {
46 &m5206e_uart,
47};
48
49/***************************************************************************/
50
51static void __init m5206_uart_init_line(int line, int irq)
52{
53 if (line == 0) {
54 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
55 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
56 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
57 } else if (line == 1) {
58 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
59 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
60 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
61 }
62}
63
64static void __init m5206e_uarts_init(void)
65{
66 const int nrlines = ARRAY_SIZE(m5206e_uart_platform);
67 int line;
68
69 for (line = 0; (line < nrlines); line++)
70 m5206e_uart_init_line(line, m5206e_uart_platform[line].irq);
71}
35 72
36/***************************************************************************/ 73/***************************************************************************/
37 74
@@ -71,21 +108,7 @@ void mcf_settimericr(unsigned int timer, unsigned int level)
71 108
72/***************************************************************************/ 109/***************************************************************************/
73 110
74int mcf_timerirqpending(int timer) 111void __init config_BSP(char *commandp, int size)
75{
76 unsigned int imr = 0;
77
78 switch (timer) {
79 case 1: imr = MCFSIM_IMR_TIMER1; break;
80 case 2: imr = MCFSIM_IMR_TIMER2; break;
81 default: break;
82 }
83 return (mcf_getipr() & imr);
84}
85
86/***************************************************************************/
87
88void config_BSP(char *commandp, int size)
89{ 112{
90 mcf_setimr(MCFSIM_IMR_MASKALL); 113 mcf_setimr(MCFSIM_IMR_MASKALL);
91 114
@@ -99,3 +122,14 @@ void config_BSP(char *commandp, int size)
99} 122}
100 123
101/***************************************************************************/ 124/***************************************************************************/
125
126static int __init init_BSP(void)
127{
128 m5206e_uarts_init();
129 platform_add_devices(m5206e_devices, ARRAY_SIZE(m5206e_devices));
130 return 0;
131}
132
133arch_initcall(init_BSP);
134
135/***************************************************************************/
diff --git a/arch/m68knommu/platform/520x/config.c b/arch/m68knommu/platform/520x/config.c
index 6edbd41261cc..06d887cdcbfb 100644
--- a/arch/m68knommu/platform/520x/config.c
+++ b/arch/m68knommu/platform/520x/config.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2005, Freescale (www.freescale.com) 6 * Copyright (C) 2005, Freescale (www.freescale.com)
7 * Copyright (C) 2005, Intec Automation (mike@steroidmicros.com) 7 * Copyright (C) 2005, Intec Automation (mike@steroidmicros.com)
8 * Copyright (C) 1999-2003, Greg Ungerer (gerg@snapgear.com) 8 * Copyright (C) 1999-2007, Greg Ungerer (gerg@snapgear.com)
9 * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com) 9 * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com)
10 */ 10 */
11 11
@@ -13,21 +13,93 @@
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/param.h> 15#include <linux/param.h>
16#include <linux/init.h>
16#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/io.h>
17#include <asm/machdep.h> 19#include <asm/machdep.h>
18#include <asm/dma.h> 20#include <asm/coldfire.h>
21#include <asm/mcfsim.h>
22#include <asm/mcfuart.h>
19 23
20/***************************************************************************/ 24/***************************************************************************/
21 25
22/* 26void coldfire_reset(void);
23 * DMA channel base address table.
24 */
25unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS];
26unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
27 27
28/***************************************************************************/ 28/***************************************************************************/
29 29
30void coldfire_reset(void); 30static struct mcf_platform_uart m520x_uart_platform[] = {
31 {
32 .mapbase = MCF_MBAR + MCFUART_BASE1,
33 .irq = MCFINT_VECBASE + MCFINT_UART0,
34 },
35 {
36 .mapbase = MCF_MBAR + MCFUART_BASE2,
37 .irq = MCFINT_VECBASE + MCFINT_UART1,
38 },
39 {
40 .mapbase = MCF_MBAR + MCFUART_BASE3,
41 .irq = MCFINT_VECBASE + MCFINT_UART2,
42 },
43 { },
44};
45
46static struct platform_device m520x_uart = {
47 .name = "mcfuart",
48 .id = 0,
49 .dev.platform_data = m520x_uart_platform,
50};
51
52static struct platform_device *m520x_devices[] __initdata = {
53 &m520x_uart,
54};
55
56/***************************************************************************/
57
58#define INTC0 (MCF_MBAR + MCFICM_INTC0)
59
60static void __init m520x_uart_init_line(int line, int irq)
61{
62 u32 imr;
63 u16 par;
64 u8 par2;
65
66 writeb(0x03, INTC0 + MCFINTC_ICR0 + MCFINT_UART0 + line);
67
68 imr = readl(INTC0 + MCFINTC_IMRL);
69 imr &= ~((1 << (irq - MCFINT_VECBASE)) | 1);
70 writel(imr, INTC0 + MCFINTC_IMRL);
71
72 switch (line) {
73 case 0:
74 par = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART);
75 par |= MCF_GPIO_PAR_UART_PAR_UTXD0 |
76 MCF_GPIO_PAR_UART_PAR_URXD0;
77 writew(par, MCF_IPSBAR + MCF_GPIO_PAR_UART);
78 break;
79 case 1:
80 par = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART);
81 par |= MCF_GPIO_PAR_UART_PAR_UTXD1 |
82 MCF_GPIO_PAR_UART_PAR_URXD1;
83 writew(par, MCF_IPSBAR + MCF_GPIO_PAR_UART);
84 break;
85 case 2:
86 par2 = readb(MCF_IPSBAR + MCF_GPIO_PAR_FECI2C);
87 par2 &= ~0x0F;
88 par2 |= MCF_GPIO_PAR_FECI2C_PAR_SCL_UTXD2 |
89 MCF_GPIO_PAR_FECI2C_PAR_SDA_URXD2;
90 writeb(par2, MCF_IPSBAR + MCF_GPIO_PAR_FECI2C);
91 break;
92 }
93}
94
95static void __init m520x_uarts_init(void)
96{
97 const int nrlines = ARRAY_SIZE(m520x_uart_platform);
98 int line;
99
100 for (line = 0; (line < nrlines); line++)
101 m520x_uart_init_line(line, m520x_uart_platform[line].irq);
102}
31 103
32/***************************************************************************/ 104/***************************************************************************/
33 105
@@ -42,9 +114,20 @@ void mcf_autovector(unsigned int vec)
42 114
43/***************************************************************************/ 115/***************************************************************************/
44 116
45void config_BSP(char *commandp, int size) 117void __init config_BSP(char *commandp, int size)
46{ 118{
47 mach_reset = coldfire_reset; 119 mach_reset = coldfire_reset;
120 m520x_uarts_init();
48} 121}
49 122
50/***************************************************************************/ 123/***************************************************************************/
124
125static int __init init_BSP(void)
126{
127 platform_add_devices(m520x_devices, ARRAY_SIZE(m520x_devices));
128 return 0;
129}
130
131arch_initcall(init_BSP);
132
133/***************************************************************************/
diff --git a/arch/m68knommu/platform/523x/config.c b/arch/m68knommu/platform/523x/config.c
index e7f80c8e8636..13f02611ea23 100644
--- a/arch/m68knommu/platform/523x/config.c
+++ b/arch/m68knommu/platform/523x/config.c
@@ -16,11 +16,11 @@
16#include <linux/param.h> 16#include <linux/param.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <asm/dma.h> 19#include <linux/io.h>
20#include <asm/machdep.h> 20#include <asm/machdep.h>
21#include <asm/coldfire.h> 21#include <asm/coldfire.h>
22#include <asm/mcfsim.h> 22#include <asm/mcfsim.h>
23#include <asm/mcfdma.h> 23#include <asm/mcfuart.h>
24 24
25/***************************************************************************/ 25/***************************************************************************/
26 26
@@ -28,14 +28,58 @@ void coldfire_reset(void);
28 28
29/***************************************************************************/ 29/***************************************************************************/
30 30
31/* 31static struct mcf_platform_uart m523x_uart_platform[] = {
32 * DMA channel base address table. 32 {
33 */ 33 .mapbase = MCF_MBAR + MCFUART_BASE1,
34unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { 34 .irq = MCFINT_VECBASE + MCFINT_UART0,
35 MCF_MBAR + MCFDMA_BASE0, 35 },
36 {
37 .mapbase = MCF_MBAR + MCFUART_BASE2,
38 .irq = MCFINT_VECBASE + MCFINT_UART0 + 1,
39 },
40 {
41 .mapbase = MCF_MBAR + MCFUART_BASE3,
42 .irq = MCFINT_VECBASE + MCFINT_UART0 + 2,
43 },
44 { },
45};
46
47static struct platform_device m523x_uart = {
48 .name = "mcfuart",
49 .id = 0,
50 .dev.platform_data = m523x_uart_platform,
51};
52
53static struct platform_device *m523x_devices[] __initdata = {
54 &m523x_uart,
36}; 55};
37 56
38unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; 57/***************************************************************************/
58
59#define INTC0 (MCF_MBAR + MCFICM_INTC0)
60
61static void __init m523x_uart_init_line(int line, int irq)
62{
63 u32 imr;
64
65 if ((line < 0) || (line > 2))
66 return;
67
68 writeb(0x30+line, (INTC0 + MCFINTC_ICR0 + MCFINT_UART0 + line));
69
70 imr = readl(INTC0 + MCFINTC_IMRL);
71 imr &= ~((1 << (irq - MCFINT_VECBASE)) | 1);
72 writel(imr, INTC0 + MCFINTC_IMRL);
73}
74
75static void __init m523x_uarts_init(void)
76{
77 const int nrlines = ARRAY_SIZE(m523x_uart_platform);
78 int line;
79
80 for (line = 0; (line < nrlines); line++)
81 m523x_uart_init_line(line, m523x_uart_platform[line].irq);
82}
39 83
40/***************************************************************************/ 84/***************************************************************************/
41 85
@@ -49,15 +93,26 @@ void mcf_disableall(void)
49 93
50void mcf_autovector(unsigned int vec) 94void mcf_autovector(unsigned int vec)
51{ 95{
52 /* Everything is auto-vectored on the 5272 */ 96 /* Everything is auto-vectored on the 523x */
53} 97}
54 98
55/***************************************************************************/ 99/***************************************************************************/
56 100
57void config_BSP(char *commandp, int size) 101void __init config_BSP(char *commandp, int size)
58{ 102{
59 mcf_disableall(); 103 mcf_disableall();
60 mach_reset = coldfire_reset; 104 mach_reset = coldfire_reset;
105 m523x_uarts_init();
61} 106}
62 107
63/***************************************************************************/ 108/***************************************************************************/
109
110static int __init init_BSP(void)
111{
112 platform_add_devices(m523x_devices, ARRAY_SIZE(m523x_devices));
113 return 0;
114}
115
116arch_initcall(init_BSP);
117
118/***************************************************************************/
diff --git a/arch/m68knommu/platform/5249/config.c b/arch/m68knommu/platform/5249/config.c
index d4d39435cb15..d299f7b8768a 100644
--- a/arch/m68knommu/platform/5249/config.c
+++ b/arch/m68knommu/platform/5249/config.c
@@ -12,11 +12,11 @@
12#include <linux/param.h> 12#include <linux/param.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <asm/dma.h> 15#include <linux/io.h>
16#include <asm/machdep.h> 16#include <asm/machdep.h>
17#include <asm/coldfire.h> 17#include <asm/coldfire.h>
18#include <asm/mcfsim.h> 18#include <asm/mcfsim.h>
19#include <asm/mcfdma.h> 19#include <asm/mcfuart.h>
20 20
21/***************************************************************************/ 21/***************************************************************************/
22 22
@@ -24,17 +24,51 @@ void coldfire_reset(void);
24 24
25/***************************************************************************/ 25/***************************************************************************/
26 26
27/* 27static struct mcf_platform_uart m5249_uart_platform[] = {
28 * DMA channel base address table. 28 {
29 */ 29 .mapbase = MCF_MBAR + MCFUART_BASE1,
30unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { 30 .irq = 73,
31 MCF_MBAR + MCFDMA_BASE0, 31 },
32 MCF_MBAR + MCFDMA_BASE1, 32 {
33 MCF_MBAR + MCFDMA_BASE2, 33 .mapbase = MCF_MBAR + MCFUART_BASE2,
34 MCF_MBAR + MCFDMA_BASE3, 34 .irq = 74,
35 }
36};
37
38static struct platform_device m5249_uart = {
39 .name = "mcfuart",
40 .id = 0,
41 .dev.platform_data = m5249_uart_platform,
42};
43
44static struct platform_device *m5249_devices[] __initdata = {
45 &m5249_uart,
35}; 46};
36 47
37unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; 48/***************************************************************************/
49
50static void __init m5249_uart_init_line(int line, int irq)
51{
52 if (line == 0) {
53 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
54 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
55 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
56 } else if (line == 1) {
57 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
58 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
59 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
60 }
61}
62
63static void __init m5249_uarts_init(void)
64{
65 const int nrlines = ARRAY_SIZE(m5249_uart_platform);
66 int line;
67
68 for (line = 0; (line < nrlines); line++)
69 m5249_uart_init_line(line, m5249_uart_platform[line].irq);
70}
71
38 72
39/***************************************************************************/ 73/***************************************************************************/
40 74
@@ -71,24 +105,21 @@ void mcf_settimericr(unsigned int timer, unsigned int level)
71 105
72/***************************************************************************/ 106/***************************************************************************/
73 107
74int mcf_timerirqpending(int timer) 108void __init config_BSP(char *commandp, int size)
75{ 109{
76 unsigned int imr = 0; 110 mcf_setimr(MCFSIM_IMR_MASKALL);
77 111 mach_reset = coldfire_reset;
78 switch (timer) {
79 case 1: imr = MCFSIM_IMR_TIMER1; break;
80 case 2: imr = MCFSIM_IMR_TIMER2; break;
81 default: break;
82 }
83 return (mcf_getipr() & imr);
84} 112}
85 113
86/***************************************************************************/ 114/***************************************************************************/
87 115
88void config_BSP(char *commandp, int size) 116static int __init init_BSP(void)
89{ 117{
90 mcf_setimr(MCFSIM_IMR_MASKALL); 118 m5249_uarts_init();
91 mach_reset = coldfire_reset; 119 platform_add_devices(m5249_devices, ARRAY_SIZE(m5249_devices));
120 return 0;
92} 121}
93 122
123arch_initcall(init_BSP);
124
94/***************************************************************************/ 125/***************************************************************************/
diff --git a/arch/m68knommu/platform/5272/config.c b/arch/m68knommu/platform/5272/config.c
index 634a6375e4a5..2aca599a1ca7 100644
--- a/arch/m68knommu/platform/5272/config.c
+++ b/arch/m68knommu/platform/5272/config.c
@@ -13,11 +13,11 @@
13#include <linux/param.h> 13#include <linux/param.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <asm/dma.h> 16#include <linux/io.h>
17#include <asm/machdep.h> 17#include <asm/machdep.h>
18#include <asm/coldfire.h> 18#include <asm/coldfire.h>
19#include <asm/mcfsim.h> 19#include <asm/mcfsim.h>
20#include <asm/mcfdma.h> 20#include <asm/mcfuart.h>
21 21
22/***************************************************************************/ 22/***************************************************************************/
23 23
@@ -37,14 +37,57 @@ unsigned char ledbank = 0xff;
37 37
38/***************************************************************************/ 38/***************************************************************************/
39 39
40/* 40static struct mcf_platform_uart m5272_uart_platform[] = {
41 * DMA channel base address table. 41 {
42 */ 42 .mapbase = MCF_MBAR + MCFUART_BASE1,
43unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { 43 .irq = 73,
44 MCF_MBAR + MCFDMA_BASE0, 44 },
45 {
46 .mapbase = MCF_MBAR + MCFUART_BASE2,
47 .irq = 74,
48 },
49 { },
45}; 50};
46 51
47unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; 52static struct platform_device m5272_uart = {
53 .name = "mcfuart",
54 .id = 0,
55 .dev.platform_data = m5272_uart_platform,
56};
57
58static struct platform_device *m5272_devices[] __initdata = {
59 &m5272_uart,
60};
61
62/***************************************************************************/
63
64static void __init m5272_uart_init_line(int line, int irq)
65{
66 u32 v;
67
68 if ((line >= 0) && (line < 2)) {
69 v = (line) ? 0x0e000000 : 0xe0000000;
70 writel(v, MCF_MBAR + MCFSIM_ICR2);
71
72 /* Enable the output lines for the serial ports */
73 v = readl(MCF_MBAR + MCFSIM_PBCNT);
74 v = (v & ~0x000000ff) | 0x00000055;
75 writel(v, MCF_MBAR + MCFSIM_PBCNT);
76
77 v = readl(MCF_MBAR + MCFSIM_PDCNT);
78 v = (v & ~0x000003fc) | 0x000002a8;
79 writel(v, MCF_MBAR + MCFSIM_PDCNT);
80 }
81}
82
83static void __init m5272_uarts_init(void)
84{
85 const int nrlines = ARRAY_SIZE(m5272_uart_platform);
86 int line;
87
88 for (line = 0; (line < nrlines); line++)
89 m5272_uart_init_line(line, m5272_uart_platform[line].irq);
90}
48 91
49/***************************************************************************/ 92/***************************************************************************/
50 93
@@ -80,20 +123,7 @@ void mcf_settimericr(int timer, int level)
80 123
81/***************************************************************************/ 124/***************************************************************************/
82 125
83int mcf_timerirqpending(int timer) 126void __init config_BSP(char *commandp, int size)
84{
85 volatile unsigned long *icrp;
86
87 if ((timer >= 1 ) && (timer <= 4)) {
88 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
89 return (*icrp & (0x8 << ((4 - timer) * 4)));
90 }
91 return 0;
92}
93
94/***************************************************************************/
95
96void config_BSP(char *commandp, int size)
97{ 127{
98#if defined (CONFIG_MOD5272) 128#if defined (CONFIG_MOD5272)
99 volatile unsigned char *pivrp; 129 volatile unsigned char *pivrp;
@@ -125,3 +155,14 @@ void config_BSP(char *commandp, int size)
125} 155}
126 156
127/***************************************************************************/ 157/***************************************************************************/
158
159static int __init init_BSP(void)
160{
161 m5272_uarts_init();
162 platform_add_devices(m5272_devices, ARRAY_SIZE(m5272_devices));
163 return 0;
164}
165
166arch_initcall(init_BSP);
167
168/***************************************************************************/
diff --git a/arch/m68knommu/platform/527x/config.c b/arch/m68knommu/platform/527x/config.c
index 9cbfbc68ae4f..73cd1aef4a90 100644
--- a/arch/m68knommu/platform/527x/config.c
+++ b/arch/m68knommu/platform/527x/config.c
@@ -16,11 +16,11 @@
16#include <linux/param.h> 16#include <linux/param.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <asm/dma.h> 19#include <linux/io.h>
20#include <asm/machdep.h> 20#include <asm/machdep.h>
21#include <asm/coldfire.h> 21#include <asm/coldfire.h>
22#include <asm/mcfsim.h> 22#include <asm/mcfsim.h>
23#include <asm/mcfdma.h> 23#include <asm/mcfuart.h>
24 24
25/***************************************************************************/ 25/***************************************************************************/
26 26
@@ -28,14 +28,72 @@ void coldfire_reset(void);
28 28
29/***************************************************************************/ 29/***************************************************************************/
30 30
31/* 31static struct mcf_platform_uart m527x_uart_platform[] = {
32 * DMA channel base address table. 32 {
33 */ 33 .mapbase = MCF_MBAR + MCFUART_BASE1,
34unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { 34 .irq = MCFINT_VECBASE + MCFINT_UART0,
35 MCF_MBAR + MCFDMA_BASE0, 35 },
36 {
37 .mapbase = MCF_MBAR + MCFUART_BASE2,
38 .irq = MCFINT_VECBASE + MCFINT_UART1,
39 },
40 {
41 .mapbase = MCF_MBAR + MCFUART_BASE3,
42 .irq = MCFINT_VECBASE + MCFINT_UART2,
43 },
44 { },
36}; 45};
37 46
38unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; 47static struct platform_device m527x_uart = {
48 .name = "mcfuart",
49 .id = 0,
50 .dev.platform_data = m527x_uart_platform,
51};
52
53static struct platform_device *m527x_devices[] __initdata = {
54 &m527x_uart,
55};
56
57/***************************************************************************/
58
59#define INTC0 (MCF_MBAR + MCFICM_INTC0)
60
61static void __init m527x_uart_init_line(int line, int irq)
62{
63 u16 sepmask;
64 u32 imr;
65
66 if ((line < 0) || (line > 2))
67 return;
68
69 /* level 6, line based priority */
70 writeb(0x30+line, INTC0 + MCFINTC_ICR0 + MCFINT_UART0 + line);
71
72 imr = readl(INTC0 + MCFINTC_IMRL);
73 imr &= ~((1 << (irq - MCFINT_VECBASE)) | 1);
74 writel(imr, INTC0 + MCFINTC_IMRL);
75
76 /*
77 * External Pin Mask Setting & Enable External Pin for Interface
78 */
79 sepmask = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART);
80 if (line == 0)
81 sepmask |= UART0_ENABLE_MASK;
82 else if (line == 1)
83 sepmask |= UART1_ENABLE_MASK;
84 else if (line == 2)
85 sepmask |= UART2_ENABLE_MASK;
86 writew(sepmask, MCF_IPSBAR + MCF_GPIO_PAR_UART);
87}
88
89static void __init m527x_uarts_init(void)
90{
91 const int nrlines = ARRAY_SIZE(m527x_uart_platform);
92 int line;
93
94 for (line = 0; (line < nrlines); line++)
95 m527x_uart_init_line(line, m527x_uart_platform[line].irq);
96}
39 97
40/***************************************************************************/ 98/***************************************************************************/
41 99
@@ -54,10 +112,21 @@ void mcf_autovector(unsigned int vec)
54 112
55/***************************************************************************/ 113/***************************************************************************/
56 114
57void config_BSP(char *commandp, int size) 115void __init config_BSP(char *commandp, int size)
58{ 116{
59 mcf_disableall(); 117 mcf_disableall();
60 mach_reset = coldfire_reset; 118 mach_reset = coldfire_reset;
61} 119}
62 120
63/***************************************************************************/ 121/***************************************************************************/
122
123static int __init init_BSP(void)
124{
125 m527x_uarts_init();
126 platform_add_devices(m527x_devices, ARRAY_SIZE(m527x_devices));
127 return 0;
128}
129
130arch_initcall(init_BSP);
131
132/***************************************************************************/
diff --git a/arch/m68knommu/platform/528x/config.c b/arch/m68knommu/platform/528x/config.c
index acbd43486d97..036e1b73d944 100644
--- a/arch/m68knommu/platform/528x/config.c
+++ b/arch/m68knommu/platform/528x/config.c
@@ -16,11 +16,15 @@
16#include <linux/param.h> 16#include <linux/param.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <asm/dma.h> 19#include <linux/platform_device.h>
20#include <linux/spi/spi.h>
21#include <linux/spi/flash.h>
22#include <linux/io.h>
20#include <asm/machdep.h> 23#include <asm/machdep.h>
21#include <asm/coldfire.h> 24#include <asm/coldfire.h>
22#include <asm/mcfsim.h> 25#include <asm/mcfsim.h>
23#include <asm/mcfdma.h> 26#include <asm/mcfuart.h>
27#include <asm/mcfqspi.h>
24 28
25/***************************************************************************/ 29/***************************************************************************/
26 30
@@ -28,14 +32,67 @@ void coldfire_reset(void);
28 32
29/***************************************************************************/ 33/***************************************************************************/
30 34
31/* 35static struct mcf_platform_uart m528x_uart_platform[] = {
32 * DMA channel base address table. 36 {
33 */ 37 .mapbase = MCF_MBAR + MCFUART_BASE1,
34unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { 38 .irq = MCFINT_VECBASE + MCFINT_UART0,
35 MCF_MBAR + MCFDMA_BASE0, 39 },
40 {
41 .mapbase = MCF_MBAR + MCFUART_BASE2,
42 .irq = MCFINT_VECBASE + MCFINT_UART0 + 1,
43 },
44 {
45 .mapbase = MCF_MBAR + MCFUART_BASE3,
46 .irq = MCFINT_VECBASE + MCFINT_UART0 + 2,
47 },
48 { },
36}; 49};
37 50
38unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; 51static struct platform_device m528x_uart = {
52 .name = "mcfuart",
53 .id = 0,
54 .dev.platform_data = m528x_uart_platform,
55};
56
57static struct platform_device *m528x_devices[] __initdata = {
58 &m528x_uart,
59};
60
61/***************************************************************************/
62
63#define INTC0 (MCF_MBAR + MCFICM_INTC0)
64
65static void __init m528x_uart_init_line(int line, int irq)
66{
67 u8 port;
68 u32 imr;
69
70 if ((line < 0) || (line > 2))
71 return;
72
73 /* level 6, line based priority */
74 writeb(0x30+line, INTC0 + MCFINTC_ICR0 + MCFINT_UART0 + line);
75
76 imr = readl(INTC0 + MCFINTC_IMRL);
77 imr &= ~((1 << (irq - MCFINT_VECBASE)) | 1);
78 writel(imr, INTC0 + MCFINTC_IMRL);
79
80 /* make sure PUAPAR is set for UART0 and UART1 */
81 if (line < 2) {
82 port = readb(MCF_MBAR + MCF5282_GPIO_PUAPAR);
83 port |= (0x03 << (line * 2));
84 writeb(port, MCF_MBAR + MCF5282_GPIO_PUAPAR);
85 }
86}
87
88static void __init m528x_uarts_init(void)
89{
90 const int nrlines = ARRAY_SIZE(m528x_uart_platform);
91 int line;
92
93 for (line = 0; (line < nrlines); line++)
94 m528x_uart_init_line(line, m528x_uart_platform[line].irq);
95}
39 96
40/***************************************************************************/ 97/***************************************************************************/
41 98
@@ -54,10 +111,21 @@ void mcf_autovector(unsigned int vec)
54 111
55/***************************************************************************/ 112/***************************************************************************/
56 113
57void config_BSP(char *commandp, int size) 114void __init config_BSP(char *commandp, int size)
58{ 115{
59 mcf_disableall(); 116 mcf_disableall();
60 mach_reset = coldfire_reset; 117 mach_reset = coldfire_reset;
61} 118}
62 119
63/***************************************************************************/ 120/***************************************************************************/
121
122static int __init init_BSP(void)
123{
124 m528x_uarts_init();
125 platform_add_devices(m528x_devices, ARRAY_SIZE(m528x_devices));
126 return 0;
127}
128
129arch_initcall(init_BSP);
130
131/***************************************************************************/
diff --git a/arch/m68knommu/platform/5307/Makefile b/arch/m68knommu/platform/5307/Makefile
index 5b600530c8d2..580fd6658d7c 100644
--- a/arch/m68knommu/platform/5307/Makefile
+++ b/arch/m68knommu/platform/5307/Makefile
@@ -16,17 +16,5 @@ ifdef CONFIG_FULLDEBUG
16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1 16EXTRA_AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif 17endif
18 18
19obj-$(CONFIG_COLDFIRE) += entry.o vectors.o 19obj-y += config.o
20obj-$(CONFIG_M5206) += timers.o
21obj-$(CONFIG_M5206e) += timers.o
22obj-$(CONFIG_M520x) += pit.o
23obj-$(CONFIG_M523x) += pit.o
24obj-$(CONFIG_M5249) += timers.o
25obj-$(CONFIG_M527x) += pit.o
26obj-$(CONFIG_M5272) += timers.o
27obj-$(CONFIG_M5307) += config.o timers.o
28obj-$(CONFIG_M532x) += timers.o
29obj-$(CONFIG_M528x) += pit.o
30obj-$(CONFIG_M5407) += timers.o
31 20
32extra-y := head.o
diff --git a/arch/m68knommu/platform/5307/config.c b/arch/m68knommu/platform/5307/config.c
index 6040821e637d..92dc862fa826 100644
--- a/arch/m68knommu/platform/5307/config.c
+++ b/arch/m68knommu/platform/5307/config.c
@@ -13,11 +13,11 @@
13#include <linux/param.h> 13#include <linux/param.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <asm/dma.h> 16#include <linux/io.h>
17#include <asm/machdep.h> 17#include <asm/machdep.h>
18#include <asm/coldfire.h> 18#include <asm/coldfire.h>
19#include <asm/mcfsim.h> 19#include <asm/mcfsim.h>
20#include <asm/mcfdma.h> 20#include <asm/mcfuart.h>
21#include <asm/mcfwdebug.h> 21#include <asm/mcfwdebug.h>
22 22
23/***************************************************************************/ 23/***************************************************************************/
@@ -38,17 +38,51 @@ unsigned char ledbank = 0xff;
38 38
39/***************************************************************************/ 39/***************************************************************************/
40 40
41/* 41static struct mcf_platform_uart m5307_uart_platform[] = {
42 * DMA channel base address table. 42 {
43 */ 43 .mapbase = MCF_MBAR + MCFUART_BASE1,
44unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { 44 .irq = 73,
45 MCF_MBAR + MCFDMA_BASE0, 45 },
46 MCF_MBAR + MCFDMA_BASE1, 46 {
47 MCF_MBAR + MCFDMA_BASE2, 47 .mapbase = MCF_MBAR + MCFUART_BASE2,
48 MCF_MBAR + MCFDMA_BASE3, 48 .irq = 74,
49 },
50 { },
51};
52
53static struct platform_device m5307_uart = {
54 .name = "mcfuart",
55 .id = 0,
56 .dev.platform_data = m5307_uart_platform,
49}; 57};
50 58
51unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; 59static struct platform_device *m5307_devices[] __initdata = {
60 &m5307_uart,
61};
62
63/***************************************************************************/
64
65static void __init m5307_uart_init_line(int line, int irq)
66{
67 if (line == 0) {
68 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
69 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
70 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
71 } else if (line == 1) {
72 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
73 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
74 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
75 }
76}
77
78static void __init m5307_uarts_init(void)
79{
80 const int nrlines = ARRAY_SIZE(m5307_uart_platform);
81 int line;
82
83 for (line = 0; (line < nrlines); line++)
84 m5307_uart_init_line(line, m5307_uart_platform[line].irq);
85}
52 86
53/***************************************************************************/ 87/***************************************************************************/
54 88
@@ -85,21 +119,7 @@ void mcf_settimericr(unsigned int timer, unsigned int level)
85 119
86/***************************************************************************/ 120/***************************************************************************/
87 121
88int mcf_timerirqpending(int timer) 122void __init config_BSP(char *commandp, int size)
89{
90 unsigned int imr = 0;
91
92 switch (timer) {
93 case 1: imr = MCFSIM_IMR_TIMER1; break;
94 case 2: imr = MCFSIM_IMR_TIMER2; break;
95 default: break;
96 }
97 return (mcf_getipr() & imr);
98}
99
100/***************************************************************************/
101
102void config_BSP(char *commandp, int size)
103{ 123{
104 mcf_setimr(MCFSIM_IMR_MASKALL); 124 mcf_setimr(MCFSIM_IMR_MASKALL);
105 125
@@ -117,7 +137,7 @@ void config_BSP(char *commandp, int size)
117 137
118 mach_reset = coldfire_reset; 138 mach_reset = coldfire_reset;
119 139
120#ifdef MCF_BDM_DISABLE 140#ifdef CONFIG_BDM_DISABLE
121 /* 141 /*
122 * Disable the BDM clocking. This also turns off most of the rest of 142 * Disable the BDM clocking. This also turns off most of the rest of
123 * the BDM device. This is good for EMC reasons. This option is not 143 * the BDM device. This is good for EMC reasons. This option is not
@@ -128,3 +148,14 @@ void config_BSP(char *commandp, int size)
128} 148}
129 149
130/***************************************************************************/ 150/***************************************************************************/
151
152static int __init init_BSP(void)
153{
154 m5307_uarts_init();
155 platform_add_devices(m5307_devices, ARRAY_SIZE(m5307_devices));
156 return 0;
157}
158
159arch_initcall(init_BSP);
160
161/***************************************************************************/
diff --git a/arch/m68knommu/platform/532x/config.c b/arch/m68knommu/platform/532x/config.c
index f77328b7b6db..4f44b632045b 100644
--- a/arch/m68knommu/platform/532x/config.c
+++ b/arch/m68knommu/platform/532x/config.c
@@ -21,10 +21,11 @@
21#include <linux/param.h> 21#include <linux/param.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <asm/dma.h> 24#include <linux/io.h>
25#include <asm/machdep.h> 25#include <asm/machdep.h>
26#include <asm/coldfire.h> 26#include <asm/coldfire.h>
27#include <asm/mcfsim.h> 27#include <asm/mcfsim.h>
28#include <asm/mcfuart.h>
28#include <asm/mcfdma.h> 29#include <asm/mcfdma.h>
29#include <asm/mcfwdebug.h> 30#include <asm/mcfwdebug.h>
30 31
@@ -38,11 +39,60 @@ extern unsigned int mcf_timerlevel;
38 39
39/***************************************************************************/ 40/***************************************************************************/
40 41
41/* 42static struct mcf_platform_uart m532x_uart_platform[] = {
42 * DMA channel base address table. 43 {
43 */ 44 .mapbase = MCF_MBAR + MCFUART_BASE1,
44unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { }; 45 .irq = MCFINT_VECBASE + MCFINT_UART0,
45unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; 46 },
47 {
48 .mapbase = MCF_MBAR + MCFUART_BASE2,
49 .irq = MCFINT_VECBASE + MCFINT_UART1,
50 },
51 {
52 .mapbase = MCF_MBAR + MCFUART_BASE3,
53 .irq = MCFINT_VECBASE + MCFINT_UART2,
54 },
55 { },
56};
57
58static struct platform_device m532x_uart = {
59 .name = "mcfuart",
60 .id = 0,
61 .dev.platform_data = m532x_uart_platform,
62};
63
64static struct platform_device *m532x_devices[] __initdata = {
65 &m532x_uart,
66};
67
68/***************************************************************************/
69
70static void __init m532x_uart_init_line(int line, int irq)
71{
72 if (line == 0) {
73 MCF_INTC0_ICR26 = 0x3;
74 MCF_INTC0_CIMR = 26;
75 /* GPIO initialization */
76 MCF_GPIO_PAR_UART |= 0x000F;
77 } else if (line == 1) {
78 MCF_INTC0_ICR27 = 0x3;
79 MCF_INTC0_CIMR = 27;
80 /* GPIO initialization */
81 MCF_GPIO_PAR_UART |= 0x0FF0;
82 } else if (line == 2) {
83 MCF_INTC0_ICR28 = 0x3;
84 MCF_INTC0_CIMR = 28;
85 }
86}
87
88static void __init m532x_uarts_init(void)
89{
90 const int nrlines = ARRAY_SIZE(m532x_uart_platform);
91 int line;
92
93 for (line = 0; (line < nrlines); line++)
94 m532x_uart_init_line(line, m532x_uart_platform[line].irq);
95}
46 96
47/***************************************************************************/ 97/***************************************************************************/
48 98
@@ -66,21 +116,7 @@ void mcf_settimericr(unsigned int timer, unsigned int level)
66 116
67/***************************************************************************/ 117/***************************************************************************/
68 118
69int mcf_timerirqpending(int timer) 119void __init config_BSP(char *commandp, int size)
70{
71 unsigned int imr = 0;
72
73 switch (timer) {
74 case 1: imr = 0x1; break;
75 case 2: imr = 0x2; break;
76 default: break;
77 }
78 return (mcf_getiprh() & imr);
79}
80
81/***************************************************************************/
82
83void config_BSP(char *commandp, int size)
84{ 120{
85 mcf_setimr(MCFSIM_IMR_MASKALL); 121 mcf_setimr(MCFSIM_IMR_MASKALL);
86 122
@@ -99,7 +135,7 @@ void config_BSP(char *commandp, int size)
99 mcf_profilevector = 64+33; 135 mcf_profilevector = 64+33;
100 mach_reset = coldfire_reset; 136 mach_reset = coldfire_reset;
101 137
102#ifdef MCF_BDM_DISABLE 138#ifdef CONFIG_BDM_DISABLE
103 /* 139 /*
104 * Disable the BDM clocking. This also turns off most of the rest of 140 * Disable the BDM clocking. This also turns off most of the rest of
105 * the BDM device. This is good for EMC reasons. This option is not 141 * the BDM device. This is good for EMC reasons. This option is not
@@ -110,9 +146,19 @@ void config_BSP(char *commandp, int size)
110} 146}
111 147
112/***************************************************************************/ 148/***************************************************************************/
113/* Board initialization */
114 149
115/********************************************************************/ 150static int __init init_BSP(void)
151{
152 m532x_uarts_init();
153 platform_add_devices(m532x_devices, ARRAY_SIZE(m532x_devices));
154 return 0;
155}
156
157arch_initcall(init_BSP);
158
159/***************************************************************************/
160/* Board initialization */
161/***************************************************************************/
116/* 162/*
117 * PLL min/max specifications 163 * PLL min/max specifications
118 */ 164 */
diff --git a/arch/m68knommu/platform/5407/config.c b/arch/m68knommu/platform/5407/config.c
index 2d3b62eba7ca..648b8b778211 100644
--- a/arch/m68knommu/platform/5407/config.c
+++ b/arch/m68knommu/platform/5407/config.c
@@ -13,11 +13,11 @@
13#include <linux/param.h> 13#include <linux/param.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <asm/dma.h> 16#include <linux/io.h>
17#include <asm/machdep.h> 17#include <asm/machdep.h>
18#include <asm/coldfire.h> 18#include <asm/coldfire.h>
19#include <asm/mcfsim.h> 19#include <asm/mcfsim.h>
20#include <asm/mcfdma.h> 20#include <asm/mcfuart.h>
21 21
22/***************************************************************************/ 22/***************************************************************************/
23 23
@@ -29,17 +29,51 @@ extern unsigned int mcf_timerlevel;
29 29
30/***************************************************************************/ 30/***************************************************************************/
31 31
32/* 32static struct mcf_platform_uart m5407_uart_platform[] = {
33 * DMA channel base address table. 33 {
34 */ 34 .mapbase = MCF_MBAR + MCFUART_BASE1,
35unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = { 35 .irq = 73,
36 MCF_MBAR + MCFDMA_BASE0, 36 },
37 MCF_MBAR + MCFDMA_BASE1, 37 {
38 MCF_MBAR + MCFDMA_BASE2, 38 .mapbase = MCF_MBAR + MCFUART_BASE2,
39 MCF_MBAR + MCFDMA_BASE3, 39 .irq = 74,
40 },
41 { },
42};
43
44static struct platform_device m5407_uart = {
45 .name = "mcfuart",
46 .id = 0,
47 .dev.platform_data = m5407_uart_platform,
40}; 48};
41 49
42unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS]; 50static struct platform_device *m5407_devices[] __initdata = {
51 &m5407_uart,
52};
53
54/***************************************************************************/
55
56static void __init m5407_uart_init_line(int line, int irq)
57{
58 if (line == 0) {
59 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
60 writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
61 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
62 } else if (line == 1) {
63 writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
64 writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
65 mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
66 }
67}
68
69static void __init m5407_uarts_init(void)
70{
71 const int nrlines = ARRAY_SIZE(m5407_uart_platform);
72 int line;
73
74 for (line = 0; (line < nrlines); line++)
75 m5407_uart_init_line(line, m5407_uart_platform[line].irq);
76}
43 77
44/***************************************************************************/ 78/***************************************************************************/
45 79
@@ -76,21 +110,7 @@ void mcf_settimericr(unsigned int timer, unsigned int level)
76 110
77/***************************************************************************/ 111/***************************************************************************/
78 112
79int mcf_timerirqpending(int timer) 113void __init config_BSP(char *commandp, int size)
80{
81 unsigned int imr = 0;
82
83 switch (timer) {
84 case 1: imr = MCFSIM_IMR_TIMER1; break;
85 case 2: imr = MCFSIM_IMR_TIMER2; break;
86 default: break;
87 }
88 return (mcf_getipr() & imr);
89}
90
91/***************************************************************************/
92
93void config_BSP(char *commandp, int size)
94{ 114{
95 mcf_setimr(MCFSIM_IMR_MASKALL); 115 mcf_setimr(MCFSIM_IMR_MASKALL);
96 116
@@ -105,3 +125,14 @@ void config_BSP(char *commandp, int size)
105} 125}
106 126
107/***************************************************************************/ 127/***************************************************************************/
128
129static int __init init_BSP(void)
130{
131 m5407_uarts_init();
132 platform_add_devices(m5407_devices, ARRAY_SIZE(m5407_devices));
133 return 0;
134}
135
136arch_initcall(init_BSP);
137
138/***************************************************************************/
diff --git a/arch/m68knommu/platform/68328/timers.c b/arch/m68knommu/platform/68328/timers.c
index 04cbc661d4bd..9159fd05c9ac 100644
--- a/arch/m68knommu/platform/68328/timers.c
+++ b/arch/m68knommu/platform/68328/timers.c
@@ -19,6 +19,7 @@
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/clocksource.h>
22#include <asm/setup.h> 23#include <asm/setup.h>
23#include <asm/system.h> 24#include <asm/system.h>
24#include <asm/pgtable.h> 25#include <asm/pgtable.h>
@@ -51,6 +52,19 @@
51#define TICKS_PER_JIFFY 10 52#define TICKS_PER_JIFFY 10
52#endif 53#endif
53 54
55static u32 m68328_tick_cnt;
56
57/***************************************************************************/
58
59static irqreturn_t hw_tick(int irq, void *dummy)
60{
61 /* Reset Timer1 */
62 TSTAT &= 0;
63
64 m68328_tick_cnt += TICKS_PER_JIFFY;
65 return arch_timer_interrupt(irq, dummy);
66}
67
54/***************************************************************************/ 68/***************************************************************************/
55 69
56static irqreturn_t hw_tick(int irq, void *dummy) 70static irqreturn_t hw_tick(int irq, void *dummy)
@@ -69,6 +83,33 @@ static struct irqaction m68328_timer_irq = {
69 .handler = hw_tick, 83 .handler = hw_tick,
70}; 84};
71 85
86/***************************************************************************/
87
88static cycle_t m68328_read_clk(void)
89{
90 unsigned long flags;
91 u32 cycles;
92
93 local_irq_save(flags);
94 cycles = m68328_tick_cnt + TCN;
95 local_irq_restore(flags);
96
97 return cycles;
98}
99
100/***************************************************************************/
101
102static struct clocksource m68328_clk = {
103 .name = "timer",
104 .rating = 250,
105 .read = m68328_read_clk,
106 .shift = 20,
107 .mask = CLOCKSOURCE_MASK(32),
108 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
109};
110
111/***************************************************************************/
112
72void hw_timer_init(void) 113void hw_timer_init(void)
73{ 114{
74 /* disable timer 1 */ 115 /* disable timer 1 */
@@ -84,19 +125,8 @@ void hw_timer_init(void)
84 125
85 /* Enable timer 1 */ 126 /* Enable timer 1 */
86 TCTL |= TCTL_TEN; 127 TCTL |= TCTL_TEN;
87} 128 m68328_clk.mult = clocksource_hz2mult(TICKS_PER_JIFFY*HZ, m68328_clk.shift);
88 129 clocksource_register(&m68328_clk);
89/***************************************************************************/
90
91unsigned long hw_timer_offset(void)
92{
93 unsigned long ticks = TCN, offset = 0;
94
95 /* check for pending interrupt */
96 if (ticks < (TICKS_PER_JIFFY >> 1) && (ISR & (1 << TMR_IRQ_NUM)))
97 offset = 1000000 / HZ;
98 ticks = (ticks * 1000000 / HZ) / TICKS_PER_JIFFY;
99 return ticks + offset;
100} 130}
101 131
102/***************************************************************************/ 132/***************************************************************************/
diff --git a/arch/m68knommu/platform/68360/config.c b/arch/m68knommu/platform/68360/config.c
index 2b3196af811f..ac629fa30099 100644
--- a/arch/m68knommu/platform/68360/config.c
+++ b/arch/m68knommu/platform/68360/config.c
@@ -103,11 +103,6 @@ void hw_timer_init(void)
103 pquicc->timer_tgcr = tgcr_save; 103 pquicc->timer_tgcr = tgcr_save;
104} 104}
105 105
106unsigned long hw_timer_offset(void)
107{
108 return 0;
109}
110
111void BSP_gettod (int *yearp, int *monp, int *dayp, 106void BSP_gettod (int *yearp, int *monp, int *dayp,
112 int *hourp, int *minp, int *secp) 107 int *hourp, int *minp, int *secp)
113{ 108{
diff --git a/arch/m68knommu/platform/coldfire/Makefile b/arch/m68knommu/platform/coldfire/Makefile
new file mode 100644
index 000000000000..e5fff297ae01
--- /dev/null
+++ b/arch/m68knommu/platform/coldfire/Makefile
@@ -0,0 +1,32 @@
1#
2# Makefile for the m68knommu kernel.
3#
4
5#
6# If you want to play with the HW breakpoints then you will
7# need to add define this, which will give you a stack backtrace
8# on the console port whenever a DBG interrupt occurs. You have to
9# set up you HW breakpoints to trigger a DBG interrupt:
10#
11# EXTRA_CFLAGS += -DTRAP_DBG_INTERRUPT
12# EXTRA_AFLAGS += -DTRAP_DBG_INTERRUPT
13#
14
15ifdef CONFIG_FULLDEBUG
16AFLAGS += -DDEBUGGER_COMPATIBLE_CACHE=1
17endif
18
19obj-$(CONFIG_COLDFIRE) += dma.o entry.o vectors.o
20obj-$(CONFIG_M5206) += timers.o
21obj-$(CONFIG_M5206e) += timers.o
22obj-$(CONFIG_M520x) += pit.o
23obj-$(CONFIG_M523x) += pit.o
24obj-$(CONFIG_M5249) += timers.o
25obj-$(CONFIG_M527x) += pit.o
26obj-$(CONFIG_M5272) += timers.o
27obj-$(CONFIG_M528x) += pit.o
28obj-$(CONFIG_M5307) += timers.o
29obj-$(CONFIG_M532x) += timers.o
30obj-$(CONFIG_M5407) += timers.o
31
32extra-y := head.o
diff --git a/arch/m68knommu/platform/coldfire/dma.c b/arch/m68knommu/platform/coldfire/dma.c
new file mode 100644
index 000000000000..2b30cf1b8f77
--- /dev/null
+++ b/arch/m68knommu/platform/coldfire/dma.c
@@ -0,0 +1,39 @@
1/***************************************************************************/
2
3/*
4 * dma.c -- Freescale ColdFire DMA support
5 *
6 * Copyright (C) 2007, Greg Ungerer (gerg@snapgear.com)
7 */
8
9/***************************************************************************/
10
11#include <linux/kernel.h>
12#include <asm/dma.h>
13#include <asm/coldfire.h>
14#include <asm/mcfsim.h>
15#include <asm/mcfdma.h>
16
17/***************************************************************************/
18
19/*
20 * DMA channel base address table.
21 */
22unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
23#ifdef MCFDMA_BASE0
24 MCF_MBAR + MCFDMA_BASE0,
25#endif
26#ifdef MCFDMA_BASE1
27 MCF_MBAR + MCFDMA_BASE1,
28#endif
29#ifdef MCFDMA_BASE2
30 MCF_MBAR + MCFDMA_BASE2,
31#endif
32#ifdef MCFDMA_BASE3
33 MCF_MBAR + MCFDMA_BASE3,
34#endif
35};
36
37unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
38
39/***************************************************************************/
diff --git a/arch/m68knommu/platform/5307/entry.S b/arch/m68knommu/platform/coldfire/entry.S
index b333731b875a..b333731b875a 100644
--- a/arch/m68knommu/platform/5307/entry.S
+++ b/arch/m68knommu/platform/coldfire/entry.S
diff --git a/arch/m68knommu/platform/5307/head.S b/arch/m68knommu/platform/coldfire/head.S
index b9aa0ca29bfb..b9aa0ca29bfb 100644
--- a/arch/m68knommu/platform/5307/head.S
+++ b/arch/m68knommu/platform/coldfire/head.S
diff --git a/arch/m68knommu/platform/5307/pit.c b/arch/m68knommu/platform/coldfire/pit.c
index 173b754d1cda..4290638012e0 100644
--- a/arch/m68knommu/platform/5307/pit.c
+++ b/arch/m68knommu/platform/coldfire/pit.c
@@ -3,9 +3,10 @@
3/* 3/*
4 * pit.c -- Freescale ColdFire PIT timer. Currently this type of 4 * pit.c -- Freescale ColdFire PIT timer. Currently this type of
5 * hardware timer only exists in the Freescale ColdFire 5 * hardware timer only exists in the Freescale ColdFire
6 * 5270/5271, 5282 and other CPUs. 6 * 5270/5271, 5282 and 5208 CPUs. No doubt newer ColdFire
7 * family members will probably use it too.
7 * 8 *
8 * Copyright (C) 1999-2007, Greg Ungerer (gerg@snapgear.com) 9 * Copyright (C) 1999-2008, Greg Ungerer (gerg@snapgear.com)
9 * Copyright (C) 2001-2004, SnapGear Inc. (www.snapgear.com) 10 * Copyright (C) 2001-2004, SnapGear Inc. (www.snapgear.com)
10 */ 11 */
11 12
@@ -17,6 +18,7 @@
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/clocksource.h>
20#include <asm/machdep.h> 22#include <asm/machdep.h>
21#include <asm/io.h> 23#include <asm/io.h>
22#include <asm/coldfire.h> 24#include <asm/coldfire.h>
@@ -28,70 +30,84 @@
28/* 30/*
29 * By default use timer1 as the system clock timer. 31 * By default use timer1 as the system clock timer.
30 */ 32 */
33#define FREQ ((MCF_CLK / 2) / 64)
31#define TA(a) (MCF_IPSBAR + MCFPIT_BASE1 + (a)) 34#define TA(a) (MCF_IPSBAR + MCFPIT_BASE1 + (a))
35#define INTC0 (MCF_IPSBAR + MCFICM_INTC0)
36
37static u32 pit_cycles_per_jiffy;
38static u32 pit_cnt;
32 39
33/***************************************************************************/ 40/***************************************************************************/
34 41
35static irqreturn_t hw_tick(int irq, void *dummy) 42static irqreturn_t pit_tick(int irq, void *dummy)
36{ 43{
37 unsigned short pcsr; 44 u16 pcsr;
38 45
39 /* Reset the ColdFire timer */ 46 /* Reset the ColdFire timer */
40 pcsr = __raw_readw(TA(MCFPIT_PCSR)); 47 pcsr = __raw_readw(TA(MCFPIT_PCSR));
41 __raw_writew(pcsr | MCFPIT_PCSR_PIF, TA(MCFPIT_PCSR)); 48 __raw_writew(pcsr | MCFPIT_PCSR_PIF, TA(MCFPIT_PCSR));
42 49
50 pit_cnt += pit_cycles_per_jiffy;
43 return arch_timer_interrupt(irq, dummy); 51 return arch_timer_interrupt(irq, dummy);
44} 52}
45 53
46/***************************************************************************/ 54/***************************************************************************/
47 55
48static struct irqaction coldfire_pit_irq = { 56static struct irqaction pit_irq = {
49 .name = "timer", 57 .name = "timer",
50 .flags = IRQF_DISABLED | IRQF_TIMER, 58 .flags = IRQF_DISABLED | IRQF_TIMER,
51 .handler = hw_tick, 59 .handler = pit_tick,
52}; 60};
53 61
54void hw_timer_init(void) 62/***************************************************************************/
63
64static cycle_t pit_read_clk(void)
55{ 65{
56 volatile unsigned char *icrp; 66 unsigned long flags;
57 volatile unsigned long *imrp; 67 u32 cycles;
68 u16 pcntr;
58 69
59 setup_irq(MCFINT_VECBASE + MCFINT_PIT1, &coldfire_pit_irq); 70 local_irq_save(flags);
71 pcntr = __raw_readw(TA(MCFPIT_PCNTR));
72 cycles = pit_cnt;
73 local_irq_restore(flags);
60 74
61 icrp = (volatile unsigned char *) (MCF_IPSBAR + MCFICM_INTC0 + 75 return cycles + pit_cycles_per_jiffy - pcntr;
62 MCFINTC_ICR0 + MCFINT_PIT1); 76}
63 *icrp = ICR_INTRCONF;
64 77
65 imrp = (volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFPIT_IMR); 78/***************************************************************************/
66 *imrp &= ~MCFPIT_IMR_IBIT;
67 79
68 /* Set up PIT timer 1 as poll clock */ 80static struct clocksource pit_clk = {
69 __raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR)); 81 .name = "pit",
70 __raw_writew(((MCF_CLK / 2) / 64) / HZ, TA(MCFPIT_PMR)); 82 .rating = 250,
71 __raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | MCFPIT_PCSR_OVW | 83 .read = pit_read_clk,
72 MCFPIT_PCSR_RLD | MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR)); 84 .shift = 20,
73} 85 .mask = CLOCKSOURCE_MASK(32),
86 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
87};
74 88
75/***************************************************************************/ 89/***************************************************************************/
76 90
77unsigned long hw_timer_offset(void) 91void hw_timer_init(void)
78{ 92{
79 volatile unsigned long *ipr; 93 u32 imr;
80 unsigned long pmr, pcntr, offset;
81 94
82 ipr = (volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 + MCFPIT_IMR); 95 setup_irq(MCFINT_VECBASE + MCFINT_PIT1, &pit_irq);
83 96
84 pmr = __raw_readw(TA(MCFPIT_PMR)); 97 __raw_writeb(ICR_INTRCONF, INTC0 + MCFINTC_ICR0 + MCFINT_PIT1);
85 pcntr = __raw_readw(TA(MCFPIT_PCNTR)); 98 imr = __raw_readl(INTC0 + MCFPIT_IMR);
99 imr &= ~MCFPIT_IMR_IBIT;
100 __raw_writel(imr, INTC0 + MCFPIT_IMR);
101
102 /* Set up PIT timer 1 as poll clock */
103 pit_cycles_per_jiffy = FREQ / HZ;
104 __raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
105 __raw_writew(pit_cycles_per_jiffy, TA(MCFPIT_PMR));
106 __raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | MCFPIT_PCSR_OVW |
107 MCFPIT_PCSR_RLD | MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
86 108
87 /* 109 pit_clk.mult = clocksource_hz2mult(FREQ, pit_clk.shift);
88 * If we are still in the first half of the upcount and a 110 clocksource_register(&pit_clk);
89 * timer interrupt is pending, then add on a ticks worth of time.
90 */
91 offset = ((pmr - pcntr) * (1000000 / HZ)) / pmr;
92 if ((offset < (1000000 / HZ / 2)) && (*ipr & MCFPIT_IMR_IBIT))
93 offset += 1000000 / HZ;
94 return offset;
95} 111}
96 112
97/***************************************************************************/ 113/***************************************************************************/
diff --git a/arch/m68knommu/platform/5307/timers.c b/arch/m68knommu/platform/coldfire/timers.c
index 489dec85c859..a60213e877ef 100644
--- a/arch/m68knommu/platform/5307/timers.c
+++ b/arch/m68knommu/platform/coldfire/timers.c
@@ -3,7 +3,7 @@
3/* 3/*
4 * timers.c -- generic ColdFire hardware timer support. 4 * timers.c -- generic ColdFire hardware timer support.
5 * 5 *
6 * Copyright (C) 1999-2007, Greg Ungerer (gerg@snapgear.com) 6 * Copyright (C) 1999-2008, Greg Ungerer <gerg@snapgear.com>
7 */ 7 */
8 8
9/***************************************************************************/ 9/***************************************************************************/
@@ -13,6 +13,8 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/profile.h>
17#include <linux/clocksource.h>
16#include <asm/io.h> 18#include <asm/io.h>
17#include <asm/traps.h> 19#include <asm/traps.h>
18#include <asm/machdep.h> 20#include <asm/machdep.h>
@@ -25,6 +27,7 @@
25/* 27/*
26 * By default use timer1 as the system clock timer. 28 * By default use timer1 as the system clock timer.
27 */ 29 */
30#define FREQ (MCF_BUSCLK / 16)
28#define TA(a) (MCF_MBAR + MCFTIMER_BASE1 + (a)) 31#define TA(a) (MCF_MBAR + MCFTIMER_BASE1 + (a))
29 32
30/* 33/*
@@ -41,7 +44,7 @@ unsigned int mcf_timerlevel = 5;
41 * Unfortunately it is a little different on each ColdFire. 44 * Unfortunately it is a little different on each ColdFire.
42 */ 45 */
43extern void mcf_settimericr(int timer, int level); 46extern void mcf_settimericr(int timer, int level);
44extern int mcf_timerirqpending(int timer); 47void coldfire_profile_init(void);
45 48
46#if defined(CONFIG_M532x) 49#if defined(CONFIG_M532x)
47#define __raw_readtrr __raw_readl 50#define __raw_readtrr __raw_readl
@@ -51,38 +54,70 @@ extern int mcf_timerirqpending(int timer);
51#define __raw_writetrr __raw_writew 54#define __raw_writetrr __raw_writew
52#endif 55#endif
53 56
57static u32 mcftmr_cycles_per_jiffy;
58static u32 mcftmr_cnt;
59
54/***************************************************************************/ 60/***************************************************************************/
55 61
56static irqreturn_t hw_tick(int irq, void *dummy) 62static irqreturn_t mcftmr_tick(int irq, void *dummy)
57{ 63{
58 /* Reset the ColdFire timer */ 64 /* Reset the ColdFire timer */
59 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER)); 65 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER));
60 66
67 mcftmr_cnt += mcftmr_cycles_per_jiffy;
61 return arch_timer_interrupt(irq, dummy); 68 return arch_timer_interrupt(irq, dummy);
62} 69}
63 70
64/***************************************************************************/ 71/***************************************************************************/
65 72
66static struct irqaction coldfire_timer_irq = { 73static struct irqaction mcftmr_timer_irq = {
67 .name = "timer", 74 .name = "timer",
68 .flags = IRQF_DISABLED | IRQF_TIMER, 75 .flags = IRQF_DISABLED | IRQF_TIMER,
69 .handler = hw_tick, 76 .handler = mcftmr_tick,
70}; 77};
71 78
72/***************************************************************************/ 79/***************************************************************************/
73 80
74static int ticks_per_intr; 81static cycle_t mcftmr_read_clk(void)
82{
83 unsigned long flags;
84 u32 cycles;
85 u16 tcn;
86
87 local_irq_save(flags);
88 tcn = __raw_readw(TA(MCFTIMER_TCN));
89 cycles = mcftmr_cnt;
90 local_irq_restore(flags);
91
92 return cycles + tcn;
93}
94
95/***************************************************************************/
96
97static struct clocksource mcftmr_clk = {
98 .name = "tmr",
99 .rating = 250,
100 .read = mcftmr_read_clk,
101 .shift = 20,
102 .mask = CLOCKSOURCE_MASK(32),
103 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
104};
105
106/***************************************************************************/
75 107
76void hw_timer_init(void) 108void hw_timer_init(void)
77{ 109{
78 setup_irq(mcf_timervector, &coldfire_timer_irq); 110 setup_irq(mcf_timervector, &mcftmr_timer_irq);
79 111
80 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR)); 112 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
81 ticks_per_intr = (MCF_BUSCLK / 16) / HZ; 113 mcftmr_cycles_per_jiffy = FREQ / HZ;
82 __raw_writetrr(ticks_per_intr - 1, TA(MCFTIMER_TRR)); 114 __raw_writetrr(mcftmr_cycles_per_jiffy, TA(MCFTIMER_TRR));
83 __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 | 115 __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
84 MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR)); 116 MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR));
85 117
118 mcftmr_clk.mult = clocksource_hz2mult(FREQ, mcftmr_clk.shift);
119 clocksource_register(&mcftmr_clk);
120
86 mcf_settimericr(1, mcf_timerlevel); 121 mcf_settimericr(1, mcf_timerlevel);
87 122
88#ifdef CONFIG_HIGHPROFILE 123#ifdef CONFIG_HIGHPROFILE
@@ -91,21 +126,6 @@ void hw_timer_init(void)
91} 126}
92 127
93/***************************************************************************/ 128/***************************************************************************/
94
95unsigned long hw_timer_offset(void)
96{
97 unsigned long tcn, offset;
98
99 tcn = __raw_readw(TA(MCFTIMER_TCN));
100 offset = ((tcn + 1) * (1000000 / HZ)) / ticks_per_intr;
101
102 /* Check if we just wrapped the counters and maybe missed a tick */
103 if ((offset < (1000000 / HZ / 2)) && mcf_timerirqpending(1))
104 offset += 1000000 / HZ;
105 return offset;
106}
107
108/***************************************************************************/
109#ifdef CONFIG_HIGHPROFILE 129#ifdef CONFIG_HIGHPROFILE
110/***************************************************************************/ 130/***************************************************************************/
111 131
diff --git a/arch/m68knommu/platform/5307/vectors.c b/arch/m68knommu/platform/coldfire/vectors.c
index 6cf894620234..6cf894620234 100644
--- a/arch/m68knommu/platform/5307/vectors.c
+++ b/arch/m68knommu/platform/coldfire/vectors.c
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index c5cfd4b04a83..5803f11c77fc 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -184,7 +184,7 @@ static void pci_dma_dev_setup_pasemi(struct pci_dev *dev)
184 if (dev->vendor == 0x1959 && dev->device == 0xa007 && 184 if (dev->vendor == 0x1959 && dev->device == 0xa007 &&
185 !firmware_has_feature(FW_FEATURE_LPAR)) { 185 !firmware_has_feature(FW_FEATURE_LPAR)) {
186 dev->dev.archdata.dma_ops = &dma_direct_ops; 186 dev->dev.archdata.dma_ops = &dma_direct_ops;
187 dev->dev.archdata.dma_data = 0; 187 return;
188 } 188 }
189#endif 189#endif
190 190
diff --git a/arch/sparc/lib/rwsem.S b/arch/sparc/lib/rwsem.S
index 20657744c864..f406b1f22791 100644
--- a/arch/sparc/lib/rwsem.S
+++ b/arch/sparc/lib/rwsem.S
@@ -7,7 +7,7 @@
7#include <asm/ptrace.h> 7#include <asm/ptrace.h>
8#include <asm/psr.h> 8#include <asm/psr.h>
9 9
10 .section .sched.text 10 .section .sched.text, "ax"
11 .align 4 11 .align 4
12 12
13 .globl ___down_read 13 .globl ___down_read
diff --git a/arch/sparc64/lib/GENbzero.S b/arch/sparc64/lib/GENbzero.S
index f9c71d64eba1..6a4f956a2f7a 100644
--- a/arch/sparc64/lib/GENbzero.S
+++ b/arch/sparc64/lib/GENbzero.S
@@ -10,7 +10,7 @@
10 .align 4; \ 10 .align 4; \
1199: retl; \ 1199: retl; \
12 mov %o1, %o0; \ 12 mov %o1, %o0; \
13 .section __ex_table; \ 13 .section __ex_table,"a";\
14 .align 4; \ 14 .align 4; \
15 .word 98b, 99b; \ 15 .word 98b, 99b; \
16 .text; \ 16 .text; \
diff --git a/arch/sparc64/lib/NGbzero.S b/arch/sparc64/lib/NGbzero.S
index f10e4529ee37..814d5f7a45e1 100644
--- a/arch/sparc64/lib/NGbzero.S
+++ b/arch/sparc64/lib/NGbzero.S
@@ -10,7 +10,7 @@
10 .align 4; \ 10 .align 4; \
1199: retl; \ 1199: retl; \
12 mov %o1, %o0; \ 12 mov %o1, %o0; \
13 .section __ex_table; \ 13 .section __ex_table,"a";\
14 .align 4; \ 14 .align 4; \
15 .word 98b, 99b; \ 15 .word 98b, 99b; \
16 .text; \ 16 .text; \
diff --git a/arch/sparc64/lib/rwsem.S b/arch/sparc64/lib/rwsem.S
index 75f0e6b951d6..1a4cc5654de4 100644
--- a/arch/sparc64/lib/rwsem.S
+++ b/arch/sparc64/lib/rwsem.S
@@ -6,7 +6,7 @@
6 6
7#include <asm/rwsem-const.h> 7#include <asm/rwsem-const.h>
8 8
9 .section .sched.text 9 .section .sched.text, "ax"
10 10
11 .globl __down_read 11 .globl __down_read
12__down_read: 12__down_read:
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index da8f4129780b..8978e98bed5b 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -143,7 +143,7 @@ mcore-$(CONFIG_X86_ES7000) := arch/x86/mach-default/
143 143
144# RDC R-321x subarch support 144# RDC R-321x subarch support
145mflags-$(CONFIG_X86_RDC321X) := -Iinclude/asm-x86/mach-rdc321x 145mflags-$(CONFIG_X86_RDC321X) := -Iinclude/asm-x86/mach-rdc321x
146mcore-$(CONFIG_X86_RDC321X) := arch/x86/mach-default 146mcore-$(CONFIG_X86_RDC321X) := arch/x86/mach-default/
147core-$(CONFIG_X86_RDC321X) += arch/x86/mach-rdc321x/ 147core-$(CONFIG_X86_RDC321X) += arch/x86/mach-rdc321x/
148 148
149# default subarch .h files 149# default subarch .h files
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 34aebc6e7589..8b552c6dd2e7 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -56,8 +56,8 @@
56 56
57#define DRV_MODULE_NAME "bnx2" 57#define DRV_MODULE_NAME "bnx2"
58#define PFX DRV_MODULE_NAME ": " 58#define PFX DRV_MODULE_NAME ": "
59#define DRV_MODULE_VERSION "1.7.2" 59#define DRV_MODULE_VERSION "1.7.3"
60#define DRV_MODULE_RELDATE "January 21, 2008" 60#define DRV_MODULE_RELDATE "January 29, 2008"
61 61
62#define RUN_AT(x) (jiffies + (x)) 62#define RUN_AT(x) (jiffies + (x))
63 63
@@ -266,6 +266,18 @@ bnx2_reg_wr_ind(struct bnx2 *bp, u32 offset, u32 val)
266} 266}
267 267
268static void 268static void
269bnx2_shmem_wr(struct bnx2 *bp, u32 offset, u32 val)
270{
271 bnx2_reg_wr_ind(bp, bp->shmem_base + offset, val);
272}
273
274static u32
275bnx2_shmem_rd(struct bnx2 *bp, u32 offset)
276{
277 return (bnx2_reg_rd_ind(bp, bp->shmem_base + offset));
278}
279
280static void
269bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val) 281bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val)
270{ 282{
271 offset += cid_addr; 283 offset += cid_addr;
@@ -685,7 +697,7 @@ bnx2_report_fw_link(struct bnx2 *bp)
685 else 697 else
686 fw_link_status = BNX2_LINK_STATUS_LINK_DOWN; 698 fw_link_status = BNX2_LINK_STATUS_LINK_DOWN;
687 699
688 REG_WR_IND(bp, bp->shmem_base + BNX2_LINK_STATUS, fw_link_status); 700 bnx2_shmem_wr(bp, BNX2_LINK_STATUS, fw_link_status);
689} 701}
690 702
691static char * 703static char *
@@ -980,6 +992,42 @@ bnx2_copper_linkup(struct bnx2 *bp)
980 return 0; 992 return 0;
981} 993}
982 994
995static void
996bnx2_init_rx_context0(struct bnx2 *bp)
997{
998 u32 val, rx_cid_addr = GET_CID_ADDR(RX_CID);
999
1000 val = BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_VALUE;
1001 val |= BNX2_L2CTX_CTX_TYPE_SIZE_L2;
1002 val |= 0x02 << 8;
1003
1004 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
1005 u32 lo_water, hi_water;
1006
1007 if (bp->flow_ctrl & FLOW_CTRL_TX)
1008 lo_water = BNX2_L2CTX_LO_WATER_MARK_DEFAULT;
1009 else
1010 lo_water = BNX2_L2CTX_LO_WATER_MARK_DIS;
1011 if (lo_water >= bp->rx_ring_size)
1012 lo_water = 0;
1013
1014 hi_water = bp->rx_ring_size / 4;
1015
1016 if (hi_water <= lo_water)
1017 lo_water = 0;
1018
1019 hi_water /= BNX2_L2CTX_HI_WATER_MARK_SCALE;
1020 lo_water /= BNX2_L2CTX_LO_WATER_MARK_SCALE;
1021
1022 if (hi_water > 0xf)
1023 hi_water = 0xf;
1024 else if (hi_water == 0)
1025 lo_water = 0;
1026 val |= lo_water | (hi_water << BNX2_L2CTX_HI_WATER_MARK_SHIFT);
1027 }
1028 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_CTX_TYPE, val);
1029}
1030
983static int 1031static int
984bnx2_set_mac_link(struct bnx2 *bp) 1032bnx2_set_mac_link(struct bnx2 *bp)
985{ 1033{
@@ -1044,6 +1092,9 @@ bnx2_set_mac_link(struct bnx2 *bp)
1044 /* Acknowledge the interrupt. */ 1092 /* Acknowledge the interrupt. */
1045 REG_WR(bp, BNX2_EMAC_STATUS, BNX2_EMAC_STATUS_LINK_CHANGE); 1093 REG_WR(bp, BNX2_EMAC_STATUS, BNX2_EMAC_STATUS_LINK_CHANGE);
1046 1094
1095 if (CHIP_NUM(bp) == CHIP_NUM_5709)
1096 bnx2_init_rx_context0(bp);
1097
1047 return 0; 1098 return 0;
1048} 1099}
1049 1100
@@ -1378,14 +1429,14 @@ bnx2_setup_remote_phy(struct bnx2 *bp, u8 port)
1378 1429
1379 if (pause_adv & (ADVERTISE_1000XPAUSE | ADVERTISE_PAUSE_CAP)) 1430 if (pause_adv & (ADVERTISE_1000XPAUSE | ADVERTISE_PAUSE_CAP))
1380 speed_arg |= BNX2_NETLINK_SET_LINK_FC_SYM_PAUSE; 1431 speed_arg |= BNX2_NETLINK_SET_LINK_FC_SYM_PAUSE;
1381 if (pause_adv & (ADVERTISE_1000XPSE_ASYM | ADVERTISE_1000XPSE_ASYM)) 1432 if (pause_adv & (ADVERTISE_1000XPSE_ASYM | ADVERTISE_PAUSE_ASYM))
1382 speed_arg |= BNX2_NETLINK_SET_LINK_FC_ASYM_PAUSE; 1433 speed_arg |= BNX2_NETLINK_SET_LINK_FC_ASYM_PAUSE;
1383 1434
1384 if (port == PORT_TP) 1435 if (port == PORT_TP)
1385 speed_arg |= BNX2_NETLINK_SET_LINK_PHY_APP_REMOTE | 1436 speed_arg |= BNX2_NETLINK_SET_LINK_PHY_APP_REMOTE |
1386 BNX2_NETLINK_SET_LINK_ETH_AT_WIRESPEED; 1437 BNX2_NETLINK_SET_LINK_ETH_AT_WIRESPEED;
1387 1438
1388 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_MB_ARG0, speed_arg); 1439 bnx2_shmem_wr(bp, BNX2_DRV_MB_ARG0, speed_arg);
1389 1440
1390 spin_unlock_bh(&bp->phy_lock); 1441 spin_unlock_bh(&bp->phy_lock);
1391 bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_CMD_SET_LINK, 0); 1442 bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_CMD_SET_LINK, 0);
@@ -1530,9 +1581,9 @@ bnx2_set_default_remote_link(struct bnx2 *bp)
1530 u32 link; 1581 u32 link;
1531 1582
1532 if (bp->phy_port == PORT_TP) 1583 if (bp->phy_port == PORT_TP)
1533 link = REG_RD_IND(bp, bp->shmem_base + BNX2_RPHY_COPPER_LINK); 1584 link = bnx2_shmem_rd(bp, BNX2_RPHY_COPPER_LINK);
1534 else 1585 else
1535 link = REG_RD_IND(bp, bp->shmem_base + BNX2_RPHY_SERDES_LINK); 1586 link = bnx2_shmem_rd(bp, BNX2_RPHY_SERDES_LINK);
1536 1587
1537 if (link & BNX2_NETLINK_SET_LINK_ENABLE_AUTONEG) { 1588 if (link & BNX2_NETLINK_SET_LINK_ENABLE_AUTONEG) {
1538 bp->req_line_speed = 0; 1589 bp->req_line_speed = 0;
@@ -1584,7 +1635,7 @@ bnx2_set_default_link(struct bnx2 *bp)
1584 1635
1585 bp->advertising = ETHTOOL_ALL_FIBRE_SPEED | ADVERTISED_Autoneg; 1636 bp->advertising = ETHTOOL_ALL_FIBRE_SPEED | ADVERTISED_Autoneg;
1586 1637
1587 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_CONFIG); 1638 reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_CONFIG);
1588 reg &= BNX2_PORT_HW_CFG_CFG_DFLT_LINK_MASK; 1639 reg &= BNX2_PORT_HW_CFG_CFG_DFLT_LINK_MASK;
1589 if (reg == BNX2_PORT_HW_CFG_CFG_DFLT_LINK_1G) { 1640 if (reg == BNX2_PORT_HW_CFG_CFG_DFLT_LINK_1G) {
1590 bp->autoneg = 0; 1641 bp->autoneg = 0;
@@ -1616,7 +1667,7 @@ bnx2_remote_phy_event(struct bnx2 *bp)
1616 u8 link_up = bp->link_up; 1667 u8 link_up = bp->link_up;
1617 u8 old_port; 1668 u8 old_port;
1618 1669
1619 msg = REG_RD_IND(bp, bp->shmem_base + BNX2_LINK_STATUS); 1670 msg = bnx2_shmem_rd(bp, BNX2_LINK_STATUS);
1620 1671
1621 if (msg & BNX2_LINK_STATUS_HEART_BEAT_EXPIRED) 1672 if (msg & BNX2_LINK_STATUS_HEART_BEAT_EXPIRED)
1622 bnx2_send_heart_beat(bp); 1673 bnx2_send_heart_beat(bp);
@@ -1693,7 +1744,7 @@ bnx2_set_remote_link(struct bnx2 *bp)
1693{ 1744{
1694 u32 evt_code; 1745 u32 evt_code;
1695 1746
1696 evt_code = REG_RD_IND(bp, bp->shmem_base + BNX2_FW_EVT_CODE_MB); 1747 evt_code = bnx2_shmem_rd(bp, BNX2_FW_EVT_CODE_MB);
1697 switch (evt_code) { 1748 switch (evt_code) {
1698 case BNX2_FW_EVT_CODE_LINK_EVENT: 1749 case BNX2_FW_EVT_CODE_LINK_EVENT:
1699 bnx2_remote_phy_event(bp); 1750 bnx2_remote_phy_event(bp);
@@ -1905,14 +1956,13 @@ bnx2_init_5708s_phy(struct bnx2 *bp)
1905 bnx2_write_phy(bp, BCM5708S_BLK_ADDR, BCM5708S_BLK_ADDR_DIG); 1956 bnx2_write_phy(bp, BCM5708S_BLK_ADDR, BCM5708S_BLK_ADDR_DIG);
1906 } 1957 }
1907 1958
1908 val = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_CONFIG) & 1959 val = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_CONFIG) &
1909 BNX2_PORT_HW_CFG_CFG_TXCTL3_MASK; 1960 BNX2_PORT_HW_CFG_CFG_TXCTL3_MASK;
1910 1961
1911 if (val) { 1962 if (val) {
1912 u32 is_backplane; 1963 u32 is_backplane;
1913 1964
1914 is_backplane = REG_RD_IND(bp, bp->shmem_base + 1965 is_backplane = bnx2_shmem_rd(bp, BNX2_SHARED_HW_CFG_CONFIG);
1915 BNX2_SHARED_HW_CFG_CONFIG);
1916 if (is_backplane & BNX2_SHARED_HW_CFG_PHY_BACKPLANE) { 1966 if (is_backplane & BNX2_SHARED_HW_CFG_PHY_BACKPLANE) {
1917 bnx2_write_phy(bp, BCM5708S_BLK_ADDR, 1967 bnx2_write_phy(bp, BCM5708S_BLK_ADDR,
1918 BCM5708S_BLK_ADDR_TX_MISC); 1968 BCM5708S_BLK_ADDR_TX_MISC);
@@ -2111,13 +2161,13 @@ bnx2_fw_sync(struct bnx2 *bp, u32 msg_data, int silent)
2111 bp->fw_wr_seq++; 2161 bp->fw_wr_seq++;
2112 msg_data |= bp->fw_wr_seq; 2162 msg_data |= bp->fw_wr_seq;
2113 2163
2114 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_MB, msg_data); 2164 bnx2_shmem_wr(bp, BNX2_DRV_MB, msg_data);
2115 2165
2116 /* wait for an acknowledgement. */ 2166 /* wait for an acknowledgement. */
2117 for (i = 0; i < (FW_ACK_TIME_OUT_MS / 10); i++) { 2167 for (i = 0; i < (FW_ACK_TIME_OUT_MS / 10); i++) {
2118 msleep(10); 2168 msleep(10);
2119 2169
2120 val = REG_RD_IND(bp, bp->shmem_base + BNX2_FW_MB); 2170 val = bnx2_shmem_rd(bp, BNX2_FW_MB);
2121 2171
2122 if ((val & BNX2_FW_MSG_ACK) == (msg_data & BNX2_DRV_MSG_SEQ)) 2172 if ((val & BNX2_FW_MSG_ACK) == (msg_data & BNX2_DRV_MSG_SEQ))
2123 break; 2173 break;
@@ -2134,7 +2184,7 @@ bnx2_fw_sync(struct bnx2 *bp, u32 msg_data, int silent)
2134 msg_data &= ~BNX2_DRV_MSG_CODE; 2184 msg_data &= ~BNX2_DRV_MSG_CODE;
2135 msg_data |= BNX2_DRV_MSG_CODE_FW_TIMEOUT; 2185 msg_data |= BNX2_DRV_MSG_CODE_FW_TIMEOUT;
2136 2186
2137 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_MB, msg_data); 2187 bnx2_shmem_wr(bp, BNX2_DRV_MB, msg_data);
2138 2188
2139 return -EBUSY; 2189 return -EBUSY;
2140 } 2190 }
@@ -2226,7 +2276,7 @@ bnx2_init_context(struct bnx2 *bp)
2226 2276
2227 /* Zero out the context. */ 2277 /* Zero out the context. */
2228 for (offset = 0; offset < PHY_CTX_SIZE; offset += 4) 2278 for (offset = 0; offset < PHY_CTX_SIZE; offset += 4)
2229 CTX_WR(bp, vcid_addr, offset, 0); 2279 bnx2_ctx_wr(bp, vcid_addr, offset, 0);
2230 } 2280 }
2231 } 2281 }
2232} 2282}
@@ -2251,11 +2301,12 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)
2251 good_mbuf_cnt = 0; 2301 good_mbuf_cnt = 0;
2252 2302
2253 /* Allocate a bunch of mbufs and save the good ones in an array. */ 2303 /* Allocate a bunch of mbufs and save the good ones in an array. */
2254 val = REG_RD_IND(bp, BNX2_RBUF_STATUS1); 2304 val = bnx2_reg_rd_ind(bp, BNX2_RBUF_STATUS1);
2255 while (val & BNX2_RBUF_STATUS1_FREE_COUNT) { 2305 while (val & BNX2_RBUF_STATUS1_FREE_COUNT) {
2256 REG_WR_IND(bp, BNX2_RBUF_COMMAND, BNX2_RBUF_COMMAND_ALLOC_REQ); 2306 bnx2_reg_wr_ind(bp, BNX2_RBUF_COMMAND,
2307 BNX2_RBUF_COMMAND_ALLOC_REQ);
2257 2308
2258 val = REG_RD_IND(bp, BNX2_RBUF_FW_BUF_ALLOC); 2309 val = bnx2_reg_rd_ind(bp, BNX2_RBUF_FW_BUF_ALLOC);
2259 2310
2260 val &= BNX2_RBUF_FW_BUF_ALLOC_VALUE; 2311 val &= BNX2_RBUF_FW_BUF_ALLOC_VALUE;
2261 2312
@@ -2265,7 +2316,7 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)
2265 good_mbuf_cnt++; 2316 good_mbuf_cnt++;
2266 } 2317 }
2267 2318
2268 val = REG_RD_IND(bp, BNX2_RBUF_STATUS1); 2319 val = bnx2_reg_rd_ind(bp, BNX2_RBUF_STATUS1);
2269 } 2320 }
2270 2321
2271 /* Free the good ones back to the mbuf pool thus discarding 2322 /* Free the good ones back to the mbuf pool thus discarding
@@ -2276,7 +2327,7 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)
2276 val = good_mbuf[good_mbuf_cnt]; 2327 val = good_mbuf[good_mbuf_cnt];
2277 val = (val << 9) | val | 1; 2328 val = (val << 9) | val | 1;
2278 2329
2279 REG_WR_IND(bp, BNX2_RBUF_FW_BUF_FREE, val); 2330 bnx2_reg_wr_ind(bp, BNX2_RBUF_FW_BUF_FREE, val);
2280 } 2331 }
2281 kfree(good_mbuf); 2332 kfree(good_mbuf);
2282 return 0; 2333 return 0;
@@ -3151,10 +3202,10 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3151 int rc; 3202 int rc;
3152 3203
3153 /* Halt the CPU. */ 3204 /* Halt the CPU. */
3154 val = REG_RD_IND(bp, cpu_reg->mode); 3205 val = bnx2_reg_rd_ind(bp, cpu_reg->mode);
3155 val |= cpu_reg->mode_value_halt; 3206 val |= cpu_reg->mode_value_halt;
3156 REG_WR_IND(bp, cpu_reg->mode, val); 3207 bnx2_reg_wr_ind(bp, cpu_reg->mode, val);
3157 REG_WR_IND(bp, cpu_reg->state, cpu_reg->state_value_clear); 3208 bnx2_reg_wr_ind(bp, cpu_reg->state, cpu_reg->state_value_clear);
3158 3209
3159 /* Load the Text area. */ 3210 /* Load the Text area. */
3160 offset = cpu_reg->spad_base + (fw->text_addr - cpu_reg->mips_view_base); 3211 offset = cpu_reg->spad_base + (fw->text_addr - cpu_reg->mips_view_base);
@@ -3167,7 +3218,7 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3167 return rc; 3218 return rc;
3168 3219
3169 for (j = 0; j < (fw->text_len / 4); j++, offset += 4) { 3220 for (j = 0; j < (fw->text_len / 4); j++, offset += 4) {
3170 REG_WR_IND(bp, offset, le32_to_cpu(fw->text[j])); 3221 bnx2_reg_wr_ind(bp, offset, le32_to_cpu(fw->text[j]));
3171 } 3222 }
3172 } 3223 }
3173 3224
@@ -3177,7 +3228,7 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3177 int j; 3228 int j;
3178 3229
3179 for (j = 0; j < (fw->data_len / 4); j++, offset += 4) { 3230 for (j = 0; j < (fw->data_len / 4); j++, offset += 4) {
3180 REG_WR_IND(bp, offset, fw->data[j]); 3231 bnx2_reg_wr_ind(bp, offset, fw->data[j]);
3181 } 3232 }
3182 } 3233 }
3183 3234
@@ -3187,7 +3238,7 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3187 int j; 3238 int j;
3188 3239
3189 for (j = 0; j < (fw->sbss_len / 4); j++, offset += 4) { 3240 for (j = 0; j < (fw->sbss_len / 4); j++, offset += 4) {
3190 REG_WR_IND(bp, offset, 0); 3241 bnx2_reg_wr_ind(bp, offset, 0);
3191 } 3242 }
3192 } 3243 }
3193 3244
@@ -3197,7 +3248,7 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3197 int j; 3248 int j;
3198 3249
3199 for (j = 0; j < (fw->bss_len/4); j++, offset += 4) { 3250 for (j = 0; j < (fw->bss_len/4); j++, offset += 4) {
3200 REG_WR_IND(bp, offset, 0); 3251 bnx2_reg_wr_ind(bp, offset, 0);
3201 } 3252 }
3202 } 3253 }
3203 3254
@@ -3208,19 +3259,19 @@ load_cpu_fw(struct bnx2 *bp, struct cpu_reg *cpu_reg, struct fw_info *fw)
3208 int j; 3259 int j;
3209 3260
3210 for (j = 0; j < (fw->rodata_len / 4); j++, offset += 4) { 3261 for (j = 0; j < (fw->rodata_len / 4); j++, offset += 4) {
3211 REG_WR_IND(bp, offset, fw->rodata[j]); 3262 bnx2_reg_wr_ind(bp, offset, fw->rodata[j]);
3212 } 3263 }
3213 } 3264 }
3214 3265
3215 /* Clear the pre-fetch instruction. */ 3266 /* Clear the pre-fetch instruction. */
3216 REG_WR_IND(bp, cpu_reg->inst, 0); 3267 bnx2_reg_wr_ind(bp, cpu_reg->inst, 0);
3217 REG_WR_IND(bp, cpu_reg->pc, fw->start_addr); 3268 bnx2_reg_wr_ind(bp, cpu_reg->pc, fw->start_addr);
3218 3269
3219 /* Start the CPU. */ 3270 /* Start the CPU. */
3220 val = REG_RD_IND(bp, cpu_reg->mode); 3271 val = bnx2_reg_rd_ind(bp, cpu_reg->mode);
3221 val &= ~cpu_reg->mode_value_halt; 3272 val &= ~cpu_reg->mode_value_halt;
3222 REG_WR_IND(bp, cpu_reg->state, cpu_reg->state_value_clear); 3273 bnx2_reg_wr_ind(bp, cpu_reg->state, cpu_reg->state_value_clear);
3223 REG_WR_IND(bp, cpu_reg->mode, val); 3274 bnx2_reg_wr_ind(bp, cpu_reg->mode, val);
3224 3275
3225 return 0; 3276 return 0;
3226} 3277}
@@ -3833,7 +3884,7 @@ bnx2_init_nvram(struct bnx2 *bp)
3833 } 3884 }
3834 3885
3835get_flash_size: 3886get_flash_size:
3836 val = REG_RD_IND(bp, bp->shmem_base + BNX2_SHARED_HW_CFG_CONFIG2); 3887 val = bnx2_shmem_rd(bp, BNX2_SHARED_HW_CFG_CONFIG2);
3837 val &= BNX2_SHARED_HW_CFG2_NVM_SIZE_MASK; 3888 val &= BNX2_SHARED_HW_CFG2_NVM_SIZE_MASK;
3838 if (val) 3889 if (val)
3839 bp->flash_size = val; 3890 bp->flash_size = val;
@@ -4142,14 +4193,14 @@ bnx2_init_remote_phy(struct bnx2 *bp)
4142 if (!(bp->phy_flags & BNX2_PHY_FLAG_SERDES)) 4193 if (!(bp->phy_flags & BNX2_PHY_FLAG_SERDES))
4143 return; 4194 return;
4144 4195
4145 val = REG_RD_IND(bp, bp->shmem_base + BNX2_FW_CAP_MB); 4196 val = bnx2_shmem_rd(bp, BNX2_FW_CAP_MB);
4146 if ((val & BNX2_FW_CAP_SIGNATURE_MASK) != BNX2_FW_CAP_SIGNATURE) 4197 if ((val & BNX2_FW_CAP_SIGNATURE_MASK) != BNX2_FW_CAP_SIGNATURE)
4147 return; 4198 return;
4148 4199
4149 if (val & BNX2_FW_CAP_REMOTE_PHY_CAPABLE) { 4200 if (val & BNX2_FW_CAP_REMOTE_PHY_CAPABLE) {
4150 bp->phy_flags |= BNX2_PHY_FLAG_REMOTE_PHY_CAP; 4201 bp->phy_flags |= BNX2_PHY_FLAG_REMOTE_PHY_CAP;
4151 4202
4152 val = REG_RD_IND(bp, bp->shmem_base + BNX2_LINK_STATUS); 4203 val = bnx2_shmem_rd(bp, BNX2_LINK_STATUS);
4153 if (val & BNX2_LINK_STATUS_SERDES_LINK) 4204 if (val & BNX2_LINK_STATUS_SERDES_LINK)
4154 bp->phy_port = PORT_FIBRE; 4205 bp->phy_port = PORT_FIBRE;
4155 else 4206 else
@@ -4167,8 +4218,7 @@ bnx2_init_remote_phy(struct bnx2 *bp)
4167 } 4218 }
4168 sig = BNX2_DRV_ACK_CAP_SIGNATURE | 4219 sig = BNX2_DRV_ACK_CAP_SIGNATURE |
4169 BNX2_FW_CAP_REMOTE_PHY_CAPABLE; 4220 BNX2_FW_CAP_REMOTE_PHY_CAPABLE;
4170 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_ACK_CAP_MB, 4221 bnx2_shmem_wr(bp, BNX2_DRV_ACK_CAP_MB, sig);
4171 sig);
4172 } 4222 }
4173 } 4223 }
4174} 4224}
@@ -4204,8 +4254,8 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
4204 4254
4205 /* Deposit a driver reset signature so the firmware knows that 4255 /* Deposit a driver reset signature so the firmware knows that
4206 * this is a soft reset. */ 4256 * this is a soft reset. */
4207 REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_RESET_SIGNATURE, 4257 bnx2_shmem_wr(bp, BNX2_DRV_RESET_SIGNATURE,
4208 BNX2_DRV_RESET_SIGNATURE_MAGIC); 4258 BNX2_DRV_RESET_SIGNATURE_MAGIC);
4209 4259
4210 /* Do a dummy read to force the chip to complete all current transaction 4260 /* Do a dummy read to force the chip to complete all current transaction
4211 * before we issue a reset. */ 4261 * before we issue a reset. */
@@ -4438,18 +4488,21 @@ bnx2_init_chip(struct bnx2 *bp)
4438 } 4488 }
4439 4489
4440 if (bp->flags & BNX2_FLAG_USING_MSIX) { 4490 if (bp->flags & BNX2_FLAG_USING_MSIX) {
4491 u32 base = ((BNX2_TX_VEC - 1) * BNX2_HC_SB_CONFIG_SIZE) +
4492 BNX2_HC_SB_CONFIG_1;
4493
4441 REG_WR(bp, BNX2_HC_MSIX_BIT_VECTOR, 4494 REG_WR(bp, BNX2_HC_MSIX_BIT_VECTOR,
4442 BNX2_HC_MSIX_BIT_VECTOR_VAL); 4495 BNX2_HC_MSIX_BIT_VECTOR_VAL);
4443 4496
4444 REG_WR(bp, BNX2_HC_SB_CONFIG_1, 4497 REG_WR(bp, base,
4445 BNX2_HC_SB_CONFIG_1_TX_TMR_MODE | 4498 BNX2_HC_SB_CONFIG_1_TX_TMR_MODE |
4446 BNX2_HC_SB_CONFIG_1_ONE_SHOT); 4499 BNX2_HC_SB_CONFIG_1_ONE_SHOT);
4447 4500
4448 REG_WR(bp, BNX2_HC_TX_QUICK_CONS_TRIP_1, 4501 REG_WR(bp, base + BNX2_HC_TX_QUICK_CONS_TRIP_OFF,
4449 (bp->tx_quick_cons_trip_int << 16) | 4502 (bp->tx_quick_cons_trip_int << 16) |
4450 bp->tx_quick_cons_trip); 4503 bp->tx_quick_cons_trip);
4451 4504
4452 REG_WR(bp, BNX2_HC_TX_TICKS_1, 4505 REG_WR(bp, base + BNX2_HC_TX_TICKS_OFF,
4453 (bp->tx_ticks_int << 16) | bp->tx_ticks); 4506 (bp->tx_ticks_int << 16) | bp->tx_ticks);
4454 4507
4455 val |= BNX2_HC_CONFIG_SB_ADDR_INC_128B; 4508 val |= BNX2_HC_CONFIG_SB_ADDR_INC_128B;
@@ -4509,6 +4562,7 @@ static void
4509bnx2_init_tx_context(struct bnx2 *bp, u32 cid) 4562bnx2_init_tx_context(struct bnx2 *bp, u32 cid)
4510{ 4563{
4511 u32 val, offset0, offset1, offset2, offset3; 4564 u32 val, offset0, offset1, offset2, offset3;
4565 u32 cid_addr = GET_CID_ADDR(cid);
4512 4566
4513 if (CHIP_NUM(bp) == CHIP_NUM_5709) { 4567 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
4514 offset0 = BNX2_L2CTX_TYPE_XI; 4568 offset0 = BNX2_L2CTX_TYPE_XI;
@@ -4522,16 +4576,16 @@ bnx2_init_tx_context(struct bnx2 *bp, u32 cid)
4522 offset3 = BNX2_L2CTX_TBDR_BHADDR_LO; 4576 offset3 = BNX2_L2CTX_TBDR_BHADDR_LO;
4523 } 4577 }
4524 val = BNX2_L2CTX_TYPE_TYPE_L2 | BNX2_L2CTX_TYPE_SIZE_L2; 4578 val = BNX2_L2CTX_TYPE_TYPE_L2 | BNX2_L2CTX_TYPE_SIZE_L2;
4525 CTX_WR(bp, GET_CID_ADDR(cid), offset0, val); 4579 bnx2_ctx_wr(bp, cid_addr, offset0, val);
4526 4580
4527 val = BNX2_L2CTX_CMD_TYPE_TYPE_L2 | (8 << 16); 4581 val = BNX2_L2CTX_CMD_TYPE_TYPE_L2 | (8 << 16);
4528 CTX_WR(bp, GET_CID_ADDR(cid), offset1, val); 4582 bnx2_ctx_wr(bp, cid_addr, offset1, val);
4529 4583
4530 val = (u64) bp->tx_desc_mapping >> 32; 4584 val = (u64) bp->tx_desc_mapping >> 32;
4531 CTX_WR(bp, GET_CID_ADDR(cid), offset2, val); 4585 bnx2_ctx_wr(bp, cid_addr, offset2, val);
4532 4586
4533 val = (u64) bp->tx_desc_mapping & 0xffffffff; 4587 val = (u64) bp->tx_desc_mapping & 0xffffffff;
4534 CTX_WR(bp, GET_CID_ADDR(cid), offset3, val); 4588 bnx2_ctx_wr(bp, cid_addr, offset3, val);
4535} 4589}
4536 4590
4537static void 4591static void
@@ -4601,36 +4655,38 @@ bnx2_init_rx_ring(struct bnx2 *bp)
4601 bnx2_init_rxbd_rings(bp->rx_desc_ring, bp->rx_desc_mapping, 4655 bnx2_init_rxbd_rings(bp->rx_desc_ring, bp->rx_desc_mapping,
4602 bp->rx_buf_use_size, bp->rx_max_ring); 4656 bp->rx_buf_use_size, bp->rx_max_ring);
4603 4657
4604 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_PG_BUF_SIZE, 0); 4658 bnx2_init_rx_context0(bp);
4659
4660 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
4661 val = REG_RD(bp, BNX2_MQ_MAP_L2_5);
4662 REG_WR(bp, BNX2_MQ_MAP_L2_5, val | BNX2_MQ_MAP_L2_5_ARM);
4663 }
4664
4665 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_PG_BUF_SIZE, 0);
4605 if (bp->rx_pg_ring_size) { 4666 if (bp->rx_pg_ring_size) {
4606 bnx2_init_rxbd_rings(bp->rx_pg_desc_ring, 4667 bnx2_init_rxbd_rings(bp->rx_pg_desc_ring,
4607 bp->rx_pg_desc_mapping, 4668 bp->rx_pg_desc_mapping,
4608 PAGE_SIZE, bp->rx_max_pg_ring); 4669 PAGE_SIZE, bp->rx_max_pg_ring);
4609 val = (bp->rx_buf_use_size << 16) | PAGE_SIZE; 4670 val = (bp->rx_buf_use_size << 16) | PAGE_SIZE;
4610 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_PG_BUF_SIZE, val); 4671 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_PG_BUF_SIZE, val);
4611 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_RBDC_KEY, 4672 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_RBDC_KEY,
4612 BNX2_L2CTX_RBDC_JUMBO_KEY); 4673 BNX2_L2CTX_RBDC_JUMBO_KEY);
4613 4674
4614 val = (u64) bp->rx_pg_desc_mapping[0] >> 32; 4675 val = (u64) bp->rx_pg_desc_mapping[0] >> 32;
4615 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_PG_BDHADDR_HI, val); 4676 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_NX_PG_BDHADDR_HI, val);
4616 4677
4617 val = (u64) bp->rx_pg_desc_mapping[0] & 0xffffffff; 4678 val = (u64) bp->rx_pg_desc_mapping[0] & 0xffffffff;
4618 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_PG_BDHADDR_LO, val); 4679 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_NX_PG_BDHADDR_LO, val);
4619 4680
4620 if (CHIP_NUM(bp) == CHIP_NUM_5709) 4681 if (CHIP_NUM(bp) == CHIP_NUM_5709)
4621 REG_WR(bp, BNX2_MQ_MAP_L2_3, BNX2_MQ_MAP_L2_3_DEFAULT); 4682 REG_WR(bp, BNX2_MQ_MAP_L2_3, BNX2_MQ_MAP_L2_3_DEFAULT);
4622 } 4683 }
4623 4684
4624 val = BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_VALUE;
4625 val |= BNX2_L2CTX_CTX_TYPE_SIZE_L2;
4626 val |= 0x02 << 8;
4627 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_CTX_TYPE, val);
4628
4629 val = (u64) bp->rx_desc_mapping[0] >> 32; 4685 val = (u64) bp->rx_desc_mapping[0] >> 32;
4630 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_BDHADDR_HI, val); 4686 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_NX_BDHADDR_HI, val);
4631 4687
4632 val = (u64) bp->rx_desc_mapping[0] & 0xffffffff; 4688 val = (u64) bp->rx_desc_mapping[0] & 0xffffffff;
4633 CTX_WR(bp, rx_cid_addr, BNX2_L2CTX_NX_BDHADDR_LO, val); 4689 bnx2_ctx_wr(bp, rx_cid_addr, BNX2_L2CTX_NX_BDHADDR_LO, val);
4634 4690
4635 ring_prod = prod = bnapi->rx_pg_prod; 4691 ring_prod = prod = bnapi->rx_pg_prod;
4636 for (i = 0; i < bp->rx_pg_ring_size; i++) { 4692 for (i = 0; i < bp->rx_pg_ring_size; i++) {
@@ -5003,9 +5059,9 @@ bnx2_do_mem_test(struct bnx2 *bp, u32 start, u32 size)
5003 5059
5004 for (offset = 0; offset < size; offset += 4) { 5060 for (offset = 0; offset < size; offset += 4) {
5005 5061
5006 REG_WR_IND(bp, start + offset, test_pattern[i]); 5062 bnx2_reg_wr_ind(bp, start + offset, test_pattern[i]);
5007 5063
5008 if (REG_RD_IND(bp, start + offset) != 5064 if (bnx2_reg_rd_ind(bp, start + offset) !=
5009 test_pattern[i]) { 5065 test_pattern[i]) {
5010 return -ENODEV; 5066 return -ENODEV;
5011 } 5067 }
@@ -5315,7 +5371,7 @@ bnx2_5706_serdes_has_link(struct bnx2 *bp)
5315 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &an_dbg); 5371 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &an_dbg);
5316 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &an_dbg); 5372 bnx2_read_phy(bp, MII_BNX2_MISC_SHADOW, &an_dbg);
5317 5373
5318 if (an_dbg & MISC_SHDW_AN_DBG_NOSYNC) 5374 if (an_dbg & (MISC_SHDW_AN_DBG_NOSYNC | MISC_SHDW_AN_DBG_RUDI_INVALID))
5319 return 0; 5375 return 0;
5320 5376
5321 bnx2_write_phy(bp, MII_BNX2_DSP_ADDRESS, MII_EXPAND_REG1); 5377 bnx2_write_phy(bp, MII_BNX2_DSP_ADDRESS, MII_EXPAND_REG1);
@@ -5440,7 +5496,8 @@ bnx2_timer(unsigned long data)
5440 5496
5441 bnx2_send_heart_beat(bp); 5497 bnx2_send_heart_beat(bp);
5442 5498
5443 bp->stats_blk->stat_FwRxDrop = REG_RD_IND(bp, BNX2_FW_RX_DROP_COUNT); 5499 bp->stats_blk->stat_FwRxDrop =
5500 bnx2_reg_rd_ind(bp, BNX2_FW_RX_DROP_COUNT);
5444 5501
5445 /* workaround occasional corrupted counters */ 5502 /* workaround occasional corrupted counters */
5446 if (CHIP_NUM(bp) == CHIP_NUM_5708 && bp->stats_ticks) 5503 if (CHIP_NUM(bp) == CHIP_NUM_5708 && bp->stats_ticks)
@@ -7155,20 +7212,20 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7155 7212
7156 bnx2_init_nvram(bp); 7213 bnx2_init_nvram(bp);
7157 7214
7158 reg = REG_RD_IND(bp, BNX2_SHM_HDR_SIGNATURE); 7215 reg = bnx2_reg_rd_ind(bp, BNX2_SHM_HDR_SIGNATURE);
7159 7216
7160 if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) == 7217 if ((reg & BNX2_SHM_HDR_SIGNATURE_SIG_MASK) ==
7161 BNX2_SHM_HDR_SIGNATURE_SIG) { 7218 BNX2_SHM_HDR_SIGNATURE_SIG) {
7162 u32 off = PCI_FUNC(pdev->devfn) << 2; 7219 u32 off = PCI_FUNC(pdev->devfn) << 2;
7163 7220
7164 bp->shmem_base = REG_RD_IND(bp, BNX2_SHM_HDR_ADDR_0 + off); 7221 bp->shmem_base = bnx2_reg_rd_ind(bp, BNX2_SHM_HDR_ADDR_0 + off);
7165 } else 7222 } else
7166 bp->shmem_base = HOST_VIEW_SHMEM_BASE; 7223 bp->shmem_base = HOST_VIEW_SHMEM_BASE;
7167 7224
7168 /* Get the permanent MAC address. First we need to make sure the 7225 /* Get the permanent MAC address. First we need to make sure the
7169 * firmware is actually running. 7226 * firmware is actually running.
7170 */ 7227 */
7171 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_DEV_INFO_SIGNATURE); 7228 reg = bnx2_shmem_rd(bp, BNX2_DEV_INFO_SIGNATURE);
7172 7229
7173 if ((reg & BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK) != 7230 if ((reg & BNX2_DEV_INFO_SIGNATURE_MAGIC_MASK) !=
7174 BNX2_DEV_INFO_SIGNATURE_MAGIC) { 7231 BNX2_DEV_INFO_SIGNATURE_MAGIC) {
@@ -7177,7 +7234,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7177 goto err_out_unmap; 7234 goto err_out_unmap;
7178 } 7235 }
7179 7236
7180 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_DEV_INFO_BC_REV); 7237 reg = bnx2_shmem_rd(bp, BNX2_DEV_INFO_BC_REV);
7181 for (i = 0, j = 0; i < 3; i++) { 7238 for (i = 0, j = 0; i < 3; i++) {
7182 u8 num, k, skip0; 7239 u8 num, k, skip0;
7183 7240
@@ -7191,7 +7248,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7191 if (i != 2) 7248 if (i != 2)
7192 bp->fw_version[j++] = '.'; 7249 bp->fw_version[j++] = '.';
7193 } 7250 }
7194 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_FEATURE); 7251 reg = bnx2_shmem_rd(bp, BNX2_PORT_FEATURE);
7195 if (reg & BNX2_PORT_FEATURE_WOL_ENABLED) 7252 if (reg & BNX2_PORT_FEATURE_WOL_ENABLED)
7196 bp->wol = 1; 7253 bp->wol = 1;
7197 7254
@@ -7199,34 +7256,33 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7199 bp->flags |= BNX2_FLAG_ASF_ENABLE; 7256 bp->flags |= BNX2_FLAG_ASF_ENABLE;
7200 7257
7201 for (i = 0; i < 30; i++) { 7258 for (i = 0; i < 30; i++) {
7202 reg = REG_RD_IND(bp, bp->shmem_base + 7259 reg = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION);
7203 BNX2_BC_STATE_CONDITION);
7204 if (reg & BNX2_CONDITION_MFW_RUN_MASK) 7260 if (reg & BNX2_CONDITION_MFW_RUN_MASK)
7205 break; 7261 break;
7206 msleep(10); 7262 msleep(10);
7207 } 7263 }
7208 } 7264 }
7209 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_BC_STATE_CONDITION); 7265 reg = bnx2_shmem_rd(bp, BNX2_BC_STATE_CONDITION);
7210 reg &= BNX2_CONDITION_MFW_RUN_MASK; 7266 reg &= BNX2_CONDITION_MFW_RUN_MASK;
7211 if (reg != BNX2_CONDITION_MFW_RUN_UNKNOWN && 7267 if (reg != BNX2_CONDITION_MFW_RUN_UNKNOWN &&
7212 reg != BNX2_CONDITION_MFW_RUN_NONE) { 7268 reg != BNX2_CONDITION_MFW_RUN_NONE) {
7213 int i; 7269 int i;
7214 u32 addr = REG_RD_IND(bp, bp->shmem_base + BNX2_MFW_VER_PTR); 7270 u32 addr = bnx2_shmem_rd(bp, BNX2_MFW_VER_PTR);
7215 7271
7216 bp->fw_version[j++] = ' '; 7272 bp->fw_version[j++] = ' ';
7217 for (i = 0; i < 3; i++) { 7273 for (i = 0; i < 3; i++) {
7218 reg = REG_RD_IND(bp, addr + i * 4); 7274 reg = bnx2_reg_rd_ind(bp, addr + i * 4);
7219 reg = swab32(reg); 7275 reg = swab32(reg);
7220 memcpy(&bp->fw_version[j], &reg, 4); 7276 memcpy(&bp->fw_version[j], &reg, 4);
7221 j += 4; 7277 j += 4;
7222 } 7278 }
7223 } 7279 }
7224 7280
7225 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_MAC_UPPER); 7281 reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_MAC_UPPER);
7226 bp->mac_addr[0] = (u8) (reg >> 8); 7282 bp->mac_addr[0] = (u8) (reg >> 8);
7227 bp->mac_addr[1] = (u8) reg; 7283 bp->mac_addr[1] = (u8) reg;
7228 7284
7229 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_MAC_LOWER); 7285 reg = bnx2_shmem_rd(bp, BNX2_PORT_HW_CFG_MAC_LOWER);
7230 bp->mac_addr[2] = (u8) (reg >> 24); 7286 bp->mac_addr[2] = (u8) (reg >> 24);
7231 bp->mac_addr[3] = (u8) (reg >> 16); 7287 bp->mac_addr[3] = (u8) (reg >> 16);
7232 bp->mac_addr[4] = (u8) (reg >> 8); 7288 bp->mac_addr[4] = (u8) (reg >> 8);
@@ -7265,8 +7321,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
7265 bp->phy_port = PORT_TP; 7321 bp->phy_port = PORT_TP;
7266 if (bp->phy_flags & BNX2_PHY_FLAG_SERDES) { 7322 if (bp->phy_flags & BNX2_PHY_FLAG_SERDES) {
7267 bp->phy_port = PORT_FIBRE; 7323 bp->phy_port = PORT_FIBRE;
7268 reg = REG_RD_IND(bp, bp->shmem_base + 7324 reg = bnx2_shmem_rd(bp, BNX2_SHARED_HW_CFG_CONFIG);
7269 BNX2_SHARED_HW_CFG_CONFIG);
7270 if (!(reg & BNX2_SHARED_HW_CFG_GIG_LINK_ON_VAUX)) { 7325 if (!(reg & BNX2_SHARED_HW_CFG_GIG_LINK_ON_VAUX)) {
7271 bp->flags |= BNX2_FLAG_NO_WOL; 7326 bp->flags |= BNX2_FLAG_NO_WOL;
7272 bp->wol = 0; 7327 bp->wol = 0;
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index d8e034700c36..3aa0364942e2 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -348,6 +348,12 @@ struct l2_fhdr {
348#define BNX2_L2CTX_BD_PRE_READ 0x00000000 348#define BNX2_L2CTX_BD_PRE_READ 0x00000000
349#define BNX2_L2CTX_CTX_SIZE 0x00000000 349#define BNX2_L2CTX_CTX_SIZE 0x00000000
350#define BNX2_L2CTX_CTX_TYPE 0x00000000 350#define BNX2_L2CTX_CTX_TYPE 0x00000000
351#define BNX2_L2CTX_LO_WATER_MARK_DEFAULT 32
352#define BNX2_L2CTX_LO_WATER_MARK_SCALE 4
353#define BNX2_L2CTX_LO_WATER_MARK_DIS 0
354#define BNX2_L2CTX_HI_WATER_MARK_SHIFT 4
355#define BNX2_L2CTX_HI_WATER_MARK_SCALE 16
356#define BNX2_L2CTX_WATER_MARKS_MSK 0x000000ff
351#define BNX2_L2CTX_CTX_TYPE_SIZE_L2 ((0x20/20)<<16) 357#define BNX2_L2CTX_CTX_TYPE_SIZE_L2 ((0x20/20)<<16)
352#define BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE (0xf<<28) 358#define BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE (0xf<<28)
353#define BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_UNDEFINED (0<<28) 359#define BNX2_L2CTX_CTX_TYPE_CTX_BD_CHN_TYPE_UNDEFINED (0<<28)
@@ -4494,6 +4500,9 @@ struct l2_fhdr {
4494#define BNX2_MQ_MAP_L2_3_ENA (0x1L<<31) 4500#define BNX2_MQ_MAP_L2_3_ENA (0x1L<<31)
4495#define BNX2_MQ_MAP_L2_3_DEFAULT 0x82004646 4501#define BNX2_MQ_MAP_L2_3_DEFAULT 0x82004646
4496 4502
4503#define BNX2_MQ_MAP_L2_5 0x00003d34
4504#define BNX2_MQ_MAP_L2_5_ARM (0x3L<<26)
4505
4497/* 4506/*
4498 * tsch_reg definition 4507 * tsch_reg definition
4499 * offset: 0x4c00 4508 * offset: 0x4c00
@@ -5510,6 +5519,15 @@ struct l2_fhdr {
5510#define BNX2_HC_PERIODIC_TICKS_8_HC_PERIODIC_TICKS (0xffffL<<0) 5519#define BNX2_HC_PERIODIC_TICKS_8_HC_PERIODIC_TICKS (0xffffL<<0)
5511#define BNX2_HC_PERIODIC_TICKS_8_HC_INT_PERIODIC_TICKS (0xffffL<<16) 5520#define BNX2_HC_PERIODIC_TICKS_8_HC_INT_PERIODIC_TICKS (0xffffL<<16)
5512 5521
5522#define BNX2_HC_SB_CONFIG_SIZE (BNX2_HC_SB_CONFIG_2 - BNX2_HC_SB_CONFIG_1)
5523#define BNX2_HC_COMP_PROD_TRIP_OFF (BNX2_HC_COMP_PROD_TRIP_1 - \
5524 BNX2_HC_SB_CONFIG_1)
5525#define BNX2_HC_COM_TICKS_OFF (BNX2_HC_COM_TICKS_1 - BNX2_HC_SB_CONFIG_1)
5526#define BNX2_HC_CMD_TICKS_OFF (BNX2_HC_CMD_TICKS_1 - BNX2_HC_SB_CONFIG_1)
5527#define BNX2_HC_TX_QUICK_CONS_TRIP_OFF (BNX2_HC_TX_QUICK_CONS_TRIP_1 - \
5528 BNX2_HC_SB_CONFIG_1)
5529#define BNX2_HC_TX_TICKS_OFF (BNX2_HC_TX_TICKS_1 - BNX2_HC_SB_CONFIG_1)
5530
5513 5531
5514/* 5532/*
5515 * txp_reg definition 5533 * txp_reg definition
@@ -6346,11 +6364,12 @@ struct l2_fhdr {
6346#define MII_BNX2_DSP_EXPAND_REG 0x0f00 6364#define MII_BNX2_DSP_EXPAND_REG 0x0f00
6347#define MII_EXPAND_REG1 (MII_BNX2_DSP_EXPAND_REG | 1) 6365#define MII_EXPAND_REG1 (MII_BNX2_DSP_EXPAND_REG | 1)
6348#define MII_EXPAND_REG1_RUDI_C 0x20 6366#define MII_EXPAND_REG1_RUDI_C 0x20
6349#define MII_EXPAND_SERDES_CTL (MII_BNX2_DSP_EXPAND_REG | 2) 6367#define MII_EXPAND_SERDES_CTL (MII_BNX2_DSP_EXPAND_REG | 3)
6350 6368
6351#define MII_BNX2_MISC_SHADOW 0x1c 6369#define MII_BNX2_MISC_SHADOW 0x1c
6352#define MISC_SHDW_AN_DBG 0x6800 6370#define MISC_SHDW_AN_DBG 0x6800
6353#define MISC_SHDW_AN_DBG_NOSYNC 0x0002 6371#define MISC_SHDW_AN_DBG_NOSYNC 0x0002
6372#define MISC_SHDW_AN_DBG_RUDI_INVALID 0x0100
6354#define MISC_SHDW_MODE_CTL 0x7c00 6373#define MISC_SHDW_MODE_CTL 0x7c00
6355#define MISC_SHDW_MODE_CTL_SIG_DET 0x0010 6374#define MISC_SHDW_MODE_CTL_SIG_DET 0x0010
6356 6375
@@ -6395,7 +6414,7 @@ struct l2_fhdr {
6395 6414
6396#define RX_COPY_THRESH 128 6415#define RX_COPY_THRESH 128
6397 6416
6398#define BNX2_MISC_ENABLE_DEFAULT 0x7ffffff 6417#define BNX2_MISC_ENABLE_DEFAULT 0x17ffffff
6399 6418
6400#define DMA_READ_CHANS 5 6419#define DMA_READ_CHANS 5
6401#define DMA_WRITE_CHANS 3 6420#define DMA_WRITE_CHANS 3
@@ -6795,9 +6814,6 @@ struct bnx2 {
6795 int irq_nvecs; 6814 int irq_nvecs;
6796}; 6815};
6797 6816
6798static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset);
6799static void bnx2_reg_wr_ind(struct bnx2 *bp, u32 offset, u32 val);
6800
6801#define REG_RD(bp, offset) \ 6817#define REG_RD(bp, offset) \
6802 readl(bp->regview + offset) 6818 readl(bp->regview + offset)
6803 6819
@@ -6807,19 +6823,6 @@ static void bnx2_reg_wr_ind(struct bnx2 *bp, u32 offset, u32 val);
6807#define REG_WR16(bp, offset, val) \ 6823#define REG_WR16(bp, offset, val) \
6808 writew(val, bp->regview + offset) 6824 writew(val, bp->regview + offset)
6809 6825
6810#define REG_RD_IND(bp, offset) \
6811 bnx2_reg_rd_ind(bp, offset)
6812
6813#define REG_WR_IND(bp, offset, val) \
6814 bnx2_reg_wr_ind(bp, offset, val)
6815
6816/* Indirect context access. Unlike the MBQ_WR, these macros will not
6817 * trigger a chip event. */
6818static void bnx2_ctx_wr(struct bnx2 *bp, u32 cid_addr, u32 offset, u32 val);
6819
6820#define CTX_WR(bp, cid_addr, offset, val) \
6821 bnx2_ctx_wr(bp, cid_addr, offset, val)
6822
6823struct cpu_reg { 6826struct cpu_reg {
6824 u32 mode; 6827 u32 mode;
6825 u32 mode_value_halt; 6828 u32 mode_value_halt;
diff --git a/drivers/net/bnx2_fw.h b/drivers/net/bnx2_fw.h
index c1ad4dd38c32..3b839d4626fe 100644
--- a/drivers/net/bnx2_fw.h
+++ b/drivers/net/bnx2_fw.h
@@ -2168,760 +2168,761 @@ static struct fw_info bnx2_cp_fw_06 = {
2168}; 2168};
2169 2169
2170static u8 bnx2_RXP_b06FwText[] = { 2170static u8 bnx2_RXP_b06FwText[] = {
2171 0xec, 0x5b, 0x6d, 0x6c, 0x5c, 0x57, 0x5a, 0x7e, 0xef, 0x99, 0xb1, 0x3d, 2171 0xec, 0x5b, 0x5d, 0x70, 0x5c, 0xd7, 0x5d, 0xff, 0xdf, 0xb3, 0x2b, 0x69,
2172 0x76, 0x6c, 0xe7, 0xda, 0x99, 0xa6, 0x93, 0xe2, 0x6e, 0x67, 0xec, 0x6b, 2172 0x2d, 0x4b, 0xf2, 0x95, 0xbc, 0x71, 0x56, 0xa9, 0x92, 0xec, 0x5a, 0x57,
2173 0x7b, 0xba, 0x36, 0xe5, 0x3a, 0x4c, 0x5b, 0xaf, 0x18, 0xb6, 0xc3, 0x1d, 2173 0xd2, 0xa6, 0x12, 0xe1, 0xca, 0x6c, 0x12, 0x75, 0xd8, 0x69, 0xb6, 0xbb,
2174 0x27, 0x75, 0x77, 0x83, 0xe4, 0xb6, 0x61, 0x37, 0x82, 0xae, 0xb0, 0x66, 2174 0xb2, 0xa3, 0xb4, 0x66, 0x46, 0x49, 0x0d, 0xcd, 0xb4, 0x65, 0x10, 0xbb,
2175 0x12, 0x51, 0x84, 0x10, 0x21, 0x82, 0xaa, 0x2c, 0x5d, 0x65, 0x34, 0x76, 2175 0x0e, 0xa4, 0x0f, 0x0c, 0xc6, 0x40, 0x26, 0x80, 0xc1, 0xcb, 0x4a, 0x71,
2176 0x53, 0xb7, 0x3b, 0xf1, 0x0c, 0x89, 0x4b, 0xf8, 0xd8, 0x1f, 0xee, 0xd8, 2176 0x94, 0x74, 0xad, 0xdd, 0xda, 0x0a, 0x86, 0x69, 0x61, 0x94, 0xd5, 0x87,
2177 0x4e, 0x0a, 0x9a, 0x78, 0xba, 0xcb, 0x8f, 0x5d, 0x56, 0x4d, 0x63, 0xd2, 2177 0x53, 0x66, 0xad, 0x4d, 0xcb, 0x4b, 0x99, 0xd6, 0xb1, 0xea, 0xb8, 0x26,
2178 0x12, 0xfa, 0x03, 0x89, 0x16, 0x56, 0x50, 0x89, 0x85, 0x86, 0x24, 0xdb, 2178 0x0f, 0x3c, 0xa4, 0x94, 0xce, 0x64, 0x20, 0x33, 0x35, 0xb2, 0x63, 0xfb,
2179 0x14, 0x09, 0x41, 0x77, 0x01, 0x6d, 0xa1, 0x69, 0x2f, 0xcf, 0x73, 0xee, 2179 0x81, 0x8f, 0xc0, 0x4c, 0x49, 0x20, 0x6e, 0x2e, 0xbf, 0xdf, 0xb9, 0xf7,
2180 0xbd, 0xc9, 0xc4, 0x35, 0x6c, 0x7f, 0xf0, 0xf3, 0x1e, 0xc9, 0xba, 0xf7, 2180 0xca, 0x2b, 0x45, 0xd0, 0x3c, 0xf0, 0x78, 0xcf, 0x8c, 0xe6, 0xde, 0x7b,
2181 0x9e, 0xf3, 0x9e, 0xf7, 0xbc, 0xdf, 0x1f, 0x67, 0x92, 0xdf, 0xe8, 0x96, 2181 0xce, 0xff, 0xfc, 0xcf, 0xff, 0xfb, 0xe3, 0xac, 0xfd, 0x3b, 0x1d, 0xd2,
2182 0x2e, 0xf1, 0x47, 0x0f, 0xfe, 0x32, 0x87, 0x9f, 0x3c, 0x72, 0xef, 0x3d, 2182 0x2e, 0xde, 0xe8, 0xc4, 0x5f, 0xea, 0xc8, 0x33, 0x47, 0x47, 0xef, 0x1f,
2183 0xf6, 0x3d, 0xfc, 0x8e, 0xb4, 0x49, 0x94, 0x4f, 0x43, 0xc2, 0x11, 0x8e, 2183 0xbd, 0x9f, 0xdf, 0x21, 0xc3, 0x08, 0xf3, 0x69, 0x48, 0x30, 0x82, 0x11,
2184 0x70, 0x84, 0x23, 0x1c, 0xe1, 0x08, 0x47, 0x38, 0xc2, 0x11, 0x8e, 0x70, 2184 0x8c, 0x60, 0x04, 0x23, 0x18, 0xc1, 0x08, 0x46, 0x30, 0x82, 0x11, 0x8c,
2185 0x84, 0x23, 0x1c, 0xe1, 0x08, 0x47, 0x38, 0xc2, 0x11, 0x8e, 0x70, 0x84, 2185 0x60, 0x04, 0x23, 0x18, 0xc1, 0x08, 0x46, 0x30, 0x82, 0x11, 0x8c, 0x60,
2186 0x23, 0x1c, 0xe1, 0x08, 0x47, 0x38, 0xc2, 0x11, 0x8e, 0x70, 0x84, 0x23, 2186 0x04, 0x23, 0x18, 0xc1, 0x08, 0x46, 0x30, 0x82, 0x11, 0x8c, 0x60, 0x04,
2187 0x1c, 0xe1, 0x08, 0x47, 0x38, 0xc2, 0x11, 0x8e, 0x70, 0x84, 0x23, 0x1c, 2187 0x23, 0x18, 0xc1, 0x08, 0x46, 0x30, 0x82, 0x11, 0x8c, 0x60, 0x04, 0x23,
2188 0xe1, 0x08, 0x47, 0x38, 0xc2, 0x11, 0x8e, 0x70, 0x84, 0x23, 0x1c, 0xe1, 2188 0x18, 0xc1, 0x08, 0x46, 0x30, 0x82, 0x11, 0x8c, 0x60, 0x04, 0x23, 0x18,
2189 0x08, 0x47, 0x38, 0xc2, 0xf1, 0xff, 0x39, 0x22, 0x22, 0x26, 0x9f, 0x3d, 2189 0xc1, 0x08, 0x46, 0x30, 0xfe, 0x3f, 0x47, 0x48, 0xc4, 0xe4, 0xb3, 0xd3,
2190 0xfe, 0x9f, 0xc4, 0x54, 0x56, 0x8e, 0x38, 0x96, 0xc4, 0x22, 0xd9, 0xd5, 2190 0xfb, 0x93, 0x88, 0x4a, 0xc7, 0x8f, 0x66, 0x2d, 0x89, 0x84, 0xd2, 0x97,
2191 0x27, 0x8a, 0x96, 0x48, 0xae, 0x31, 0x96, 0xcc, 0xcb, 0x87, 0x6e, 0x29, 2191 0x9e, 0x2e, 0x58, 0x22, 0x99, 0xfa, 0x70, 0x3c, 0x27, 0x3f, 0x71, 0x8a,
2192 0x1e, 0x15, 0xce, 0xdf, 0x99, 0xbd, 0x7e, 0xf4, 0xdc, 0xfd, 0xa9, 0xf7, 2192 0xd1, 0xb0, 0x70, 0xfe, 0xee, 0xf4, 0xad, 0xe3, 0xe7, 0x1f, 0x4a, 0xbc,
2193 0x96, 0x23, 0x12, 0x33, 0xb3, 0x6f, 0x4c, 0x98, 0x23, 0x12, 0x1b, 0xc0, 2193 0xb3, 0x10, 0x92, 0x88, 0x99, 0x7e, 0x63, 0xd4, 0x1c, 0x94, 0x48, 0x1f,
2194 0x9e, 0xaf, 0x8d, 0xbe, 0xbc, 0x5d, 0x7a, 0x03, 0x5c, 0x22, 0xf5, 0x4a, 2194 0xf6, 0x7c, 0x6d, 0x68, 0x6d, 0x97, 0x74, 0xf9, 0xb8, 0x44, 0x6a, 0xe5,
2195 0xca, 0xde, 0x2b, 0x63, 0xe6, 0x05, 0x89, 0x4a, 0x0e, 0x67, 0x9c, 0x6e, 2195 0x84, 0x7d, 0x40, 0x86, 0xcd, 0x8b, 0x12, 0x96, 0x0c, 0xce, 0x58, 0xa9,
2196 0x88, 0x94, 0x2b, 0x06, 0x71, 0x48, 0xb9, 0x11, 0x93, 0x4b, 0x11, 0x42, 2196 0x8b, 0x94, 0xca, 0x06, 0x71, 0x48, 0xa9, 0x1e, 0x91, 0x2b, 0x21, 0x42,
2197 0x7d, 0xcb, 0x70, 0xaa, 0x1f, 0xb9, 0xb9, 0x28, 0xce, 0xb5, 0xf0, 0xde, 2197 0x7d, 0xcb, 0xc8, 0x56, 0x3e, 0x70, 0x32, 0x61, 0x9c, 0x6b, 0xe1, 0xbd,
2198 0x0c, 0xe6, 0x63, 0xa2, 0xb2, 0xa9, 0x84, 0x13, 0x99, 0x96, 0xc2, 0x92, 2198 0xe1, 0xcf, 0x47, 0x44, 0xa5, 0x13, 0xc9, 0x6c, 0x68, 0x42, 0x6a, 0xf3,
2199 0xeb, 0xce, 0xdb, 0xb7, 0x03, 0x47, 0xbf, 0xcc, 0x5b, 0xde, 0xb7, 0x63, 2199 0x8e, 0x33, 0x63, 0x7f, 0x0c, 0x38, 0x7a, 0x64, 0xc6, 0x72, 0xbf, 0xb3,
2200 0x7f, 0xda, 0x9c, 0x92, 0x1d, 0x98, 0x8b, 0x88, 0xb2, 0xee, 0xc0, 0xdf, 2200 0xf6, 0xc7, 0xcd, 0x71, 0xb9, 0x13, 0x73, 0x21, 0x51, 0xd6, 0x5d, 0xf8,
2201 0x57, 0x0d, 0x67, 0xa5, 0x5b, 0xca, 0x55, 0xc9, 0x39, 0x76, 0x0c, 0xf3, 2201 0x8b, 0x1b, 0xb9, 0xd3, 0x5f, 0x36, 0xb2, 0x8b, 0x1d, 0x52, 0xaa, 0x38,
2202 0x09, 0x99, 0xab, 0x26, 0x0d, 0xe7, 0xa4, 0x21, 0xc5, 0x0c, 0xde, 0x9b, 2202 0x52, 0xb0, 0x25, 0x93, 0xb5, 0x77, 0x60, 0xfd, 0x03, 0xa7, 0xb0, 0xb1,
2203 0xae, 0x38, 0xf6, 0x47, 0xae, 0x63, 0x11, 0xff, 0x92, 0xe1, 0x9c, 0xf9, 2203 0x67, 0xd8, 0xcc, 0x49, 0x8b, 0x64, 0xa2, 0x31, 0xc0, 0xcc, 0x1b, 0xb9,
2204 0xc8, 0x55, 0x96, 0x65, 0x16, 0x84, 0xdf, 0x09, 0x29, 0x37, 0x89, 0x87, 2204 0xb3, 0x7f, 0xdd, 0x21, 0xed, 0xa0, 0x27, 0xc5, 0xef, 0x0f, 0x9c, 0x90,
2205 0xef, 0xc4, 0x73, 0xc9, 0x3d, 0x37, 0x9a, 0x90, 0x6f, 0x34, 0xe3, 0xf2, 2205 0x65, 0x61, 0x9d, 0xe7, 0xe3, 0xbb, 0x41, 0xbc, 0x7c, 0x27, 0xce, 0x2b,
2206 0xf5, 0xa6, 0x29, 0x2f, 0x35, 0x07, 0xe4, 0x7c, 0xd3, 0x75, 0xbf, 0x6e, 2206 0xce, 0xf9, 0xa1, 0x98, 0x7c, 0xb3, 0x11, 0x95, 0x6f, 0x34, 0x4c, 0x79,
2207 0xbb, 0xee, 0x1b, 0xf8, 0xfb, 0x81, 0x7d, 0x83, 0x66, 0x8c, 0x92, 0x31, 2207 0xa5, 0xd1, 0x27, 0x17, 0x1a, 0x8e, 0xf3, 0x0d, 0xdb, 0x71, 0xde, 0xc0,
2208 0xd5, 0xfc, 0xc3, 0x6e, 0xe9, 0x4d, 0x25, 0x45, 0x75, 0xe3, 0xcc, 0x84, 2208 0xdf, 0x7f, 0xd8, 0x1b, 0x3c, 0x60, 0x14, 0x8d, 0xf1, 0xc6, 0x57, 0x3b,
2209 0xcc, 0x57, 0x2b, 0xc6, 0xc3, 0x67, 0x16, 0x8d, 0x99, 0x33, 0x35, 0x23, 2209 0xa4, 0x2b, 0x11, 0x17, 0xd5, 0x21, 0xd3, 0x95, 0x98, 0xcc, 0x54, 0xca,
2210 0x7f, 0x26, 0x8a, 0x39, 0x29, 0x95, 0xed, 0x17, 0x8d, 0x7c, 0x73, 0xc1, 2210 0xc6, 0x63, 0x67, 0xe7, 0x8c, 0xc9, 0xb3, 0x55, 0x9c, 0x19, 0xc6, 0x9c,
2211 0x78, 0xe4, 0x4c, 0xaf, 0xa6, 0xad, 0x5c, 0xdd, 0x09, 0xda, 0xae, 0x83, 2211 0x14, 0x4b, 0xf6, 0xcb, 0x46, 0xae, 0x31, 0x6b, 0x3c, 0x7e, 0xb6, 0x0b,
2212 0x26, 0xca, 0x34, 0x65, 0xfe, 0x3c, 0xc4, 0xec, 0x54, 0xc8, 0x57, 0xbb, 2212 0x34, 0xf2, 0xfc, 0x3d, 0x46, 0xf6, 0xf4, 0x2d, 0xc9, 0xda, 0x94, 0x71,
2213 0xe4, 0xe2, 0x5c, 0x77, 0x5d, 0x95, 0x75, 0x8f, 0x3a, 0x19, 0xcb, 0x2c, 2213 0xc2, 0xfc, 0x3c, 0xc4, 0x9e, 0x2d, 0x93, 0xe6, 0x56, 0x8f, 0x5e, 0xc7,
2214 0x0b, 0xe9, 0xd3, 0x73, 0xe7, 0x23, 0xa0, 0x39, 0x2f, 0xa7, 0x41, 0x7f, 2214 0x51, 0x69, 0xe7, 0x78, 0x36, 0x65, 0x99, 0x25, 0x21, 0x7d, 0x7a, 0xee,
2215 0xb7, 0x91, 0x3f, 0x15, 0x05, 0x1d, 0x32, 0x10, 0x11, 0xee, 0x1b, 0x4e, 2215 0x82, 0x4b, 0xf3, 0x8a, 0x91, 0x3d, 0xdb, 0x61, 0xe4, 0xce, 0x84, 0x41,
2216 0x14, 0xa4, 0x81, 0x33, 0xc4, 0x54, 0x59, 0xca, 0x11, 0x34, 0x83, 0x96, 2216 0x87, 0xf4, 0x85, 0x84, 0xfb, 0x06, 0x62, 0x79, 0xa9, 0xe3, 0x0c, 0x31,
2217 0x6f, 0x54, 0xc1, 0x43, 0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224 0x53, 0xa6, 0x96, 0xfc, 0xfd, 0xbe, 0x1d, 0x1c, 0x91, 0x83, 0x95, 0x1e,
2225 0x95, 0xd3, 0x4a, 0xc4, 0x28, 0xd8, 0x47, 0xb5, 0xbe, 0x57, 0x2d, 0xc9, 2225 0xc8, 0x86, 0xb2, 0x4c, 0xd8, 0x22, 0x0e, 0x64, 0x54, 0x4a, 0x2a, 0x11,
2226 0x15, 0x6c, 0xca, 0x51, 0x92, 0x05, 0xbb, 0x94, 0x88, 0xc2, 0xbe, 0x56, 2226 0x23, 0x6f, 0x1f, 0xd7, 0xfa, 0x5f, 0xb2, 0x24, 0x93, 0xb7, 0x29, 0x47,
2227 0xad, 0x92, 0x19, 0x15, 0xca, 0x31, 0x95, 0xf8, 0x32, 0x64, 0x79, 0xa8, 2227 0x89, 0xe7, 0xed, 0x62, 0x2c, 0x0c, 0x7b, 0x5b, 0xb2, 0x8a, 0x66, 0x58,
2228 0x22, 0xb9, 0xcf, 0x55, 0x02, 0x19, 0x7b, 0xf2, 0xfd, 0x7c, 0xe5, 0xa7, 2228 0x28, 0xc7, 0x44, 0xec, 0xf7, 0x21, 0xcb, 0x27, 0xcb, 0x92, 0xf9, 0x74,
2229 0x7b, 0xa4, 0x4b, 0x7d, 0xaa, 0x4d, 0x7e, 0x15, 0x7b, 0x89, 0xfb, 0x96, 2229 0xd9, 0x97, 0xb1, 0x2b, 0xdf, 0xcf, 0x94, 0x3f, 0xd5, 0x29, 0xed, 0xea,
2230 0xbd, 0xd8, 0xe7, 0xc1, 0x79, 0x7b, 0x53, 0x07, 0x44, 0x08, 0x5b, 0x1e, 2230 0x9e, 0x16, 0xf9, 0x0d, 0xec, 0x25, 0xee, 0x4d, 0x7b, 0xb1, 0xcf, 0x85,
2231 0x6a, 0xf3, 0x7c, 0xc2, 0x70, 0xac, 0x52, 0x22, 0x02, 0xb8, 0x82, 0x94, 2231 0x73, 0xf7, 0x26, 0x9e, 0x10, 0x21, 0x6c, 0xa9, 0xbf, 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 0x29, 0xb3, 0xe6, 2246 0x76, 0x67, 0xf2, 0x3c, 0x89, 0x84, 0xd3, 0xe1, 0xd1, 0x99, 0xf2, 0x11,
2247 0xd0, 0xec, 0x3e, 0x61, 0xac, 0x89, 0x4d, 0x14, 0x7d, 0x1d, 0xe6, 0xc5, 2247 0xc9, 0x56, 0xe2, 0x32, 0x3d, 0xb2, 0x43, 0xa6, 0xcc, 0xfe, 0xa9, 0x83,
2248 0x90, 0x39, 0xf0, 0xb8, 0xaf, 0x21, 0x31, 0x03, 0xf0, 0x43, 0x8d, 0xa8, 2248 0xc2, 0xd8, 0x13, 0x19, 0x2d, 0x78, 0x3a, 0xcc, 0x89, 0x21, 0xd3, 0xe0,
2249 0x3c, 0xdb, 0x34, 0xa4, 0x5d, 0xfb, 0x67, 0xca, 0xdc, 0x80, 0x1d, 0x3e, 2249 0xf1, 0x60, 0x5d, 0x22, 0x06, 0xe0, 0xfb, 0xeb, 0x61, 0x79, 0xbe, 0x61,
2250 0x5d, 0xa5, 0x1d, 0xd3, 0x66, 0x25, 0x57, 0x87, 0x9d, 0x9e, 0xd7, 0xbe, 2250 0x48, 0xab, 0xf6, 0xcf, 0x84, 0xb9, 0x06, 0x3b, 0x7c, 0xb6, 0x42, 0x3b,
2251 0xda, 0x45, 0xbd, 0x96, 0x4a, 0x02, 0x57, 0xcc, 0x5a, 0x66, 0x5d, 0x3a, 2251 0xa6, 0xcd, 0x4a, 0xa6, 0x06, 0x3b, 0xbd, 0xa0, 0x7d, 0xb5, 0x9d, 0x7a,
2252 0x24, 0x37, 0x23, 0x25, 0xae, 0xfb, 0xbe, 0x93, 0x58, 0x91, 0x73, 0xb0, 2252 0x2d, 0x16, 0x05, 0xae, 0x98, 0xb6, 0xcc, 0x9a, 0xb4, 0x49, 0x66, 0x52,
2253 0x01, 0x31, 0x9d, 0x0c, 0xe7, 0x09, 0xdf, 0x02, 0x6b, 0x7a, 0x7e, 0x17, 2253 0x8a, 0x5c, 0xf7, 0x7c, 0x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
2261 0x2f, 0x45, 0xde, 0x06, 0xad, 0xdc, 0xa3, 0xe1, 0x62, 0x1d, 0xd9, 0x8c, 2261 0x17, 0x9b, 0xa6, 0x1f, 0xa7, 0x18, 0xb3, 0xdc, 0xf8, 0x29, 0x72, 0x15,
2262 0x5c, 0xab, 0xec, 0x92, 0x4b, 0x71, 0xf2, 0x0f, 0x9c, 0x55, 0xc4, 0xc4, 2262 0xb4, 0x72, 0x8f, 0x86, 0x8b, 0xb4, 0xa5, 0x53, 0x72, 0xa3, 0xdc, 0x2b,
2263 0xb8, 0x01, 0xfa, 0x13, 0x7e, 0xdc, 0xdb, 0xe1, 0x7f, 0x1b, 0x77, 0x79, 2263 0x57, 0xa2, 0xe4, 0x1f, 0x38, 0x2b, 0x88, 0x87, 0x51, 0x03, 0xf4, 0x93,
2264 0x67, 0x88, 0x19, 0xc9, 0xf6, 0x4a, 0x5e, 0xcf, 0x89, 0x52, 0x13, 0xdb, 2264 0x6e, 0xc6, 0xbf, 0xdd, 0xde, 0xb7, 0x71, 0xaf, 0x7b, 0x86, 0x98, 0xa1,
2265 0xfc, 0xf5, 0x5e, 0x63, 0xef, 0x29, 0x25, 0xa3, 0xf7, 0x21, 0x66, 0xe1, 2265 0x74, 0x97, 0xe4, 0xf4, 0x9c, 0x28, 0x35, 0xba, 0xd3, 0x5b, 0xef, 0x32,
2266 0xac, 0x8b, 0x96, 0xeb, 0x5e, 0xb4, 0xbf, 0x0f, 0x9f, 0x57, 0xd2, 0x66, 2266 0x0e, 0x9c, 0x51, 0x32, 0xf4, 0x20, 0x62, 0x16, 0xce, 0xba, 0x6c, 0x39,
2267 0xfd, 0x63, 0xaf, 0x74, 0x41, 0x9e, 0x55, 0xa3, 0x45, 0x86, 0x09, 0x39, 2267 0xce, 0x65, 0xfb, 0xc7, 0xf0, 0x79, 0x25, 0x2d, 0xd6, 0x7a, 0x97, 0xb4,
2268 0x56, 0xe5, 0x9e, 0x92, 0x44, 0x2d, 0xc2, 0x10, 0xfe, 0xef, 0x01, 0x17, 2268 0x43, 0x9e, 0x15, 0xa3, 0x49, 0x86, 0x31, 0x39, 0x51, 0xe1, 0x9e, 0xa2,
2269 0x91, 0x0e, 0xf8, 0xe2, 0x05, 0x3b, 0x4e, 0x7a, 0xb7, 0x7b, 0xf0, 0x7d, 2269 0x84, 0x2d, 0xc2, 0x10, 0xfe, 0x47, 0x80, 0x0b, 0x49, 0x1b, 0x7c, 0xf1,
2270 0x38, 0x83, 0xb4, 0xd3, 0xf7, 0x5c, 0xed, 0x7b, 0x4e, 0x44, 0xe5, 0xa6, 2270 0xa2, 0x1d, 0x25, 0xbd, 0xbb, 0x5c, 0xf8, 0x6e, 0x9c, 0x41, 0xda, 0xe9,
2271 0x96, 0xe0, 0x49, 0xe3, 0x94, 0xb7, 0xd3, 0x87, 0x50, 0x2f, 0x73, 0xa3, 2271 0x7b, 0x8e, 0xf6, 0xbd, 0x6c, 0x48, 0x65, 0xc6, 0xe7, 0xe1, 0x49, 0x23,
2272 0x25, 0x53, 0x69, 0x5d, 0x8b, 0xe4, 0x2b, 0x77, 0xc9, 0xbc, 0x8d, 0xf3, 2272 0x94, 0x77, 0xb6, 0x1b, 0xa1, 0x5f, 0xa6, 0x87, 0x8a, 0xa6, 0xd2, 0xba,
2273 0xac, 0x28, 0x68, 0x66, 0x9c, 0x19, 0x2e, 0x45, 0x14, 0x3c, 0xac, 0x9f, 2273 0x16, 0xc9, 0x95, 0xef, 0x95, 0x19, 0x1b, 0xe7, 0x59, 0x61, 0xd0, 0xcc,
2274 0xb2, 0x0a, 0x68, 0x7d, 0x0b, 0xe7, 0x95, 0x8c, 0xa8, 0xc5, 0x33, 0xbe, 2274 0x38, 0x33, 0x50, 0x0c, 0x29, 0x78, 0x58, 0x0f, 0x65, 0xe5, 0xd3, 0xfa,
2275 0xe4, 0xcb, 0x87, 0x76, 0x67, 0x8b, 0x53, 0xe9, 0xe6, 0x37, 0xe8, 0xe8, 2275 0x16, 0xce, 0x2b, 0x1a, 0x61, 0x8b, 0x67, 0xfc, 0xb2, 0x27, 0x1f, 0xda,
2276 0xd2, 0x74, 0x44, 0xb2, 0x5a, 0x77, 0x86, 0xca, 0x52, 0x96, 0x6d, 0x3e, 2276 0x9d, 0x2d, 0xd9, 0x72, 0x07, 0xbf, 0x41, 0x47, 0xbb, 0xa6, 0x23, 0x94,
2277 0x3d, 0xb7, 0xe0, 0x01, 0x1f, 0xdc, 0x6b, 0x61, 0x6f, 0x0c, 0x34, 0xf6, 2277 0xd6, 0xba, 0x33, 0x54, 0xda, 0x8f, 0xff, 0x04, 0xdd, 0x84, 0x07, 0x7c,
2278 0xb4, 0xd0, 0xdf, 0x45, 0x78, 0xc8, 0x2a, 0xe6, 0x9f, 0xa1, 0xf9, 0x36, 2278 0x70, 0xaf, 0x85, 0xbd, 0x11, 0xd0, 0xd8, 0xd9, 0x44, 0x7f, 0x3b, 0xe1,
2279 0x3c, 0xbe, 0x03, 0x59, 0x7d, 0x1b, 0xb2, 0xfa, 0xc0, 0x1d, 0xdd, 0x4d, 2279 0x21, 0xab, 0x88, 0x77, 0x86, 0xe6, 0xdb, 0x70, 0xf9, 0xf6, 0x65, 0xf5,
2280 0x1c, 0x19, 0xe0, 0x60, 0x1e, 0x62, 0xbc, 0x62, 0x8c, 0x32, 0x6f, 0xe0, 2280 0x2a, 0x64, 0xf5, 0xbe, 0x33, 0xb4, 0x8f, 0x38, 0x52, 0xc0, 0x01, 0xb9,
2281 0x82, 0x1f, 0xa8, 0x48, 0xb6, 0x5b, 0xf2, 0xa6, 0xce, 0x01, 0x80, 0x9d, 2281 0x9b, 0x8c, 0x57, 0x8c, 0x51, 0xe6, 0x06, 0x2e, 0xf8, 0x81, 0x0a, 0xa5,
2282 0x14, 0x1d, 0xe3, 0x2d, 0xf2, 0xe8, 0x7f, 0x5b, 0x29, 0x6d, 0x37, 0x85, 2282 0x3b, 0x24, 0x67, 0xea, 0x1c, 0x00, 0xd8, 0x31, 0xd1, 0x31, 0xde, 0x22,
2283 0x1a, 0xf3, 0xc0, 0x57, 0x40, 0xdb, 0x46, 0x4a, 0x69, 0xd6, 0xba, 0x21, 2283 0x8f, 0xde, 0xb7, 0x95, 0xd0, 0x76, 0x93, 0xaf, 0x32, 0x0f, 0xfc, 0x31,
2284 0x73, 0x89, 0xb5, 0x65, 0xdf, 0x90, 0xb5, 0x8a, 0xda, 0xd9, 0x2e, 0xdb, 2284 0x68, 0x5b, 0x4b, 0x28, 0xcd, 0x5a, 0x07, 0x64, 0x2e, 0x91, 0x96, 0xf4,
2285 0x65, 0x06, 0x32, 0xaa, 0x4f, 0x22, 0x7f, 0x8e, 0x77, 0x4b, 0xe4, 0x1e, 2285 0x1b, 0xb2, 0x5c, 0x56, 0x7b, 0x5a, 0x65, 0x97, 0x4c, 0x42, 0x46, 0xb5,
2286 0xe6, 0x81, 0x04, 0x68, 0xdd, 0x48, 0x99, 0x72, 0xdd, 0x55, 0x23, 0xd8, 2286 0x31, 0xe4, 0xaf, 0x91, 0x0e, 0x09, 0xdd, 0xcf, 0x3c, 0x10, 0x03, 0xad,
2287 0x3f, 0x0e, 0x3d, 0xec, 0xa7, 0x4e, 0x95, 0x0f, 0x47, 0x98, 0x08, 0x65, 2287 0x6b, 0x09, 0x53, 0x6e, 0x39, 0x6a, 0x10, 0xfb, 0x47, 0xa0, 0x87, 0x43,
2288 0xde, 0xdf, 0x2e, 0xc4, 0xcd, 0xb5, 0xb1, 0x84, 0x29, 0x9c, 0xef, 0x84, 2288 0xd4, 0xa9, 0xf2, 0xe0, 0x08, 0x13, 0xa2, 0xcc, 0x7b, 0x5a, 0x85, 0xb8,
2289 0x5e, 0xb9, 0x97, 0xfc, 0x79, 0x7b, 0x3e, 0xce, 0x5f, 0xb0, 0x4e, 0x99, 2289 0xb9, 0x36, 0x1c, 0x33, 0x85, 0xf3, 0xc8, 0x95, 0x93, 0xdc, 0x4b, 0xfe,
2290 0x51, 0x76, 0xb0, 0x31, 0xf0, 0xe8, 0xd8, 0x3f, 0xeb,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f, 0xea, 0xd9, 0xf6, 0xfb, 0xce, 0xe8, 0x3e, 0x5f,
2298 0x7f, 0xed, 0xa1, 0xad, 0xc4, 0x36, 0xed, 0x29, 0x6d, 0xb1, 0x67, 0x87, 2298 0xef, 0x90, 0xd7, 0x87, 0xf6, 0x08, 0xf4, 0xfc, 0x7f, 0xed, 0xa1, 0xad,
2299 0xc8, 0x17, 0xe8, 0x43, 0x3d, 0x7e, 0xcc, 0x08, 0x7c, 0x2a, 0xc0, 0x03, 2299 0x44, 0xb6, 0xec, 0x29, 0x6e, 0xb3, 0x67, 0xb7, 0xc8, 0x2f, 0xd1, 0x87,
2300 0xdd, 0x68, 0x5b, 0xe5, 0xdc, 0x56, 0xbe, 0x48, 0x1c, 0xc4, 0xc5, 0xbd, 2300 0xba, 0xbd, 0x98, 0xe1, 0xfb, 0x94, 0x8f, 0x07, 0xba, 0xd1, 0xb6, 0xca,
2301 0x84, 0x09, 0x72, 0x2a, 0xd4, 0x21, 0x5b, 0xe6, 0x55, 0x8c, 0x69, 0xbc, 2301 0xb9, 0xed, 0x7c, 0x91, 0x38, 0x88, 0x8b, 0x7b, 0x09, 0xe3, 0xe7, 0x54,
2302 0x2b, 0xc4, 0xa1, 0xd6, 0xfc, 0xca, 0x39, 0x13, 0xdf, 0x53, 0x78, 0x5a, 2302 0xa8, 0x43, 0xb6, 0xcd, 0xab, 0x18, 0x13, 0x78, 0x57, 0x88, 0x43, 0xcd,
2303 0x52, 0x68, 0xd0, 0x9f, 0xb8, 0x9f, 0xf9, 0xf6, 0x5d, 0x3f, 0x7e, 0x76, 2303 0xf9, 0x95, 0x73, 0x26, 0xbe, 0xc7, 0xf1, 0xb4, 0x24, 0x5f, 0xa7, 0x3f,
2304 0xcf, 0x46, 0xb3, 0x71, 0xc4, 0x4f, 0x99, 0x29, 0x57, 0x8e, 0xba, 0x11, 2304 0x71, 0x3f, 0xf3, 0xed, 0x4d, 0x2f, 0x7e, 0x76, 0x4c, 0x85, 0xd3, 0x51,
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 0xca, 0x53, 0xab, 0x99, 0x28, 2312 0xa2, 0x50, 0xd7, 0xc4, 0x0e, 0x0b, 0xbe, 0x57, 0x3f, 0xfb, 0x59, 0x95,
2313 0x6b, 0xc6, 0xe4, 0x8c, 0x3c, 0x85, 0x3a, 0xf1, 0x49, 0x99, 0xab, 0x80, 2313 0x0e, 0x41, 0xb7, 0x72, 0x6c, 0x29, 0x15, 0x66, 0x0d, 0x19, 0x9f, 0x94,
2314 0x2e, 0xcd, 0x77, 0x02, 0xfc, 0x0e, 0x00, 0x37, 0x69, 0x8f, 0x23, 0xc6, 2314 0x63, 0xa8, 0x1b, 0x9f, 0x91, 0xe9, 0x32, 0xe8, 0xd2, 0x7c, 0xc7, 0xc0,
2315 0x7a, 0xb4, 0x83, 0xe6, 0x5c, 0x9e, 0x75, 0x52, 0x86, 0x79, 0xe5, 0x3d, 2315 0x6f, 0x1f, 0x70, 0x93, 0xf6, 0x28, 0x62, 0xac, 0x4b, 0x3b, 0x68, 0xce,
2316 0xd8, 0x0f, 0xfd, 0xe5, 0x5f, 0x64, 0xcd, 0xea, 0x94, 0x82, 0x17, 0x1f, 2316 0xe4, 0x58, 0x27, 0xa5, 0x98, 0x57, 0xde, 0x81, 0xfd, 0xd0, 0x5f, 0xfe,
2317 0x68, 0xaf, 0x58, 0x7b, 0xd7, 0x5f, 0xbb, 0x8a, 0x35, 0xda, 0xef, 0xb6, 2317 0x59, 0x96, 0xad, 0x1d, 0x92, 0x77, 0xe3, 0x03, 0xed, 0x15, 0x6b, 0x37,
2318 0x16, 0x1d, 0x7e, 0x55, 0xd7, 0x3a, 0x17, 0x6d, 0xbe, 0x13, 0xf6, 0x2f, 2318 0xbd, 0xb5, 0x6b, 0x58, 0xa3, 0xfd, 0xee, 0x6c, 0xd2, 0xe1, 0x97, 0x75,
2319 0x27, 0x3c, 0xd8, 0xd7, 0x27, 0xd6, 0xac, 0x47, 0xb7, 0x4b, 0x97, 0x49, 2319 0xad, 0x73, 0xd9, 0xe6,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 0xda, 0x1e,
2327 0x59, 0xd4, 0xcd, 0x6b, 0x32, 0xd8, 0xa8, 0x6c, 0xf7, 0xfe, 0xaf, 0xb6, 2327 0x19, 0x77, 0x4a, 0xda, 0xae, 0x2e, 0xb9, 0x76, 0x65, 0x51, 0x37, 0x97,
2328 0x29, 0x11, 0xad, 0x4f, 0xe6, 0x37, 0xda, 0xd8, 0xed, 0x88, 0xeb, 0xee, 2328 0x64, 0x6f, 0xbd, 0xba, 0xcb, 0xfd, 0xbf, 0xdb, 0xa6, 0x84, 0xb4, 0x3e,
2329 0x0f, 0x99, 0x67, 0x66, 0x98, 0x83, 0x66, 0x98, 0x3b, 0x0c, 0x3f, 0x1e, 2329 0x99, 0xdf, 0x68, 0x63, 0x77, 0x22, 0xae, 0x3b, 0xef, 0x32, 0xcf, 0x4c,
2330 0x26, 0x5b, 0x70, 0x24, 0x81, 0xa3, 0xee, 0xdb, 0xef, 0x73, 0x3e, 0xae, 2330 0x32, 0x07, 0x4d, 0x32, 0x77, 0x18, 0x5e, 0x3c, 0x8c, 0x37, 0xe1, 0x88,
2331 0xa0, 0xfe, 0x0c, 0x62, 0xea, 0xef, 0xdf, 0x71, 0xeb, 0xfa, 0x47, 0x3e, 2331 0x03, 0xc7, 0x8a, 0x67, 0xbf, 0x73, 0x1e, 0x2e, 0xbf, 0xfe, 0xf4, 0x63,
2332 0x7d, 0xed, 0x3a, 0x1e, 0xc3, 0xd6, 0x41, 0x7f, 0x72, 0x56, 0xc1, 0xbe, 2332 0xea, 0x9f, 0xdf, 0xb5, 0x79, 0x5d, 0x99, 0xee, 0x77, 0xab, 0x8e, 0xc7,
2333 0xf2, 0x0d, 0x4f, 0x1f, 0xf0, 0x7d, 0xd8, 0x1e, 0x5f, 0x03, 0xdd, 0x7a, 2333 0xb0, 0x75, 0xd0, 0x1f, 0x9f, 0x52, 0xb0, 0xaf, 0x5c, 0xdd, 0xd5, 0x07,
2334 0xf5, 0xb7, 0x27, 0x03, 0xea, 0x34, 0x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xbb, 2341 0x8d, 0xa2, 0x4a, 0xa3, 0x76, 0x49, 0x31, 0x67, 0x25, 0xc6, 0x32, 0x62,
2342 0x15, 0xea, 0xf9, 0x3a, 0x62, 0x35, 0xf5, 0xfe, 0xbe, 0xcc, 0x57, 0x86, 2342 0x41, 0x27, 0x09, 0x7b, 0x0a, 0xbb, 0x6e, 0x96, 0xa9, 0xe7, 0x5b, 0x88,
2343 0xec, 0x76, 0x83, 0xfe, 0x9a, 0x4a, 0x9f, 0x96, 0x31, 0xfb, 0xb4, 0xae, 2343 0xd5, 0xd4, 0xfb, 0x7b, 0x32, 0x53, 0xee, 0xb7, 0x5b, 0x0d, 0xfa, 0x6b,
2344 0xa1, 0x52, 0xc9, 0x63, 0x42, 0xd9, 0x5e, 0x97, 0x61, 0x5d, 0xdb, 0xbc, 2344 0x22, 0xb9, 0x22, 0xc3, 0xf6, 0x8a, 0xae, 0xa1, 0x12, 0xf1, 0x13, 0x42,
2345 0x2f, 0x16, 0xe4, 0x32, 0x53, 0x85, 0x8f, 0xed, 0xfe, 0x57, 0x57, 0xd7, 2345 0xd9, 0xde, 0x92, 0x01, 0x5d, 0xdb, 0xbc, 0x27, 0x16, 0xe4, 0x32, 0x59,
2346 0xa4, 0x08, 0x6f, 0xef, 0x6c, 0x81, 0xeb, 0x75, 0x8d, 0x87, 0xf8, 0x5a, 2346 0x81, 0x8f, 0xed, 0xfb, 0x57, 0x47, 0xd7, 0xa4, 0x08, 0x6f, 0xd7, 0xb7,
2347 0x71, 0x19, 0xd2, 0xb1, 0x3b, 0xc0, 0x67, 0xc9, 0x42, 0x33, 0xc0, 0x19, 2347 0xc1, 0xf5, 0xba, 0xc6, 0x43, 0x7c, 0xcd, 0xb8, 0x0c, 0x69, 0xdb, 0xe7,
2348 0x45, 0x5c, 0x46, 0x0c, 0xd8, 0xfd, 0x05, 0x5f, 0x1f, 0x7c, 0x7f, 0xd3, 2348 0xe3, 0xb3, 0x64, 0xb6, 0xe1, 0xe3, 0x0c,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370 0xb7, 0xda, 0x47, 0x9f, 0x39, 0xba, 0x77, 0x81, 0xcf, 0xe2, 0xd1, 0xd1,
2371 0xe3, 0x6f, 0x01, 0x0b, 0xb9, 0x54, 0x03, 0xfc, 0x84, 0xff, 0xd3, 0x4d, 2371 0x3a, 0x61, 0xf8, 0x7e, 0xec, 0xe8, 0xde, 0xfa, 0x3f, 0x00, 0x16, 0x72,
2372 0x67, 0x6a, 0xd9, 0xe2, 0x4c, 0xfa, 0xfd, 0x81, 0x23, 0x4e, 0x8d, 0x75, 2372 0xa9, 0xf8, 0xf8, 0x09, 0x7f, 0x7e, 0xcb, 0x99, 0x5a, 0xb6, 0x38, 0x93,
2373 0x42, 0x2a, 0x21, 0xba, 0x16, 0x9f, 0x3d, 0x52, 0x44, 0x7e, 0x8c, 0x68, 2373 0x7e, 0xff, 0xcc, 0xd1, 0x6c, 0x95, 0x75, 0x42, 0x22, 0x26, 0xba, 0x16,
2374 0x5a, 0x82, 0x75, 0xae, 0x51, 0x0f, 0x5b, 0xd1, 0x46, 0xba, 0x5a, 0xf1, 2374 0x2f, 0x1e, 0x2d, 0x20, 0x3f, 0x86, 0x34, 0x2d, 0xfe, 0x3a, 0xd7, 0xa8,
2375 0x30, 0xcf, 0x10, 0xcf, 0x63, 0xc0, 0x93, 0x06, 0x1e, 0xe6, 0x1b, 0x8f, 2375 0x87, 0xed, 0x68, 0x23, 0x5d, 0xcd, 0x78, 0x98, 0x67, 0x88, 0xe7, 0x18,
2376 0xde, 0xe4, 0xf2, 0x56, 0xb4, 0x11, 0x17, 0xcf, 0x0a, 0xf0, 0xf5, 0x8b, 2376 0xf0, 0x24, 0x81, 0x87, 0xf9, 0xc6, 0xa5, 0x37, 0xbe, 0xb0, 0x1d, 0x6d,
2377 0x3a, 0xfd, 0x26, 0xe9, 0x35, 0x59, 0xdb, 0x7a, 0xb1, 0xa6, 0x4d, 0x0a, 2377 0xc4, 0xc5, 0xb3, 0x7c, 0x7c, 0x3d, 0xa2, 0x56,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xf2, 0x03, 2392 0xc4, 0xf0, 0xaa, 0xa5, 0x76, 0x2b, 0x6d, 0x91, 0x89, 0x2a, 0x62, 0x12,
2393 0xad, 0x87, 0x36, 0x6b, 0xcc, 0xec, 0x57, 0x5f, 0xa4, 0x5d, 0x69, 0xca, 2393 0xba, 0xde, 0x44, 0x7c, 0x41, 0xfe, 0x53, 0xeb, 0xa1, 0xc5, 0x1a, 0x36,
2394 0x23, 0x27, 0x90, 0x97, 0xc7, 0x1f, 0x46, 0xce, 0x81, 0xbc, 0x4e, 0x94, 2394 0x7b, 0xd4, 0xe7, 0x68, 0x57, 0x9a, 0xf2, 0xd0, 0x29, 0xe4, 0xe5, 0x91,
2395 0xd0, 0xc9, 0xd3, 0x46, 0x36, 0x7e, 0xbd, 0x68, 0x79, 0x7d, 0x80, 0xce, 2395 0xc7, 0x90, 0x73, 0x20, 0xaf, 0x53, 0x45, 0x74, 0xf2, 0xb4, 0x91, 0x37,
2396 0x67, 0xe2, 0xf1, 0x18, 0x39, 0xd1, 0xad, 0xe3, 0x4c, 0x41, 0xc7, 0x9b, 2396 0x7e, 0xab, 0x60, 0xb9, 0x7d, 0x80, 0xce, 0x67, 0xe2, 0xf2, 0x18, 0x3a,
2397 0x21, 0x73, 0x46, 0x75, 0xa1, 0xc6, 0x40, 0x01, 0x8a, 0x0a, 0xc7, 0x1c, 2397 0xd5, 0xa1, 0xe3, 0x4c, 0x5e, 0xc7, 0x9b, 0x7e, 0x73, 0x52, 0xb5, 0xa3,
2398 0x11, 0x19, 0x5c, 0x44, 0x5c, 0x41, 0x1c, 0x1e, 0x5c, 0x47, 0x74, 0x3b, 2398 0xc6, 0x40, 0x01, 0x8a, 0x0a, 0xc7, 0x1c, 0x14, 0xd9, 0x3b, 0x87, 0xb8,
2399 0x41, 0x78, 0x25, 0xd1, 0x13, 0x11, 0x69, 0x3b, 0xc1, 0xfb, 0x10, 0xd9, 2399 0x82, 0x38, 0xbc, 0x77, 0x15, 0xd1, 0xed, 0x14,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, 0xfa, 0x75, 0xe0, 0x1e, 0x81, 0x9d, 0xd2, 0x36, 0x6d,
2422 0xe3, 0x43, 0x06, 0x67, 0x7e, 0x08, 0x9e, 0xd3, 0x90, 0x47, 0xa7, 0xae, 2422 0xd8, 0xac, 0x29, 0xcb, 0x43, 0x89, 0x6a, 0x51, 0x18, 0x1f, 0x52, 0x38,
2423 0x85, 0x72, 0x0a, 0xba, 0x5d, 0x9c, 0x97, 0x42, 0xf3, 0x57, 0x80, 0x2f, 2423 0xd3, 0xc0, 0xbe, 0x24, 0xe4, 0xb1, 0x43, 0xd7, 0x42, 0x19, 0x05, 0xdd,
2424 0x27, 0xb3, 0xcd, 0x49, 0x9c, 0x75, 0x1c, 0x76, 0x3b, 0xda, 0x2f, 0x5d, 2424 0xce, 0xcd, 0x48, 0xbe, 0xf1, 0x9b, 0x98, 0xcf, 0xc8, 0x54, 0x63, 0x0c,
2425 0x3c, 0x27, 0x03, 0x1a, 0xef, 0x97, 0xe2, 0xc9, 0x79, 0x39, 0x58, 0x25, 2425 0x67, 0x9d, 0xa4, 0xdd, 0xf6, 0x48, 0x3b, 0xcf, 0x49, 0x81, 0xc6, 0x87,
2426 0x9d, 0xc8, 0x25, 0x76, 0x2a, 0x9d, 0x97, 0xb1, 0xe4, 0x2a, 0x6a, 0x27, 2426 0xa4, 0x70, 0x7a, 0x46, 0x0e, 0x57, 0x48, 0x27, 0xef, 0x19, 0x13, 0xc9,
2427 0xcf, 0x1f, 0xb3, 0x52, 0x3c, 0x05, 0x1c, 0x55, 0xde, 0x03, 0x0c, 0xc1, 2427 0x9c, 0x0c, 0xc7, 0x97, 0x50, 0x3b, 0xb9, 0xfe, 0x98, 0x96, 0xc2, 0x19,
2428 0x6e, 0xc6, 0x74, 0x5f, 0x33, 0xab, 0xe3, 0x0e, 0xe7, 0xdf, 0x84, 0x9e, 2428 0xe0, 0xa8, 0xf0, 0x1e, 0xa0, 0x1f, 0x76, 0x33, 0xac, 0xfb, 0x9a, 0x29,
2429 0x86, 0x4a, 0x7b, 0x00, 0x57, 0x40, 0x0f, 0x34, 0x83, 0x7a, 0x79, 0xa5, 2429 0x1d, 0x77, 0x38, 0xff, 0x43, 0xe8, 0xa9, 0xbf, 0xb8, 0x1f, 0x70, 0x79,
2430 0x8a, 0x7e, 0xcf, 0x8e, 0xb0, 0xf6, 0x52, 0xea, 0x9e, 0x01, 0xa9, 0x57, 2430 0xf4, 0x40, 0x93, 0xa8, 0x97, 0x17, 0x2b, 0xe8, 0xf7, 0xec, 0x10, 0x6b,
2431 0xc7, 0x4c, 0xa5, 0x58, 0x53, 0x51, 0x17, 0x5c, 0xa3, 0x7f, 0x27, 0x54, 2431 0x2f, 0xa5, 0xee, 0xef, 0x93, 0x5a, 0x65, 0xd8, 0x54, 0x8a, 0x35, 0x15,
2432 0xd4, 0x1a, 0x90, 0xd5, 0x6a, 0x09, 0x7d, 0xb3, 0xf2, 0xef, 0x35, 0x4a, 2432 0x75, 0xc1, 0x35, 0xfa, 0x77, 0x4c, 0x85, 0xad, 0x3e, 0x59, 0xaa, 0x14,
2433 0x62, 0x5a, 0x5e, 0xdc, 0xcb, 0x29, 0xf2, 0x8d, 0xfa, 0xb3, 0xf9, 0x59, 2433 0xd1, 0x37, 0x2b, 0xef, 0x5e, 0x03, 0x16, 0x60, 0xb9, 0x71, 0x2f, 0xa3,
2434 0xd0, 0x98, 0x4b, 0x9a, 0x72, 0x14, 0xf4, 0xe1, 0x7d, 0x05, 0x36, 0xbe, 2434 0xc8, 0x37, 0xea, 0xcf, 0xc6, 0x27, 0x41, 0x63, 0x26, 0x6e, 0xca, 0x71,
2435 0xc8, 0x1a, 0x2e, 0x87, 0xb5, 0xac, 0x1c, 0x3e, 0x33, 0x03, 0x1a, 0x7a, 2435 0xd0, 0x87, 0xf7, 0x45, 0xd8, 0xf8, 0x1c, 0x6b, 0xb8, 0x0c, 0xd6, 0xd2,
2436 0x65, 0xe8, 0x77, 0xe9, 0x63, 0x07, 0x30, 0xc7, 0xef, 0x14, 0xec, 0xf5, 2436 0x72, 0xe4, 0xec, 0x24, 0x68, 0xe8, 0x92, 0xfe, 0x3f, 0xa1, 0x8f, 0x3d,
2437 0x31, 0xbc, 0x13, 0x36, 0x81, 0x27, 0xe5, 0x30, 0x80, 0xa7, 0x09, 0x5a, 2437 0x81, 0x39, 0x7e, 0x27, 0x60, 0xaf, 0x5f, 0xc4, 0x3b, 0x61, 0x63, 0x78,
2438 0x62, 0x5e, 0x6f, 0xb2, 0x3f, 0x29, 0xf5, 0x93, 0xf7, 0xc9, 0xec, 0xca, 2438 0x52, 0x0e, 0x7d, 0x78, 0x9a, 0xa0, 0x25, 0xe2, 0xf6, 0x26, 0x87, 0xe2,
2439 0x7d, 0xc0, 0xff, 0x36, 0xfa, 0x02, 0xe4, 0xb7, 0x15, 0x9e, 0xc5, 0xfa, 2439 0x52, 0x3b, 0xfd, 0xa0, 0x4c, 0x2d, 0x3e, 0x08, 0xfc, 0x3f, 0x42, 0x5f,
2440 0x8f, 0xe7, 0x74, 0xf4, 0x6b, 0xdf, 0x58, 0xe4, 0x3c, 0x9f, 0xfb, 0xb0, 2440 0x80, 0xfc, 0xb6, 0xc8, 0xb3, 0x58, 0xff, 0xf1, 0x9c, 0x9d, 0x3d, 0xda,
2441 0x1f, 0x3d, 0x46, 0x35, 0x27, 0xc5, 0x2a, 0xcf, 0x82, 0xee, 0x50, 0x4f, 2441 0x37, 0xe6, 0x38, 0xcf, 0xe7, 0x41, 0xec, 0x47, 0x8f, 0x51, 0xc9, 0x48,
2442 0x15, 0x4e, 0xce, 0xf8, 0x3a, 0xee, 0x97, 0x7c, 0xbc, 0xc4, 0xfe, 0x02, 2442 0xa1, 0xc2, 0xb3, 0xa0, 0x3b, 0xd4, 0x53, 0xf9, 0xd3, 0x93, 0x9e, 0x8e,
2443 0x79, 0x62, 0x79, 0xc2, 0xa9, 0xa4, 0x4c, 0x47, 0x11, 0x57, 0x5a, 0x98, 2443 0x7b, 0x24, 0x17, 0x2d, 0x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 0x2a, 0xf2, 0x62, 0x95, 0x6b, 0x5a, 2458 0xa2, 0x91, 0x80, 0x4f, 0x50, 0x86, 0x56, 0x93, 0x0c, 0x45, 0xbe, 0x5e,
2459 0x86, 0x09, 0x27, 0xd2, 0xa5, 0xef, 0xd2, 0x0b, 0xf2, 0x1d, 0x39, 0xb8, 2459 0x11, 0x79, 0xb9, 0xc2, 0x35, 0x2d, 0xc3, 0x58, 0x36, 0xd4, 0xce, 0xbb,
2460 0x24, 0x72, 0x06, 0xeb, 0x6b, 0x55, 0xfa, 0xea, 0x38, 0xea, 0xd7, 0x6d, 2460 0x75, 0xd8, 0xe5, 0xdf, 0xcb, 0xe1, 0x79, 0x91, 0xb3, 0x58, 0x5f, 0xae,
2461 0x52, 0x5f, 0x46, 0x4f, 0x56, 0x95, 0x59, 0xe7, 0x5e, 0xe6, 0x9b, 0x98, 2461 0xd0, 0x57, 0x47, 0x50, 0xbf, 0xee, 0x94, 0xda, 0x02, 0x7a, 0xb2, 0x8a,
2462 0x5c, 0xd6, 0x77, 0xb2, 0x22, 0x23, 0x67, 0xa3, 0x12, 0x3d, 0x8b, 0xe6, 2462 0x4c, 0x65, 0x1f, 0x60, 0xbe, 0x89, 0xc8, 0xba, 0xbe, 0x93, 0x15, 0x19,
2463 0x0f, 0xb2, 0x3f, 0x37, 0x1a, 0xdc, 0xd1, 0x7a, 0x3e, 0x5f, 0xae, 0x60, 2463 0x3c, 0x17, 0x96, 0xf0, 0x39, 0x34, 0x7f, 0x90, 0xfd, 0xf9, 0x21, 0xff,
2464 0x6f, 0x75, 0x48, 0xc7, 0xc9, 0x72, 0xa3, 0x28, 0x85, 0x1a, 0xcf, 0xc2, 2464 0x8e, 0xd6, 0xf5, 0xf9, 0x52, 0x19, 0x7b, 0x2b, 0xfd, 0x3a, 0x4e, 0x96,
2465 0x73, 0x39, 0x89, 0xb5, 0x8c, 0xcc, 0x9d, 0x1c, 0x97, 0xa7, 0x71, 0x06, 2465 0xea, 0x05, 0xc9,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02, 0xf5, 0xf5, 0xa7,
2473 0xf5, 0x08, 0x7a, 0x2d, 0xf6, 0xa0, 0xae, 0x4c, 0xd9, 0x9f, 0x36, 0x9f, 2473 0xd1, 0xeb, 0xc7, 0xbb, 0xa9, 0x47, 0xd0, 0x6b, 0xb1, 0x07, 0x75, 0x64,
2474 0x65, 0x97, 0xd0, 0x60, 0x9e, 0xfc, 0x2f, 0x37, 0x87, 0xbc, 0x77, 0x0d, 2474 0xdc, 0xfe, 0xb8, 0xf9, 0x3c, 0x24, 0x7b, 0xb5, 0xce, 0x3c, 0xf9, 0x5f,
2475 0xbd, 0x63, 0x4e, 0xc3, 0x19, 0x1e, 0x5c, 0x8d, 0x70, 0x63, 0xe6, 0x73, 2475 0x4e, 0x06, 0x79, 0xef, 0x06, 0x7a, 0xc7, 0x8c, 0x86, 0x33, 0x5c, 0xb8,
2476 0x84, 0x5b, 0x36, 0x7c, 0x38, 0x03, 0x70, 0x11, 0xb9, 0x60, 0x47, 0x61, 2476 0x2a, 0xe1, 0x86, 0xcd, 0x17, 0x08, 0xb7, 0x60, 0x78, 0x70, 0x06, 0xe0,
2477 0x23, 0xd3, 0xe0, 0x13, 0x31, 0x7e, 0xa2, 0xc7, 0xaf, 0x83, 0x3b, 0x91, 2477 0x42, 0x72, 0xd1, 0x0e, 0xc3, 0x46, 0x26, 0xc0, 0x27, 0x62, 0xfc, 0x68,
2478 0x5b, 0x6f, 0xee, 0x7f, 0xd5, 0xdf, 0xff, 0xb4, 0xbf, 0xff, 0xe2, 0x8d, 2478 0xa7, 0x57, 0x07, 0xef, 0x40, 0x6e, 0xbd, 0xbd, 0xff, 0x35, 0x6f, 0xff,
2479 0xfd, 0x41, 0x7e, 0xfd, 0xd0, 0x95, 0x16, 0xba, 0x5e, 0xad, 0x78, 0xf0, 2479 0xb3, 0xde, 0xfe, 0xcb, 0x1b, 0xfb, 0xfd, 0xfc, 0xfa, 0x13, 0x47, 0x9a,
2480 0x0b, 0x3e, 0x5d, 0x17, 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 0x8f, 0xc8, 0x61, 0xd8, 0x77, 0x4d,
2495 0xe9, 0x12, 0x6a, 0x9d, 0x3f, 0xd6, 0xb9, 0xcd, 0x75, 0xaf, 0x21, 0xbf, 2495 0xe7, 0x45, 0xda, 0x71, 0x62, 0xa2, 0x88, 0x5a, 0xe7, 0x2f, 0x75, 0x6e,
2496 0x4d, 0x6f, 0xb2, 0x3d, 0x75, 0xd6, 0xb3, 0x3d, 0x75, 0x16, 0x3d, 0xf0, 2496 0x73, 0x9c, 0x1b, 0xc8, 0x6f, 0x13, 0x5b, 0x6c, 0x4f, 0x9d, 0x73, 0x6d,
2497 0xf1, 0x98, 0x74, 0xac, 0xc1, 0x7f, 0x5e, 0xd8, 0xe9, 0xd5, 0x73, 0x2f, 2497 0x4f, 0x9d, 0x43, 0x0f, 0x7c, 0x32, 0x22, 0x6d, 0xcb, 0xf0, 0x9f, 0x97,
2498 0x24, 0x8d, 0xfc, 0x49, 0xc4, 0xbb, 0xe3, 0x51, 0xb1, 0x8e, 0xeb, 0x7c, 2498 0xf6, 0xb8, 0xf5, 0xdc, 0x4b, 0xfc, 0xdd, 0x09, 0xf1, 0xee, 0x64, 0x58,
2499 0x00, 0x79, 0x4f, 0xc9, 0xdc, 0x29, 0xc6, 0x54, 0x4b, 0x86, 0x8f, 0x53, 2499 0xac, 0x93, 0x3a, 0x1f, 0x40, 0xde, 0xe3, 0x32, 0x7d, 0x86, 0x31, 0xd5,
2500 0x1f, 0xac, 0x6b, 0x96, 0x27, 0x8a, 0xf0, 0x91, 0x79, 0xc4, 0x05, 0xb5, 2500 0x92, 0x81, 0x93, 0xd4, 0x07, 0xeb, 0x9a, 0x85, 0xd1, 0x02, 0x7c, 0x64,
2501 0xf6, 0xae, 0x14, 0x2d, 0xca, 0xa1, 0x57, 0xba, 0xd6, 0xd0, 0x8f, 0xaf, 2501 0x06, 0x71, 0x41, 0x2d, 0xdf, 0x94, 0x82, 0x45, 0x39, 0x74, 0x49, 0xfb,
2502 0x21, 0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 0xc4, 0x80, 0x01, 2509 0x7c, 0xf9, 0xfc, 0x40, 0xd0, 0xe0, 0x67, 0xef, 0xc9, 0x18, 0xf0, 0x7f,
2510 0x3c, 0x0f, 0xe0, 0x89, 0x94, 0x76, 0x96, 0xbc, 0x93, 0xd7, 0x77, 0x50, 2510 0x11, 0x31, 0xa0, 0x0f, 0xcf, 0x27, 0xf0, 0x44, 0x4a, 0x3b, 0x47, 0xde,
2511 0x37, 0x06, 0x7c, 0xce, 0xe2, 0xfd, 0x15, 0x99, 0x5b, 0x72, 0x8f, 0x22, 2511 0xc9, 0xeb, 0x75, 0xd4, 0x8d, 0x3e, 0x9f, 0x53, 0x78, 0x7f, 0x55, 0xa6,
2512 0xaf, 0xf2, 0x0e, 0xbd, 0xdf, 0xbb, 0x0f, 0xde, 0xcc, 0xfb, 0x2b, 0xe2, 2512 0xe7, 0x9d, 0xe3, 0xc8, 0xab, 0xbc, 0x43, 0xef, 0x71, 0xef, 0x83, 0xb7,
2513 0xc9, 0x27, 0x65, 0xd6, 0x05, 0xef, 0xab, 0x9b, 0x65, 0xd1, 0x1a, 0x3b, 2513 0xf2, 0xfe, 0xaa, 0xb8, 0xf2, 0x49, 0x98, 0x35, 0xc1, 0xfb, 0xd2, 0x56,
2514 0x12, 0xba, 0x0e, 0x3f, 0xd8, 0x60, 0x9c, 0xa0, 0x8c, 0xde, 0x11, 0x67, 2514 0x59, 0x34, 0xc7, 0x8e, 0x98, 0xae, 0xc3, 0x0f, 0xd7, 0x19, 0x27, 0x28,
2515 0x89, 0xf7, 0x5f, 0x1e, 0xbe, 0xd9, 0x46, 0x10, 0x37, 0x5a, 0xf7, 0xd8, 2515 0xa3, 0xeb, 0x92, 0x9d, 0xe7, 0xfd, 0x97, 0x8b, 0x6f, 0xaa, 0xee, 0xc7,
2516 0x80, 0x1b, 0x00, 0x1c, 0xe9, 0xda, 0xa0, 0xfc, 0x10, 0x73, 0x76, 0xb5, 2516 0x8d, 0xe6, 0x3d, 0x36, 0xe0, 0xfa, 0x00, 0x47, 0xba, 0xd6, 0x28, 0x3f,
2517 0xc4, 0x9a, 0xd6, 0x7d, 0x93, 0xf2, 0x0c, 0xea, 0x80, 0x57, 0xed, 0x5b, 2517 0xc4, 0x9c, 0xde, 0xa6, 0x58, 0xd3, 0xbc, 0x6f, 0x4c, 0x9e, 0x43, 0x1d,
2518 0xe4, 0x3a, 0xcb, 0x5a, 0xa8, 0xde, 0x98, 0x81, 0x4f, 0xb6, 0x21, 0x96, 2518 0xf0, 0x9a, 0xbd, 0x49, 0xae, 0x53, 0xac, 0x85, 0x6a, 0xf5, 0x49, 0xf8,
2519 0x99, 0x72, 0xb9, 0xd2, 0x2e, 0x75, 0xd4, 0x3b, 0x2b, 0xab, 0x8c, 0x85, 2519 0x64, 0x0b, 0x62, 0x99, 0x29, 0xeb, 0xe5, 0x56, 0xa9, 0xa1, 0xde, 0x59,
2520 0xa4, 0xbd, 0x0b, 0xf3, 0x5e, 0xfc, 0x62, 0xac, 0xbd, 0x5c, 0x41, 0x9e, 2520 0x5c, 0x62, 0x2c, 0x24, 0xed, 0xed, 0x98, 0x77, 0xe3, 0x17, 0x63, 0xed,
2521 0x85, 0x6f, 0x5f, 0xae, 0xc4, 0xf1, 0x1c, 0xc0, 0xd3, 0xc2, 0x33, 0x89, 2521 0x7a, 0x19, 0x79, 0x16, 0xbe, 0xbd, 0x5e, 0x8e, 0xe2, 0xd9, 0x87, 0xa7,
2522 0x67, 0x1a, 0xcf, 0x71, 0x3c, 0xc7, 0xf1, 0xb4, 0xb0, 0x37, 0x81, 0x67, 2522 0x85, 0x67, 0x1c, 0xcf, 0x24, 0x9e, 0x23, 0x78, 0x8e, 0xe0, 0x69, 0x61,
2523 0xd0, 0x33, 0x10, 0xd7, 0x4d, 0xbe, 0xcb, 0xfa, 0x3c, 0xd4, 0x8a, 0x16, 2523 0x6f, 0x0c, 0x4f, 0xbf, 0x67, 0x20, 0xae, 0xdb, 0x7c, 0x97, 0xf4, 0x79,
2524 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0xb8, 0xee, 0xdc,
2546 0xf3, 0xc0, 0xf5, 0xcd, 0x75, 0x7f, 0xca, 0x2c, 0xdd, 0xb8, 0x1b, 0x66, 2546 0xc2, 0x83, 0xf2, 0x78, 0xe0, 0xfa, 0xd6, 0xba, 0x3f, 0x61, 0x16, 0x37,
2547 0xfe, 0xa5, 0x6e, 0x32, 0xd8, 0x1f, 0xe8, 0x67, 0xc0, 0xef, 0x05, 0x52, 2547 0xee, 0x86, 0x99, 0x7f, 0xa9, 0x9b, 0x14, 0xf6, 0xfb, 0xfa, 0xe9, 0xf3,
2548 0x0b, 0xe8, 0x23, 0x20, 0x7f, 0xea, 0x68, 0x92, 0xf1, 0x09, 0xf8, 0x6d, 2548 0x7a, 0x81, 0xc4, 0x6c, 0x51, 0x58, 0xab, 0x50, 0x47, 0x63, 0xf0, 0x6b,
2549 0xa9, 0x55, 0x3a, 0x44, 0xf5, 0xb3, 0x37, 0x66, 0xad, 0xdc, 0x7a, 0xe6, 2549 0x13, 0xf8, 0x6d, 0xa9, 0x96, 0xdb, 0x44, 0xf5, 0xb0, 0x37, 0x66, 0xad,
2550 0x2f, 0xfa, 0x67, 0xa2, 0x9f, 0x3e, 0xc1, 0xba, 0x59, 0xe7, 0x19, 0xc0, 2550 0xdc, 0x7c, 0xe6, 0xaf, 0x78, 0x67, 0xa2, 0x9f, 0x3e, 0xc5, 0xba, 0x59,
2551 0x74, 0x6f, 0xa2, 0xed, 0xe7, 0x7c, 0x38, 0xae, 0xa7, 0xa5, 0x84, 0x3a, 2551 0xe7, 0x19, 0xc0, 0x74, 0x6c, 0xa1, 0xed, 0x17, 0x3d, 0x38, 0xae, 0x27,
2552 0x34, 0xbf, 0x88, 0x8a, 0x1e, 0xf1, 0x5b, 0x65, 0xf9, 0xbb, 0x16, 0xef, 2552 0xa5, 0x88, 0x3a, 0x34, 0x37, 0x87, 0x8a, 0x1e, 0xf1, 0x5b, 0xa5, 0xf9,
2553 0xf0, 0xc6, 0x92, 0x73, 0xa0, 0xb1, 0x64, 0xe6, 0x78, 0x6f, 0x06, 0x1c, 2553 0xbb, 0x16, 0xef, 0xf0, 0x86, 0xe3, 0xd3, 0xa0, 0xb1, 0x68, 0x66, 0x78,
2554 0xbb, 0x36, 0xe1, 0x98, 0xf2, 0x71, 0x4c, 0x49, 0xf9, 0xd4, 0x34, 0x7c, 2554 0x6f, 0x06, 0x1c, 0xbd, 0x5b, 0x70, 0x8c, 0x7b, 0x38, 0xc6, 0xa5, 0x74,
2555 0x2d, 0x87, 0xfc, 0x3e, 0x64, 0x3e, 0x28, 0x9f, 0x41, 0x73, 0x8d, 0xb9, 2555 0x66, 0x02, 0xbe, 0x96, 0x41, 0x7e, 0xef, 0x37, 0x1f, 0x91, 0x4f, 0xa0,
2556 0x33, 0xe3, 0xd0, 0x93, 0xeb, 0xee, 0xb1, 0xf7, 0x83, 0xee, 0x97, 0x91, 2556 0xb9, 0xc6, 0xdc, 0xd9, 0x11, 0xe8, 0xc9, 0x71, 0xf6, 0xdb, 0x87, 0x40,
2557 0x5b, 0x83, 0x9a, 0xa7, 0x9c, 0x88, 0x20, 0x87, 0x1d, 0xd6, 0xbf, 0xc3, 2557 0xf7, 0x77, 0x90, 0x5b, 0xfd, 0x9a, 0xa7, 0x14, 0x0b, 0x21, 0x87, 0x1d,
2558 0x96, 0x4c, 0x13, 0xf6, 0xaa, 0x8c, 0xb1, 0x34, 0xda, 0x7b, 0xe4, 0xb7, 2558 0xd1, 0xbf, 0xc3, 0x16, 0x4d, 0x13, 0xf6, 0xaa, 0x8c, 0xe1, 0x24, 0xda,
2559 0x05, 0xe4, 0x2a, 0xf2, 0xd9, 0x23, 0x65, 0xd3, 0x78, 0x20, 0x82, 0xba, 2559 0x7b, 0xe4, 0xb7, 0x59, 0xe4, 0x2a, 0xf2, 0xd9, 0x29, 0x25, 0xd3, 0x78,
2560 0xc6, 0x59, 0xa4, 0x1f, 0xc9, 0x70, 0x24, 0xdb, 0x8e, 0x9a, 0xd4, 0x95, 2560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d, 0x2e, 0xce, 0x87, 0x65,
2568 0x91, 0x24, 0x1d, 0xc0, 0x5e, 0x58, 0xfd, 0x07, 0xcf, 0x26, 0x08, 0x8f, 2568 0xd1, 0x62, 0x5d, 0x24, 0xf1, 0x2c, 0x60, 0x2f, 0x2e, 0xfd, 0x93, 0x6b,
2569 0x9e, 0xa7, 0x84, 0xba, 0xee, 0x41, 0xbd, 0xf7, 0x47, 0xe9, 0x99, 0x34, 2569 0x13, 0x84, 0x47, 0xcf, 0x53, 0x44, 0x5d, 0xf7, 0x88, 0xde, 0xfb, 0xd3,
2570 0xb5, 0xf6, 0x79, 0x45, 0xb9, 0x40, 0x7f, 0xd2, 0xbf, 0x51, 0xb0, 0x36, 2570 0xf4, 0x4c, 0x9a, 0x9a, 0xfb, 0xbc, 0x82, 0x5c, 0xa4, 0x3f, 0xe9, 0xdf,
2571 0x78, 0x0a, 0x36, 0xcb, 0xda, 0x9d, 0xfd, 0x00, 0xde, 0x1b, 0x5c, 0x27, 2571 0x28, 0x58, 0x1b, 0x1c, 0x83, 0xcd, 0xb2, 0x76, 0x67, 0x3f, 0x80, 0xf7,
2572 0xef, 0x78, 0x2e, 0x0f, 0x41, 0x36, 0xf4, 0x7b, 0xde, 0x89, 0x21, 0x8f, 2572 0x3a, 0xd7, 0xc9, 0x3b, 0x9e, 0x0b, 0xfd, 0x90, 0x0d, 0xfd, 0x9e, 0x77,
2573 0x2a, 0xfa, 0x7a, 0x59, 0xc7, 0x82, 0x72, 0xb5, 0x88, 0x9c, 0x82, 0x18, 2573 0x62, 0xc8, 0xa3, 0x8a, 0xbe, 0x5e, 0xd2, 0xb1, 0xa0, 0x54, 0x29, 0x20,
2574 0x60, 0xef, 0x82, 0x2d, 0xce, 0x40, 0x97, 0x93, 0x80, 0xdb, 0x94, 0x4b, 2574 0xa7, 0x20, 0x06, 0xd8, 0xbd, 0xb0, 0xc5, 0x49, 0xe8, 0x72, 0x0c, 0x70,
2575 0xd6, 0xcb, 0xba, 0x2e,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f, 2582 0x05, 0x1b, 0xa3, 0xec, 0xb0, 0xa6, 0x73, 0xc0, 0x79, 0xc9, 0xe8, 0x27,
2583 0x48, 0x6e, 0x75, 0x5c, 0x9e, 0xd3, 0x71, 0x2b, 0x88, 0x59, 0xac, 0x21, 2583 0x65, 0xf6, 0xaa, 0x64, 0x96, 0x46, 0xe4, 0x05, 0x1d, 0xb7, 0xfc, 0x98,
2584 0xf9, 0xfb, 0x71, 0x5a, 0x9e, 0x3d, 0x79, 0x55, 0x9c, 0xe7, 0x19, 0xb7, 2584 0xc5, 0x1a, 0x92, 0xbf, 0x1f, 0x27, 0xe5, 0xf9, 0xd3, 0xd7, 0x24, 0xfb,
2585 0xc6, 0x12, 0x9d, 0x06, 0x63, 0x95, 0x2b, 0x0d, 0xe4, 0xa6, 0x07, 0x6d, 2585 0x22, 0xe3, 0xd6, 0x70, 0x6c, 0x87, 0xc1, 0x58, 0xe5, 0x48, 0x1d, 0xb9,
2586 0xfe, 0x5b, 0x80, 0x08, 0x7a, 0x3a, 0x57, 0xda, 0x27, 0x52, 0x76, 0xd2, 2586 0xe9, 0x11, 0x9b, 0xff, 0x16, 0x20, 0x84, 0x9e, 0xce, 0x91, 0xd6, 0xd1,
2587 0x18, 0x3a, 0xd0, 0x69, 0x30, 0x37, 0x8e, 0x99, 0x8f, 0x4b, 0x70, 0x1f, 2587 0x84, 0x1d, 0x37, 0xfa, 0x9f, 0xd8, 0x61, 0x30, 0x37, 0x0e, 0x9b, 0x4f,
2588 0xd5, 0x21, 0x8f, 0xeb, 0xbb, 0x0a, 0xb8, 0xed, 0xe2, 0x07, 0xfa, 0x77, 2588 0x89, 0x7f, 0x1f, 0xd5, 0x26, 0x4f, 0xe9, 0xbb, 0x0a, 0xb8, 0xed, 0xdc,
2589 0x94, 0x6b, 0x19, 0xca, 0x1a, 0xdf, 0xeb, 0x9c, 0x2f, 0xc5, 0xae, 0x65, 2589 0xfb, 0xfa, 0x77, 0x94, 0x1b, 0x29, 0xca, 0x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b, 0xfd, 0x2e, 0x48, 0xbe, 2604 0xf7, 0xec, 0x52, 0xa5, 0x99, 0x66, 0xd2, 0x4b, 0x9d, 0x9e, 0x97, 0x9c,
2605 0x76, 0x4e, 0xf6, 0xd4, 0x16, 0xe4, 0x21, 0xeb, 0x01, 0xf0, 0x7b, 0xc9, 2605 0xd6, 0xef, 0xac, 0xe4, 0xaa, 0xe7, 0x65, 0x7f, 0x75, 0x56, 0x1e, 0xb5,
2606 0x2d, 0x5a, 0xba, 0x57, 0x99, 0x2c, 0xe0, 0xec, 0xe2, 0xff, 0x74, 0x6e, 2606 0x1e, 0x06, 0xbf, 0x57, 0x9c, 0x82, 0xa5, 0x7b, 0x95, 0xb1, 0x3c, 0xce,
2607 0xb5, 0xbf, 0x6d, 0x55, 0x67, 0xfc, 0xf1, 0xb5, 0x9d, 0xa4, 0xa1, 0x09, 2607 0x2e, 0x8c, 0xf4, 0xca, 0x4d, 0xd4, 0x1d, 0xcf, 0x2e, 0x9a, 0xf2, 0x3f,
2608 0xb7, 0xae, 0x93, 0xb8, 0x69, 0x0a, 0x76, 0x7c, 0xdb, 0x46, 0x24, 0xad, 2608 0x9d, 0x5b, 0x5f, 0x6c, 0x5b, 0xd5, 0x19, 0xff, 0x7c, 0x6d, 0x27, 0x69,
2609 0x6e, 0x43, 0x46, 0xa3, 0x2e, 0x53, 0x4c, 0x12, 0xba, 0x74, 0xeb, 0x44, 2609 0x68, 0xc2, 0xad, 0xeb, 0x24, 0x6e, 0x9a, 0x51, 0x3b, 0xbe, 0x6d, 0x23,
2610 0xda, 0x75, 0x5d, 0x37, 0xd0, 0x64, 0x9c, 0xb4, 0x14, 0x98, 0x54, 0x28, 2610 0x92, 0xa2, 0xdb, 0x10, 0x68, 0xd4, 0x65, 0x8a, 0x71, 0x42, 0x17, 0xb6,
2611 0xac, 0x43, 0x08, 0xa9, 0xc6, 0x6d, 0x35, 0xa6, 0xa5, 0x71, 0xfa, 0x46, 2611 0x22, 0xd2, 0xae, 0xab, 0x2a, 0x8d, 0x81, 0xe5, 0xa6, 0x7f, 0xd8, 0xc3,
2612 0x10, 0x5f, 0xb0, 0x92, 0xb4, 0x65, 0x52, 0x84, 0x5b, 0x04, 0xdb, 0x3e, 2612 0x0a, 0x85, 0x75, 0x08, 0x21, 0xd5, 0xb8, 0xe9, 0xd6, 0x69, 0x21, 0x4e,
2613 0xb0, 0xd1, 0xa5, 0x8c, 0x3f, 0x60, 0xfb, 0x30, 0x26, 0xb1, 0x29, 0x2b, 2613 0xff, 0x2d, 0x8c, 0x87, 0xcd, 0x4a, 0xd2, 0x96, 0x4d, 0x11, 0x2e, 0x88,
2614 0xb0, 0xb1, 0x7d, 0xea, 0x07, 0x26, 0x75, 0xda, 0x8a, 0xf7, 0xfb, 0x3d, 2614 0xb2, 0x3d, 0x6c, 0xa3, 0x4a, 0x01, 0xed, 0x79, 0x7b, 0x99, 0x34, 0x36,
2615 0xe7, 0x5e, 0xc7, 0x36, 0x41, 0x48, 0x8b, 0x14, 0xf9, 0x9e, 0x97, 0x7b, 2615 0x65, 0x05, 0x36, 0x5e, 0x36, 0xf5, 0x81, 0x07, 0xa6, 0xd1, 0x79, 0xbf,
2616 0xee, 0xb9, 0xe7, 0x79, 0x7f, 0x9e, 0xdf, 0xed, 0x59, 0x27, 0x9f, 0xc0, 2616 0xdf, 0x77, 0xee, 0x75, 0x6c, 0x13, 0x84, 0xb4, 0x48, 0x91, 0xef, 0x39,
2617 0xef, 0x38, 0x35, 0x67, 0x4b, 0xda, 0xee, 0x97, 0x9f, 0x6a, 0x2e, 0x9f, 2617 0xf7, 0xdc, 0x73, 0xce, 0x3d, 0xdf, 0xff, 0xef, 0xfb, 0xdd, 0x8c, 0x3d,
2618 0xf1, 0x49, 0x00, 0x3e, 0xa9, 0xc1, 0x16, 0x48, 0x8b, 0x13, 0xbb, 0x21, 2618 0x28, 0x3f, 0xd2, 0x5c, 0x3e, 0xe3, 0x93, 0x00, 0x7c, 0x52, 0x83, 0x2d,
2619 0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0x5a, 0x1f, 0x74, 2684 0xf1, 0x5b, 0x0b, 0xce, 0x8b, 0xb9, 0x5a, 0xe8, 0xba, 0x7d, 0xd4, 0xf9,
2685 0xa8, 0xfb, 0x56, 0x43, 0x9f, 0xb1, 0xbd, 0x59, 0xfd, 0x11, 0x13, 0x6f, 2685 0xcf, 0x76, 0x68, 0x7d, 0xd0, 0xa1, 0xee, 0x5b, 0x0b, 0x7d, 0xc6, 0xf6,
2686 0xc5, 0x35, 0x0f, 0x1a, 0x84, 0x7e, 0x9e, 0x9d, 0x84, 0xaf, 0x46, 0xdc, 2686 0x56, 0xf5, 0x47, 0x4c, 0xbc, 0x15, 0xd7, 0x3c, 0x68, 0x10, 0xfa, 0x79,
2687 0x5b, 0x15, 0xad, 0x1e, 0xf7, 0xce, 0xeb, 0x55, 0xa5, 0x0d, 0x65, 0x80, 2687 0x6e, 0x0a, 0xbe, 0x1a, 0x71, 0x6f, 0x35, 0xb4, 0xfa, 0x8e, 0x77, 0x5e,
2688 0x7a, 0x73, 0x0d, 0xd6, 0xdb, 0x13, 0xed, 0x01, 0x7f, 0xbd, 0x82, 0xfe, 2688 0xf3, 0x4a, 0x1b, 0xca, 0x00, 0xf5, 0xe6, 0x3a, 0xcc, 0xb7, 0x27, 0xda,
2689 0x8d, 0x1a, 0x4f, 0x04, 0x21, 0xf3, 0x37, 0x26, 0x5b, 0xbd, 0x18, 0xce, 2689 0x07, 0xfe, 0xfa, 0x19, 0xfa, 0x37, 0x6b, 0x3c, 0x11, 0x84, 0xcc, 0xdf,
2690 0x41, 0x1b, 0x71, 0xeb, 0x64, 0x84, 0x31, 0x05, 0xda, 0x5d, 0x52, 0x37, 2690 0x9c, 0x6a, 0xf7, 0x62, 0x38, 0x07, 0x6d, 0xc4, 0xad, 0x53, 0x11, 0xc6,
2691 0x85, 0xf8, 0x15, 0x7a, 0x7c, 0x51, 0xed, 0x51, 0x0f, 0xc6, 0xef, 0x20, 2691 0x14, 0x68, 0xf7, 0x48, 0xc3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2728 0x64, 0x97, 0x5d, 0xd2, 0xda, 0x4d, 0xc3, 0x40, 0xf6, 0x58, 0xc3, 0x69, 2728 0x78, 0xae, 0x35, 0xce, 0x73, 0xf2, 0x90, 0x5d, 0xd6, 0xda, 0x4d, 0xd3,
2729 0x9f, 0xef, 0xc9, 0x4f, 0x4f, 0x1e, 0x1b, 0x9f, 0x2e, 0x0d, 0x86, 0xb6, 2729 0x50, 0xf1, 0x44, 0xd3, 0x8b, 0x3e, 0xdf, 0x93, 0x9f, 0x66, 0x4e, 0x1c,
2730 0x75, 0xdb, 0x39, 0x59, 0x0f, 0x9a, 0x0f, 0xca, 0xa3, 0x8a, 0x1d, 0x7e, 2730 0x9c, 0x29, 0x0f, 0x87, 0xb6, 0xf7, 0xda, 0x79, 0x21, 0x66, 0x7f, 0x58,
2731 0x0d, 0xe3, 0xfb, 0x18, 0x5f, 0x26, 0x42, 0x8a, 0x09, 0x4e, 0xc4, 0x26, 2731 0x8e, 0x28, 0x76, 0xf8, 0x15, 0xdc, 0xdf, 0xc7, 0xf8, 0x32, 0x11, 0x52,
2732 0x20, 0x8b, 0x19, 0x37, 0xd1, 0x35, 0x14, 0x5c, 0xcd, 0xdc, 0x0d, 0x62, 2732 0x4c, 0x70, 0x22, 0x36, 0x01, 0x59, 0xcc, 0xba, 0xc4, 0xf8, 0xaf, 0x55,
2733 0x66, 0xfa, 0x59, 0xc4, 0x14, 0x3c, 0x2b, 0x87, 0xdc, 0x8d, 0xee, 0xa2, 2733 0xac, 0xff, 0x9c, 0xd0, 0xcf, 0x22, 0xa6, 0xe0, 0x59, 0x39, 0xec, 0x6e,
2734 0x64, 0x3d, 0x4c, 0x3e, 0x6b, 0x42, 0xf5, 0x32, 0xe1, 0x86, 0x1a, 0x86, 2734 0x76, 0x97, 0xc4, 0xf8, 0xbf, 0x59, 0xad, 0x09, 0x35, 0xca, 0x84, 0x1b,
2735 0x8a, 0x46, 0x06, 0x46, 0x82, 0xa9, 0x55, 0x27, 0x9d, 0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e8, 0xfb, 0x59, 0xce, 0x76, 0x53, 0xe7, 0xac, 0x19, 0xb3,
2743 0xfb, 0xdd, 0x16, 0x83, 0x4f, 0xb8, 0x45, 0x7a, 0x67, 0x53, 0xb2, 0xab, 2743 0xae, 0xae, 0xfd, 0xfb, 0x36, 0x83, 0x4f, 0xf8, 0x94, 0xf4, 0xce, 0xa5,
2744 0xad, 0xba, 0xfd, 0xcf, 0x9a, 0x76, 0xb3, 0xac, 0x6a, 0x21, 0x19, 0x9e, 2744 0xe4, 0xe1, 0x8e, 0xda, 0xf6, 0xbf, 0xea, 0xda, 0xad, 0xb2, 0xa6, 0x8d,
2745 0x68, 0xad, 0xee, 0xf7, 0xf9, 0xc9, 0x6f, 0xb7, 0xe1, 0x7d, 0x13, 0x30, 2745 0x64, 0x38, 0xd6, 0x5e, 0xdb, 0xef, 0xf3, 0x93, 0xdf, 0xee, 0xc0, 0xfb,
2746 0x78, 0x49, 0x8d, 0xa5, 0x6e, 0x44, 0xf9, 0xac, 0xbf, 0xd6, 0xdc, 0xc3, 2746 0x42, 0x66, 0xac, 0xa4, 0xc6, 0x52, 0x37, 0xa3, 0x5c, 0xeb, 0xc3, 0xba,
2747 0x6b, 0xde, 0xc3, 0x7b, 0x99, 0xd7, 0xfb, 0x37, 0xfb, 0x71, 0x0f, 0x73, 2747 0x67, 0x78, 0xcd, 0x67, 0xf8, 0x2c, 0xf3, 0x7a, 0xb7, 0xd9, 0x8f, 0x67,
2748 0x02, 0xcc, 0x6b, 0x90, 0x67, 0x57, 0x8a, 0xb3, 0x38, 0xe7, 0xf3, 0xf9, 2748 0x98, 0x13, 0x60, 0x5e, 0x83, 0x3c, 0xbb, 0x5a, 0x9c, 0xc5, 0x31, 0x9f,
2749 0x86, 0x74, 0x99, 0xf7, 0x7c, 0xbd, 0x12, 0x2b, 0x63, 0xd5, 0x76, 0xe6, 2749 0xcd, 0x37, 0x64, 0x2a, 0xbc, 0xe7, 0xeb, 0x95, 0x58, 0x05, 0xab, 0xb6,
2750 0xfd, 0x9c, 0x30, 0x69, 0xa7, 0x35, 0xa9, 0xd8, 0x75, 0xd0, 0xf9, 0x20, 2750 0xab, 0xe0, 0xe7, 0x84, 0x49, 0x3b, 0xad, 0x49, 0xc5, 0x6e, 0x80, 0xce,
2751 0xe8, 0xfc, 0x40, 0x90, 0x71, 0x61, 0xa3, 0x47, 0x6b, 0x47, 0x86, 0x8b, 2751 0x87, 0x40, 0xe7, 0x07, 0x83, 0x8c, 0x0b, 0x9b, 0x3d, 0x5a, 0x3b, 0x32,
2752 0x6f, 0x43, 0xc6, 0xc9, 0xa3, 0xf0, 0x29, 0x8a, 0x96, 0x87, 0xcf, 0xe8, 2752 0x52, 0xfa, 0x0d, 0x64, 0x9c, 0x3c, 0x0a, 0x9f, 0xa2, 0x64, 0x79, 0xf8,
2753 0x83, 0x4d, 0x73, 0x25, 0xa8, 0x79, 0x07, 0xc4, 0xf7, 0x73, 0xd7, 0x64, 2753 0x8c, 0x01, 0xd8, 0x34, 0x57, 0x82, 0x9a, 0x77, 0x40, 0x7c, 0x3f, 0x7f,
2754 0x78, 0x92, 0x39, 0x01, 0xf2, 0x33, 0xe3, 0xfa, 0x14, 0xc6, 0x6e, 0x62, 2754 0x5d, 0x46, 0xa6, 0x98, 0x13, 0x20, 0x3f, 0x33, 0xae, 0x4f, 0xe1, 0xde,
2755 0xae, 0x0b, 0x19, 0x1e, 0x05, 0xbf, 0x86, 0xc4, 0x99, 0xda, 0x22, 0xd9, 2755 0x2d, 0x8c, 0x75, 0x21, 0xc3, 0x63, 0xe0, 0xd7, 0x90, 0x38, 0xd3, 0xdb,
2756 0xb1, 0x51, 0xf5, 0x01, 0x3a, 0x61, 0xa3, 0x4e, 0xb8, 0x23, 0x72, 0xf2, 2756 0x24, 0x37, 0x3e, 0xa6, 0x3e, 0x40, 0x37, 0x6c, 0xd4, 0x29, 0x77, 0x54,
2757 0xf2, 0xdd, 0x90, 0x55, 0xc6, 0xfd, 0x9a, 0xd3, 0x28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x31, 0x5f, 0x5c, 0xba, 0x5f, 0x1d, 0xd3, 0xb8, 0xfe, 0x54,
2765 0x35, 0xf9, 0x02, 0x13, 0xc7, 0x5e, 0x93, 0x89, 0x05, 0xd2, 0x87, 0x36, 2765 0x4d, 0x0c, 0x6b, 0xf2, 0x05, 0x26, 0x8e, 0xbd, 0x2e, 0x13, 0x8b, 0xa4,
2766 0x3e, 0x20, 0x3f, 0x77, 0xba, 0xed, 0xc7, 0xb4, 0xd6, 0x98, 0x48, 0xb1, 2766 0x0f, 0x6d, 0x7c, 0x40, 0x7e, 0xe1, 0xf4, 0xda, 0x4f, 0x68, 0xad, 0x31,
2767 0x3e, 0xd3, 0xe8, 0x24, 0xed, 0x39, 0x09, 0xf5, 0x7f, 0x03, 0xd7, 0x8c, 2767 0x91, 0x62, 0x7d, 0xa6, 0xd9, 0x49, 0xda, 0xf3, 0x12, 0x1a, 0xfc, 0x1a,
2768 0x6b, 0x73, 0x6e, 0xb7, 0xfb, 0x98, 0xf8, 0x38, 0x90, 0x8d, 0xa9, 0xfa, 2768 0xae, 0x19, 0xd7, 0xe6, 0xdd, 0x5e, 0xf7, 0x09, 0xf1, 0x71, 0x20, 0x9b,
2769 0xc0, 0xad, 0xd2, 0xb5, 0x7d, 0x9c, 0x63, 0x70, 0x20, 0x12, 0x20, 0xad, 2769 0x53, 0x8d, 0x81, 0x4f, 0xca, 0xd7, 0xf7, 0x71, 0x8c, 0xc1, 0x81, 0x48,
2770 0x3e, 0xb8, 0x8b, 0xf8, 0x99, 0xea, 0xfc, 0xdf, 0xfd, 0x47, 0xf6, 0xf6, 2770 0x80, 0xb4, 0x7a, 0xef, 0x2e, 0xe2, 0x67, 0x6a, 0xf3, 0x7f, 0x0f, 0x1c,
2771 0x25, 0x5e, 0x64, 0x0c, 0x1b, 0x76, 0x0e, 0xac, 0x33, 0xef, 0x9a, 0xcd, 2771 0xdb, 0x3b, 0x90, 0x38, 0xc3, 0x18, 0x36, 0xec, 0x3c, 0xba, 0x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, 0xeb, 0x3c, 0xac, 0xd3, 0x0f, 0x8f, 0x76, 2779 0xb2, 0xfd, 0xe4, 0x43, 0xa6, 0x7d, 0x06, 0xed, 0x06, 0x0f, 0xeb, 0x34,
2780 0x16, 0x9e, 0x58, 0x67, 0xe2, 0xef, 0x25, 0xc5, 0x7f, 0xbd, 0x53, 0x15, 2780 0x75, 0xbc, 0xbb, 0x78, 0x6c, 0x83, 0x89, 0xbf, 0x97, 0x15, 0xff, 0xf5,
2781 0xd3, 0xa4, 0x02, 0x63, 0xf9, 0xd1, 0xc0, 0x68, 0xde, 0xea, 0x69, 0x00, 2781 0x56, 0x4d, 0x4c, 0x93, 0x0a, 0x8c, 0x17, 0xc6, 0x02, 0x63, 0x05, 0xab,
2782 0xad, 0xe6, 0x5d, 0xe6, 0x6a, 0xfc, 0x9c, 0x15, 0xf3, 0xfd, 0x22, 0x4f, 2782 0xaf, 0x09, 0xb4, 0x5a, 0x70, 0x99, 0xab, 0xf1, 0x73, 0x56, 0xcc, 0xf7,
2783 0x2a, 0x46, 0x8a, 0x35, 0x45, 0x4b, 0x7d, 0xa1, 0x83, 0xf3, 0xcc, 0xf1, 2783 0x8b, 0x3c, 0xa9, 0x18, 0x29, 0xd6, 0x14, 0x2d, 0xf5, 0x85, 0x0e, 0x2d,
2784 0x47, 0x54, 0x1f, 0x1c, 0x5a, 0x68, 0x96, 0x9c, 0xbd, 0x56, 0x72, 0x2a, 2784 0x30, 0xc7, 0x1f, 0x51, 0x7d, 0x70, 0x78, 0xb1, 0x55, 0xf2, 0xf6, 0x7a,
2785 0xe3, 0x51, 0xd5, 0x01, 0x96, 0xb3, 0x15, 0x7d, 0xdc, 0xf7, 0x43, 0x8a, 2785 0xc9, 0xab, 0x8c, 0x47, 0x55, 0x07, 0x58, 0xce, 0x3d, 0xe8, 0xe3, 0xbe,
2786 0x8b, 0x78, 0x23, 0xdf, 0x8e, 0x36, 0x73, 0xcd, 0xdb, 0x6b, 0xfa, 0x2b, 2786 0x1f,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 0x77, 0xcb, 0xd0, 0x14, 2808 0xe1, 0x2b, 0x16, 0x17, 0x1d, 0xfc, 0xf7, 0xe0, 0xbf, 0x0f, 0xff, 0xbb,
2809 0xfd, 0x57, 0xd6, 0x72, 0x9a, 0x6a, 0x9e, 0x4f, 0x1f, 0xa9, 0x43, 0x71, 2809 0x25, 0x3d, 0x4d, 0xff, 0x95, 0xb5, 0x9c, 0x96, 0xba, 0xf5, 0xe9, 0x23,
2810 0x60, 0x39, 0x2f, 0xce, 0xc9, 0x15, 0x6a, 0xe5, 0x84, 0x79, 0x52, 0x5f, 2810 0x75, 0x29, 0x0e, 0x2c, 0xef, 0xc5, 0x39, 0xf9, 0x62, 0xbd, 0x9c, 0x30,
2811 0x47, 0x30, 0x5f, 0xea, 0xd7, 0xfa, 0x2a, 0x6b, 0x58, 0x96, 0x57, 0xf7, 2811 0x4f, 0xea, 0xeb, 0x08, 0xe6, 0x4b, 0xfd, 0x5a, 0x5f, 0x75, 0x0d, 0xcb,
2812 0x22, 0x4f, 0x37, 0xca, 0xa1, 0x82, 0x5f, 0xbb, 0x8a, 0xc9, 0xa3, 0xe5, 2812 0xf2, 0xea, 0x5e, 0xe4, 0xe9, 0x66, 0x39, 0x5c, 0xf4, 0x6b, 0x57, 0x31,
2813 0xda, 0x95, 0xa4, 0x83, 0x03, 0xb7, 0x1e, 0xcc, 0x4c, 0x2a, 0x9e, 0xc0, 2813 0x39, 0x52, 0xa9, 0x5d, 0x49, 0x26, 0x38, 0xf4, 0xc9, 0x23, 0xd9, 0x29,
2814 0xb2, 0x06, 0xae, 0x3d, 0x38, 0xb1, 0xf0, 0xee, 0x83, 0xcb, 0x98, 0x70, 2814 0xc5, 0x13, 0x58, 0xd6, 0xd0, 0xf5, 0x47, 0x26, 0x16, 0xdf, 0x7e, 0x64,
2815 0x8c, 0x2d, 0xac, 0x84, 0x19, 0x22, 0x96, 0xee, 0x33, 0xf2, 0x10, 0x0d, 2815 0x05, 0x13, 0x8e, 0x7b, 0x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
2823 0x80, 0x37, 0xe9, 0xf7, 0x1c, 0x55, 0x3f, 0x9b, 0xf8, 0xfa, 0xc4, 0xaf, 2823 0x07, 0xcf, 0x2b, 0x06, 0xf0, 0x16, 0xfd, 0x9e, 0xe3, 0xea, 0x67, 0x13,
2824 0x18, 0xcf, 0x13, 0x9b, 0x59, 0x28, 0xfa, 0x18, 0x8e, 0x89, 0x0e, 0x3c, 2824 0x5f, 0x9f, 0xf8, 0x35, 0xe3, 0x79, 0x62, 0x33, 0x8b, 0x25, 0x1f, 0xc3,
2825 0xdb, 0xe6, 0xb7, 0x29, 0xc3, 0xe7, 0x22, 0x81, 0x91, 0x73, 0xa1, 0xc0, 2825 0x71, 0xb4, 0x0b, 0x6b, 0xdb, 0xfc, 0x36, 0x65, 0xe4, 0x7c, 0x24, 0x30,
2826 0x03, 0xfa, 0x9d, 0x0b, 0xeb, 0x9d, 0x25, 0x39, 0xe9, 0x3a, 0xe4, 0xcd, 2826 0x7a, 0x3e, 0x14, 0x78, 0x50, 0xbf, 0x73, 0x61, 0xbd, 0xb3, 0x2c, 0x93,
2827 0xfe, 0x61, 0xc8, 0xc2, 0x08, 0x54, 0xfd, 0x2e, 0x67, 0xad, 0x80, 0xa4, 2827 0xae, 0x43, 0xde, 0x1c, 0x1c, 0x81, 0x2c, 0x8c, 0x42, 0xd5, 0x3f, 0xe4,
2828 0xa9, 0x4f, 0xe0, 0x67, 0x26, 0x4f, 0xbb, 0x92, 0xc9, 0xcf, 0x05, 0x0c, 2828 0xac, 0x17, 0x90, 0x34, 0xf5, 0x11, 0xfc, 0xcc, 0xe4, 0x8b, 0xae, 0x64,
2829 0x1e, 0xcd, 0x46, 0xbb, 0x07, 0xed, 0x57, 0xbd, 0xf6, 0x0e, 0xc9, 0xcc, 2829 0x0b, 0xf3, 0x01, 0x83, 0x47, 0xb3, 0xd1, 0xee, 0x43, 0xfb, 0xe7, 0x5e,
2830 0x48, 0xea, 0x43, 0xf5, 0x87, 0x5f, 0xf1, 0x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, 0xfe, 0x2c, 0xe9, 0xd5, 0x0b, 0x5d, 0x9d, 0x82, 0xdc, 0xba, 0xb2,
2838 0x7c, 0x4a, 0x0c, 0x9e, 0xda, 0x92, 0x74, 0x34, 0x25, 0xa7, 0xfa, 0x12, 2838 0x50, 0x0a, 0x05, 0x46, 0x0a, 0x29, 0x31, 0x78, 0x6a, 0x4b, 0x32, 0xd1,
2839 0x5d, 0xcc, 0x43, 0x66, 0x7a, 0x5d, 0xb9, 0x58, 0xa4, 0x3d, 0xce, 0xca, 2839 0x94, 0x9c, 0x1e, 0x48, 0xf4, 0x30, 0x0f, 0x99, 0xed, 0x77, 0xe5, 0x52,
2840 0xa5, 0xbe, 0x84, 0x5b, 0x10, 0xe2, 0x62, 0x5c, 0xb9, 0x04, 0xd9, 0xfc, 2840 0x89, 0xf6, 0x38, 0x27, 0x97, 0x07, 0x12, 0x6e, 0x51, 0x88, 0x8b, 0x71,
2841 0xdd, 0xb9, 0xdd, 0xf2, 0x68, 0x5e, 0xfd, 0xe0, 0xee, 0xb0, 0xbc, 0x20, 2841 0xe5, 0x32, 0x64, 0xf3, 0x9d, 0xf3, 0xbb, 0xe5, 0x48, 0x41, 0xfd, 0xe0,
2842 0x17, 0xfb, 0x5e, 0xb8, 0x79, 0xd1, 0x7d, 0x04, 0x67, 0x4a, 0x3e, 0xcc, 2842 0xde, 0xb0, 0xbc, 0x20, 0x97, 0x06, 0x5e, 0xb8, 0x75, 0xc9, 0x3d, 0x84,
2843 0x74, 0x98, 0x7d, 0x2b, 0x0e, 0x49, 0x98, 0x0f, 0xd1, 0x9a, 0x9a, 0x53, 2843 0x33, 0x25, 0x1f, 0x1e, 0xee, 0x32, 0xfb, 0x56, 0x1c, 0x92, 0x30, 0x1f,
2844 0x2f, 0x43, 0xfb, 0x23, 0x5e, 0x5c, 0x0e, 0x9f, 0x3b, 0xe0, 0x9a, 0x7a, 2844 0xa2, 0x35, 0x35, 0xa7, 0x51, 0xd2, 0xfb, 0x23, 0x5e,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 0x27, 0x86, 0x7c, 0x7f, 0x58, 0xb6, 0x2d, 0x9f, 2852 0xdf, 0x48, 0x6c, 0xe4, 0x52, 0xc1, 0xef, 0x87, 0x9f, 0x18, 0xf2, 0xfd,
2853 0xb5, 0x6c, 0xeb, 0x5c, 0xf8, 0xae, 0xb7, 0x66, 0xca, 0x9b, 0x8b, 0x98, 2853 0x61, 0xd9, 0xbe, 0x72, 0xd6, 0xb2, 0xbd, 0x7b, 0xf1, 0x5b, 0xde, 0x9c,
2854 0x23, 0xb6, 0x5a, 0xed, 0x93, 0x99, 0xfb, 0x5f, 0x79, 0xba, 0x37, 0xf1, 2854 0x29, 0x6f, 0x2c, 0x62, 0x8e, 0xd8, 0x5a, 0xb5, 0x4f, 0x66, 0xec, 0xa7,
2855 0x9a, 0xe2, 0x64, 0xcb, 0xf7, 0x70, 0x1c, 0x31, 0x64, 0x51, 0xef, 0x89, 2855 0xf2, 0x74, 0x7f, 0xe2, 0x15, 0xc5, 0xc9, 0x56, 0x9e, 0xe1, 0x7d, 0xc4,
2856 0xed, 0x01, 0x7d, 0xd3, 0xb1, 0x7b, 0xec, 0x39, 0x2b, 0x18, 0x30, 0xfe, 2856 0x90, 0x25, 0x7d, 0x26, 0xb6, 0x07, 0xf4, 0xcd, 0xc4, 0xee, 0xb6, 0xe7,
2857 0x48, 0x9d, 0xfc, 0x28, 0x0a, 0xbb, 0xcd, 0x6f, 0x58, 0x98, 0xff, 0x72, 2857 0xad, 0x60, 0xc0, 0xf8, 0x23, 0x0d, 0xf2, 0xbd, 0x28, 0xec, 0x36, 0xbf,
2858 0x6f, 0x7b, 0x7e, 0x0a, 0xfb, 0x12, 0x2f, 0x26, 0xad, 0x34, 0xf6, 0xc7, 2858 0x61, 0x61, 0xfe, 0xcb, 0xbd, 0xed, 0xf9, 0x29, 0xec, 0x4b, 0x9c, 0x49,
2859 0x33, 0x20, 0x06, 0xd4, 0x02, 0x9d, 0xda, 0xf1, 0x7e, 0x88, 0x9f, 0x7a, 2859 0x5a, 0x13, 0xd8, 0x1f, 0xcf, 0x80, 0x18, 0x50, 0x0b, 0x74, 0xea, 0xc4,
2860 0xfd, 0xf7, 0x5f, 0x03, 0x1d, 0xc6, 0xfd, 0x1b, 0x5c, 0x98, 0x58, 0xcc, 2860 0xfb, 0x21, 0x7e, 0xea, 0xf7, 0xdf, 0x7f, 0x1d, 0x74, 0x18, 0xf7, 0x6f,
2861 0x85, 0x0c, 0x7a, 0x18, 0xd8, 0x4a, 0xb9, 0xf5, 0xb1, 0xb1, 0x3e, 0x9e, 2861 0x70, 0x61, 0x62, 0x31, 0x17, 0x32, 0xec, 0x61, 0x60, 0xab, 0xe5, 0xd6,
2862 0x8e, 0x18, 0xa5, 0x18, 0xfc, 0x40, 0xca, 0x04, 0x79, 0xb3, 0x0d, 0xfd, 2862 0xc7, 0xc6, 0xfa, 0x78, 0x3a, 0x62, 0x94, 0x62, 0xf0, 0x03, 0x29, 0x13,
2863 0xab, 0x6e, 0xa5, 0xf4, 0xd5, 0xfd, 0xbe, 0x8f, 0xcb, 0xd8, 0xee, 0x89, 2863 0xe4, 0xcd, 0x0e, 0xf4, 0xaf, 0xf9, 0x24, 0xa5, 0xaf, 0xee, 0xf7, 0x7d,
2864 0xfc, 0x3e, 0x83, 0xcd, 0xb3, 0x96, 0x24, 0xd5, 0x91, 0xb4, 0x4f, 0x62, 2864 0x58, 0xc1, 0x76, 0x4f, 0x14, 0xf6, 0x19, 0x6c, 0x9e, 0xb5, 0x2c, 0xa9,
2865 0xbf, 0x43, 0xa1, 0x44, 0x21, 0x2b, 0x31, 0x99, 0x83, 0xbe, 0xb8, 0x0a, 2865 0xae, 0xa4, 0x3d, 0x89, 0xfd, 0xa6, 0x43, 0x89, 0x62, 0x4e, 0x62, 0x32,
2866 0xd9, 0x7f, 0xab, 0xc8, 0xef, 0x6d, 0x53, 0x72, 0x28, 0x0f, 0x83, 0x3e, 2866 0x0f, 0x7d, 0xf1, 0x1a, 0x64, 0xff, 0x5a, 0x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0x29, 0x3d, 0x87, 0xb9, 0x02,
2896 0x0e, 0x23, 0x03, 0xdb, 0xb2, 0x57, 0xe7, 0xc7, 0x96, 0xe5, 0xbb, 0x23, 2896 0xf9, 0x37, 0xa4, 0x39, 0x8c, 0x2c, 0x6c, 0xcb, 0x5e, 0x1d, 0x1f, 0x5b,
2897 0xa0, 0x71, 0x77, 0x26, 0xbf, 0x4a, 0x3a, 0x55, 0x07, 0x75, 0x78, 0xbc, 2897 0x91, 0xef, 0xae, 0x80, 0xc6, 0xdd, 0xd9, 0xc2, 0x1a, 0xe9, 0x56, 0x1d,
2898 0x0d, 0x7b, 0xa1, 0x58, 0xee, 0x03, 0x72, 0xb4, 0xd8, 0x0f, 0x3a, 0xc4, 2898 0xd4, 0xe5, 0xf1, 0x36, 0xec, 0x85, 0x62, 0xb9, 0x0f, 0xc8, 0xf1, 0xd2,
2899 0xe4, 0x29, 0xf8, 0xcd, 0xcf, 0x14, 0xef, 0x90, 0xa5, 0x08, 0xf6, 0x55, 2899 0x20, 0xe8, 0x10, 0x93, 0xa7, 0xe0, 0x37, 0x3f, 0x53, 0xba, 0x43, 0x96,
2900 0x96, 0xb1, 0x41, 0xf9, 0xf1, 0xdc, 0x06, 0xef, 0x3a, 0xe1, 0x2e, 0x59, 2900 0x23, 0xd8, 0x57, 0x45, 0xc6, 0x86, 0xe5, 0xfb, 0xf3, 0x09, 0xef, 0x3a,
2901 0xdb, 0xb1, 0x07, 0xca, 0x13, 0xe5, 0x8a, 0xf3, 0x82, 0x88, 0x45, 0xb8, 2901 0xe1, 0x2e, 0x5b, 0x3b, 0xb0, 0x07, 0xca, 0x13, 0xe5, 0x8a, 0xe3, 0x82,
2902 0xee, 0x11, 0xa3, 0xdb, 0xb0, 0x6e, 0x21, 0x42, 0xf9, 0xe5, 0xde, 0x42, 2902 0x88, 0x45, 0x38, 0xef, 0xd3, 0x46, 0xb7, 0x61, 0xde, 0x62, 0x84, 0xf2,
2903 0x9e, 0xcc, 0x32, 0xae, 0xe2, 0x3b, 0x1b, 0x9b, 0x94, 0xae, 0x3a, 0x8b, 2903 0xcb, 0xbd, 0x85, 0x3c, 0x99, 0x65, 0x5c, 0xc5, 0x77, 0x36, 0x36, 0x29,
2904 0x84, 0xe2, 0x40, 0x97, 0xcf, 0xc0, 0x5f, 0xc7, 0x97, 0x4b, 0xff, 0x3b, 2904 0x53, 0x73, 0x16, 0x09, 0xc5, 0x81, 0xae, 0x9c, 0x81, 0x3f, 0x8f, 0x2f,
2905 0x0a, 0xea, 0x51, 0xd8, 0xca, 0x3c, 0x6c, 0x65, 0x1e, 0x36, 0x12, 0xb2, 2905 0x97, 0xfe, 0x77, 0x14, 0xd4, 0xa3, 0xb0, 0x95, 0x05, 0xd8, 0xca, 0x02,
2906 0xf0, 0x56, 0x1e, 0x36, 0x32, 0x0f, 0x1b, 0x09, 0x7d, 0xf6, 0x06, 0x62, 2906 0x6c, 0x24, 0x64, 0xe1, 0x5a, 0x01, 0x36, 0xb2, 0x00, 0x1b, 0x09, 0x7d,
2907 0xbb, 0xab, 0xe0, 0x21, 0xe3, 0x6b, 0x1f, 0xa6, 0xaf, 0x8d, 0xbf, 0xff, 2907 0xf6, 0x3a, 0x62, 0xbb, 0xd7, 0xc0, 0x43, 0xc6, 0xd7, 0x3e, 0x4a, 0x5f,
2908 0x01, 0x88, 0x97, 0xee, 0xe9, 0xc4, 0x71, 0x00, 0x00, 0x00 }; 2908 0x1b, 0x7f, 0xff, 0x03, 0x4c, 0x03, 0x3a, 0xe1, 0xd4, 0x71, 0x00, 0x00,
2909 0x00 };
2909 2910
2910static const u32 bnx2_RXP_b06FwData[(0x0/4) + 1] = { 0x0 }; 2911static const u32 bnx2_RXP_b06FwData[(0x0/4) + 1] = { 0x0 };
2911static const u32 bnx2_RXP_b06FwRodata[(0x24/4) + 1] = { 2912static const u32 bnx2_RXP_b06FwRodata[(0x24/4) + 1] = {
2912 0x08004580, 0x08004580, 0x080044f8, 0x08004530, 0x08004564, 0x08004588, 2913 0x08004590, 0x08004590, 0x08004508, 0x08004540, 0x08004574, 0x08004598,
2913 0x08004588, 0x08004588, 0x08004468, 0x00000000 }; 2914 0x08004598, 0x08004598, 0x08004478, 0x00000000 };
2914 2915
2915static struct fw_info bnx2_rxp_fw_06 = { 2916static struct fw_info bnx2_rxp_fw_06 = {
2916 /* Firmware version: 4.0.5 */ 2917 /* Firmware version: 4.1.1 */
2917 .ver_major = 0x4, 2918 .ver_major = 0x4,
2918 .ver_minor = 0x0, 2919 .ver_minor = 0x1,
2919 .ver_fix = 0x5, 2920 .ver_fix = 0x1,
2920 2921
2921 .start_addr = 0x080031d0, 2922 .start_addr = 0x080031d0,
2922 2923
2923 .text_addr = 0x08000000, 2924 .text_addr = 0x08000000,
2924 .text_len = 0x71c0, 2925 .text_len = 0x71d0,
2925 .text_index = 0x0, 2926 .text_index = 0x0,
2926 .gz_text = bnx2_RXP_b06FwText, 2927 .gz_text = bnx2_RXP_b06FwText,
2927 .gz_text_len = sizeof(bnx2_RXP_b06FwText), 2928 .gz_text_len = sizeof(bnx2_RXP_b06FwText),
@@ -2931,22 +2932,22 @@ static struct fw_info bnx2_rxp_fw_06 = {
2931 .data_index = 0x0, 2932 .data_index = 0x0,
2932 .data = bnx2_RXP_b06FwData, 2933 .data = bnx2_RXP_b06FwData,
2933 2934
2934 .sbss_addr = 0x08007200, 2935 .sbss_addr = 0x08007220,
2935 .sbss_len = 0x58, 2936 .sbss_len = 0x58,
2936 .sbss_index = 0x0, 2937 .sbss_index = 0x0,
2937 2938
2938 .bss_addr = 0x08007258, 2939 .bss_addr = 0x08007278,
2939 .bss_len = 0x44c, 2940 .bss_len = 0x44c,
2940 .bss_index = 0x0, 2941 .bss_index = 0x0,
2941 2942
2942 .rodata_addr = 0x080071c0, 2943 .rodata_addr = 0x080071d0,
2943 .rodata_len = 0x24, 2944 .rodata_len = 0x24,
2944 .rodata_index = 0x0, 2945 .rodata_index = 0x0,
2945 .rodata = bnx2_RXP_b06FwRodata, 2946 .rodata = bnx2_RXP_b06FwRodata,
2946}; 2947};
2947 2948
2948static u8 bnx2_rv2p_proc1[] = { 2949static u8 bnx2_rv2p_proc1[] = {
2949 /* Date: 12/07/2007 14:57 */ 2950 /* Date: 12/07/2007 15:02 */
2950 0xd5, 0x56, 0x41, 0x6b, 0x13, 0x51, 0x10, 0x9e, 0xdd, 0x6c, 0xbb, 0xdb, 2951 0xd5, 0x56, 0x41, 0x6b, 0x13, 0x51, 0x10, 0x9e, 0xdd, 0x6c, 0xbb, 0xdb,
2951 0x64, 0xb3, 0x59, 0xaa, 0xd6, 0x50, 0x53, 0x93, 0x06, 0x2f, 0xad, 0x29, 2952 0x64, 0xb3, 0x59, 0xaa, 0xd6, 0x50, 0x53, 0x93, 0x06, 0x2f, 0xad, 0x29,
2952 0x6d, 0xaa, 0x82, 0x42, 0xa1, 0x92, 0x4b, 0xc1, 0xf6, 0x20, 0xf5, 0x22, 2953 0x6d, 0xaa, 0x82, 0x42, 0xa1, 0x92, 0x4b, 0xc1, 0xf6, 0x20, 0xf5, 0x22,
@@ -3032,7 +3033,7 @@ static u8 bnx2_rv2p_proc1[] = {
3032 0xa7, 0xd8, 0x0d, 0x00, 0x00, 0x00 }; 3033 0xa7, 0xd8, 0x0d, 0x00, 0x00, 0x00 };
3033 3034
3034static u8 bnx2_rv2p_proc2[] = { 3035static u8 bnx2_rv2p_proc2[] = {
3035 /* Date: 12/07/2007 14:57 */ 3036 /* Date: 12/07/2007 15:02 */
3036 0xed, 0x59, 0x5d, 0x6c, 0x54, 0xc7, 0x15, 0x9e, 0xbd, 0xbb, 0x7b, 0xf7, 3037 0xed, 0x59, 0x5d, 0x6c, 0x54, 0xc7, 0x15, 0x9e, 0xbd, 0xbb, 0x7b, 0xf7,
3037 0x7a, 0x7d, 0xf7, 0xae, 0x71, 0xa8, 0xff, 0xf9, 0xb3, 0x09, 0xd8, 0xa9, 3038 0x7a, 0x7d, 0xf7, 0xae, 0x71, 0xa8, 0xff, 0xf9, 0xb3, 0x09, 0xd8, 0xa9,
3038 0x21, 0xce, 0x9a, 0x98, 0x02, 0x55, 0x63, 0x39, 0x95, 0x81, 0xa6, 0x55, 3039 0x21, 0xce, 0x9a, 0x98, 0x02, 0x55, 0x63, 0x39, 0x95, 0x81, 0xa6, 0x55,
diff --git a/drivers/net/bnx2_fw2.h b/drivers/net/bnx2_fw2.h
index 13b222eb2f63..e6ffa2769f3d 100644
--- a/drivers/net/bnx2_fw2.h
+++ b/drivers/net/bnx2_fw2.h
@@ -3173,250 +3173,250 @@ static struct fw_info bnx2_rxp_fw_09 = {
3173}; 3173};
3174 3174
3175static u8 bnx2_xi_rv2p_proc1[] = { 3175static u8 bnx2_xi_rv2p_proc1[] = {
3176 /* Date: 12/07/2007 16:21 */ 3176 /* Date: 01/14/2008 15:44 */
3177 0xc5, 0x56, 0xcd, 0x6b, 0x13, 0x51, 0x10, 0x9f, 0xdd, 0xa4, 0xd9, 0x34, 3177 0xc5, 0x56, 0xcd, 0x6b, 0x13, 0x51, 0x10, 0x9f, 0xdd, 0x7c, 0x6c, 0x9a,
3178 0xd9, 0x64, 0x97, 0xaa, 0x25, 0xb4, 0x91, 0xa6, 0x55, 0x0f, 0x69, 0x23, 3178 0x6c, 0xb2, 0xa1, 0x6a, 0x09, 0x35, 0xd2, 0x58, 0x7a, 0x30, 0x6d, 0xc4,
3179 0xb6, 0xea, 0xc1, 0x43, 0xc1, 0xda, 0x8b, 0xa0, 0x9e, 0x7a, 0x10, 0xf1, 3179 0x56, 0x3d, 0x78, 0x28, 0x54, 0x7a, 0x11, 0xac, 0xa7, 0x1e, 0x44, 0xc4,
3180 0xdb, 0x20, 0x05, 0xf1, 0x8f, 0x70, 0x51, 0xab, 0x20, 0x78, 0x28, 0x6a, 3180 0xcf, 0x20, 0x05, 0xf5, 0x8f, 0x70, 0x51, 0xab, 0x20, 0x78, 0x28, 0x68,
3181 0xb0, 0x0a, 0xea, 0x49, 0x45, 0x3c, 0x34, 0x07, 0x41, 0x50, 0x14, 0x14, 3181 0xb4, 0x7e, 0xa0, 0x27, 0x15, 0xf1, 0x90, 0x1c, 0x04, 0x05, 0x45, 0x50,
3182 0x3c, 0xe9, 0x4d, 0xf0, 0xe3, 0x50, 0x15, 0x3f, 0x0e, 0x7a, 0x13, 0x8f, 3182 0xf0, 0xa4, 0x37, 0x41, 0xbd, 0x54, 0xc5, 0x0f, 0xf0, 0xe2, 0x45, 0x8f,
3183 0xda, 0xf8, 0xde, 0xcc, 0xef, 0xd9, 0xdd, 0x4d, 0xd3, 0x14, 0x0f, 0xba, 3183 0xda, 0xf8, 0xde, 0xcc, 0xef, 0xd9, 0xdd, 0x4d, 0xd2, 0x14, 0x0f, 0x1a,
3184 0xd0, 0xfc, 0xfa, 0xde, 0x9b, 0x37, 0x6f, 0xe6, 0x37, 0xf3, 0x66, 0x9e, 3184 0x68, 0x7f, 0xec, 0xdb, 0xdf, 0x9b, 0x37, 0xf3, 0x9b, 0x79, 0x33, 0x9b,
3185 0x4f, 0x44, 0x36, 0x05, 0xf5, 0x3e, 0x85, 0x94, 0xb5, 0x12, 0x69, 0x05, 3185 0x27, 0x22, 0x9b, 0xfc, 0xc6, 0x80, 0x42, 0x72, 0xad, 0x58, 0x4a, 0x81,
3186 0x16, 0xd1, 0x5d, 0x97, 0x31, 0xd8, 0x40, 0xf2, 0x0d, 0x09, 0x04, 0x43, 3186 0x45, 0x74, 0xcf, 0x65, 0xf4, 0x37, 0x91, 0xfc, 0x46, 0x04, 0xfc, 0x91,
3187 0xbe, 0xfa, 0xfd, 0x4e, 0x5b, 0x4b, 0x1a, 0x13, 0xb4, 0xb5, 0x5f, 0xe3, 3187 0xbc, 0xfa, 0xff, 0x9d, 0x26, 0x4a, 0x1a, 0x63, 0x34, 0xb1, 0x5e, 0xe3,
3188 0x36, 0x7a, 0x5c, 0x2a, 0x28, 0xfc, 0xd5, 0xa0, 0x40, 0x8f, 0xd7, 0xcc, 3188 0x24, 0x3d, 0x29, 0x15, 0x14, 0xfe, 0x6a,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0xa1, 0xae, 0xf0, 0xd3, 0x27, 0xfe, 0x4e, 0xc2, 0xec, 0x77, 0x83, 3196 0x49, 0xe2, 0x49, 0xd0, 0x4c, 0xca, 0x15, 0x9d, 0x06, 0x84, 0xfd, 0x6e,
3197 0xfa, 0x1f, 0x65, 0xdb, 0xa0, 0x96, 0x9b, 0x53, 0x7e, 0x1b, 0x7f, 0x8d, 3197 0x58, 0xef, 0x57, 0xbe, 0x0d, 0x6b, 0xde, 0x82, 0x8a, 0xdb, 0xc4, 0x1b,
3198 0xbc, 0xc8, 0x39, 0xac, 0xe7, 0xad, 0x5a, 0x37, 0x7e, 0x85, 0xfd, 0xc9, 3198 0xe6, 0x39, 0x15, 0x63, 0x57, 0xf3, 0xde, 0x2a, 0x9e, 0x89, 0x2f, 0x18,
3199 0x86, 0xfc, 0x89, 0xf9, 0xd9, 0xe4, 0x57, 0x98, 0xa7, 0xf4, 0x22, 0x76, 3199 0x57, 0x26, 0x10, 0x57, 0x24, 0xde, 0x96, 0xf8, 0x82, 0x7a, 0xa5, 0xda,
3200 0xeb, 0x73, 0x94, 0x0d, 0x7c, 0x4e, 0x0a, 0xfc, 0xa6, 0x62, 0xfb, 0x52, 3200 0xf8, 0xaf, 0xcf, 0x51, 0xbe, 0xf0, 0x39, 0x49, 0xe8, 0x9c, 0x8c, 0xec,
3201 0x2d, 0xf6, 0x7d, 0x6a, 0x2c, 0xf8, 0x69, 0xd6, 0xf5, 0xfc, 0xd3, 0x85, 3201 0x4b, 0x76, 0x88, 0xfb, 0x93, 0x35, 0xb3, 0x21, 0xec, 0x3f, 0x91, 0xb6,
3202 0xf9, 0x72, 0x74, 0x5d, 0xfc, 0xef, 0x80, 0xff, 0x8f, 0xe0, 0xdf, 0x0e, 3202 0xf7, 0x54, 0xf9, 0x8d, 0xf5, 0x72, 0x3b, 0x1d, 0x12, 0xd0, 0xe1, 0x31,
3203 0x5a, 0x6b, 0x17, 0x78, 0x3d, 0xc9, 0xfb, 0x7b, 0x95, 0x3d, 0x1a, 0x57, 3203 0xe2, 0x9b, 0xa2, 0x21, 0xbb, 0xc0, 0xef, 0xe3, 0xbc, 0x7f, 0xad, 0xf2,
3204 0x03, 0xfb, 0x81, 0x07, 0x81, 0x07, 0x80, 0xab, 0x80, 0x2b, 0x81, 0x2b, 3204 0x47, 0xe3, 0x3a, 0xe0, 0x7a, 0xe0, 0x01, 0xe0, 0x7e, 0xe0, 0x1a, 0xe0,
3205 0x80, 0x5d, 0xc0, 0xcb, 0x40, 0x1f, 0xe8, 0x01, 0xf3, 0xc0, 0x8b, 0x40, 3205 0x6a, 0xe0, 0x2a, 0x60, 0x2f, 0xf0, 0x32, 0x30, 0x0f, 0xf4, 0x80, 0x39,
3206 0x17, 0x98, 0x05, 0xd6, 0x80, 0x57, 0x81, 0x69, 0xe0, 0x31, 0xe0, 0x23, 3206 0xe0, 0x05, 0xa0, 0x0b, 0xcc, 0x00, 0x6b, 0xc0, 0xab, 0xc0, 0x14, 0xf0,
3207 0xe0, 0x13, 0xe0, 0x37, 0xe0, 0x39, 0xa3, 0xcf, 0xc2, 0xb9, 0x40, 0x42, 3207 0x28, 0xf0, 0x21, 0xf0, 0x31, 0xf0, 0x0b, 0xf0, 0x1c, 0xd0, 0xb1, 0x60,
3208 0x3e, 0x58, 0x31, 0x9e, 0xae, 0x21, 0xef, 0x35, 0xcf, 0x58, 0x2f, 0x1b, 3208 0x0f, 0xa8, 0x7e, 0x3e, 0xee, 0x47, 0x48, 0xa7, 0xeb, 0xa8, 0x7f, 0xad,
3209 0x39, 0xc4, 0x97, 0x79, 0x9a, 0x81, 0x5c, 0xd7, 0xec, 0x8d, 0xd8, 0xfd, 3209 0x33, 0xde, 0x97, 0x0d, 0x0f, 0xf9, 0x65, 0x9d, 0x2e, 0x83, 0xd7, 0x5b,
3210 0x28, 0xb5, 0xbd, 0x17, 0xf1, 0xb8, 0x79, 0xec, 0xcf, 0xe1, 0xed, 0x1e, 3210 0xbf, 0x19, 0xb9, 0x27, 0xa5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218 0x25, 0x97, 0x71, 0xf7, 0x10, 0xc5, 0x3e, 0xb3, 0x2e, 0xf7, 0x31, 0x60, 3218 0x2f, 0x84, 0xff, 0xba, 0xe4, 0x32, 0xee, 0x1e, 0xa1, 0xc8, 0xcf, 0xbc,
3219 0xbb, 0x7f, 0x58, 0x41, 0xdd, 0x9c, 0x83, 0x7d, 0xc7, 0x4d, 0x1c, 0x7d, 3219 0x97, 0xfb, 0xe8, 0xb3, 0xdf, 0x3f, 0x2c, 0xbf, 0x61, 0xce, 0xc1, 0xbe,
3220 0xb6, 0x73, 0x80, 0x64, 0x3c, 0x51, 0x96, 0xf5, 0x89, 0x32, 0xee, 0xf3, 3220 0xe3, 0x26, 0x8f, 0x79, 0xf6, 0x73, 0x90, 0xe4, 0x79, 0xba, 0x2c, 0xef,
3221 0x40, 0x34, 0x1f, 0xe4, 0x5e, 0x24, 0x10, 0xef, 0x7d, 0xb8, 0x17, 0xf1, 3221 0xa7, 0xcb, 0xb8, 0xcf, 0x83, 0xe1, 0x7a, 0x90, 0x7b, 0x11, 0x43, 0xbe,
3222 0x7b, 0x9c, 0x9e, 0xbd, 0x31, 0x1d, 0xce, 0x97, 0x02, 0x55, 0x47, 0x60, 3222 0xf7, 0xe2, 0x5e, 0x44, 0xef, 0x71, 0xaa, 0x7e, 0x73, 0x2e, 0x58, 0x2f,
3223 0x4f, 0x53, 0x9c, 0x4d, 0x3d, 0x36, 0xf9, 0xce, 0xd3, 0xb3, 0x41, 0x22, 3223 0x05, 0xaa, 0x8e, 0xc1, 0x9f, 0x96, 0x3c, 0x9b, 0xbe, 0x6c, 0xea, 0x9d,
3224 0xc2, 0xdf, 0x18, 0x55, 0xc2, 0x71, 0xb2, 0x16, 0xc9, 0x97, 0x76, 0xe7, 3224 0x97, 0xeb, 0x7e, 0x2c, 0xa4, 0xdf, 0x76, 0xaa, 0x04, 0xf3, 0x64, 0xb5,
3225 0x44, 0xf4, 0xe5, 0x55, 0x04, 0xa8, 0x39, 0x8f, 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x71, 0x59, 0x2f, 0x18, 0x3c, 0x7b, 0x4a, 0xbe, 0xfb, 0x6c, 0xfa, 0x0d,
3262 0x0f, 0x65, 0x7b, 0x50, 0x0d, 0x00, 0x00, 0x00 }; 3262 0x6d, 0x29, 0x98, 0xe1, 0x30, 0x0d, 0x00, 0x00, 0x00 };
3263 3263
3264static u8 bnx2_xi_rv2p_proc2[] = { 3264static u8 bnx2_xi_rv2p_proc2[] = {
3265 /* Date: 12/07/2007 16:21 */ 3265 /* Date: 01/14/2008 15:44 */
3266 0xad, 0x58, 0x5d, 0x6c, 0xd3, 0x55, 0x14, 0xbf, 0xfd, 0x58, 0xdb, 0xb5, 3266 0xad, 0x58, 0x5d, 0x6c, 0xd3, 0x55, 0x14, 0xbf, 0xfd, 0x58, 0xdb, 0x75,
3267 0xff, 0xb6, 0x63, 0x9b, 0xdd, 0xa7, 0x6e, 0x6e, 0x61, 0x6c, 0xd8, 0xcd, 3267 0xff, 0xb6, 0x63, 0x9b, 0xdd, 0xa7, 0x6e, 0x6e, 0x61, 0x6c, 0xd8, 0xcd,
3268 0xd1, 0x8d, 0x4f, 0x4d, 0x5c, 0x86, 0x19, 0x20, 0x26, 0x8c, 0x61, 0xd4, 3268 0xd1, 0x8d, 0x4f, 0x4d, 0x5c, 0x86, 0x19, 0x20, 0x26, 0x8c, 0x61, 0xd4,
3269 0x37, 0xd8, 0x90, 0xb2, 0xb1, 0x8d, 0x2c, 0x8c, 0xf0, 0xc0, 0x8b, 0x0d, 3269 0x37, 0xd8, 0x90, 0xb2, 0xb2, 0x8d, 0x2c, 0x8c, 0xf0, 0xc0, 0x8b, 0x0d,
3270 0xd3, 0xf1, 0xd2, 0x07, 0x47, 0xb2, 0x0d, 0x8d, 0xc1, 0x45, 0x7d, 0x40, 3270 0xd3, 0xf1, 0xd2, 0x07, 0x47, 0xb2, 0x0d, 0x8d, 0xc1, 0x45, 0x7d, 0x40,
3271 0x9f, 0xec, 0x83, 0x32, 0x30, 0xc6, 0xc4, 0xe8, 0x42, 0xf0, 0x01, 0x48, 3271 0x9f, 0xec, 0x83, 0x52, 0x30, 0xc6, 0xc4, 0xe8, 0x42, 0xf0, 0x01, 0x48,
3272 0x30, 0xc6, 0x68, 0x48, 0x08, 0xea, 0x32, 0x10, 0x75, 0x0c, 0xfb, 0x64, 3272 0x30, 0xc6, 0x68, 0x48, 0x08, 0xea, 0x32, 0x10, 0x75, 0x0c, 0xfb, 0x64,
3273 0x98, 0xf7, 0x9e, 0xdf, 0xb9, 0xff, 0xfe, 0xff, 0x6d, 0x27, 0x18, 0xec, 3273 0x98, 0xf7, 0x9e, 0xdf, 0xb9, 0xff, 0xfe, 0xff, 0x5d, 0x27, 0x18, 0xec,
3274 0x43, 0x4f, 0xef, 0xbd, 0xe7, 0x9e, 0x7b, 0x3e, 0x7e, 0xe7, 0x9c, 0x7b, 3274 0x43, 0x4f, 0xef, 0xbd, 0xe7, 0x9e, 0x7b, 0x3e, 0x7e, 0xe7, 0x9c, 0x7b,
3275 0x5b, 0x24, 0x84, 0x70, 0x8a, 0x44, 0xaa, 0x46, 0x52, 0x11, 0x70, 0xb8, 3275 0x5b, 0x2c, 0x84, 0x70, 0x8a, 0x44, 0xaa, 0x56, 0x52, 0x61, 0x38, 0x5c,
3276 0x04, 0x3e, 0x6b, 0x8b, 0x88, 0x5c, 0x4b, 0xf9, 0xe4, 0x77, 0x81, 0x78, 3276 0x02, 0x9f, 0xb5, 0xc5, 0x44, 0xae, 0xa5, 0x7c, 0xf2, 0xbb, 0x40, 0xbc,
3277 0xc9, 0x59, 0x4e, 0x63, 0xb7, 0x50, 0x34, 0x2c, 0x44, 0xc2, 0x4a, 0x4b, 3277 0xe4, 0xac, 0xa0, 0xb1, 0x5b, 0x28, 0x1a, 0x12, 0x22, 0x61, 0xa5, 0xa5,
3278 0x98, 0x5e, 0x65, 0xfa, 0x3b, 0xd3, 0xc7, 0x1d, 0xa0, 0x57, 0x78, 0xbc, 3278 0x4c, 0xaf, 0x32, 0xfd,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, 0xbe,
3286 0x9a, 0x1f, 0xf4, 0x17, 0x7f, 0xa1, 0xfc, 0x5e, 0x5e, 0x8e, 0x07, 0x58, 3286 0xe6, 0x07, 0xfd, 0xc5, 0x5f, 0x28, 0xbf, 0x97, 0x96, 0x62, 0x45, 0x2c,
3287 0xbe, 0xc1, 0x6a, 0x07, 0xb0, 0x7f, 0xce, 0x80, 0x1e, 0x2f, 0xd7, 0x42, 3287 0xdf, 0x60, 0xb5, 0x8b, 0xb0, 0x7f, 0xd6, 0x80, 0x1e, 0x2f, 0xd7, 0x41,
3288 0xbf, 0xef, 0x9f, 0x52, 0xf3, 0x2e, 0x91, 0x60, 0x39, 0x42, 0x68, 0x3d, 3288 0xbf, 0xef, 0x9f, 0x52, 0xf3, 0x2e, 0x91, 0x60, 0x39, 0x42, 0x68, 0x3d,
3289 0x79, 0x7d, 0x10, 0xfb, 0x56, 0xad, 0xc1, 0xea, 0x5b, 0x71, 0x8c, 0xab, 3289 0x79, 0x7d, 0x10, 0xfb, 0x56, 0xad, 0xc1, 0xea, 0x5b, 0x31, 0x8c, 0xab,
3290 0x3e, 0x28, 0xa2, 0xb8, 0x9c, 0x4e, 0x69, 0xfe, 0x7c, 0x72, 0xdd, 0x52, 3290 0x3f, 0x28, 0xa6, 0xb8, 0x9c, 0x4e, 0x69, 0xfe, 0x7c, 0x72, 0xdd, 0x52,
3291 0x2e, 0xe4, 0x8b, 0x3a, 0x1f, 0x29, 0x93, 0x88, 0x82, 0x8a, 0xe6, 0xec, 3291 0x2e, 0xe4, 0x8b, 0x7a, 0x1f, 0x29, 0x93, 0x88, 0x80, 0x8a, 0x96, 0xdc,
3292 0x73, 0x20, 0x7f, 0x6a, 0xb5, 0x9a, 0x77, 0x8a, 0x1e, 0x97, 0x9a, 0xf7, 3292 0x73, 0x20, 0x7f, 0x6a, 0xb5, 0x9a, 0x77, 0x8a, 0x5e, 0x97, 0x9a, 0xf7,
3293 0x88, 0x9e, 0x01, 0xed, 0x5f, 0xac, 0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 0xbf, 0x9b, 0xe2,
3308 0xc1, 0x21, 0x8c, 0x2e, 0xd0, 0x37, 0x69, 0xfd, 0x6f, 0x47, 0x92, 0xec, 3308 0xe0, 0x10, 0x46, 0x37, 0xe8, 0x9b, 0xb4, 0xfe, 0xb7, 0x23, 0x49, 0x76,
3309 0xee, 0x0a, 0xb9, 0xcf, 0x81, 0x91, 0x71, 0x6d, 0xe2, 0x56, 0xe3, 0xfe, 3309 0x77, 0x07, 0xdd, 0xe7, 0xc0, 0xc8, 0xb8, 0x36, 0x71, 0xab, 0x71, 0xff,
3310 0x61, 0xf1, 0x3b, 0x6e, 0x68, 0xbc, 0xb2, 0xff, 0xd9, 0xbf, 0xef, 0x89, 3310 0xb0, 0xf8, 0x1d, 0x37, 0x34, 0x5e, 0xd9, 0xff, 0xec, 0xdf, 0xf7, 0x44,
3311 0x6c, 0x9c, 0x82, 0x76, 0x35, 0x80, 0x7a, 0xea, 0xb3, 0xf1, 0xaa, 0xf1, 3311 0x2e, 0x4e, 0x41, 0xbb, 0x1b, 0x41, 0x3d, 0x0d, 0xb9, 0x78, 0xd5, 0xf8,
3312 0x69, 0xf7, 0x33, 0xc7, 0xc7, 0x82, 0x17, 0x22, 0x12, 0x27, 0x36, 0xdc, 3312 0xb4, 0xfb, 0x99, 0xe3, 0x63, 0xc1, 0x0b, 0x11, 0x89, 0x13, 0x1b, 0x6e,
3313 0x30, 0x4e, 0x2b, 0xa4, 0xbf, 0x74, 0xfc, 0x95, 0x20, 0xaf, 0x18, 0x64, 3313 0x18, 0xa7, 0x95, 0xd2, 0x5f, 0x3a, 0xfe, 0x4a, 0x90, 0x57, 0x0c, 0xb2,
3314 0x79, 0x03, 0x6c, 0xd7, 0x10, 0xdb, 0x75, 0xc7, 0xaf, 0xfd, 0xaa, 0xed, 3314 0xbc, 0x38, 0xdb, 0x35, 0xc4, 0x76, 0xdd, 0xf1, 0x6b, 0xbf, 0x6a, 0x7b,
3315 0x01, 0x3d, 0x69, 0xb3, 0xc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96, 0xc5, 0xd9, 0x95, 0xde, 0xc9, 0xe0, 0x9b, 0xe2, 3395 0x3a, 0x28, 0x4e, 0xad, 0x0b, 0xe9, 0x95, 0xde, 0xc9, 0xe0, 0x9b, 0xe2,
3396 0x73, 0x23, 0xdc, 0x4f, 0x22, 0xc8, 0x3f, 0x51, 0x9e, 0xe4, 0x77, 0xcb, 3396 0x73, 0xc3, 0xdc, 0x4f, 0xc2, 0xc8, 0x3f, 0x51, 0x91, 0xe4, 0x77, 0xcb,
3397 0x04, 0xee, 0x9d, 0x53, 0x06, 0x68, 0x24, 0xa8, 0xf5, 0x45, 0x3e, 0x26, 3397 0x04, 0xee, 0x9d, 0x53, 0x06, 0x68, 0x38, 0xa0, 0xf5, 0x45, 0x3e, 0x26,
3398 0x52, 0xc8, 0x3b, 0xac, 0x3b, 0x2c, 0xeb, 0x7c, 0x1f, 0xc9, 0x79, 0xe7, 3398 0x52, 0xc8, 0x3b, 0xac, 0x3b, 0x2c, 0xeb, 0x7c, 0x1f, 0x59, 0xf6, 0xce,
3399 0x28, 0xba, 0xe4, 0x28, 0x71, 0x68, 0x3b, 0xb1, 0xda, 0x17, 0x54, 0xf8, 3399 0x51, 0x74, 0xd1, 0x51, 0xea, 0xd0, 0x76, 0x62, 0xb5, 0x3f, 0xa0, 0xf0,
3400 0xbd, 0x69, 0xe6, 0xd5, 0x02, 0xf9, 0xad, 0x6a, 0x26, 0x4d, 0xfa, 0x57, 3400 0x7b, 0xd3, 0xcc, 0xab, 0x79, 0xf2, 0x5b, 0xf5, 0x4c, 0x86, 0xf4, 0xaf,
3401 0x8a, 0x12, 0xea, 0xc3, 0x15, 0xa1, 0x45, 0xf8, 0x31, 0x36, 0xcd, 0xfe, 3401 0x12, 0xa5, 0xd4, 0x87, 0x2b, 0x83, 0x0b, 0xf0, 0x63, 0x74, 0x9a, 0xfd,
3402 0x1f, 0xd9, 0x04, 0x7a, 0x8c, 0xf1, 0xa7, 0x71, 0x75, 0x65, 0xa3, 0x41,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e, 0x33,
3417 0x86, 0x51, 0x9f, 0xce, 0x0c, 0x9f, 0xe5, 0x77, 0x07, 0xfb, 0xa5, 0x9b, 3417 0xc3, 0xa8, 0x4f, 0x67, 0x86, 0xcf, 0xf2, 0xbb, 0x83, 0xfd, 0xd2, 0x43,
3418 0xfe, 0xb7, 0x90, 0xb1, 0xab, 0xb3, 0xd7, 0x37, 0xbb, 0x1e, 0x55, 0x16, 3418 0xff, 0x5b, 0xc8, 0xd8, 0xd5, 0xdb, 0xeb, 0x9b, 0x5d, 0x8f, 0x6a, 0x8b,
3419 0x3d, 0xf4, 0xb9, 0xff, 0x00, 0x0e, 0x4b, 0x7c, 0x26, 0x30, 0x14, 0x00, 3419 0x1e, 0xfa, 0xdc, 0x7f, 0x00, 0x5a, 0x33, 0xe6, 0xc0, 0x30, 0x14, 0x00,
3420 0x00, 0x00 }; 3420 0x00, 0x00 };
3421 3421
3422static u8 bnx2_TPAT_b09FwText[] = { 3422static u8 bnx2_TPAT_b09FwText[] = {
diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h
index d66c605b4075..266ec8777ca8 100644
--- a/drivers/net/dl2k.h
+++ b/drivers/net/dl2k.h
@@ -388,8 +388,8 @@ enum _mii_mssr {
388 MII_MSSR_CFG_RES = 0x4000, 388 MII_MSSR_CFG_RES = 0x4000,
389 MII_MSSR_LOCAL_RCV_STATUS = 0x2000, 389 MII_MSSR_LOCAL_RCV_STATUS = 0x2000,
390 MII_MSSR_REMOTE_RCVR = 0x1000, 390 MII_MSSR_REMOTE_RCVR = 0x1000,
391 MII_MSSR_LP_1000BT_HD = 0x0800, 391 MII_MSSR_LP_1000BT_FD = 0x0800,
392 MII_MSSR_LP_1000BT_FD = 0x0400, 392 MII_MSSR_LP_1000BT_HD = 0x0400,
393 MII_MSSR_IDLE_ERR_COUNT = 0x00ff, 393 MII_MSSR_IDLE_ERR_COUNT = 0x00ff,
394}; 394};
395 395
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 6ef6b8b39e71..f651a816b280 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -508,7 +508,7 @@ static int __init macvlan_init_module(void)
508 goto err1; 508 goto err1;
509 return 0; 509 return 0;
510err1: 510err1:
511 macvlan_handle_frame_hook = macvlan_handle_frame; 511 macvlan_handle_frame_hook = NULL;
512 unregister_netdevice_notifier(&macvlan_notifier_block); 512 unregister_netdevice_notifier(&macvlan_notifier_block);
513 return err; 513 return err;
514} 514}
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 569028b2baf2..6f245cfb6624 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -33,8 +33,7 @@
33#include <linux/mii.h> 33#include <linux/mii.h>
34#include <linux/usb.h> 34#include <linux/usb.h>
35#include <linux/crc32.h> 35#include <linux/crc32.h>
36 36#include <linux/usb/usbnet.h>
37#include "usbnet.h"
38 37
39#define DRIVER_VERSION "14-Jun-2006" 38#define DRIVER_VERSION "14-Jun-2006"
40static const char driver_name [] = "asix"; 39static const char driver_name [] = "asix";
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index a42acc3cc609..a934428a5890 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -31,8 +31,7 @@
31#include <linux/mii.h> 31#include <linux/mii.h>
32#include <linux/usb.h> 32#include <linux/usb.h>
33#include <linux/usb/cdc.h> 33#include <linux/usb/cdc.h>
34 34#include <linux/usb/usbnet.h>
35#include "usbnet.h"
36 35
37 36
38#if defined(CONFIG_USB_NET_RNDIS_HOST) || defined(CONFIG_USB_NET_RNDIS_HOST_MODULE) 37#if defined(CONFIG_USB_NET_RNDIS_HOST) || defined(CONFIG_USB_NET_RNDIS_HOST_MODULE)
@@ -228,15 +227,16 @@ next_desc:
228 buf += buf [0]; 227 buf += buf [0];
229 } 228 }
230 229
231 /* Microsoft ActiveSync based RNDIS devices lack the CDC descriptors, 230 /* Microsoft ActiveSync based and some regular RNDIS devices lack the
232 * so we'll hard-wire the interfaces and not check for descriptors. 231 * CDC descriptors, so we'll hard-wire the interfaces and not check
232 * for descriptors.
233 */ 233 */
234 if (is_activesync(&intf->cur_altsetting->desc) && !info->u) { 234 if (rndis && !info->u) {
235 info->control = usb_ifnum_to_if(dev->udev, 0); 235 info->control = usb_ifnum_to_if(dev->udev, 0);
236 info->data = usb_ifnum_to_if(dev->udev, 1); 236 info->data = usb_ifnum_to_if(dev->udev, 1);
237 if (!info->control || !info->data) { 237 if (!info->control || !info->data) {
238 dev_dbg(&intf->dev, 238 dev_dbg(&intf->dev,
239 "activesync: master #0/%p slave #1/%p\n", 239 "rndis: master #0/%p slave #1/%p\n",
240 info->control, 240 info->control,
241 info->data); 241 info->data);
242 goto bad_desc; 242 goto bad_desc;
@@ -316,7 +316,6 @@ void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf)
316} 316}
317EXPORT_SYMBOL_GPL(usbnet_cdc_unbind); 317EXPORT_SYMBOL_GPL(usbnet_cdc_unbind);
318 318
319
320/*------------------------------------------------------------------------- 319/*-------------------------------------------------------------------------
321 * 320 *
322 * Communications Device Class, Ethernet Control model 321 * Communications Device Class, Ethernet Control model
diff --git a/drivers/net/usb/cdc_subset.c b/drivers/net/usb/cdc_subset.c
index 943988ed01d8..0ec7936cbe21 100644
--- a/drivers/net/usb/cdc_subset.c
+++ b/drivers/net/usb/cdc_subset.c
@@ -26,8 +26,7 @@
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <linux/mii.h> 27#include <linux/mii.h>
28#include <linux/usb.h> 28#include <linux/usb.h>
29 29#include <linux/usb/usbnet.h>
30#include "usbnet.h"
31 30
32 31
33/* 32/*
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 633a511d6cb6..4b131a6c6b70 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -20,8 +20,7 @@
20#include <linux/mii.h> 20#include <linux/mii.h>
21#include <linux/usb.h> 21#include <linux/usb.h>
22#include <linux/crc32.h> 22#include <linux/crc32.h>
23 23#include <linux/usb/usbnet.h>
24#include "usbnet.h"
25 24
26/* datasheet: 25/* datasheet:
27 http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-P01-930914.pdf 26 http://www.davicom.com.tw/big5/download/Data%20Sheet/DM9601-DS-P01-930914.pdf
diff --git a/drivers/net/usb/gl620a.c b/drivers/net/usb/gl620a.c
index 031cf5ca4dbb..f7ccfad9384e 100644
--- a/drivers/net/usb/gl620a.c
+++ b/drivers/net/usb/gl620a.c
@@ -29,8 +29,7 @@
29#include <linux/workqueue.h> 29#include <linux/workqueue.h>
30#include <linux/mii.h> 30#include <linux/mii.h>
31#include <linux/usb.h> 31#include <linux/usb.h>
32 32#include <linux/usb/usbnet.h>
33#include "usbnet.h"
34 33
35 34
36/* 35/*
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index 5ea7411e1337..c3d119f997f5 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -31,8 +31,7 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/netdevice.h> 32#include <linux/netdevice.h>
33#include <linux/usb.h> 33#include <linux/usb.h>
34 34#include <linux/usb/usbnet.h>
35#include "usbnet.h"
36 35
37/* requests */ 36/* requests */
38#define MCS7830_RD_BMREQ (USB_DIR_IN | USB_TYPE_VENDOR | \ 37#define MCS7830_RD_BMREQ (USB_DIR_IN | USB_TYPE_VENDOR | \
diff --git a/drivers/net/usb/net1080.c b/drivers/net/usb/net1080.c
index 19bf8dae70c9..034e8a73ca6b 100644
--- a/drivers/net/usb/net1080.c
+++ b/drivers/net/usb/net1080.c
@@ -28,11 +28,10 @@
28#include <linux/workqueue.h> 28#include <linux/workqueue.h>
29#include <linux/mii.h> 29#include <linux/mii.h>
30#include <linux/usb.h> 30#include <linux/usb.h>
31#include <linux/usb/usbnet.h>
31 32
32#include <asm/unaligned.h> 33#include <asm/unaligned.h>
33 34
34#include "usbnet.h"
35
36 35
37/* 36/*
38 * Netchip 1080 driver ... http://www.netchip.com 37 * Netchip 1080 driver ... http://www.netchip.com
diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c
index 45300939d185..08555f8b15f4 100644
--- a/drivers/net/usb/plusb.c
+++ b/drivers/net/usb/plusb.c
@@ -28,8 +28,7 @@
28#include <linux/workqueue.h> 28#include <linux/workqueue.h>
29#include <linux/mii.h> 29#include <linux/mii.h>
30#include <linux/usb.h> 30#include <linux/usb.h>
31 31#include <linux/usb/usbnet.h>
32#include "usbnet.h"
33 32
34 33
35/* 34/*
diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 1ebe3259be0d..a61324757b17 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -29,8 +29,8 @@
29#include <linux/mii.h> 29#include <linux/mii.h>
30#include <linux/usb.h> 30#include <linux/usb.h>
31#include <linux/usb/cdc.h> 31#include <linux/usb/cdc.h>
32 32#include <linux/usb/usbnet.h>
33#include "usbnet.h" 33#include <linux/usb/rndis_host.h>
34 34
35 35
36/* 36/*
@@ -56,217 +56,17 @@
56 */ 56 */
57 57
58/* 58/*
59 * CONTROL uses CDC "encapsulated commands" with funky notifications.
60 * - control-out: SEND_ENCAPSULATED
61 * - interrupt-in: RESPONSE_AVAILABLE
62 * - control-in: GET_ENCAPSULATED
63 *
64 * We'll try to ignore the RESPONSE_AVAILABLE notifications.
65 *
66 * REVISIT some RNDIS implementations seem to have curious issues still
67 * to be resolved.
68 */
69struct rndis_msg_hdr {
70 __le32 msg_type; /* RNDIS_MSG_* */
71 __le32 msg_len;
72 // followed by data that varies between messages
73 __le32 request_id;
74 __le32 status;
75 // ... and more
76} __attribute__ ((packed));
77
78/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */
79#define CONTROL_BUFFER_SIZE 1025
80
81/* RNDIS defines an (absurdly huge) 10 second control timeout,
82 * but ActiveSync seems to use a more usual 5 second timeout
83 * (which matches the USB 2.0 spec).
84 */
85#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000)
86
87
88#define ccpu2 __constant_cpu_to_le32
89
90#define RNDIS_MSG_COMPLETION ccpu2(0x80000000)
91
92/* codes for "msg_type" field of rndis messages;
93 * only the data channel uses packet messages (maybe batched);
94 * everything else goes on the control channel.
95 */
96#define RNDIS_MSG_PACKET ccpu2(0x00000001) /* 1-N packets */
97#define RNDIS_MSG_INIT ccpu2(0x00000002)
98#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
99#define RNDIS_MSG_HALT ccpu2(0x00000003)
100#define RNDIS_MSG_QUERY ccpu2(0x00000004)
101#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
102#define RNDIS_MSG_SET ccpu2(0x00000005)
103#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
104#define RNDIS_MSG_RESET ccpu2(0x00000006)
105#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
106#define RNDIS_MSG_INDICATE ccpu2(0x00000007)
107#define RNDIS_MSG_KEEPALIVE ccpu2(0x00000008)
108#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
109
110/* codes for "status" field of completion messages */
111#define RNDIS_STATUS_SUCCESS ccpu2(0x00000000)
112#define RNDIS_STATUS_FAILURE ccpu2(0xc0000001)
113#define RNDIS_STATUS_INVALID_DATA ccpu2(0xc0010015)
114#define RNDIS_STATUS_NOT_SUPPORTED ccpu2(0xc00000bb)
115#define RNDIS_STATUS_MEDIA_CONNECT ccpu2(0x4001000b)
116#define RNDIS_STATUS_MEDIA_DISCONNECT ccpu2(0x4001000c)
117
118
119struct rndis_data_hdr {
120 __le32 msg_type; /* RNDIS_MSG_PACKET */
121 __le32 msg_len; // rndis_data_hdr + data_len + pad
122 __le32 data_offset; // 36 -- right after header
123 __le32 data_len; // ... real packet size
124
125 __le32 oob_data_offset; // zero
126 __le32 oob_data_len; // zero
127 __le32 num_oob; // zero
128 __le32 packet_data_offset; // zero
129
130 __le32 packet_data_len; // zero
131 __le32 vc_handle; // zero
132 __le32 reserved; // zero
133} __attribute__ ((packed));
134
135struct rndis_init { /* OUT */
136 // header and:
137 __le32 msg_type; /* RNDIS_MSG_INIT */
138 __le32 msg_len; // 24
139 __le32 request_id;
140 __le32 major_version; // of rndis (1.0)
141 __le32 minor_version;
142 __le32 max_transfer_size;
143} __attribute__ ((packed));
144
145struct rndis_init_c { /* IN */
146 // header and:
147 __le32 msg_type; /* RNDIS_MSG_INIT_C */
148 __le32 msg_len;
149 __le32 request_id;
150 __le32 status;
151 __le32 major_version; // of rndis (1.0)
152 __le32 minor_version;
153 __le32 device_flags;
154 __le32 medium; // zero == 802.3
155 __le32 max_packets_per_message;
156 __le32 max_transfer_size;
157 __le32 packet_alignment; // max 7; (1<<n) bytes
158 __le32 af_list_offset; // zero
159 __le32 af_list_size; // zero
160} __attribute__ ((packed));
161
162struct rndis_halt { /* OUT (no reply) */
163 // header and:
164 __le32 msg_type; /* RNDIS_MSG_HALT */
165 __le32 msg_len;
166 __le32 request_id;
167} __attribute__ ((packed));
168
169struct rndis_query { /* OUT */
170 // header and:
171 __le32 msg_type; /* RNDIS_MSG_QUERY */
172 __le32 msg_len;
173 __le32 request_id;
174 __le32 oid;
175 __le32 len;
176 __le32 offset;
177/*?*/ __le32 handle; // zero
178} __attribute__ ((packed));
179
180struct rndis_query_c { /* IN */
181 // header and:
182 __le32 msg_type; /* RNDIS_MSG_QUERY_C */
183 __le32 msg_len;
184 __le32 request_id;
185 __le32 status;
186 __le32 len;
187 __le32 offset;
188} __attribute__ ((packed));
189
190struct rndis_set { /* OUT */
191 // header and:
192 __le32 msg_type; /* RNDIS_MSG_SET */
193 __le32 msg_len;
194 __le32 request_id;
195 __le32 oid;
196 __le32 len;
197 __le32 offset;
198/*?*/ __le32 handle; // zero
199} __attribute__ ((packed));
200
201struct rndis_set_c { /* IN */
202 // header and:
203 __le32 msg_type; /* RNDIS_MSG_SET_C */
204 __le32 msg_len;
205 __le32 request_id;
206 __le32 status;
207} __attribute__ ((packed));
208
209struct rndis_reset { /* IN */
210 // header and:
211 __le32 msg_type; /* RNDIS_MSG_RESET */
212 __le32 msg_len;
213 __le32 reserved;
214} __attribute__ ((packed));
215
216struct rndis_reset_c { /* OUT */
217 // header and:
218 __le32 msg_type; /* RNDIS_MSG_RESET_C */
219 __le32 msg_len;
220 __le32 status;
221 __le32 addressing_lost;
222} __attribute__ ((packed));
223
224struct rndis_indicate { /* IN (unrequested) */
225 // header and:
226 __le32 msg_type; /* RNDIS_MSG_INDICATE */
227 __le32 msg_len;
228 __le32 status;
229 __le32 length;
230 __le32 offset;
231/**/ __le32 diag_status;
232 __le32 error_offset;
233/**/ __le32 message;
234} __attribute__ ((packed));
235
236struct rndis_keepalive { /* OUT (optionally IN) */
237 // header and:
238 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */
239 __le32 msg_len;
240 __le32 request_id;
241} __attribute__ ((packed));
242
243struct rndis_keepalive_c { /* IN (optionally OUT) */
244 // header and:
245 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */
246 __le32 msg_len;
247 __le32 request_id;
248 __le32 status;
249} __attribute__ ((packed));
250
251/* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and
252 * there are gobs more that may optionally be supported. We'll avoid as much
253 * of that mess as possible.
254 */
255#define OID_802_3_PERMANENT_ADDRESS ccpu2(0x01010101)
256#define OID_GEN_MAXIMUM_FRAME_SIZE ccpu2(0x00010106)
257#define OID_GEN_CURRENT_PACKET_FILTER ccpu2(0x0001010e)
258
259/*
260 * RNDIS notifications from device: command completion; "reverse" 59 * RNDIS notifications from device: command completion; "reverse"
261 * keepalives; etc 60 * keepalives; etc
262 */ 61 */
263static void rndis_status(struct usbnet *dev, struct urb *urb) 62void rndis_status(struct usbnet *dev, struct urb *urb)
264{ 63{
265 devdbg(dev, "rndis status urb, len %d stat %d", 64 devdbg(dev, "rndis status urb, len %d stat %d",
266 urb->actual_length, urb->status); 65 urb->actual_length, urb->status);
267 // FIXME for keepalives, respond immediately (asynchronously) 66 // FIXME for keepalives, respond immediately (asynchronously)
268 // if not an RNDIS status, do like cdc_status(dev,urb) does 67 // if not an RNDIS status, do like cdc_status(dev,urb) does
269} 68}
69EXPORT_SYMBOL_GPL(rndis_status);
270 70
271/* 71/*
272 * RPC done RNDIS-style. Caller guarantees: 72 * RPC done RNDIS-style. Caller guarantees:
@@ -278,7 +78,7 @@ static void rndis_status(struct usbnet *dev, struct urb *urb)
278 * Call context is likely probe(), before interface name is known, 78 * Call context is likely probe(), before interface name is known,
279 * which is why we won't try to use it in the diagnostics. 79 * which is why we won't try to use it in the diagnostics.
280 */ 80 */
281static int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf) 81int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf)
282{ 82{
283 struct cdc_state *info = (void *) &dev->data; 83 struct cdc_state *info = (void *) &dev->data;
284 int master_ifnum; 84 int master_ifnum;
@@ -347,10 +147,26 @@ static int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf)
347 request_id, xid); 147 request_id, xid);
348 /* then likely retry */ 148 /* then likely retry */
349 } else switch (buf->msg_type) { 149 } else switch (buf->msg_type) {
350 case RNDIS_MSG_INDICATE: { /* fault */ 150 case RNDIS_MSG_INDICATE: { /* fault/event */
351 // struct rndis_indicate *msg = (void *)buf; 151 struct rndis_indicate *msg = (void *)buf;
352 dev_info(&info->control->dev, 152 int state = 0;
353 "rndis fault indication\n"); 153
154 switch (msg->status) {
155 case RNDIS_STATUS_MEDIA_CONNECT:
156 state = 1;
157 case RNDIS_STATUS_MEDIA_DISCONNECT:
158 dev_info(&info->control->dev,
159 "rndis media %sconnect\n",
160 !state?"dis":"");
161 if (dev->driver_info->link_change)
162 dev->driver_info->link_change(
163 dev, state);
164 break;
165 default:
166 dev_info(&info->control->dev,
167 "rndis indication: 0x%08x\n",
168 le32_to_cpu(msg->status));
169 }
354 } 170 }
355 break; 171 break;
356 case RNDIS_MSG_KEEPALIVE: { /* ping */ 172 case RNDIS_MSG_KEEPALIVE: { /* ping */
@@ -387,6 +203,7 @@ static int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf)
387 dev_dbg(&info->control->dev, "rndis response timeout\n"); 203 dev_dbg(&info->control->dev, "rndis response timeout\n");
388 return -ETIMEDOUT; 204 return -ETIMEDOUT;
389} 205}
206EXPORT_SYMBOL_GPL(rndis_command);
390 207
391/* 208/*
392 * rndis_query: 209 * rndis_query:
@@ -453,7 +270,8 @@ response_error:
453 return -EDOM; 270 return -EDOM;
454} 271}
455 272
456static int rndis_bind(struct usbnet *dev, struct usb_interface *intf) 273int
274generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
457{ 275{
458 int retval; 276 int retval;
459 struct net_device *net = dev->net; 277 struct net_device *net = dev->net;
@@ -467,8 +285,9 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
467 struct rndis_query_c *get_c; 285 struct rndis_query_c *get_c;
468 struct rndis_set *set; 286 struct rndis_set *set;
469 struct rndis_set_c *set_c; 287 struct rndis_set_c *set_c;
288 struct rndis_halt *halt;
470 } u; 289 } u;
471 u32 tmp; 290 u32 tmp, *phym;
472 int reply_len; 291 int reply_len;
473 unsigned char *bp; 292 unsigned char *bp;
474 293
@@ -517,7 +336,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
517 "dev can't take %u byte packets (max %u)\n", 336 "dev can't take %u byte packets (max %u)\n",
518 dev->hard_mtu, tmp); 337 dev->hard_mtu, tmp);
519 retval = -EINVAL; 338 retval = -EINVAL;
520 goto fail_and_release; 339 goto halt_fail_and_release;
521 } 340 }
522 dev->hard_mtu = tmp; 341 dev->hard_mtu = tmp;
523 net->mtu = dev->hard_mtu - net->hard_header_len; 342 net->mtu = dev->hard_mtu - net->hard_header_len;
@@ -533,13 +352,43 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
533 dev->hard_mtu, tmp, dev->rx_urb_size, 352 dev->hard_mtu, tmp, dev->rx_urb_size,
534 1 << le32_to_cpu(u.init_c->packet_alignment)); 353 1 << le32_to_cpu(u.init_c->packet_alignment));
535 354
355 /* module has some device initialization code needs to be done right
356 * after RNDIS_INIT */
357 if (dev->driver_info->early_init &&
358 dev->driver_info->early_init(dev) != 0)
359 goto halt_fail_and_release;
360
361 /* Check physical medium */
362 reply_len = sizeof *phym;
363 retval = rndis_query(dev, intf, u.buf, OID_GEN_PHYSICAL_MEDIUM,
364 0, (void **) &phym, &reply_len);
365 if (retval != 0)
366 /* OID is optional so don't fail here. */
367 *phym = RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED;
368 if ((flags & FLAG_RNDIS_PHYM_WIRELESS) &&
369 *phym != RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
370 if (netif_msg_probe(dev))
371 dev_dbg(&intf->dev, "driver requires wireless "
372 "physical medium, but device is not.\n");
373 retval = -ENODEV;
374 goto halt_fail_and_release;
375 }
376 if ((flags & FLAG_RNDIS_PHYM_NOT_WIRELESS) &&
377 *phym == RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN) {
378 if (netif_msg_probe(dev))
379 dev_dbg(&intf->dev, "driver requires non-wireless "
380 "physical medium, but device is wireless.\n");
381 retval = -ENODEV;
382 goto halt_fail_and_release;
383 }
384
536 /* Get designated host ethernet address */ 385 /* Get designated host ethernet address */
537 reply_len = ETH_ALEN; 386 reply_len = ETH_ALEN;
538 retval = rndis_query(dev, intf, u.buf, OID_802_3_PERMANENT_ADDRESS, 387 retval = rndis_query(dev, intf, u.buf, OID_802_3_PERMANENT_ADDRESS,
539 48, (void **) &bp, &reply_len); 388 48, (void **) &bp, &reply_len);
540 if (unlikely(retval< 0)) { 389 if (unlikely(retval< 0)) {
541 dev_err(&intf->dev, "rndis get ethaddr, %d\n", retval); 390 dev_err(&intf->dev, "rndis get ethaddr, %d\n", retval);
542 goto fail_and_release; 391 goto halt_fail_and_release;
543 } 392 }
544 memcpy(net->dev_addr, bp, ETH_ALEN); 393 memcpy(net->dev_addr, bp, ETH_ALEN);
545 394
@@ -550,12 +399,12 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
550 u.set->oid = OID_GEN_CURRENT_PACKET_FILTER; 399 u.set->oid = OID_GEN_CURRENT_PACKET_FILTER;
551 u.set->len = ccpu2(4); 400 u.set->len = ccpu2(4);
552 u.set->offset = ccpu2((sizeof *u.set) - 8); 401 u.set->offset = ccpu2((sizeof *u.set) - 8);
553 *(__le32 *)(u.buf + sizeof *u.set) = ccpu2(DEFAULT_FILTER); 402 *(__le32 *)(u.buf + sizeof *u.set) = RNDIS_DEFAULT_FILTER;
554 403
555 retval = rndis_command(dev, u.header); 404 retval = rndis_command(dev, u.header);
556 if (unlikely(retval < 0)) { 405 if (unlikely(retval < 0)) {
557 dev_err(&intf->dev, "rndis set packet filter, %d\n", retval); 406 dev_err(&intf->dev, "rndis set packet filter, %d\n", retval);
558 goto fail_and_release; 407 goto halt_fail_and_release;
559 } 408 }
560 409
561 retval = 0; 410 retval = 0;
@@ -563,6 +412,11 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
563 kfree(u.buf); 412 kfree(u.buf);
564 return retval; 413 return retval;
565 414
415halt_fail_and_release:
416 memset(u.halt, 0, sizeof *u.halt);
417 u.halt->msg_type = RNDIS_MSG_HALT;
418 u.halt->msg_len = ccpu2(sizeof *u.halt);
419 (void) rndis_command(dev, (void *)u.halt);
566fail_and_release: 420fail_and_release:
567 usb_set_intfdata(info->data, NULL); 421 usb_set_intfdata(info->data, NULL);
568 usb_driver_release_interface(driver_of(intf), info->data); 422 usb_driver_release_interface(driver_of(intf), info->data);
@@ -571,13 +425,19 @@ fail:
571 kfree(u.buf); 425 kfree(u.buf);
572 return retval; 426 return retval;
573} 427}
428EXPORT_SYMBOL_GPL(generic_rndis_bind);
429
430static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)
431{
432 return generic_rndis_bind(dev, intf, FLAG_RNDIS_PHYM_NOT_WIRELESS);
433}
574 434
575static void rndis_unbind(struct usbnet *dev, struct usb_interface *intf) 435void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)
576{ 436{
577 struct rndis_halt *halt; 437 struct rndis_halt *halt;
578 438
579 /* try to clear any rndis state/activity (no i/o from stack!) */ 439 /* try to clear any rndis state/activity (no i/o from stack!) */
580 halt = kzalloc(sizeof *halt, GFP_KERNEL); 440 halt = kzalloc(CONTROL_BUFFER_SIZE, GFP_KERNEL);
581 if (halt) { 441 if (halt) {
582 halt->msg_type = RNDIS_MSG_HALT; 442 halt->msg_type = RNDIS_MSG_HALT;
583 halt->msg_len = ccpu2(sizeof *halt); 443 halt->msg_len = ccpu2(sizeof *halt);
@@ -585,13 +445,14 @@ static void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)
585 kfree(halt); 445 kfree(halt);
586 } 446 }
587 447
588 return usbnet_cdc_unbind(dev, intf); 448 usbnet_cdc_unbind(dev, intf);
589} 449}
450EXPORT_SYMBOL_GPL(rndis_unbind);
590 451
591/* 452/*
592 * DATA -- host must not write zlps 453 * DATA -- host must not write zlps
593 */ 454 */
594static int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb) 455int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
595{ 456{
596 /* peripheral may have batched packets to us... */ 457 /* peripheral may have batched packets to us... */
597 while (likely(skb->len)) { 458 while (likely(skb->len)) {
@@ -633,8 +494,9 @@ static int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
633 /* caller will usbnet_skb_return the remaining packet */ 494 /* caller will usbnet_skb_return the remaining packet */
634 return 1; 495 return 1;
635} 496}
497EXPORT_SYMBOL_GPL(rndis_rx_fixup);
636 498
637static struct sk_buff * 499struct sk_buff *
638rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) 500rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
639{ 501{
640 struct rndis_data_hdr *hdr; 502 struct rndis_data_hdr *hdr;
@@ -679,6 +541,7 @@ fill:
679 /* FIXME make the last packet always be short ... */ 541 /* FIXME make the last packet always be short ... */
680 return skb; 542 return skb;
681} 543}
544EXPORT_SYMBOL_GPL(rndis_tx_fixup);
682 545
683 546
684static const struct driver_info rndis_info = { 547static const struct driver_info rndis_info = {
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 8ed1fc5cbc70..8463efb9e0b1 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -41,8 +41,7 @@
41#include <linux/workqueue.h> 41#include <linux/workqueue.h>
42#include <linux/mii.h> 42#include <linux/mii.h>
43#include <linux/usb.h> 43#include <linux/usb.h>
44 44#include <linux/usb/usbnet.h>
45#include "usbnet.h"
46 45
47#define DRIVER_VERSION "22-Aug-2005" 46#define DRIVER_VERSION "22-Aug-2005"
48 47
@@ -1204,6 +1203,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
1204 if ((dev->driver_info->flags & FLAG_ETHER) != 0 1203 if ((dev->driver_info->flags & FLAG_ETHER) != 0
1205 && (net->dev_addr [0] & 0x02) == 0) 1204 && (net->dev_addr [0] & 0x02) == 0)
1206 strcpy (net->name, "eth%d"); 1205 strcpy (net->name, "eth%d");
1206 /* WLAN devices should always be named "wlan%d" */
1207 if ((dev->driver_info->flags & FLAG_WLAN) != 0)
1208 strcpy(net->name, "wlan%d");
1207 1209
1208 /* maybe the remote can't receive an Ethernet MTU */ 1210 /* maybe the remote can't receive an Ethernet MTU */
1209 if (net->mtu > (dev->hard_mtu - net->hard_header_len)) 1211 if (net->mtu > (dev->hard_mtu - net->hard_header_len))
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index 9f98e8ce487a..e24f7b3ace4b 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -29,8 +29,7 @@
29#include <linux/crc32.h> 29#include <linux/crc32.h>
30#include <linux/usb.h> 30#include <linux/usb.h>
31#include <linux/usb/cdc.h> 31#include <linux/usb/cdc.h>
32 32#include <linux/usb/usbnet.h>
33#include "usbnet.h"
34 33
35 34
36/* 35/*
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index f372960904b2..714a6ca30ad2 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -545,6 +545,34 @@ config USB_ZD1201
545 To compile this driver as a module, choose M here: the 545 To compile this driver as a module, choose M here: the
546 module will be called zd1201. 546 module will be called zd1201.
547 547
548config USB_NET_RNDIS_WLAN
549 tristate "Wireless RNDIS USB support"
550 depends on USB && WLAN_80211 && EXPERIMENTAL
551 select USB_USBNET
552 select USB_NET_CDCETHER
553 select USB_NET_RNDIS_HOST
554 select WIRELESS_EXT
555 ---help---
556 This is a driver for wireless RNDIS devices.
557 These are USB based adapters found in devices such as:
558
559 Buffalo WLI-U2-KG125S
560 U.S. Robotics USR5421
561 Belkin F5D7051
562 Linksys WUSB54GSv2
563 Linksys WUSB54GSC
564 Asus WL169gE
565 Eminent EM4045
566 BT Voyager 1055
567 Linksys WUSB54GSv1
568 U.S. Robotics USR5420
569 BUFFALO WLI-USB-G54
570
571 All of these devices are based on Broadcom 4320 chip which is the
572 only wireless RNDIS chip known to date.
573
574 If you choose to build a module, it'll be called rndis_wlan.
575
548config RTL8180 576config RTL8180
549 tristate "Realtek 8180/8185 PCI support" 577 tristate "Realtek 8180/8185 PCI support"
550 depends on MAC80211 && PCI && WLAN_80211 && EXPERIMENTAL 578 depends on MAC80211 && PCI && WLAN_80211 && EXPERIMENTAL
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
index 6af7b158624e..091dfe2e574e 100644
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -44,6 +44,8 @@ obj-$(CONFIG_ZD1211RW) += zd1211rw/
44obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o 44obj-$(CONFIG_PCMCIA_RAYCS) += ray_cs.o
45obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o 45obj-$(CONFIG_PCMCIA_WL3501) += wl3501_cs.o
46 46
47obj-$(CONFIG_USB_NET_RNDIS_WLAN) += rndis_wlan.o
48
47obj-$(CONFIG_USB_ZD1201) += zd1201.o 49obj-$(CONFIG_USB_ZD1201) += zd1201.o
48obj-$(CONFIG_LIBERTAS) += libertas/ 50obj-$(CONFIG_LIBERTAS) += libertas/
49 51
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 72bcf321d1ce..d6599d219193 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1980,7 +1980,7 @@ ath5k_beacon_send(struct ath5k_softc *sc)
1980 struct ath5k_buf *bf = sc->bbuf; 1980 struct ath5k_buf *bf = sc->bbuf;
1981 struct ath5k_hw *ah = sc->ah; 1981 struct ath5k_hw *ah = sc->ah;
1982 1982
1983 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON_PROC, "in beacon_send\n"); 1983 ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON, "in beacon_send\n");
1984 1984
1985 if (unlikely(bf->skb == NULL || sc->opmode == IEEE80211_IF_TYPE_STA || 1985 if (unlikely(bf->skb == NULL || sc->opmode == IEEE80211_IF_TYPE_STA ||
1986 sc->opmode == IEEE80211_IF_TYPE_MNTR)) { 1986 sc->opmode == IEEE80211_IF_TYPE_MNTR)) {
@@ -1996,10 +1996,10 @@ ath5k_beacon_send(struct ath5k_softc *sc)
1996 */ 1996 */
1997 if (unlikely(ath5k_hw_num_tx_pending(ah, sc->bhalq) != 0)) { 1997 if (unlikely(ath5k_hw_num_tx_pending(ah, sc->bhalq) != 0)) {
1998 sc->bmisscount++; 1998 sc->bmisscount++;
1999 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON_PROC, 1999 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON,
2000 "missed %u consecutive beacons\n", sc->bmisscount); 2000 "missed %u consecutive beacons\n", sc->bmisscount);
2001 if (sc->bmisscount > 3) { /* NB: 3 is a guess */ 2001 if (sc->bmisscount > 3) { /* NB: 3 is a guess */
2002 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON_PROC, 2002 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON,
2003 "stuck beacon time (%u missed)\n", 2003 "stuck beacon time (%u missed)\n",
2004 sc->bmisscount); 2004 sc->bmisscount);
2005 tasklet_schedule(&sc->restq); 2005 tasklet_schedule(&sc->restq);
@@ -2007,7 +2007,7 @@ ath5k_beacon_send(struct ath5k_softc *sc)
2007 return; 2007 return;
2008 } 2008 }
2009 if (unlikely(sc->bmisscount != 0)) { 2009 if (unlikely(sc->bmisscount != 0)) {
2010 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON_PROC, 2010 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON,
2011 "resume beacon xmit after %u misses\n", 2011 "resume beacon xmit after %u misses\n",
2012 sc->bmisscount); 2012 sc->bmisscount);
2013 sc->bmisscount = 0; 2013 sc->bmisscount = 0;
@@ -2027,7 +2027,7 @@ ath5k_beacon_send(struct ath5k_softc *sc)
2027 2027
2028 ath5k_hw_put_tx_buf(ah, sc->bhalq, bf->daddr); 2028 ath5k_hw_put_tx_buf(ah, sc->bhalq, bf->daddr);
2029 ath5k_hw_tx_start(ah, sc->bhalq); 2029 ath5k_hw_tx_start(ah, sc->bhalq);
2030 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON_PROC, "TXDP[%u] = %llx (%p)\n", 2030 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, "TXDP[%u] = %llx (%p)\n",
2031 sc->bhalq, (unsigned long long)bf->daddr, bf->desc); 2031 sc->bhalq, (unsigned long long)bf->daddr, bf->desc);
2032 2032
2033 sc->bsent++; 2033 sc->bsent++;
diff --git a/drivers/net/wireless/ath5k/debug.c b/drivers/net/wireless/ath5k/debug.c
index 4ba649e20269..bb581ef6d1ef 100644
--- a/drivers/net/wireless/ath5k/debug.c
+++ b/drivers/net/wireless/ath5k/debug.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2007 Bruno Randolf <bruno@thinktube.com> 2 * Copyright (c) 2007-2008 Bruno Randolf <bruno@thinktube.com>
3 * 3 *
4 * This file is free software: you may copy, redistribute and/or modify it 4 * This file is free software: you may copy, redistribute and/or modify it
5 * under the terms of the GNU General Public License as published by the 5 * under the terms of the GNU General Public License as published by the
@@ -200,7 +200,7 @@ static ssize_t read_file_tsf(struct file *file, char __user *user_buf,
200{ 200{
201 struct ath5k_softc *sc = file->private_data; 201 struct ath5k_softc *sc = file->private_data;
202 char buf[100]; 202 char buf[100];
203 snprintf(buf, 100, "0x%016llx\n", ath5k_hw_get_tsf64(sc->ah)); 203 snprintf(buf, sizeof(buf), "0x%016llx\n", ath5k_hw_get_tsf64(sc->ah));
204 return simple_read_from_buffer(user_buf, count, ppos, buf, 19); 204 return simple_read_from_buffer(user_buf, count, ppos, buf, 19);
205} 205}
206 206
@@ -209,7 +209,12 @@ static ssize_t write_file_tsf(struct file *file,
209 size_t count, loff_t *ppos) 209 size_t count, loff_t *ppos)
210{ 210{
211 struct ath5k_softc *sc = file->private_data; 211 struct ath5k_softc *sc = file->private_data;
212 if (strncmp(userbuf, "reset", 5) == 0) { 212 char buf[20];
213
214 if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
215 return -EFAULT;
216
217 if (strncmp(buf, "reset", 5) == 0) {
213 ath5k_hw_reset_tsf(sc->ah); 218 ath5k_hw_reset_tsf(sc->ah);
214 printk(KERN_INFO "debugfs reset TSF\n"); 219 printk(KERN_INFO "debugfs reset TSF\n");
215 } 220 }
@@ -231,8 +236,8 @@ static ssize_t read_file_beacon(struct file *file, char __user *user_buf,
231{ 236{
232 struct ath5k_softc *sc = file->private_data; 237 struct ath5k_softc *sc = file->private_data;
233 struct ath5k_hw *ah = sc->ah; 238 struct ath5k_hw *ah = sc->ah;
234 char buf[1000]; 239 char buf[500];
235 int len = 0; 240 unsigned int len = 0;
236 unsigned int v; 241 unsigned int v;
237 u64 tsf; 242 u64 tsf;
238 243
@@ -277,11 +282,15 @@ static ssize_t write_file_beacon(struct file *file,
277{ 282{
278 struct ath5k_softc *sc = file->private_data; 283 struct ath5k_softc *sc = file->private_data;
279 struct ath5k_hw *ah = sc->ah; 284 struct ath5k_hw *ah = sc->ah;
285 char buf[20];
286
287 if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
288 return -EFAULT;
280 289
281 if (strncmp(userbuf, "disable", 7) == 0) { 290 if (strncmp(buf, "disable", 7) == 0) {
282 AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE); 291 AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE);
283 printk(KERN_INFO "debugfs disable beacons\n"); 292 printk(KERN_INFO "debugfs disable beacons\n");
284 } else if (strncmp(userbuf, "enable", 6) == 0) { 293 } else if (strncmp(buf, "enable", 6) == 0) {
285 AR5K_REG_ENABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE); 294 AR5K_REG_ENABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE);
286 printk(KERN_INFO "debugfs enable beacons\n"); 295 printk(KERN_INFO "debugfs enable beacons\n");
287 } 296 }
@@ -314,6 +323,82 @@ static const struct file_operations fops_reset = {
314}; 323};
315 324
316 325
326/* debugfs: debug level */
327
328static struct {
329 enum ath5k_debug_level level;
330 const char *name;
331 const char *desc;
332} dbg_info[] = {
333 { ATH5K_DEBUG_RESET, "reset", "reset and initialization" },
334 { ATH5K_DEBUG_INTR, "intr", "interrupt handling" },
335 { ATH5K_DEBUG_MODE, "mode", "mode init/setup" },
336 { ATH5K_DEBUG_XMIT, "xmit", "basic xmit operation" },
337 { ATH5K_DEBUG_BEACON, "beacon", "beacon handling" },
338 { ATH5K_DEBUG_CALIBRATE, "calib", "periodic calibration" },
339 { ATH5K_DEBUG_TXPOWER, "txpower", "transmit power setting" },
340 { ATH5K_DEBUG_LED, "led", "LED mamagement" },
341 { ATH5K_DEBUG_DUMP_RX, "dumprx", "print received skb content" },
342 { ATH5K_DEBUG_DUMP_TX, "dumptx", "print transmit skb content" },
343 { ATH5K_DEBUG_DUMPMODES, "dumpmodes", "dump modes" },
344 { ATH5K_DEBUG_TRACE, "trace", "trace function calls" },
345 { ATH5K_DEBUG_ANY, "all", "show all debug levels" },
346};
347
348static ssize_t read_file_debug(struct file *file, char __user *user_buf,
349 size_t count, loff_t *ppos)
350{
351 struct ath5k_softc *sc = file->private_data;
352 char buf[700];
353 unsigned int len = 0;
354 unsigned int i;
355
356 len += snprintf(buf+len, sizeof(buf)-len,
357 "DEBUG LEVEL: 0x%08x\n\n", sc->debug.level);
358
359 for (i = 0; i < ARRAY_SIZE(dbg_info) - 1; i++) {
360 len += snprintf(buf+len, sizeof(buf)-len,
361 "%10s %c 0x%08x - %s\n", dbg_info[i].name,
362 sc->debug.level & dbg_info[i].level ? '+' : ' ',
363 dbg_info[i].level, dbg_info[i].desc);
364 }
365 len += snprintf(buf+len, sizeof(buf)-len,
366 "%10s %c 0x%08x - %s\n", dbg_info[i].name,
367 sc->debug.level == dbg_info[i].level ? '+' : ' ',
368 dbg_info[i].level, dbg_info[i].desc);
369
370 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
371}
372
373static ssize_t write_file_debug(struct file *file,
374 const char __user *userbuf,
375 size_t count, loff_t *ppos)
376{
377 struct ath5k_softc *sc = file->private_data;
378 unsigned int i;
379 char buf[20];
380
381 if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
382 return -EFAULT;
383
384 for (i = 0; i < ARRAY_SIZE(dbg_info); i++) {
385 if (strncmp(buf, dbg_info[i].name,
386 strlen(dbg_info[i].name)) == 0) {
387 sc->debug.level ^= dbg_info[i].level; /* toggle bit */
388 break;
389 }
390 }
391 return count;
392}
393
394static const struct file_operations fops_debug = {
395 .read = read_file_debug,
396 .write = write_file_debug,
397 .open = ath5k_debugfs_open,
398 .owner = THIS_MODULE,
399};
400
401
317/* init */ 402/* init */
318 403
319void 404void
@@ -326,26 +411,24 @@ void
326ath5k_debug_init_device(struct ath5k_softc *sc) 411ath5k_debug_init_device(struct ath5k_softc *sc)
327{ 412{
328 sc->debug.level = ath5k_debug; 413 sc->debug.level = ath5k_debug;
414
329 sc->debug.debugfs_phydir = debugfs_create_dir(wiphy_name(sc->hw->wiphy), 415 sc->debug.debugfs_phydir = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
330 ath5k_global_debugfs); 416 ath5k_global_debugfs);
331 sc->debug.debugfs_debug = debugfs_create_u32("debug", 417
332 0666, sc->debug.debugfs_phydir, &sc->debug.level); 418 sc->debug.debugfs_debug = debugfs_create_file("debug", 0666,
419 sc->debug.debugfs_phydir, sc, &fops_debug);
333 420
334 sc->debug.debugfs_registers = debugfs_create_file("registers", 0444, 421 sc->debug.debugfs_registers = debugfs_create_file("registers", 0444,
335 sc->debug.debugfs_phydir, 422 sc->debug.debugfs_phydir, sc, &fops_registers);
336 sc, &fops_registers);
337 423
338 sc->debug.debugfs_tsf = debugfs_create_file("tsf", 0666, 424 sc->debug.debugfs_tsf = debugfs_create_file("tsf", 0666,
339 sc->debug.debugfs_phydir, 425 sc->debug.debugfs_phydir, sc, &fops_tsf);
340 sc, &fops_tsf);
341 426
342 sc->debug.debugfs_beacon = debugfs_create_file("beacon", 0666, 427 sc->debug.debugfs_beacon = debugfs_create_file("beacon", 0666,
343 sc->debug.debugfs_phydir, 428 sc->debug.debugfs_phydir, sc, &fops_beacon);
344 sc, &fops_beacon);
345 429
346 sc->debug.debugfs_reset = debugfs_create_file("reset", 0222, 430 sc->debug.debugfs_reset = debugfs_create_file("reset", 0222,
347 sc->debug.debugfs_phydir, 431 sc->debug.debugfs_phydir, sc, &fops_reset);
348 sc, &fops_reset);
349} 432}
350 433
351void 434void
@@ -415,8 +498,7 @@ ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah)
415 struct ath5k_buf *bf; 498 struct ath5k_buf *bf;
416 int status; 499 int status;
417 500
418 if (likely(!(sc->debug.level & 501 if (likely(!(sc->debug.level & ATH5K_DEBUG_RESET)))
419 (ATH5K_DEBUG_RESET | ATH5K_DEBUG_FATAL))))
420 return; 502 return;
421 503
422 printk(KERN_DEBUG "rx queue %x, link %p\n", 504 printk(KERN_DEBUG "rx queue %x, link %p\n",
@@ -426,7 +508,7 @@ ath5k_debug_printrxbuffs(struct ath5k_softc *sc, struct ath5k_hw *ah)
426 list_for_each_entry(bf, &sc->rxbuf, list) { 508 list_for_each_entry(bf, &sc->rxbuf, list) {
427 ds = bf->desc; 509 ds = bf->desc;
428 status = ah->ah_proc_rx_desc(ah, ds); 510 status = ah->ah_proc_rx_desc(ah, ds);
429 if (!status || (sc->debug.level & ATH5K_DEBUG_FATAL)) 511 if (!status)
430 ath5k_debug_printrxbuf(bf, status == 0); 512 ath5k_debug_printrxbuf(bf, status == 0);
431 } 513 }
432 spin_unlock_bh(&sc->rxbuflock); 514 spin_unlock_bh(&sc->rxbuflock);
diff --git a/drivers/net/wireless/ath5k/debug.h b/drivers/net/wireless/ath5k/debug.h
index 2b491cbc8c80..c4fd8c43df0c 100644
--- a/drivers/net/wireless/ath5k/debug.h
+++ b/drivers/net/wireless/ath5k/debug.h
@@ -91,7 +91,6 @@ struct ath5k_dbg_info {
91 * @ATH5K_DEBUG_MODE: mode init/setup 91 * @ATH5K_DEBUG_MODE: mode init/setup
92 * @ATH5K_DEBUG_XMIT: basic xmit operation 92 * @ATH5K_DEBUG_XMIT: basic xmit operation
93 * @ATH5K_DEBUG_BEACON: beacon handling 93 * @ATH5K_DEBUG_BEACON: beacon handling
94 * @ATH5K_DEBUG_BEACON_PROC: beacon ISR proc
95 * @ATH5K_DEBUG_CALIBRATE: periodic calibration 94 * @ATH5K_DEBUG_CALIBRATE: periodic calibration
96 * @ATH5K_DEBUG_TXPOWER: transmit power setting 95 * @ATH5K_DEBUG_TXPOWER: transmit power setting
97 * @ATH5K_DEBUG_LED: led management 96 * @ATH5K_DEBUG_LED: led management
@@ -99,7 +98,6 @@ struct ath5k_dbg_info {
99 * @ATH5K_DEBUG_DUMP_TX: print transmit skb content 98 * @ATH5K_DEBUG_DUMP_TX: print transmit skb content
100 * @ATH5K_DEBUG_DUMPMODES: dump modes 99 * @ATH5K_DEBUG_DUMPMODES: dump modes
101 * @ATH5K_DEBUG_TRACE: trace function calls 100 * @ATH5K_DEBUG_TRACE: trace function calls
102 * @ATH5K_DEBUG_FATAL: fatal errors
103 * @ATH5K_DEBUG_ANY: show at any debug level 101 * @ATH5K_DEBUG_ANY: show at any debug level
104 * 102 *
105 * The debug level is used to control the amount and type of debugging output 103 * The debug level is used to control the amount and type of debugging output
@@ -115,15 +113,13 @@ enum ath5k_debug_level {
115 ATH5K_DEBUG_MODE = 0x00000004, 113 ATH5K_DEBUG_MODE = 0x00000004,
116 ATH5K_DEBUG_XMIT = 0x00000008, 114 ATH5K_DEBUG_XMIT = 0x00000008,
117 ATH5K_DEBUG_BEACON = 0x00000010, 115 ATH5K_DEBUG_BEACON = 0x00000010,
118 ATH5K_DEBUG_BEACON_PROC = 0x00000020, 116 ATH5K_DEBUG_CALIBRATE = 0x00000020,
119 ATH5K_DEBUG_CALIBRATE = 0x00000100, 117 ATH5K_DEBUG_TXPOWER = 0x00000040,
120 ATH5K_DEBUG_TXPOWER = 0x00000200, 118 ATH5K_DEBUG_LED = 0x00000080,
121 ATH5K_DEBUG_LED = 0x00000400, 119 ATH5K_DEBUG_DUMP_RX = 0x00000100,
122 ATH5K_DEBUG_DUMP_RX = 0x00001000, 120 ATH5K_DEBUG_DUMP_TX = 0x00000200,
123 ATH5K_DEBUG_DUMP_TX = 0x00002000, 121 ATH5K_DEBUG_DUMPMODES = 0x00000400,
124 ATH5K_DEBUG_DUMPMODES = 0x00004000, 122 ATH5K_DEBUG_TRACE = 0x00001000,
125 ATH5K_DEBUG_TRACE = 0x00010000,
126 ATH5K_DEBUG_FATAL = 0x80000000,
127 ATH5K_DEBUG_ANY = 0xffffffff 123 ATH5K_DEBUG_ANY = 0xffffffff
128}; 124};
129 125
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index 3e73d2a523aa..8a708b77925d 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1114,7 +1114,7 @@ static int dma_tx_fragment(struct b43_dmaring *ring,
1114{ 1114{
1115 const struct b43_dma_ops *ops = ring->ops; 1115 const struct b43_dma_ops *ops = ring->ops;
1116 u8 *header; 1116 u8 *header;
1117 int slot; 1117 int slot, old_top_slot, old_used_slots;
1118 int err; 1118 int err;
1119 struct b43_dmadesc_generic *desc; 1119 struct b43_dmadesc_generic *desc;
1120 struct b43_dmadesc_meta *meta; 1120 struct b43_dmadesc_meta *meta;
@@ -1126,6 +1126,9 @@ static int dma_tx_fragment(struct b43_dmaring *ring,
1126#define SLOTS_PER_PACKET 2 1126#define SLOTS_PER_PACKET 2
1127 B43_WARN_ON(skb_shinfo(skb)->nr_frags); 1127 B43_WARN_ON(skb_shinfo(skb)->nr_frags);
1128 1128
1129 old_top_slot = ring->current_slot;
1130 old_used_slots = ring->used_slots;
1131
1129 /* Get a slot for the header. */ 1132 /* Get a slot for the header. */
1130 slot = request_slot(ring); 1133 slot = request_slot(ring);
1131 desc = ops->idx2desc(ring, slot, &meta_hdr); 1134 desc = ops->idx2desc(ring, slot, &meta_hdr);
@@ -1133,13 +1136,21 @@ static int dma_tx_fragment(struct b43_dmaring *ring,
1133 1136
1134 header = &(ring->txhdr_cache[slot * hdrsize]); 1137 header = &(ring->txhdr_cache[slot * hdrsize]);
1135 cookie = generate_cookie(ring, slot); 1138 cookie = generate_cookie(ring, slot);
1136 b43_generate_txhdr(ring->dev, header, 1139 err = b43_generate_txhdr(ring->dev, header,
1137 skb->data, skb->len, ctl, cookie); 1140 skb->data, skb->len, ctl, cookie);
1141 if (unlikely(err)) {
1142 ring->current_slot = old_top_slot;
1143 ring->used_slots = old_used_slots;
1144 return err;
1145 }
1138 1146
1139 meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header, 1147 meta_hdr->dmaaddr = map_descbuffer(ring, (unsigned char *)header,
1140 hdrsize, 1); 1148 hdrsize, 1);
1141 if (dma_mapping_error(meta_hdr->dmaaddr)) 1149 if (dma_mapping_error(meta_hdr->dmaaddr)) {
1150 ring->current_slot = old_top_slot;
1151 ring->used_slots = old_used_slots;
1142 return -EIO; 1152 return -EIO;
1153 }
1143 ops->fill_descriptor(ring, desc, meta_hdr->dmaaddr, 1154 ops->fill_descriptor(ring, desc, meta_hdr->dmaaddr,
1144 hdrsize, 1, 0, 0); 1155 hdrsize, 1, 0, 0);
1145 1156
@@ -1157,6 +1168,8 @@ static int dma_tx_fragment(struct b43_dmaring *ring,
1157 if (dma_mapping_error(meta->dmaaddr)) { 1168 if (dma_mapping_error(meta->dmaaddr)) {
1158 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); 1169 bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
1159 if (!bounce_skb) { 1170 if (!bounce_skb) {
1171 ring->current_slot = old_top_slot;
1172 ring->used_slots = old_used_slots;
1160 err = -ENOMEM; 1173 err = -ENOMEM;
1161 goto out_unmap_hdr; 1174 goto out_unmap_hdr;
1162 } 1175 }
@@ -1167,6 +1180,8 @@ static int dma_tx_fragment(struct b43_dmaring *ring,
1167 meta->skb = skb; 1180 meta->skb = skb;
1168 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); 1181 meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
1169 if (dma_mapping_error(meta->dmaaddr)) { 1182 if (dma_mapping_error(meta->dmaaddr)) {
1183 ring->current_slot = old_top_slot;
1184 ring->used_slots = old_used_slots;
1170 err = -EIO; 1185 err = -EIO;
1171 goto out_free_bounce; 1186 goto out_free_bounce;
1172 } 1187 }
@@ -1252,6 +1267,13 @@ int b43_dma_tx(struct b43_wldev *dev,
1252 B43_WARN_ON(ring->stopped); 1267 B43_WARN_ON(ring->stopped);
1253 1268
1254 err = dma_tx_fragment(ring, skb, ctl); 1269 err = dma_tx_fragment(ring, skb, ctl);
1270 if (unlikely(err == -ENOKEY)) {
1271 /* Drop this packet, as we don't have the encryption key
1272 * anymore and must not transmit it unencrypted. */
1273 dev_kfree_skb_any(skb);
1274 err = 0;
1275 goto out_unlock;
1276 }
1255 if (unlikely(err)) { 1277 if (unlikely(err)) {
1256 b43err(dev->wl, "DMA tx mapping failure\n"); 1278 b43err(dev->wl, "DMA tx mapping failure\n");
1257 goto out_unlock; 1279 goto out_unlock;
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 88d2c15d3fbe..64c154d080d8 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3532,8 +3532,6 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
3532 b43_bluetooth_coext_enable(dev); 3532 b43_bluetooth_coext_enable(dev);
3533 3533
3534 ssb_bus_powerup(bus, 1); /* Enable dynamic PCTL */ 3534 ssb_bus_powerup(bus, 1); /* Enable dynamic PCTL */
3535 memset(wl->bssid, 0, ETH_ALEN);
3536 memset(wl->mac_addr, 0, ETH_ALEN);
3537 b43_upload_card_macaddress(dev); 3535 b43_upload_card_macaddress(dev);
3538 b43_security_init(dev); 3536 b43_security_init(dev);
3539 b43_rng_init(wl); 3537 b43_rng_init(wl);
@@ -3630,6 +3628,15 @@ static int b43_op_start(struct ieee80211_hw *hw)
3630 struct b43_wldev *dev = wl->current_dev; 3628 struct b43_wldev *dev = wl->current_dev;
3631 int did_init = 0; 3629 int did_init = 0;
3632 int err = 0; 3630 int err = 0;
3631 bool do_rfkill_exit = 0;
3632
3633 /* Kill all old instance specific information to make sure
3634 * the card won't use it in the short timeframe between start
3635 * and mac80211 reconfiguring it. */
3636 memset(wl->bssid, 0, ETH_ALEN);
3637 memset(wl->mac_addr, 0, ETH_ALEN);
3638 wl->filter_flags = 0;
3639 wl->radiotap_enabled = 0;
3633 3640
3634 /* First register RFkill. 3641 /* First register RFkill.
3635 * LEDs that are registered later depend on it. */ 3642 * LEDs that are registered later depend on it. */
@@ -3639,8 +3646,10 @@ static int b43_op_start(struct ieee80211_hw *hw)
3639 3646
3640 if (b43_status(dev) < B43_STAT_INITIALIZED) { 3647 if (b43_status(dev) < B43_STAT_INITIALIZED) {
3641 err = b43_wireless_core_init(dev); 3648 err = b43_wireless_core_init(dev);
3642 if (err) 3649 if (err) {
3650 do_rfkill_exit = 1;
3643 goto out_mutex_unlock; 3651 goto out_mutex_unlock;
3652 }
3644 did_init = 1; 3653 did_init = 1;
3645 } 3654 }
3646 3655
@@ -3649,6 +3658,7 @@ static int b43_op_start(struct ieee80211_hw *hw)
3649 if (err) { 3658 if (err) {
3650 if (did_init) 3659 if (did_init)
3651 b43_wireless_core_exit(dev); 3660 b43_wireless_core_exit(dev);
3661 do_rfkill_exit = 1;
3652 goto out_mutex_unlock; 3662 goto out_mutex_unlock;
3653 } 3663 }
3654 } 3664 }
@@ -3656,6 +3666,9 @@ static int b43_op_start(struct ieee80211_hw *hw)
3656 out_mutex_unlock: 3666 out_mutex_unlock:
3657 mutex_unlock(&wl->mutex); 3667 mutex_unlock(&wl->mutex);
3658 3668
3669 if (do_rfkill_exit)
3670 b43_rfkill_exit(dev);
3671
3659 return err; 3672 return err;
3660} 3673}
3661 3674
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 3fc53e8b4416..7caa26eb4105 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -178,12 +178,12 @@ static u8 b43_calc_fallback_rate(u8 bitrate)
178} 178}
179 179
180/* Generate a TX data header. */ 180/* Generate a TX data header. */
181void b43_generate_txhdr(struct b43_wldev *dev, 181int b43_generate_txhdr(struct b43_wldev *dev,
182 u8 *_txhdr, 182 u8 *_txhdr,
183 const unsigned char *fragment_data, 183 const unsigned char *fragment_data,
184 unsigned int fragment_len, 184 unsigned int fragment_len,
185 const struct ieee80211_tx_control *txctl, 185 const struct ieee80211_tx_control *txctl,
186 u16 cookie) 186 u16 cookie)
187{ 187{
188 struct b43_txhdr *txhdr = (struct b43_txhdr *)_txhdr; 188 struct b43_txhdr *txhdr = (struct b43_txhdr *)_txhdr;
189 const struct b43_phy *phy = &dev->phy; 189 const struct b43_phy *phy = &dev->phy;
@@ -237,7 +237,15 @@ void b43_generate_txhdr(struct b43_wldev *dev,
237 237
238 B43_WARN_ON(key_idx >= dev->max_nr_keys); 238 B43_WARN_ON(key_idx >= dev->max_nr_keys);
239 key = &(dev->key[key_idx]); 239 key = &(dev->key[key_idx]);
240 B43_WARN_ON(!key->keyconf); 240
241 if (unlikely(!key->keyconf)) {
242 /* This key is invalid. This might only happen
243 * in a short timeframe after machine resume before
244 * we were able to reconfigure keys.
245 * Drop this packet completely. Do not transmit it
246 * unencrypted to avoid leaking information. */
247 return -ENOKEY;
248 }
241 249
242 /* Hardware appends ICV. */ 250 /* Hardware appends ICV. */
243 plcp_fragment_len += txctl->icv_len; 251 plcp_fragment_len += txctl->icv_len;
@@ -408,6 +416,7 @@ void b43_generate_txhdr(struct b43_wldev *dev,
408 txhdr->phy_ctl = cpu_to_le16(phy_ctl); 416 txhdr->phy_ctl = cpu_to_le16(phy_ctl);
409 txhdr->extra_ft = extra_ft; 417 txhdr->extra_ft = extra_ft;
410 418
419 return 0;
411} 420}
412 421
413static s8 b43_rssi_postprocess(struct b43_wldev *dev, 422static s8 b43_rssi_postprocess(struct b43_wldev *dev,
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
index ca2a2ab8654c..41765039552b 100644
--- a/drivers/net/wireless/b43/xmit.h
+++ b/drivers/net/wireless/b43/xmit.h
@@ -174,11 +174,11 @@ size_t b43_txhdr_size(struct b43_wldev *dev)
174} 174}
175 175
176 176
177void b43_generate_txhdr(struct b43_wldev *dev, 177int b43_generate_txhdr(struct b43_wldev *dev,
178 u8 * txhdr, 178 u8 * txhdr,
179 const unsigned char *fragment_data, 179 const unsigned char *fragment_data,
180 unsigned int fragment_len, 180 unsigned int fragment_len,
181 const struct ieee80211_tx_control *txctl, u16 cookie); 181 const struct ieee80211_tx_control *txctl, u16 cookie);
182 182
183/* Transmit Status */ 183/* Transmit Status */
184struct b43_txstatus { 184struct b43_txstatus {
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h
index 93419adb925e..c80edd2b9044 100644
--- a/drivers/net/wireless/b43legacy/b43legacy.h
+++ b/drivers/net/wireless/b43legacy/b43legacy.h
@@ -23,7 +23,7 @@
23#include "phy.h" 23#include "phy.h"
24 24
25 25
26#define B43legacy_IRQWAIT_MAX_RETRIES 100 26#define B43legacy_IRQWAIT_MAX_RETRIES 20
27 27
28#define B43legacy_RX_MAX_SSI 60 /* best guess at max ssi */ 28#define B43legacy_RX_MAX_SSI 60 /* best guess at max ssi */
29 29
@@ -40,9 +40,8 @@
40#define B43legacy_MMIO_DMA4_IRQ_MASK 0x44 40#define B43legacy_MMIO_DMA4_IRQ_MASK 0x44
41#define B43legacy_MMIO_DMA5_REASON 0x48 41#define B43legacy_MMIO_DMA5_REASON 0x48
42#define B43legacy_MMIO_DMA5_IRQ_MASK 0x4C 42#define B43legacy_MMIO_DMA5_IRQ_MASK 0x4C
43#define B43legacy_MMIO_MACCTL 0x120 43#define B43legacy_MMIO_MACCTL 0x120 /* MAC control */
44#define B43legacy_MMIO_STATUS_BITFIELD 0x120 44#define B43legacy_MMIO_MACCMD 0x124 /* MAC command */
45#define B43legacy_MMIO_STATUS2_BITFIELD 0x124
46#define B43legacy_MMIO_GEN_IRQ_REASON 0x128 45#define B43legacy_MMIO_GEN_IRQ_REASON 0x128
47#define B43legacy_MMIO_GEN_IRQ_MASK 0x12C 46#define B43legacy_MMIO_GEN_IRQ_MASK 0x12C
48#define B43legacy_MMIO_RAM_CONTROL 0x130 47#define B43legacy_MMIO_RAM_CONTROL 0x130
@@ -177,31 +176,25 @@
177#define B43legacy_RADIOCTL_ID 0x01 176#define B43legacy_RADIOCTL_ID 0x01
178 177
179/* MAC Control bitfield */ 178/* MAC Control bitfield */
179#define B43legacy_MACCTL_ENABLED 0x00000001 /* MAC Enabled */
180#define B43legacy_MACCTL_PSM_RUN 0x00000002 /* Run Microcode */
181#define B43legacy_MACCTL_PSM_JMP0 0x00000004 /* Microcode jump to 0 */
182#define B43legacy_MACCTL_SHM_ENABLED 0x00000100 /* SHM Enabled */
180#define B43legacy_MACCTL_IHR_ENABLED 0x00000400 /* IHR Region Enabled */ 183#define B43legacy_MACCTL_IHR_ENABLED 0x00000400 /* IHR Region Enabled */
184#define B43legacy_MACCTL_BE 0x00010000 /* Big Endian mode */
181#define B43legacy_MACCTL_INFRA 0x00020000 /* Infrastructure mode */ 185#define B43legacy_MACCTL_INFRA 0x00020000 /* Infrastructure mode */
182#define B43legacy_MACCTL_AP 0x00040000 /* AccessPoint mode */ 186#define B43legacy_MACCTL_AP 0x00040000 /* AccessPoint mode */
187#define B43legacy_MACCTL_RADIOLOCK 0x00080000 /* Radio lock */
183#define B43legacy_MACCTL_BEACPROMISC 0x00100000 /* Beacon Promiscuous */ 188#define B43legacy_MACCTL_BEACPROMISC 0x00100000 /* Beacon Promiscuous */
184#define B43legacy_MACCTL_KEEP_BADPLCP 0x00200000 /* Keep bad PLCP frames */ 189#define B43legacy_MACCTL_KEEP_BADPLCP 0x00200000 /* Keep bad PLCP frames */
185#define B43legacy_MACCTL_KEEP_CTL 0x00400000 /* Keep control frames */ 190#define B43legacy_MACCTL_KEEP_CTL 0x00400000 /* Keep control frames */
186#define B43legacy_MACCTL_KEEP_BAD 0x00800000 /* Keep bad frames (FCS) */ 191#define B43legacy_MACCTL_KEEP_BAD 0x00800000 /* Keep bad frames (FCS) */
187#define B43legacy_MACCTL_PROMISC 0x01000000 /* Promiscuous mode */ 192#define B43legacy_MACCTL_PROMISC 0x01000000 /* Promiscuous mode */
193#define B43legacy_MACCTL_HWPS 0x02000000 /* Hardware Power Saving */
194#define B43legacy_MACCTL_AWAKE 0x04000000 /* Device is awake */
195#define B43legacy_MACCTL_TBTTHOLD 0x10000000 /* TBTT Hold */
188#define B43legacy_MACCTL_GMODE 0x80000000 /* G Mode */ 196#define B43legacy_MACCTL_GMODE 0x80000000 /* G Mode */
189 197
190/* StatusBitField */
191#define B43legacy_SBF_MAC_ENABLED 0x00000001
192#define B43legacy_SBF_CORE_READY 0x00000004
193#define B43legacy_SBF_400 0x00000400 /*FIXME: fix name*/
194#define B43legacy_SBF_XFER_REG_BYTESWAP 0x00010000
195#define B43legacy_SBF_MODE_NOTADHOC 0x00020000
196#define B43legacy_SBF_MODE_AP 0x00040000
197#define B43legacy_SBF_RADIOREG_LOCK 0x00080000
198#define B43legacy_SBF_MODE_MONITOR 0x00400000
199#define B43legacy_SBF_MODE_PROMISC 0x01000000
200#define B43legacy_SBF_PS1 0x02000000
201#define B43legacy_SBF_PS2 0x04000000
202#define B43legacy_SBF_NO_SSID_BCAST 0x08000000
203#define B43legacy_SBF_TIME_UPDATE 0x10000000
204
205/* 802.11 core specific TM State Low flags */ 198/* 802.11 core specific TM State Low flags */
206#define B43legacy_TMSLOW_GMODE 0x20000000 /* G Mode Enable */ 199#define B43legacy_TMSLOW_GMODE 0x20000000 /* G Mode Enable */
207#define B43legacy_TMSLOW_PLLREFSEL 0x00200000 /* PLL Freq Ref Select */ 200#define B43legacy_TMSLOW_PLLREFSEL 0x00200000 /* PLL Freq Ref Select */
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 4ed4243feeaa..aa20d5d56e2f 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -225,8 +225,8 @@ static void b43legacy_ram_write(struct b43legacy_wldev *dev, u16 offset,
225 225
226 B43legacy_WARN_ON(offset % 4 != 0); 226 B43legacy_WARN_ON(offset % 4 != 0);
227 227
228 status = b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); 228 status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
229 if (status & B43legacy_SBF_XFER_REG_BYTESWAP) 229 if (status & B43legacy_MACCTL_BE)
230 val = swab32(val); 230 val = swab32(val);
231 231
232 b43legacy_write32(dev, B43legacy_MMIO_RAM_CONTROL, offset); 232 b43legacy_write32(dev, B43legacy_MMIO_RAM_CONTROL, offset);
@@ -434,9 +434,9 @@ static void b43legacy_time_lock(struct b43legacy_wldev *dev)
434{ 434{
435 u32 status; 435 u32 status;
436 436
437 status = b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); 437 status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
438 status |= B43legacy_SBF_TIME_UPDATE; 438 status |= B43legacy_MACCTL_TBTTHOLD;
439 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, status); 439 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, status);
440 mmiowb(); 440 mmiowb();
441} 441}
442 442
@@ -444,9 +444,9 @@ static void b43legacy_time_unlock(struct b43legacy_wldev *dev)
444{ 444{
445 u32 status; 445 u32 status;
446 446
447 status = b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); 447 status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
448 status &= ~B43legacy_SBF_TIME_UPDATE; 448 status &= ~B43legacy_MACCTL_TBTTHOLD;
449 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, status); 449 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, status);
450} 450}
451 451
452static void b43legacy_tsf_write_locked(struct b43legacy_wldev *dev, u64 tsf) 452static void b43legacy_tsf_write_locked(struct b43legacy_wldev *dev, u64 tsf)
@@ -647,7 +647,7 @@ void b43legacy_dummy_transmission(struct b43legacy_wldev *dev)
647 b43legacy_ram_write(dev, i * 4, buffer[i]); 647 b43legacy_ram_write(dev, i * 4, buffer[i]);
648 648
649 /* dummy read follows */ 649 /* dummy read follows */
650 b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); 650 b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
651 651
652 b43legacy_write16(dev, 0x0568, 0x0000); 652 b43legacy_write16(dev, 0x0568, 0x0000);
653 b43legacy_write16(dev, 0x07C0, 0x0000); 653 b43legacy_write16(dev, 0x07C0, 0x0000);
@@ -794,9 +794,9 @@ static void b43legacy_jssi_write(struct b43legacy_wldev *dev, u32 jssi)
794static void b43legacy_generate_noise_sample(struct b43legacy_wldev *dev) 794static void b43legacy_generate_noise_sample(struct b43legacy_wldev *dev)
795{ 795{
796 b43legacy_jssi_write(dev, 0x7F7F7F7F); 796 b43legacy_jssi_write(dev, 0x7F7F7F7F);
797 b43legacy_write32(dev, B43legacy_MMIO_STATUS2_BITFIELD, 797 b43legacy_write32(dev, B43legacy_MMIO_MACCMD,
798 b43legacy_read32(dev, 798 b43legacy_read32(dev,
799 B43legacy_MMIO_STATUS2_BITFIELD) 799 B43legacy_MMIO_MACCMD)
800 | (1 << 4)); 800 | (1 << 4));
801 B43legacy_WARN_ON(dev->noisecalc.channel_at_start != 801 B43legacy_WARN_ON(dev->noisecalc.channel_at_start !=
802 dev->phy.channel); 802 dev->phy.channel);
@@ -895,8 +895,8 @@ static void handle_irq_atim_end(struct b43legacy_wldev *dev)
895{ 895{
896 if (!dev->reg124_set_0x4) /*FIXME rename this variable*/ 896 if (!dev->reg124_set_0x4) /*FIXME rename this variable*/
897 return; 897 return;
898 b43legacy_write32(dev, B43legacy_MMIO_STATUS2_BITFIELD, 898 b43legacy_write32(dev, B43legacy_MMIO_MACCMD,
899 b43legacy_read32(dev, B43legacy_MMIO_STATUS2_BITFIELD) 899 b43legacy_read32(dev, B43legacy_MMIO_MACCMD)
900 | 0x4); 900 | 0x4);
901} 901}
902 902
@@ -1106,9 +1106,9 @@ static void b43legacy_update_templates(struct b43legacy_wldev *dev)
1106 b43legacy_write_probe_resp_template(dev, 0x268, 0x4A, 1106 b43legacy_write_probe_resp_template(dev, 0x268, 0x4A,
1107 B43legacy_CCK_RATE_11MB); 1107 B43legacy_CCK_RATE_11MB);
1108 1108
1109 status = b43legacy_read32(dev, B43legacy_MMIO_STATUS2_BITFIELD); 1109 status = b43legacy_read32(dev, B43legacy_MMIO_MACCMD);
1110 status |= 0x03; 1110 status |= 0x03;
1111 b43legacy_write32(dev, B43legacy_MMIO_STATUS2_BITFIELD, status); 1111 b43legacy_write32(dev, B43legacy_MMIO_MACCMD, status);
1112} 1112}
1113 1113
1114static void b43legacy_refresh_templates(struct b43legacy_wldev *dev, 1114static void b43legacy_refresh_templates(struct b43legacy_wldev *dev,
@@ -1166,7 +1166,7 @@ static void handle_irq_beacon(struct b43legacy_wldev *dev)
1166 return; 1166 return;
1167 1167
1168 dev->irq_savedstate &= ~B43legacy_IRQ_BEACON; 1168 dev->irq_savedstate &= ~B43legacy_IRQ_BEACON;
1169 status = b43legacy_read32(dev, B43legacy_MMIO_STATUS2_BITFIELD); 1169 status = b43legacy_read32(dev, B43legacy_MMIO_MACCMD);
1170 1170
1171 if (!dev->cached_beacon || ((status & 0x1) && (status & 0x2))) { 1171 if (!dev->cached_beacon || ((status & 0x1) && (status & 0x2))) {
1172 /* ACK beacon IRQ. */ 1172 /* ACK beacon IRQ. */
@@ -1182,14 +1182,14 @@ static void handle_irq_beacon(struct b43legacy_wldev *dev)
1182 b43legacy_write_beacon_template(dev, 0x68, 0x18, 1182 b43legacy_write_beacon_template(dev, 0x68, 0x18,
1183 B43legacy_CCK_RATE_1MB); 1183 B43legacy_CCK_RATE_1MB);
1184 status |= 0x1; 1184 status |= 0x1;
1185 b43legacy_write32(dev, B43legacy_MMIO_STATUS2_BITFIELD, 1185 b43legacy_write32(dev, B43legacy_MMIO_MACCMD,
1186 status); 1186 status);
1187 } 1187 }
1188 if (!(status & 0x2)) { 1188 if (!(status & 0x2)) {
1189 b43legacy_write_beacon_template(dev, 0x468, 0x1A, 1189 b43legacy_write_beacon_template(dev, 0x468, 0x1A,
1190 B43legacy_CCK_RATE_1MB); 1190 B43legacy_CCK_RATE_1MB);
1191 status |= 0x2; 1191 status |= 0x2;
1192 b43legacy_write32(dev, B43legacy_MMIO_STATUS2_BITFIELD, 1192 b43legacy_write32(dev, B43legacy_MMIO_MACCMD,
1193 status); 1193 status);
1194 } 1194 }
1195} 1195}
@@ -1548,9 +1548,20 @@ static int b43legacy_upload_microcode(struct b43legacy_wldev *dev)
1548 u16 fwpatch; 1548 u16 fwpatch;
1549 u16 fwdate; 1549 u16 fwdate;
1550 u16 fwtime; 1550 u16 fwtime;
1551 u32 tmp; 1551 u32 tmp, macctl;
1552 int err = 0; 1552 int err = 0;
1553 1553
1554 /* Jump the microcode PSM to offset 0 */
1555 macctl = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
1556 B43legacy_WARN_ON(macctl & B43legacy_MACCTL_PSM_RUN);
1557 macctl |= B43legacy_MACCTL_PSM_JMP0;
1558 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl);
1559 /* Zero out all microcode PSM registers and shared memory. */
1560 for (i = 0; i < 64; i++)
1561 b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, i, 0);
1562 for (i = 0; i < 4096; i += 2)
1563 b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, i, 0);
1564
1554 /* Upload Microcode. */ 1565 /* Upload Microcode. */
1555 data = (__be32 *) (dev->fw.ucode->data + hdr_len); 1566 data = (__be32 *) (dev->fw.ucode->data + hdr_len);
1556 len = (dev->fw.ucode->size - hdr_len) / sizeof(__be32); 1567 len = (dev->fw.ucode->size - hdr_len) / sizeof(__be32);
@@ -1581,7 +1592,12 @@ static int b43legacy_upload_microcode(struct b43legacy_wldev *dev)
1581 1592
1582 b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_REASON, 1593 b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_REASON,
1583 B43legacy_IRQ_ALL); 1594 B43legacy_IRQ_ALL);
1584 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, 0x00020402); 1595
1596 /* Start the microcode PSM */
1597 macctl = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
1598 macctl &= ~B43legacy_MACCTL_PSM_JMP0;
1599 macctl |= B43legacy_MACCTL_PSM_RUN;
1600 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl);
1585 1601
1586 /* Wait for the microcode to load and respond */ 1602 /* Wait for the microcode to load and respond */
1587 i = 0; 1603 i = 0;
@@ -1594,9 +1610,13 @@ static int b43legacy_upload_microcode(struct b43legacy_wldev *dev)
1594 b43legacyerr(dev->wl, "Microcode not responding\n"); 1610 b43legacyerr(dev->wl, "Microcode not responding\n");
1595 b43legacy_print_fw_helptext(dev->wl); 1611 b43legacy_print_fw_helptext(dev->wl);
1596 err = -ENODEV; 1612 err = -ENODEV;
1597 goto out; 1613 goto error;
1614 }
1615 msleep_interruptible(50);
1616 if (signal_pending(current)) {
1617 err = -EINTR;
1618 goto error;
1598 } 1619 }
1599 udelay(10);
1600 } 1620 }
1601 /* dummy read follows */ 1621 /* dummy read follows */
1602 b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON); 1622 b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON);
@@ -1617,9 +1637,8 @@ static int b43legacy_upload_microcode(struct b43legacy_wldev *dev)
1617 " is supported. You must change your firmware" 1637 " is supported. You must change your firmware"
1618 " files.\n"); 1638 " files.\n");
1619 b43legacy_print_fw_helptext(dev->wl); 1639 b43legacy_print_fw_helptext(dev->wl);
1620 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, 0);
1621 err = -EOPNOTSUPP; 1640 err = -EOPNOTSUPP;
1622 goto out; 1641 goto error;
1623 } 1642 }
1624 b43legacydbg(dev->wl, "Loading firmware version 0x%X, patch level %u " 1643 b43legacydbg(dev->wl, "Loading firmware version 0x%X, patch level %u "
1625 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", fwrev, fwpatch, 1644 "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n", fwrev, fwpatch,
@@ -1629,7 +1648,14 @@ static int b43legacy_upload_microcode(struct b43legacy_wldev *dev)
1629 dev->fw.rev = fwrev; 1648 dev->fw.rev = fwrev;
1630 dev->fw.patch = fwpatch; 1649 dev->fw.patch = fwpatch;
1631 1650
1632out: 1651 return 0;
1652
1653error:
1654 macctl = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
1655 macctl &= ~B43legacy_MACCTL_PSM_RUN;
1656 macctl |= B43legacy_MACCTL_PSM_JMP0;
1657 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl);
1658
1633 return err; 1659 return err;
1634} 1660}
1635 1661
@@ -1736,9 +1762,9 @@ static int b43legacy_gpio_init(struct b43legacy_wldev *dev)
1736 u32 mask; 1762 u32 mask;
1737 u32 set; 1763 u32 set;
1738 1764
1739 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, 1765 b43legacy_write32(dev, B43legacy_MMIO_MACCTL,
1740 b43legacy_read32(dev, 1766 b43legacy_read32(dev,
1741 B43legacy_MMIO_STATUS_BITFIELD) 1767 B43legacy_MMIO_MACCTL)
1742 & 0xFFFF3FFF); 1768 & 0xFFFF3FFF);
1743 1769
1744 b43legacy_write16(dev, B43legacy_MMIO_GPIO_MASK, 1770 b43legacy_write16(dev, B43legacy_MMIO_GPIO_MASK,
@@ -1798,14 +1824,14 @@ void b43legacy_mac_enable(struct b43legacy_wldev *dev)
1798 B43legacy_WARN_ON(dev->mac_suspended < 0); 1824 B43legacy_WARN_ON(dev->mac_suspended < 0);
1799 B43legacy_WARN_ON(irqs_disabled()); 1825 B43legacy_WARN_ON(irqs_disabled());
1800 if (dev->mac_suspended == 0) { 1826 if (dev->mac_suspended == 0) {
1801 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, 1827 b43legacy_write32(dev, B43legacy_MMIO_MACCTL,
1802 b43legacy_read32(dev, 1828 b43legacy_read32(dev,
1803 B43legacy_MMIO_STATUS_BITFIELD) 1829 B43legacy_MMIO_MACCTL)
1804 | B43legacy_SBF_MAC_ENABLED); 1830 | B43legacy_MACCTL_ENABLED);
1805 b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_REASON, 1831 b43legacy_write32(dev, B43legacy_MMIO_GEN_IRQ_REASON,
1806 B43legacy_IRQ_MAC_SUSPENDED); 1832 B43legacy_IRQ_MAC_SUSPENDED);
1807 /* the next two are dummy reads */ 1833 /* the next two are dummy reads */
1808 b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); 1834 b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
1809 b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON); 1835 b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON);
1810 b43legacy_power_saving_ctl_bits(dev, -1, -1); 1836 b43legacy_power_saving_ctl_bits(dev, -1, -1);
1811 1837
@@ -1836,10 +1862,10 @@ void b43legacy_mac_suspend(struct b43legacy_wldev *dev)
1836 dev->irq_savedstate = tmp; 1862 dev->irq_savedstate = tmp;
1837 1863
1838 b43legacy_power_saving_ctl_bits(dev, -1, 1); 1864 b43legacy_power_saving_ctl_bits(dev, -1, 1);
1839 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, 1865 b43legacy_write32(dev, B43legacy_MMIO_MACCTL,
1840 b43legacy_read32(dev, 1866 b43legacy_read32(dev,
1841 B43legacy_MMIO_STATUS_BITFIELD) 1867 B43legacy_MMIO_MACCTL)
1842 & ~B43legacy_SBF_MAC_ENABLED); 1868 & ~B43legacy_MACCTL_ENABLED);
1843 b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON); 1869 b43legacy_read32(dev, B43legacy_MMIO_GEN_IRQ_REASON);
1844 for (i = 40; i; i--) { 1870 for (i = 40; i; i--) {
1845 tmp = b43legacy_read32(dev, 1871 tmp = b43legacy_read32(dev,
@@ -2007,12 +2033,15 @@ static int b43legacy_chip_init(struct b43legacy_wldev *dev)
2007 struct b43legacy_phy *phy = &dev->phy; 2033 struct b43legacy_phy *phy = &dev->phy;
2008 int err; 2034 int err;
2009 int tmp; 2035 int tmp;
2010 u32 value32; 2036 u32 value32, macctl;
2011 u16 value16; 2037 u16 value16;
2012 2038
2013 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, 2039 /* Initialize the MAC control */
2014 B43legacy_SBF_CORE_READY 2040 macctl = B43legacy_MACCTL_IHR_ENABLED | B43legacy_MACCTL_SHM_ENABLED;
2015 | B43legacy_SBF_400); 2041 if (dev->phy.gmode)
2042 macctl |= B43legacy_MACCTL_GMODE;
2043 macctl |= B43legacy_MACCTL_INFRA;
2044 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl);
2016 2045
2017 err = b43legacy_request_firmware(dev); 2046 err = b43legacy_request_firmware(dev);
2018 if (err) 2047 if (err)
@@ -2052,12 +2081,12 @@ static int b43legacy_chip_init(struct b43legacy_wldev *dev)
2052 if (dev->dev->id.revision < 5) 2081 if (dev->dev->id.revision < 5)
2053 b43legacy_write32(dev, 0x010C, 0x01000000); 2082 b43legacy_write32(dev, 0x010C, 0x01000000);
2054 2083
2055 value32 = b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); 2084 value32 = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
2056 value32 &= ~B43legacy_SBF_MODE_NOTADHOC; 2085 value32 &= ~B43legacy_MACCTL_INFRA;
2057 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, value32); 2086 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, value32);
2058 value32 = b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); 2087 value32 = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
2059 value32 |= B43legacy_SBF_MODE_NOTADHOC; 2088 value32 |= B43legacy_MACCTL_INFRA;
2060 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, value32); 2089 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, value32);
2061 2090
2062 if (b43legacy_using_pio(dev)) { 2091 if (b43legacy_using_pio(dev)) {
2063 b43legacy_write32(dev, 0x0210, 0x00000100); 2092 b43legacy_write32(dev, 0x0210, 0x00000100);
@@ -2951,12 +2980,19 @@ static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev)
2951{ 2980{
2952 struct b43legacy_wl *wl = dev->wl; 2981 struct b43legacy_wl *wl = dev->wl;
2953 struct b43legacy_phy *phy = &dev->phy; 2982 struct b43legacy_phy *phy = &dev->phy;
2983 u32 macctl;
2954 2984
2955 B43legacy_WARN_ON(b43legacy_status(dev) > B43legacy_STAT_INITIALIZED); 2985 B43legacy_WARN_ON(b43legacy_status(dev) > B43legacy_STAT_INITIALIZED);
2956 if (b43legacy_status(dev) != B43legacy_STAT_INITIALIZED) 2986 if (b43legacy_status(dev) != B43legacy_STAT_INITIALIZED)
2957 return; 2987 return;
2958 b43legacy_set_status(dev, B43legacy_STAT_UNINIT); 2988 b43legacy_set_status(dev, B43legacy_STAT_UNINIT);
2959 2989
2990 /* Stop the microcode PSM. */
2991 macctl = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
2992 macctl &= ~B43legacy_MACCTL_PSM_RUN;
2993 macctl |= B43legacy_MACCTL_PSM_JMP0;
2994 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, macctl);
2995
2960 mutex_unlock(&wl->mutex); 2996 mutex_unlock(&wl->mutex);
2961 /* Must unlock as it would otherwise deadlock. No races here. 2997 /* Must unlock as it would otherwise deadlock. No races here.
2962 * Cancel possibly pending workqueues. */ 2998 * Cancel possibly pending workqueues. */
@@ -3221,6 +3257,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
3221 struct b43legacy_wldev *dev = wl->current_dev; 3257 struct b43legacy_wldev *dev = wl->current_dev;
3222 int did_init = 0; 3258 int did_init = 0;
3223 int err = 0; 3259 int err = 0;
3260 bool do_rfkill_exit = 0;
3224 3261
3225 /* First register RFkill. 3262 /* First register RFkill.
3226 * LEDs that are registered later depend on it. */ 3263 * LEDs that are registered later depend on it. */
@@ -3230,8 +3267,10 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
3230 3267
3231 if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) { 3268 if (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED) {
3232 err = b43legacy_wireless_core_init(dev); 3269 err = b43legacy_wireless_core_init(dev);
3233 if (err) 3270 if (err) {
3271 do_rfkill_exit = 1;
3234 goto out_mutex_unlock; 3272 goto out_mutex_unlock;
3273 }
3235 did_init = 1; 3274 did_init = 1;
3236 } 3275 }
3237 3276
@@ -3240,6 +3279,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
3240 if (err) { 3279 if (err) {
3241 if (did_init) 3280 if (did_init)
3242 b43legacy_wireless_core_exit(dev); 3281 b43legacy_wireless_core_exit(dev);
3282 do_rfkill_exit = 1;
3243 goto out_mutex_unlock; 3283 goto out_mutex_unlock;
3244 } 3284 }
3245 } 3285 }
@@ -3247,6 +3287,9 @@ static int b43legacy_op_start(struct ieee80211_hw *hw)
3247out_mutex_unlock: 3287out_mutex_unlock:
3248 mutex_unlock(&wl->mutex); 3288 mutex_unlock(&wl->mutex);
3249 3289
3290 if (do_rfkill_exit)
3291 b43legacy_rfkill_exit(dev);
3292
3250 return err; 3293 return err;
3251} 3294}
3252 3295
diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c
index c16febbdbf5d..8e5c09b81871 100644
--- a/drivers/net/wireless/b43legacy/phy.c
+++ b/drivers/net/wireless/b43legacy/phy.c
@@ -140,7 +140,7 @@ void b43legacy_phy_calibrate(struct b43legacy_wldev *dev)
140{ 140{
141 struct b43legacy_phy *phy = &dev->phy; 141 struct b43legacy_phy *phy = &dev->phy;
142 142
143 b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); /* Dummy read. */ 143 b43legacy_read32(dev, B43legacy_MMIO_MACCTL); /* Dummy read. */
144 if (phy->calibrated) 144 if (phy->calibrated)
145 return; 145 return;
146 if (phy->type == B43legacy_PHYTYPE_G && phy->rev == 1) { 146 if (phy->type == B43legacy_PHYTYPE_G && phy->rev == 1) {
@@ -2231,16 +2231,16 @@ bit26 = 1;
2231 * or the latest PS-Poll packet sent was successful, 2231 * or the latest PS-Poll packet sent was successful,
2232 * set bit26 */ 2232 * set bit26 */
2233 } 2233 }
2234 status = b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); 2234 status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
2235 if (bit25) 2235 if (bit25)
2236 status |= B43legacy_SBF_PS1; 2236 status |= B43legacy_MACCTL_HWPS;
2237 else 2237 else
2238 status &= ~B43legacy_SBF_PS1; 2238 status &= ~B43legacy_MACCTL_HWPS;
2239 if (bit26) 2239 if (bit26)
2240 status |= B43legacy_SBF_PS2; 2240 status |= B43legacy_MACCTL_AWAKE;
2241 else 2241 else
2242 status &= ~B43legacy_SBF_PS2; 2242 status &= ~B43legacy_MACCTL_AWAKE;
2243 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, status); 2243 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, status);
2244 if (bit26 && dev->dev->id.revision >= 5) { 2244 if (bit26 && dev->dev->id.revision >= 5) {
2245 for (i = 0; i < 100; i++) { 2245 for (i = 0; i < 100; i++) {
2246 if (b43legacy_shm_read32(dev, B43legacy_SHM_SHARED, 2246 if (b43legacy_shm_read32(dev, B43legacy_SHM_SHARED,
diff --git a/drivers/net/wireless/b43legacy/pio.c b/drivers/net/wireless/b43legacy/pio.c
index de843ac147ae..e4f4c5c39e33 100644
--- a/drivers/net/wireless/b43legacy/pio.c
+++ b/drivers/net/wireless/b43legacy/pio.c
@@ -334,9 +334,9 @@ struct b43legacy_pioqueue *b43legacy_setup_pioqueue(struct b43legacy_wldev *dev,
334 tasklet_init(&queue->txtask, tx_tasklet, 334 tasklet_init(&queue->txtask, tx_tasklet,
335 (unsigned long)queue); 335 (unsigned long)queue);
336 336
337 value = b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); 337 value = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
338 value &= ~B43legacy_SBF_XFER_REG_BYTESWAP; 338 value &= ~B43legacy_MACCTL_BE;
339 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, value); 339 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, value);
340 340
341 qsize = b43legacy_read16(dev, queue->mmio_base 341 qsize = b43legacy_read16(dev, queue->mmio_base
342 + B43legacy_PIO_TXQBUFSIZE); 342 + B43legacy_PIO_TXQBUFSIZE);
diff --git a/drivers/net/wireless/b43legacy/radio.c b/drivers/net/wireless/b43legacy/radio.c
index 318a270cf9b4..955832e8654f 100644
--- a/drivers/net/wireless/b43legacy/radio.c
+++ b/drivers/net/wireless/b43legacy/radio.c
@@ -91,10 +91,10 @@ void b43legacy_radio_lock(struct b43legacy_wldev *dev)
91{ 91{
92 u32 status; 92 u32 status;
93 93
94 status = b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); 94 status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
95 B43legacy_WARN_ON(status & B43legacy_SBF_RADIOREG_LOCK); 95 B43legacy_WARN_ON(status & B43legacy_MACCTL_RADIOLOCK);
96 status |= B43legacy_SBF_RADIOREG_LOCK; 96 status |= B43legacy_MACCTL_RADIOLOCK;
97 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, status); 97 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, status);
98 mmiowb(); 98 mmiowb();
99 udelay(10); 99 udelay(10);
100} 100}
@@ -104,10 +104,10 @@ void b43legacy_radio_unlock(struct b43legacy_wldev *dev)
104 u32 status; 104 u32 status;
105 105
106 b43legacy_read16(dev, B43legacy_MMIO_PHY_VER); /* dummy read */ 106 b43legacy_read16(dev, B43legacy_MMIO_PHY_VER); /* dummy read */
107 status = b43legacy_read32(dev, B43legacy_MMIO_STATUS_BITFIELD); 107 status = b43legacy_read32(dev, B43legacy_MMIO_MACCTL);
108 B43legacy_WARN_ON(!(status & B43legacy_SBF_RADIOREG_LOCK)); 108 B43legacy_WARN_ON(!(status & B43legacy_MACCTL_RADIOLOCK));
109 status &= ~B43legacy_SBF_RADIOREG_LOCK; 109 status &= ~B43legacy_MACCTL_RADIOLOCK;
110 b43legacy_write32(dev, B43legacy_MMIO_STATUS_BITFIELD, status); 110 b43legacy_write32(dev, B43legacy_MMIO_MACCTL, status);
111 mmiowb(); 111 mmiowb();
112} 112}
113 113
diff --git a/drivers/net/wireless/hostap/hostap_80211.h b/drivers/net/wireless/hostap/hostap_80211.h
index d6b9362a3d5c..3694b1eba521 100644
--- a/drivers/net/wireless/hostap/hostap_80211.h
+++ b/drivers/net/wireless/hostap/hostap_80211.h
@@ -71,11 +71,6 @@ struct hostap_80211_rx_status {
71 u16 rate; /* in 100 kbps */ 71 u16 rate; /* in 100 kbps */
72}; 72};
73 73
74
75void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
76 struct hostap_80211_rx_status *rx_stats);
77
78
79/* prism2_rx_80211 'type' argument */ 74/* prism2_rx_80211 'type' argument */
80enum { 75enum {
81 PRISM2_RX_MONITOR, PRISM2_RX_MGMT, PRISM2_RX_NON_ASSOC, 76 PRISM2_RX_MONITOR, PRISM2_RX_MGMT, PRISM2_RX_NON_ASSOC,
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 07593803065a..437a9bcc9bd3 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -891,6 +891,9 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
891 PCMCIA_DEVICE_PROD_ID123( 891 PCMCIA_DEVICE_PROD_ID123(
892 "The Linksys Group, Inc.", "Wireless Network CF Card", "ISL37300P", 892 "The Linksys Group, Inc.", "Wireless Network CF Card", "ISL37300P",
893 0xa5f472c2, 0x9c05598d, 0xc9049a39), 893 0xa5f472c2, 0x9c05598d, 0xc9049a39),
894 PCMCIA_DEVICE_PROD_ID123(
895 "Wireless LAN" , "11Mbps PC Card", "Version 01.02",
896 0x4b8870ff, 0x70e946d1, 0x4b74baa0),
894 PCMCIA_DEVICE_NULL 897 PCMCIA_DEVICE_NULL
895}; 898};
896MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids); 899MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
index 6e0187393af4..571815d7e8bf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
@@ -373,7 +373,7 @@ struct iwl3945_eeprom {
373#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */ 373#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */
374#define CSR_INT_BIT_DNLD (1 << 28) /* uCode Download */ 374#define CSR_INT_BIT_DNLD (1 << 28) /* uCode Download */
375#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */ 375#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */
376#define CSR_INT_BIT_MAC_CLK_ACTV (1 << 26) /* NIC controller's clock toggled on/off */ 376#define CSR_INT_BIT_SCD (1 << 26) /* TXQ pointer advanced */
377#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */ 377#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */
378#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */ 378#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */
379#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */ 379#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 76c4ed1135f2..4fdeb5323248 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -2369,18 +2369,4 @@ struct pci_device_id iwl3945_hw_card_ids[] = {
2369 {0} 2369 {0}
2370}; 2370};
2371 2371
2372/*
2373 * Clear the OWNER_MSK, to establish driver (instead of uCode running on
2374 * embedded controller) as EEPROM reader; each read is a series of pulses
2375 * to/from the EEPROM chip, not a single event, so even reads could conflict
2376 * if they weren't arbitrated by some ownership mechanism. Here, the driver
2377 * simply claims ownership, which should be safe when this function is called
2378 * (i.e. before loading uCode!).
2379 */
2380inline int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv)
2381{
2382 _iwl3945_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK);
2383 return 0;
2384}
2385
2386MODULE_DEVICE_TABLE(pci, iwl3945_hw_card_ids); 2372MODULE_DEVICE_TABLE(pci, iwl3945_hw_card_ids);
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 20b925f57e35..1da14f9bbe0f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -671,7 +671,6 @@ extern int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel);
671/* 671/*
672 * Forward declare iwl-3945.c functions for iwl-base.c 672 * Forward declare iwl-3945.c functions for iwl-base.c
673 */ 673 */
674extern int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv);
675extern __le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv); 674extern __le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv);
676extern int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv); 675extern int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv);
677extern void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv); 676extern void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv);
@@ -791,7 +790,6 @@ struct iwl3945_priv {
791 u16 active_rate_basic; 790 u16 active_rate_basic;
792 791
793 u8 call_post_assoc_from_beacon; 792 u8 call_post_assoc_from_beacon;
794 u8 assoc_station_added;
795 /* Rate scaling data */ 793 /* Rate scaling data */
796 s8 data_retry_limit; 794 s8 data_retry_limit;
797 u8 retry_rate; 795 u8 retry_rate;
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
index ff71c09ab1a7..ffe1e9dfdec7 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
@@ -465,7 +465,7 @@ struct iwl4965_eeprom {
465#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */ 465#define CSR_INT_BIT_HW_ERR (1 << 29) /* DMA hardware error FH_INT[31] */
466#define CSR_INT_BIT_DNLD (1 << 28) /* uCode Download */ 466#define CSR_INT_BIT_DNLD (1 << 28) /* uCode Download */
467#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */ 467#define CSR_INT_BIT_FH_TX (1 << 27) /* Tx DMA FH_INT[1:0] */
468#define CSR_INT_BIT_MAC_CLK_ACTV (1 << 26) /* NIC controller's clock toggled on/off */ 468#define CSR_INT_BIT_SCD (1 << 26) /* TXQ pointer advanced */
469#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */ 469#define CSR_INT_BIT_SW_ERR (1 << 25) /* uCode error */
470#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */ 470#define CSR_INT_BIT_RF_KILL (1 << 7) /* HW RFKILL switch GP_CNTRL[27] toggled */
471#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */ 471#define CSR_INT_BIT_CT_KILL (1 << 6) /* Critical temp (chip too hot) rfkill */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 04db34ba814b..569347ff377b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4961,11 +4961,4 @@ int iwl4965_eeprom_acquire_semaphore(struct iwl4965_priv *priv)
4961 return rc; 4961 return rc;
4962} 4962}
4963 4963
4964inline void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv)
4965{
4966 iwl4965_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
4967 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
4968}
4969
4970
4971MODULE_DEVICE_TABLE(pci, iwl4965_hw_card_ids); 4964MODULE_DEVICE_TABLE(pci, iwl4965_hw_card_ids);
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h
index 78bc148c9f7f..9cb82be0ff80 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.h
@@ -750,7 +750,6 @@ struct iwl4965_priv;
750 * Forward declare iwl-4965.c functions for iwl-base.c 750 * Forward declare iwl-4965.c functions for iwl-base.c
751 */ 751 */
752extern int iwl4965_eeprom_acquire_semaphore(struct iwl4965_priv *priv); 752extern int iwl4965_eeprom_acquire_semaphore(struct iwl4965_priv *priv);
753extern void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv);
754 753
755extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv, 754extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv,
756 struct iwl4965_tx_queue *txq, 755 struct iwl4965_tx_queue *txq,
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index cd2eb1848310..cb009f4c401f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -246,10 +246,10 @@ static inline int iwl_check_bits(unsigned long field, unsigned long mask)
246static inline unsigned long elapsed_jiffies(unsigned long start, 246static inline unsigned long elapsed_jiffies(unsigned long start,
247 unsigned long end) 247 unsigned long end)
248{ 248{
249 if (end > start) 249 if (end >= start)
250 return end - start; 250 return end - start;
251 251
252 return end + (MAX_JIFFY_OFFSET - start); 252 return end + (MAX_JIFFY_OFFSET - start) + 1;
253} 253}
254 254
255static inline u8 iwl_get_dma_hi_address(dma_addr_t addr) 255static inline u8 iwl_get_dma_hi_address(dma_addr_t addr)
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 748ac1222abb..33239f197984 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1557,6 +1557,20 @@ static void get_eeprom_mac(struct iwl3945_priv *priv, u8 *mac)
1557 memcpy(mac, priv->eeprom.mac_address, 6); 1557 memcpy(mac, priv->eeprom.mac_address, 6);
1558} 1558}
1559 1559
1560/*
1561 * Clear the OWNER_MSK, to establish driver (instead of uCode running on
1562 * embedded controller) as EEPROM reader; each read is a series of pulses
1563 * to/from the EEPROM chip, not a single event, so even reads could conflict
1564 * if they weren't arbitrated by some ownership mechanism. Here, the driver
1565 * simply claims ownership, which should be safe when this function is called
1566 * (i.e. before loading uCode!).
1567 */
1568static inline int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv)
1569{
1570 _iwl3945_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK);
1571 return 0;
1572}
1573
1560/** 1574/**
1561 * iwl3945_eeprom_init - read EEPROM contents 1575 * iwl3945_eeprom_init - read EEPROM contents
1562 * 1576 *
@@ -2792,7 +2806,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2792#endif 2806#endif
2793 2807
2794 /* drop all data frame if we are not associated */ 2808 /* drop all data frame if we are not associated */
2795 if (!iwl3945_is_associated(priv) && !priv->assoc_id && 2809 if ((!iwl3945_is_associated(priv) || !priv->assoc_id) &&
2796 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 2810 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
2797 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n"); 2811 IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n");
2798 goto drop_unlock; 2812 goto drop_unlock;
@@ -4745,8 +4759,9 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
4745#ifdef CONFIG_IWL3945_DEBUG 4759#ifdef CONFIG_IWL3945_DEBUG
4746 if (iwl3945_debug_level & (IWL_DL_ISR)) { 4760 if (iwl3945_debug_level & (IWL_DL_ISR)) {
4747 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 4761 /* NIC fires this, but we don't use it, redundant with WAKEUP */
4748 if (inta & CSR_INT_BIT_MAC_CLK_ACTV) 4762 if (inta & CSR_INT_BIT_SCD)
4749 IWL_DEBUG_ISR("Microcode started or stopped.\n"); 4763 IWL_DEBUG_ISR("Scheduler finished to transmit "
4764 "the frame/frames.\n");
4750 4765
4751 /* Alive notification via Rx interrupt will do the real work */ 4766 /* Alive notification via Rx interrupt will do the real work */
4752 if (inta & CSR_INT_BIT_ALIVE) 4767 if (inta & CSR_INT_BIT_ALIVE)
@@ -4754,7 +4769,7 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
4754 } 4769 }
4755#endif 4770#endif
4756 /* Safely ignore these bits for debug checks below */ 4771 /* Safely ignore these bits for debug checks below */
4757 inta &= ~(CSR_INT_BIT_MAC_CLK_ACTV | CSR_INT_BIT_ALIVE); 4772 inta &= ~(CSR_INT_BIT_SCD | CSR_INT_BIT_ALIVE);
4758 4773
4759 /* HW RF KILL switch toggled (4965 only) */ 4774 /* HW RF KILL switch toggled (4965 only) */
4760 if (inta & CSR_INT_BIT_RF_KILL) { 4775 if (inta & CSR_INT_BIT_RF_KILL) {
@@ -4890,8 +4905,11 @@ static irqreturn_t iwl3945_isr(int irq, void *data)
4890 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 4905 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
4891 inta, inta_mask, inta_fh); 4906 inta, inta_mask, inta_fh);
4892 4907
4908 inta &= ~CSR_INT_BIT_SCD;
4909
4893 /* iwl3945_irq_tasklet() will service interrupts and re-enable them */ 4910 /* iwl3945_irq_tasklet() will service interrupts and re-enable them */
4894 tasklet_schedule(&priv->irq_tasklet); 4911 if (likely(inta || inta_fh))
4912 tasklet_schedule(&priv->irq_tasklet);
4895unplugged: 4913unplugged:
4896 spin_unlock(&priv->lock); 4914 spin_unlock(&priv->lock);
4897 4915
@@ -5146,6 +5164,15 @@ static int iwl3945_init_channel_map(struct iwl3945_priv *priv)
5146 return 0; 5164 return 0;
5147} 5165}
5148 5166
5167/*
5168 * iwl3945_free_channel_map - undo allocations in iwl3945_init_channel_map
5169 */
5170static void iwl3945_free_channel_map(struct iwl3945_priv *priv)
5171{
5172 kfree(priv->channel_info);
5173 priv->channel_count = 0;
5174}
5175
5149/* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after 5176/* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after
5150 * sending probe req. This should be set long enough to hear probe responses 5177 * sending probe req. This should be set long enough to hear probe responses
5151 * from more than one AP. */ 5178 * from more than one AP. */
@@ -5471,6 +5498,17 @@ static int iwl3945_init_geos(struct iwl3945_priv *priv)
5471 return 0; 5498 return 0;
5472} 5499}
5473 5500
5501/*
5502 * iwl3945_free_geos - undo allocations in iwl3945_init_geos
5503 */
5504static void iwl3945_free_geos(struct iwl3945_priv *priv)
5505{
5506 kfree(priv->modes);
5507 kfree(priv->ieee_channels);
5508 kfree(priv->ieee_rates);
5509 clear_bit(STATUS_GEO_CONFIGURED, &priv->status);
5510}
5511
5474/****************************************************************************** 5512/******************************************************************************
5475 * 5513 *
5476 * uCode download functions 5514 * uCode download functions
@@ -6130,15 +6168,6 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
6130 /* Clear out the uCode error bit if it is set */ 6168 /* Clear out the uCode error bit if it is set */
6131 clear_bit(STATUS_FW_ERROR, &priv->status); 6169 clear_bit(STATUS_FW_ERROR, &priv->status);
6132 6170
6133 rc = iwl3945_init_channel_map(priv);
6134 if (rc) {
6135 IWL_ERROR("initializing regulatory failed: %d\n", rc);
6136 return;
6137 }
6138
6139 iwl3945_init_geos(priv);
6140 iwl3945_reset_channel_flag(priv);
6141
6142 if (iwl3945_is_rfkill(priv)) 6171 if (iwl3945_is_rfkill(priv))
6143 return; 6172 return;
6144 6173
@@ -6599,7 +6628,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
6599 * that based on the direct_mask added to each channel entry */ 6628 * that based on the direct_mask added to each channel entry */
6600 scan->tx_cmd.len = cpu_to_le16( 6629 scan->tx_cmd.len = cpu_to_le16(
6601 iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, 6630 iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
6602 IWL_MAX_SCAN_SIZE - sizeof(scan), 0)); 6631 IWL_MAX_SCAN_SIZE - sizeof(*scan), 0));
6603 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 6632 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
6604 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; 6633 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id;
6605 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 6634 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
@@ -7120,7 +7149,7 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv)
7120{ 7149{
7121 int rc = 0; 7150 int rc = 0;
7122 7151
7123 if (priv->status & STATUS_EXIT_PENDING) 7152 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
7124 return; 7153 return;
7125 7154
7126 /* The following should be done only at AP bring up */ 7155 /* The following should be done only at AP bring up */
@@ -8614,11 +8643,24 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
8614 IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr)); 8643 IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr));
8615 SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); 8644 SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
8616 8645
8646 err = iwl3945_init_channel_map(priv);
8647 if (err) {
8648 IWL_ERROR("initializing regulatory failed: %d\n", err);
8649 goto out_remove_sysfs;
8650 }
8651
8652 err = iwl3945_init_geos(priv);
8653 if (err) {
8654 IWL_ERROR("initializing geos failed: %d\n", err);
8655 goto out_free_channel_map;
8656 }
8657 iwl3945_reset_channel_flag(priv);
8658
8617 iwl3945_rate_control_register(priv->hw); 8659 iwl3945_rate_control_register(priv->hw);
8618 err = ieee80211_register_hw(priv->hw); 8660 err = ieee80211_register_hw(priv->hw);
8619 if (err) { 8661 if (err) {
8620 IWL_ERROR("Failed to register network device (error %d)\n", err); 8662 IWL_ERROR("Failed to register network device (error %d)\n", err);
8621 goto out_remove_sysfs; 8663 goto out_free_geos;
8622 } 8664 }
8623 8665
8624 priv->hw->conf.beacon_int = 100; 8666 priv->hw->conf.beacon_int = 100;
@@ -8628,6 +8670,10 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
8628 8670
8629 return 0; 8671 return 0;
8630 8672
8673 out_free_geos:
8674 iwl3945_free_geos(priv);
8675 out_free_channel_map:
8676 iwl3945_free_channel_map(priv);
8631 out_remove_sysfs: 8677 out_remove_sysfs:
8632 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group); 8678 sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
8633 8679
@@ -8702,10 +8748,8 @@ static void iwl3945_pci_remove(struct pci_dev *pdev)
8702 pci_disable_device(pdev); 8748 pci_disable_device(pdev);
8703 pci_set_drvdata(pdev, NULL); 8749 pci_set_drvdata(pdev, NULL);
8704 8750
8705 kfree(priv->channel_info); 8751 iwl3945_free_channel_map(priv);
8706 8752 iwl3945_free_geos(priv);
8707 kfree(priv->ieee_channels);
8708 kfree(priv->ieee_rates);
8709 8753
8710 if (priv->ibss_beacon) 8754 if (priv->ibss_beacon)
8711 dev_kfree_skb(priv->ibss_beacon); 8755 dev_kfree_skb(priv->ibss_beacon);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index c86da5cd1df1..bf3a60c037aa 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1639,6 +1639,12 @@ static void get_eeprom_mac(struct iwl4965_priv *priv, u8 *mac)
1639 memcpy(mac, priv->eeprom.mac_address, 6); 1639 memcpy(mac, priv->eeprom.mac_address, 6);
1640} 1640}
1641 1641
1642static inline void iwl4965_eeprom_release_semaphore(struct iwl4965_priv *priv)
1643{
1644 iwl4965_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
1645 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
1646}
1647
1642/** 1648/**
1643 * iwl4965_eeprom_init - read EEPROM contents 1649 * iwl4965_eeprom_init - read EEPROM contents
1644 * 1650 *
@@ -2927,8 +2933,10 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv,
2927#endif 2933#endif
2928 2934
2929 /* drop all data frame if we are not associated */ 2935 /* drop all data frame if we are not associated */
2930 if (!iwl4965_is_associated(priv) && !priv->assoc_id && 2936 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
2931 ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 2937 (!iwl4965_is_associated(priv) ||
2938 !priv->assoc_id ||
2939 !priv->assoc_station_added)) {
2932 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n"); 2940 IWL_DEBUG_DROP("Dropping - !iwl4965_is_associated\n");
2933 goto drop_unlock; 2941 goto drop_unlock;
2934 } 2942 }
@@ -5131,8 +5139,9 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv)
5131#ifdef CONFIG_IWL4965_DEBUG 5139#ifdef CONFIG_IWL4965_DEBUG
5132 if (iwl4965_debug_level & (IWL_DL_ISR)) { 5140 if (iwl4965_debug_level & (IWL_DL_ISR)) {
5133 /* NIC fires this, but we don't use it, redundant with WAKEUP */ 5141 /* NIC fires this, but we don't use it, redundant with WAKEUP */
5134 if (inta & CSR_INT_BIT_MAC_CLK_ACTV) 5142 if (inta & CSR_INT_BIT_SCD)
5135 IWL_DEBUG_ISR("Microcode started or stopped.\n"); 5143 IWL_DEBUG_ISR("Scheduler finished to transmit "
5144 "the frame/frames.\n");
5136 5145
5137 /* Alive notification via Rx interrupt will do the real work */ 5146 /* Alive notification via Rx interrupt will do the real work */
5138 if (inta & CSR_INT_BIT_ALIVE) 5147 if (inta & CSR_INT_BIT_ALIVE)
@@ -5140,7 +5149,7 @@ static void iwl4965_irq_tasklet(struct iwl4965_priv *priv)
5140 } 5149 }
5141#endif 5150#endif
5142 /* Safely ignore these bits for debug checks below */ 5151 /* Safely ignore these bits for debug checks below */
5143 inta &= ~(CSR_INT_BIT_MAC_CLK_ACTV | CSR_INT_BIT_ALIVE); 5152 inta &= ~(CSR_INT_BIT_SCD | CSR_INT_BIT_ALIVE);
5144 5153
5145 /* HW RF KILL switch toggled */ 5154 /* HW RF KILL switch toggled */
5146 if (inta & CSR_INT_BIT_RF_KILL) { 5155 if (inta & CSR_INT_BIT_RF_KILL) {
@@ -5269,8 +5278,11 @@ static irqreturn_t iwl4965_isr(int irq, void *data)
5269 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n", 5278 IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
5270 inta, inta_mask, inta_fh); 5279 inta, inta_mask, inta_fh);
5271 5280
5281 inta &= ~CSR_INT_BIT_SCD;
5282
5272 /* iwl4965_irq_tasklet() will service interrupts and re-enable them */ 5283 /* iwl4965_irq_tasklet() will service interrupts and re-enable them */
5273 tasklet_schedule(&priv->irq_tasklet); 5284 if (likely(inta || inta_fh))
5285 tasklet_schedule(&priv->irq_tasklet);
5274 5286
5275 unplugged: 5287 unplugged:
5276 spin_unlock(&priv->lock); 5288 spin_unlock(&priv->lock);
@@ -5576,6 +5588,15 @@ static int iwl4965_init_channel_map(struct iwl4965_priv *priv)
5576 return 0; 5588 return 0;
5577} 5589}
5578 5590
5591/*
5592 * iwl4965_free_channel_map - undo allocations in iwl4965_init_channel_map
5593 */
5594static void iwl4965_free_channel_map(struct iwl4965_priv *priv)
5595{
5596 kfree(priv->channel_info);
5597 priv->channel_count = 0;
5598}
5599
5579/* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after 5600/* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after
5580 * sending probe req. This should be set long enough to hear probe responses 5601 * sending probe req. This should be set long enough to hear probe responses
5581 * from more than one AP. */ 5602 * from more than one AP. */
@@ -5909,6 +5930,17 @@ static int iwl4965_init_geos(struct iwl4965_priv *priv)
5909 return 0; 5930 return 0;
5910} 5931}
5911 5932
5933/*
5934 * iwl4965_free_geos - undo allocations in iwl4965_init_geos
5935 */
5936static void iwl4965_free_geos(struct iwl4965_priv *priv)
5937{
5938 kfree(priv->modes);
5939 kfree(priv->ieee_channels);
5940 kfree(priv->ieee_rates);
5941 clear_bit(STATUS_GEO_CONFIGURED, &priv->status);
5942}
5943
5912/****************************************************************************** 5944/******************************************************************************
5913 * 5945 *
5914 * uCode download functions 5946 * uCode download functions
@@ -6560,15 +6592,6 @@ static void iwl4965_alive_start(struct iwl4965_priv *priv)
6560 /* Clear out the uCode error bit if it is set */ 6592 /* Clear out the uCode error bit if it is set */
6561 clear_bit(STATUS_FW_ERROR, &priv->status); 6593 clear_bit(STATUS_FW_ERROR, &priv->status);
6562 6594
6563 rc = iwl4965_init_channel_map(priv);
6564 if (rc) {
6565 IWL_ERROR("initializing regulatory failed: %d\n", rc);
6566 return;
6567 }
6568
6569 iwl4965_init_geos(priv);
6570 iwl4965_reset_channel_flag(priv);
6571
6572 if (iwl4965_is_rfkill(priv)) 6595 if (iwl4965_is_rfkill(priv))
6573 return; 6596 return;
6574 6597
@@ -7023,7 +7046,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
7023 * that based on the direct_mask added to each channel entry */ 7046 * that based on the direct_mask added to each channel entry */
7024 scan->tx_cmd.len = cpu_to_le16( 7047 scan->tx_cmd.len = cpu_to_le16(
7025 iwl4965_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data, 7048 iwl4965_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
7026 IWL_MAX_SCAN_SIZE - sizeof(scan), 0)); 7049 IWL_MAX_SCAN_SIZE - sizeof(*scan), 0));
7027 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; 7050 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
7028 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id; 7051 scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id;
7029 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 7052 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
@@ -7448,7 +7471,7 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw,
7448 7471
7449 if (priv->vif) { 7472 if (priv->vif) {
7450 IWL_DEBUG_MAC80211("leave - vif != NULL\n"); 7473 IWL_DEBUG_MAC80211("leave - vif != NULL\n");
7451 return 0; 7474 return -EOPNOTSUPP;
7452 } 7475 }
7453 7476
7454 spin_lock_irqsave(&priv->lock, flags); 7477 spin_lock_irqsave(&priv->lock, flags);
@@ -7580,7 +7603,7 @@ static void iwl4965_config_ap(struct iwl4965_priv *priv)
7580{ 7603{
7581 int rc = 0; 7604 int rc = 0;
7582 7605
7583 if (priv->status & STATUS_EXIT_PENDING) 7606 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
7584 return; 7607 return;
7585 7608
7586 /* The following should be done only at AP bring up */ 7609 /* The following should be done only at AP bring up */
@@ -9198,11 +9221,24 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
9198 IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr)); 9221 IWL_DEBUG_INFO("MAC address: %s\n", print_mac(mac, priv->mac_addr));
9199 SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); 9222 SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
9200 9223
9224 err = iwl4965_init_channel_map(priv);
9225 if (err) {
9226 IWL_ERROR("initializing regulatory failed: %d\n", err);
9227 goto out_remove_sysfs;
9228 }
9229
9230 err = iwl4965_init_geos(priv);
9231 if (err) {
9232 IWL_ERROR("initializing geos failed: %d\n", err);
9233 goto out_free_channel_map;
9234 }
9235 iwl4965_reset_channel_flag(priv);
9236
9201 iwl4965_rate_control_register(priv->hw); 9237 iwl4965_rate_control_register(priv->hw);
9202 err = ieee80211_register_hw(priv->hw); 9238 err = ieee80211_register_hw(priv->hw);
9203 if (err) { 9239 if (err) {
9204 IWL_ERROR("Failed to register network device (error %d)\n", err); 9240 IWL_ERROR("Failed to register network device (error %d)\n", err);
9205 goto out_remove_sysfs; 9241 goto out_free_geos;
9206 } 9242 }
9207 9243
9208 priv->hw->conf.beacon_int = 100; 9244 priv->hw->conf.beacon_int = 100;
@@ -9212,6 +9248,10 @@ static int iwl4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
9212 9248
9213 return 0; 9249 return 0;
9214 9250
9251 out_free_geos:
9252 iwl4965_free_geos(priv);
9253 out_free_channel_map:
9254 iwl4965_free_channel_map(priv);
9215 out_remove_sysfs: 9255 out_remove_sysfs:
9216 sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group); 9256 sysfs_remove_group(&pdev->dev.kobj, &iwl4965_attribute_group);
9217 9257
@@ -9286,10 +9326,8 @@ static void iwl4965_pci_remove(struct pci_dev *pdev)
9286 pci_disable_device(pdev); 9326 pci_disable_device(pdev);
9287 pci_set_drvdata(pdev, NULL); 9327 pci_set_drvdata(pdev, NULL);
9288 9328
9289 kfree(priv->channel_info); 9329 iwl4965_free_channel_map(priv);
9290 9330 iwl4965_free_geos(priv);
9291 kfree(priv->ieee_channels);
9292 kfree(priv->ieee_rates);
9293 9331
9294 if (priv->ibss_beacon) 9332 if (priv->ibss_beacon)
9295 dev_kfree_skb(priv->ibss_beacon); 9333 dev_kfree_skb(priv->ibss_beacon);
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index c622e9b63cd1..87e145ffe8f1 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -12,8 +12,10 @@
12#include "cmd.h" 12#include "cmd.h"
13 13
14 14
15static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 15static const u8 bssid_any[ETH_ALEN] __attribute__ ((aligned (2))) =
16static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 16 { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
17static const u8 bssid_off[ETH_ALEN] __attribute__ ((aligned (2))) =
18 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
17 19
18 20
19static int assoc_helper_essid(struct lbs_private *priv, 21static int assoc_helper_essid(struct lbs_private *priv,
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 58d7ef6b5ff5..5a69f2b60865 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -349,7 +349,7 @@ struct assoc_request {
349 u8 channel; 349 u8 channel;
350 u8 band; 350 u8 band;
351 u8 mode; 351 u8 mode;
352 u8 bssid[ETH_ALEN]; 352 u8 bssid[ETH_ALEN] __attribute__ ((aligned (2)));
353 353
354 /** WEP keys */ 354 /** WEP keys */
355 struct enc_key wep_keys[4]; 355 struct enc_key wep_keys[4];
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 4b5ab9a6b97b..5a9cadb97503 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -249,14 +249,14 @@ static irqreturn_t if_cs_interrupt(int irq, void *data)
249 lbs_deb_enter(LBS_DEB_CS); 249 lbs_deb_enter(LBS_DEB_CS);
250 250
251 int_cause = if_cs_read16(card, IF_CS_C_INT_CAUSE); 251 int_cause = if_cs_read16(card, IF_CS_C_INT_CAUSE);
252 if(int_cause == 0x0) { 252 if (int_cause == 0x0) {
253 /* Not for us */ 253 /* Not for us */
254 return IRQ_NONE; 254 return IRQ_NONE;
255 255
256 } else if (int_cause == 0xffff) { 256 } else if (int_cause == 0xffff) {
257 /* Read in junk, the card has probably been removed */ 257 /* Read in junk, the card has probably been removed */
258 card->priv->surpriseremoved = 1; 258 card->priv->surpriseremoved = 1;
259 259 return IRQ_HANDLED;
260 } else { 260 } else {
261 if (int_cause & IF_CS_H_IC_TX_OVER) 261 if (int_cause & IF_CS_H_IC_TX_OVER)
262 lbs_host_to_card_done(card->priv); 262 lbs_host_to_card_done(card->priv);
@@ -717,8 +717,8 @@ static void if_cs_release(struct pcmcia_device *p_dev)
717 717
718 lbs_deb_enter(LBS_DEB_CS); 718 lbs_deb_enter(LBS_DEB_CS);
719 719
720 pcmcia_disable_device(p_dev);
721 free_irq(p_dev->irq.AssignedIRQ, card); 720 free_irq(p_dev->irq.AssignedIRQ, card);
721 pcmcia_disable_device(p_dev);
722 if (card->iobase) 722 if (card->iobase)
723 ioport_unmap(card->iobase); 723 ioport_unmap(card->iobase);
724 724
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
new file mode 100644
index 000000000000..d3ecf89abd93
--- /dev/null
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -0,0 +1,2757 @@
1/*
2 * Driver for RNDIS based wireless USB devices.
3 *
4 * Copyright (C) 2007 by Bjorge Dijkstra <bjd@jooz.net>
5 * Copyright (C) 2008 by Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * Portions of this file are based on NDISwrapper project,
22 * Copyright (C) 2003-2005 Pontus Fuchs, Giridhar Pemmasani
23 * http://ndiswrapper.sourceforge.net/
24 */
25
26// #define DEBUG // error path messages, extra info
27// #define VERBOSE // more; success messages
28
29#include <linux/module.h>
30#include <linux/init.h>
31#include <linux/netdevice.h>
32#include <linux/etherdevice.h>
33#include <linux/ethtool.h>
34#include <linux/workqueue.h>
35#include <linux/mutex.h>
36#include <linux/mii.h>
37#include <linux/usb.h>
38#include <linux/usb/cdc.h>
39#include <linux/wireless.h>
40#include <linux/if_arp.h>
41#include <linux/ctype.h>
42#include <linux/spinlock.h>
43#include <net/iw_handler.h>
44#include <net/ieee80211.h>
45#include <linux/usb/usbnet.h>
46#include <linux/usb/rndis_host.h>
47
48
49/* NOTE: All these are settings for Broadcom chipset */
50static char modparam_country[4] = "EU";
51module_param_string(country, modparam_country, 4, 0444);
52MODULE_PARM_DESC(country, "Country code (ISO 3166-1 alpha-2), default: EU");
53
54static int modparam_frameburst = 1;
55module_param_named(frameburst, modparam_frameburst, int, 0444);
56MODULE_PARM_DESC(frameburst, "enable frame bursting (default: on)");
57
58static int modparam_afterburner = 0;
59module_param_named(afterburner, modparam_afterburner, int, 0444);
60MODULE_PARM_DESC(afterburner,
61 "enable afterburner aka '125 High Speed Mode' (default: off)");
62
63static int modparam_power_save = 0;
64module_param_named(power_save, modparam_power_save, int, 0444);
65MODULE_PARM_DESC(power_save,
66 "set power save mode: 0=off, 1=on, 2=fast (default: off)");
67
68static int modparam_power_output = 3;
69module_param_named(power_output, modparam_power_output, int, 0444);
70MODULE_PARM_DESC(power_output,
71 "set power output: 0=25%, 1=50%, 2=75%, 3=100% (default: 100%)");
72
73static int modparam_roamtrigger = -70;
74module_param_named(roamtrigger, modparam_roamtrigger, int, 0444);
75MODULE_PARM_DESC(roamtrigger,
76 "set roaming dBm trigger: -80=optimize for distance, "
77 "-60=bandwidth (default: -70)");
78
79static int modparam_roamdelta = 1;
80module_param_named(roamdelta, modparam_roamdelta, int, 0444);
81MODULE_PARM_DESC(roamdelta,
82 "set roaming tendency: 0=aggressive, 1=moderate, "
83 "2=conservative (default: moderate)");
84
85static int modparam_workaround_interval = 500;
86module_param_named(workaround_interval, modparam_workaround_interval,
87 int, 0444);
88MODULE_PARM_DESC(workaround_interval,
89 "set stall workaround interval in msecs (default: 500)");
90
91
92/* various RNDIS OID defs */
93#define OID_GEN_LINK_SPEED ccpu2(0x00010107)
94#define OID_GEN_RNDIS_CONFIG_PARAMETER ccpu2(0x0001021b)
95
96#define OID_GEN_XMIT_OK ccpu2(0x00020101)
97#define OID_GEN_RCV_OK ccpu2(0x00020102)
98#define OID_GEN_XMIT_ERROR ccpu2(0x00020103)
99#define OID_GEN_RCV_ERROR ccpu2(0x00020104)
100#define OID_GEN_RCV_NO_BUFFER ccpu2(0x00020105)
101
102#define OID_802_3_PERMANENT_ADDRESS ccpu2(0x01010101)
103#define OID_802_3_CURRENT_ADDRESS ccpu2(0x01010102)
104#define OID_802_3_MULTICAST_LIST ccpu2(0x01010103)
105#define OID_802_3_MAXIMUM_LIST_SIZE ccpu2(0x01010104)
106
107#define OID_802_11_BSSID ccpu2(0x0d010101)
108#define OID_802_11_SSID ccpu2(0x0d010102)
109#define OID_802_11_INFRASTRUCTURE_MODE ccpu2(0x0d010108)
110#define OID_802_11_ADD_WEP ccpu2(0x0d010113)
111#define OID_802_11_REMOVE_WEP ccpu2(0x0d010114)
112#define OID_802_11_DISASSOCIATE ccpu2(0x0d010115)
113#define OID_802_11_AUTHENTICATION_MODE ccpu2(0x0d010118)
114#define OID_802_11_PRIVACY_FILTER ccpu2(0x0d010119)
115#define OID_802_11_BSSID_LIST_SCAN ccpu2(0x0d01011a)
116#define OID_802_11_ENCRYPTION_STATUS ccpu2(0x0d01011b)
117#define OID_802_11_ADD_KEY ccpu2(0x0d01011d)
118#define OID_802_11_REMOVE_KEY ccpu2(0x0d01011e)
119#define OID_802_11_PMKID ccpu2(0x0d010123)
120#define OID_802_11_NETWORK_TYPES_SUPPORTED ccpu2(0x0d010203)
121#define OID_802_11_NETWORK_TYPE_IN_USE ccpu2(0x0d010204)
122#define OID_802_11_TX_POWER_LEVEL ccpu2(0x0d010205)
123#define OID_802_11_RSSI ccpu2(0x0d010206)
124#define OID_802_11_RSSI_TRIGGER ccpu2(0x0d010207)
125#define OID_802_11_FRAGMENTATION_THRESHOLD ccpu2(0x0d010209)
126#define OID_802_11_RTS_THRESHOLD ccpu2(0x0d01020a)
127#define OID_802_11_SUPPORTED_RATES ccpu2(0x0d01020e)
128#define OID_802_11_CONFIGURATION ccpu2(0x0d010211)
129#define OID_802_11_BSSID_LIST ccpu2(0x0d010217)
130
131
132/* Typical noise/maximum signal level values taken from ndiswrapper iw_ndis.h */
133#define WL_NOISE -96 /* typical noise level in dBm */
134#define WL_SIGMAX -32 /* typical maximum signal level in dBm */
135
136
137/* Assume that Broadcom 4320 (only chipset at time of writing known to be
138 * based on wireless rndis) has default txpower of 13dBm.
139 * This value is from Linksys WUSB54GSC User Guide, Appendix F: Specifications.
140 * 13dBm == 19.9mW
141 */
142#define BCM4320_DEFAULT_TXPOWER 20
143
144
145/* codes for "status" field of completion messages */
146#define RNDIS_STATUS_ADAPTER_NOT_READY ccpu2(0xc0010011)
147#define RNDIS_STATUS_ADAPTER_NOT_OPEN ccpu2(0xc0010012)
148
149
150/* NDIS data structures. Taken from wpa_supplicant driver_ndis.c
151 * slightly modified for datatype endianess, etc
152 */
153#define NDIS_802_11_LENGTH_SSID 32
154#define NDIS_802_11_LENGTH_RATES 8
155#define NDIS_802_11_LENGTH_RATES_EX 16
156
157struct NDIS_802_11_SSID {
158 __le32 SsidLength;
159 u8 Ssid[NDIS_802_11_LENGTH_SSID];
160} __attribute__((packed));
161
162enum NDIS_802_11_NETWORK_TYPE {
163 Ndis802_11FH,
164 Ndis802_11DS,
165 Ndis802_11OFDM5,
166 Ndis802_11OFDM24,
167 Ndis802_11NetworkTypeMax
168};
169
170struct NDIS_802_11_CONFIGURATION_FH {
171 __le32 Length;
172 __le32 HopPattern;
173 __le32 HopSet;
174 __le32 DwellTime;
175} __attribute__((packed));
176
177struct NDIS_802_11_CONFIGURATION {
178 __le32 Length;
179 __le32 BeaconPeriod;
180 __le32 ATIMWindow;
181 __le32 DSConfig;
182 struct NDIS_802_11_CONFIGURATION_FH FHConfig;
183} __attribute__((packed));
184
185enum NDIS_802_11_NETWORK_INFRASTRUCTURE {
186 Ndis802_11IBSS,
187 Ndis802_11Infrastructure,
188 Ndis802_11AutoUnknown,
189 Ndis802_11InfrastructureMax
190};
191
192enum NDIS_802_11_AUTHENTICATION_MODE {
193 Ndis802_11AuthModeOpen,
194 Ndis802_11AuthModeShared,
195 Ndis802_11AuthModeAutoSwitch,
196 Ndis802_11AuthModeWPA,
197 Ndis802_11AuthModeWPAPSK,
198 Ndis802_11AuthModeWPANone,
199 Ndis802_11AuthModeWPA2,
200 Ndis802_11AuthModeWPA2PSK,
201 Ndis802_11AuthModeMax
202};
203
204enum NDIS_802_11_ENCRYPTION_STATUS {
205 Ndis802_11WEPEnabled,
206 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
207 Ndis802_11WEPDisabled,
208 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
209 Ndis802_11WEPKeyAbsent,
210 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
211 Ndis802_11WEPNotSupported,
212 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
213 Ndis802_11Encryption2Enabled,
214 Ndis802_11Encryption2KeyAbsent,
215 Ndis802_11Encryption3Enabled,
216 Ndis802_11Encryption3KeyAbsent
217};
218
219enum NDIS_802_11_PRIVACY_FILTER {
220 Ndis802_11PrivFilterAcceptAll,
221 Ndis802_11PrivFilter8021xWEP
222};
223
224struct NDIS_WLAN_BSSID_EX {
225 __le32 Length;
226 u8 MacAddress[6];
227 u8 Padding[2];
228 struct NDIS_802_11_SSID Ssid;
229 __le32 Privacy;
230 __le32 Rssi;
231 enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
232 struct NDIS_802_11_CONFIGURATION Configuration;
233 enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
234 u8 SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
235 __le32 IELength;
236 u8 IEs[0];
237} __attribute__((packed));
238
239struct NDIS_802_11_BSSID_LIST_EX {
240 __le32 NumberOfItems;
241 struct NDIS_WLAN_BSSID_EX Bssid[0];
242} __attribute__((packed));
243
244struct NDIS_802_11_FIXED_IEs {
245 u8 Timestamp[8];
246 __le16 BeaconInterval;
247 __le16 Capabilities;
248} __attribute__((packed));
249
250struct NDIS_802_11_WEP {
251 __le32 Length;
252 __le32 KeyIndex;
253 __le32 KeyLength;
254 u8 KeyMaterial[32];
255} __attribute__((packed));
256
257struct NDIS_802_11_KEY {
258 __le32 Length;
259 __le32 KeyIndex;
260 __le32 KeyLength;
261 u8 Bssid[6];
262 u8 Padding[6];
263 __le64 KeyRSC;
264 u8 KeyMaterial[32];
265} __attribute__((packed));
266
267struct NDIS_802_11_REMOVE_KEY {
268 __le32 Length;
269 __le32 KeyIndex;
270 u8 Bssid[6];
271} __attribute__((packed));
272
273struct RNDIS_CONFIG_PARAMETER_INFOBUFFER {
274 __le32 ParameterNameOffset;
275 __le32 ParameterNameLength;
276 __le32 ParameterType;
277 __le32 ParameterValueOffset;
278 __le32 ParameterValueLength;
279} __attribute__((packed));
280
281/* these have to match what is in wpa_supplicant */
282enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg;
283enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP, CIPHER_WEP104 }
284 wpa_cipher;
285enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE, KEY_MGMT_802_1X_NO_WPA,
286 KEY_MGMT_WPA_NONE } wpa_key_mgmt;
287
288/*
289 * private data
290 */
291#define NET_TYPE_11FB 0
292
293#define CAP_MODE_80211A 1
294#define CAP_MODE_80211B 2
295#define CAP_MODE_80211G 4
296#define CAP_MODE_MASK 7
297#define CAP_SUPPORT_TXPOWER 8
298
299#define WORK_CONNECTION_EVENT (1<<0)
300#define WORK_SET_MULTICAST_LIST (1<<1)
301
302/* RNDIS device private data */
303struct rndis_wext_private {
304 char name[32];
305
306 struct usbnet *usbdev;
307
308 struct workqueue_struct *workqueue;
309 struct delayed_work stats_work;
310 struct work_struct work;
311 struct mutex command_lock;
312 spinlock_t stats_lock;
313 unsigned long work_pending;
314
315 struct iw_statistics iwstats;
316 struct iw_statistics privstats;
317
318 int nick_len;
319 char nick[32];
320
321 int caps;
322 int multicast_size;
323
324 /* module parameters */
325 char param_country[4];
326 int param_frameburst;
327 int param_afterburner;
328 int param_power_save;
329 int param_power_output;
330 int param_roamtrigger;
331 int param_roamdelta;
332 u32 param_workaround_interval;
333
334 /* hardware state */
335 int radio_on;
336 int infra_mode;
337 struct NDIS_802_11_SSID essid;
338
339 /* encryption stuff */
340 int encr_tx_key_index;
341 char encr_keys[4][32];
342 int encr_key_len[4];
343 int wpa_version;
344 int wpa_keymgmt;
345 int wpa_authalg;
346 int wpa_ie_len;
347 u8 *wpa_ie;
348 int wpa_cipher_pair;
349 int wpa_cipher_group;
350};
351
352
353static const int freq_chan[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442,
354 2447, 2452, 2457, 2462, 2467, 2472, 2484 };
355
356static const int rates_80211g[8] = { 6, 9, 12, 18, 24, 36, 48, 54 };
357
358static const int bcm4320_power_output[4] = { 25, 50, 75, 100 };
359
360static const unsigned char zero_bssid[ETH_ALEN] = {0,};
361static const unsigned char ffff_bssid[ETH_ALEN] = { 0xff, 0xff, 0xff,
362 0xff, 0xff, 0xff };
363
364
365static struct rndis_wext_private *get_rndis_wext_priv(struct usbnet *dev)
366{
367 return (struct rndis_wext_private *)dev->driver_priv;
368}
369
370
371static u32 get_bcm4320_power(struct rndis_wext_private *priv)
372{
373 return BCM4320_DEFAULT_TXPOWER *
374 bcm4320_power_output[priv->param_power_output] / 100;
375}
376
377
378/* translate error code */
379static int rndis_error_status(__le32 rndis_status)
380{
381 int ret = -EINVAL;
382 switch (rndis_status) {
383 case RNDIS_STATUS_SUCCESS:
384 ret = 0;
385 break;
386 case RNDIS_STATUS_FAILURE:
387 case RNDIS_STATUS_INVALID_DATA:
388 ret = -EINVAL;
389 break;
390 case RNDIS_STATUS_NOT_SUPPORTED:
391 ret = -EOPNOTSUPP;
392 break;
393 case RNDIS_STATUS_ADAPTER_NOT_READY:
394 case RNDIS_STATUS_ADAPTER_NOT_OPEN:
395 ret = -EBUSY;
396 break;
397 }
398 return ret;
399}
400
401
402static int rndis_query_oid(struct usbnet *dev, __le32 oid, void *data, int *len)
403{
404 struct rndis_wext_private *priv = get_rndis_wext_priv(dev);
405 union {
406 void *buf;
407 struct rndis_msg_hdr *header;
408 struct rndis_query *get;
409 struct rndis_query_c *get_c;
410 } u;
411 int ret, buflen;
412
413 buflen = *len + sizeof(*u.get);
414 if (buflen < CONTROL_BUFFER_SIZE)
415 buflen = CONTROL_BUFFER_SIZE;
416 u.buf = kmalloc(buflen, GFP_KERNEL);
417 if (!u.buf)
418 return -ENOMEM;
419 memset(u.get, 0, sizeof *u.get);
420 u.get->msg_type = RNDIS_MSG_QUERY;
421 u.get->msg_len = ccpu2(sizeof *u.get);
422 u.get->oid = oid;
423
424 mutex_lock(&priv->command_lock);
425 ret = rndis_command(dev, u.header);
426 mutex_unlock(&priv->command_lock);
427
428 if (ret == 0) {
429 ret = le32_to_cpu(u.get_c->len);
430 *len = (*len > ret) ? ret : *len;
431 memcpy(data, u.buf + le32_to_cpu(u.get_c->offset) + 8, *len);
432 ret = rndis_error_status(u.get_c->status);
433 }
434
435 kfree(u.buf);
436 return ret;
437}
438
439
440static int rndis_set_oid(struct usbnet *dev, __le32 oid, void *data, int len)
441{
442 struct rndis_wext_private *priv = get_rndis_wext_priv(dev);
443 union {
444 void *buf;
445 struct rndis_msg_hdr *header;
446 struct rndis_set *set;
447 struct rndis_set_c *set_c;
448 } u;
449 int ret, buflen;
450
451 buflen = len + sizeof(*u.set);
452 if (buflen < CONTROL_BUFFER_SIZE)
453 buflen = CONTROL_BUFFER_SIZE;
454 u.buf = kmalloc(buflen, GFP_KERNEL);
455 if (!u.buf)
456 return -ENOMEM;
457
458 memset(u.set, 0, sizeof *u.set);
459 u.set->msg_type = RNDIS_MSG_SET;
460 u.set->msg_len = cpu_to_le32(sizeof(*u.set) + len);
461 u.set->oid = oid;
462 u.set->len = cpu_to_le32(len);
463 u.set->offset = ccpu2(sizeof(*u.set) - 8);
464 u.set->handle = ccpu2(0);
465 memcpy(u.buf + sizeof(*u.set), data, len);
466
467 mutex_lock(&priv->command_lock);
468 ret = rndis_command(dev, u.header);
469 mutex_unlock(&priv->command_lock);
470
471 if (ret == 0)
472 ret = rndis_error_status(u.set_c->status);
473
474 kfree(u.buf);
475 return ret;
476}
477
478
479/*
480 * Specs say that we can only set config parameters only soon after device
481 * initialization.
482 * value_type: 0 = u32, 2 = unicode string
483 */
484static int rndis_set_config_parameter(struct usbnet *dev, char *param,
485 int value_type, void *value)
486{
487 struct RNDIS_CONFIG_PARAMETER_INFOBUFFER *infobuf;
488 int value_len, info_len, param_len, ret, i;
489 __le16 *unibuf;
490 __le32 *dst_value;
491
492 if (value_type == 0)
493 value_len = sizeof(__le32);
494 else if (value_type == 2)
495 value_len = strlen(value) * sizeof(__le16);
496 else
497 return -EINVAL;
498
499 param_len = strlen(param) * sizeof(__le16);
500 info_len = sizeof(*infobuf) + param_len + value_len;
501
502#ifdef DEBUG
503 info_len += 12;
504#endif
505 infobuf = kmalloc(info_len, GFP_KERNEL);
506 if (!infobuf)
507 return -ENOMEM;
508
509#ifdef DEBUG
510 info_len -= 12;
511 /* extra 12 bytes are for padding (debug output) */
512 memset(infobuf, 0xCC, info_len + 12);
513#endif
514
515 if (value_type == 2)
516 devdbg(dev, "setting config parameter: %s, value: %s",
517 param, (u8 *)value);
518 else
519 devdbg(dev, "setting config parameter: %s, value: %d",
520 param, *(u32 *)value);
521
522 infobuf->ParameterNameOffset = cpu_to_le32(sizeof(*infobuf));
523 infobuf->ParameterNameLength = cpu_to_le32(param_len);
524 infobuf->ParameterType = cpu_to_le32(value_type);
525 infobuf->ParameterValueOffset = cpu_to_le32(sizeof(*infobuf) +
526 param_len);
527 infobuf->ParameterValueLength = cpu_to_le32(value_len);
528
529 /* simple string to unicode string conversion */
530 unibuf = (void *)infobuf + sizeof(*infobuf);
531 for (i = 0; i < param_len / sizeof(__le16); i++)
532 unibuf[i] = cpu_to_le16(param[i]);
533
534 if (value_type == 2) {
535 unibuf = (void *)infobuf + sizeof(*infobuf) + param_len;
536 for (i = 0; i < value_len / sizeof(__le16); i++)
537 unibuf[i] = cpu_to_le16(((u8 *)value)[i]);
538 } else {
539 dst_value = (void *)infobuf + sizeof(*infobuf) + param_len;
540 *dst_value = cpu_to_le32(*(u32 *)value);
541 }
542
543#ifdef DEBUG
544 devdbg(dev, "info buffer (len: %d):", info_len);
545 for (i = 0; i < info_len; i += 12) {
546 u32 *tmp = (u32 *)((u8 *)infobuf + i);
547 devdbg(dev, "%08X:%08X:%08X",
548 cpu_to_be32(tmp[0]),
549 cpu_to_be32(tmp[1]),
550 cpu_to_be32(tmp[2]));
551 }
552#endif
553
554 ret = rndis_set_oid(dev, OID_GEN_RNDIS_CONFIG_PARAMETER,
555 infobuf, info_len);
556 if (ret != 0)
557 devdbg(dev, "setting rndis config paramater failed, %d.", ret);
558
559 kfree(infobuf);
560 return ret;
561}
562
563static int rndis_set_config_parameter_str(struct usbnet *dev,
564 char *param, char *value)
565{
566 return(rndis_set_config_parameter(dev, param, 2, value));
567}
568
569/*static int rndis_set_config_parameter_u32(struct usbnet *dev,
570 char *param, u32 value)
571{
572 return(rndis_set_config_parameter(dev, param, 0, &value));
573}*/
574
575
576/*
577 * data conversion functions
578 */
579static int level_to_qual(int level)
580{
581 int qual = 100 * (level - WL_NOISE) / (WL_SIGMAX - WL_NOISE);
582 return qual >= 0 ? (qual <= 100 ? qual : 100) : 0;
583}
584
585
586static void dsconfig_to_freq(unsigned int dsconfig, struct iw_freq *freq)
587{
588 freq->e = 0;
589 freq->i = 0;
590 freq->flags = 0;
591
592 /* see comment in wireless.h above the "struct iw_freq"
593 * definition for an explanation of this if
594 * NOTE: 1000000 is due to the kHz
595 */
596 if (dsconfig > 1000000) {
597 freq->m = dsconfig / 10;
598 freq->e = 1;
599 } else
600 freq->m = dsconfig;
601
602 /* convert from kHz to Hz */
603 freq->e += 3;
604}
605
606
607static int freq_to_dsconfig(struct iw_freq *freq, unsigned int *dsconfig)
608{
609 if (freq->m < 1000 && freq->e == 0) {
610 if (freq->m >= 1 &&
611 freq->m <= (sizeof(freq_chan) / sizeof(freq_chan[0])))
612 *dsconfig = freq_chan[freq->m - 1] * 1000;
613 else
614 return -1;
615 } else {
616 int i;
617 *dsconfig = freq->m;
618 for (i = freq->e; i > 0; i--)
619 *dsconfig *= 10;
620 *dsconfig /= 1000;
621 }
622
623 return 0;
624}
625
626
627/*
628 * common functions
629 */
630static int
631add_wep_key(struct usbnet *usbdev, char *key, int key_len, int index);
632
633static int get_essid(struct usbnet *usbdev, struct NDIS_802_11_SSID *ssid)
634{
635 int ret, len;
636
637 len = sizeof(*ssid);
638 ret = rndis_query_oid(usbdev, OID_802_11_SSID, ssid, &len);
639
640 if (ret != 0)
641 ssid->SsidLength = 0;
642
643#ifdef DEBUG
644 {
645 unsigned char tmp[NDIS_802_11_LENGTH_SSID + 1];
646
647 memcpy(tmp, ssid->Ssid, le32_to_cpu(ssid->SsidLength));
648 tmp[le32_to_cpu(ssid->SsidLength)] = 0;
649 devdbg(usbdev, "get_essid: '%s', ret: %d", tmp, ret);
650 }
651#endif
652 return ret;
653}
654
655
656static int set_essid(struct usbnet *usbdev, struct NDIS_802_11_SSID *ssid)
657{
658 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
659 int ret;
660
661 ret = rndis_set_oid(usbdev, OID_802_11_SSID, ssid, sizeof(*ssid));
662 if (ret == 0) {
663 memcpy(&priv->essid, ssid, sizeof(priv->essid));
664 priv->radio_on = 1;
665 devdbg(usbdev, "set_essid: radio_on = 1");
666 }
667
668 return ret;
669}
670
671
672static int get_bssid(struct usbnet *usbdev, u8 bssid[ETH_ALEN])
673{
674 int ret, len;
675
676 len = ETH_ALEN;
677 ret = rndis_query_oid(usbdev, OID_802_11_BSSID, bssid, &len);
678
679 if (ret != 0)
680 memset(bssid, 0, ETH_ALEN);
681
682 return ret;
683}
684
685
686static int is_associated(struct usbnet *usbdev)
687{
688 u8 bssid[ETH_ALEN];
689 int ret;
690
691 ret = get_bssid(usbdev, bssid);
692
693 return(ret == 0 && memcmp(bssid, zero_bssid, ETH_ALEN) != 0);
694}
695
696
697static int disassociate(struct usbnet *usbdev, int reset_ssid)
698{
699 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
700 struct NDIS_802_11_SSID ssid;
701 int i, ret = 0;
702
703 if (priv->radio_on) {
704 ret = rndis_set_oid(usbdev, OID_802_11_DISASSOCIATE, NULL, 0);
705 if (ret == 0) {
706 priv->radio_on = 0;
707 devdbg(usbdev, "disassociate: radio_on = 0");
708
709 if (reset_ssid)
710 msleep(100);
711 }
712 }
713
714 /* disassociate causes radio to be turned off; if reset_ssid
715 * is given, set random ssid to enable radio */
716 if (reset_ssid) {
717 ssid.SsidLength = cpu_to_le32(sizeof(ssid.Ssid));
718 get_random_bytes(&ssid.Ssid[2], sizeof(ssid.Ssid)-2);
719 ssid.Ssid[0] = 0x1;
720 ssid.Ssid[1] = 0xff;
721 for (i = 2; i < sizeof(ssid.Ssid); i++)
722 ssid.Ssid[i] = 0x1 + (ssid.Ssid[i] * 0xfe / 0xff);
723 ret = set_essid(usbdev, &ssid);
724 }
725 return ret;
726}
727
728
729static int set_auth_mode(struct usbnet *usbdev, int wpa_version, int authalg)
730{
731 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
732 __le32 tmp;
733 int auth_mode, ret;
734
735 devdbg(usbdev, "set_auth_mode: wpa_version=0x%x authalg=0x%x "
736 "keymgmt=0x%x", wpa_version, authalg, priv->wpa_keymgmt);
737
738 if (wpa_version & IW_AUTH_WPA_VERSION_WPA2) {
739 if (priv->wpa_keymgmt & IW_AUTH_KEY_MGMT_802_1X)
740 auth_mode = Ndis802_11AuthModeWPA2;
741 else
742 auth_mode = Ndis802_11AuthModeWPA2PSK;
743 } else if (wpa_version & IW_AUTH_WPA_VERSION_WPA) {
744 if (priv->wpa_keymgmt & IW_AUTH_KEY_MGMT_802_1X)
745 auth_mode = Ndis802_11AuthModeWPA;
746 else if (priv->wpa_keymgmt & IW_AUTH_KEY_MGMT_PSK)
747 auth_mode = Ndis802_11AuthModeWPAPSK;
748 else
749 auth_mode = Ndis802_11AuthModeWPANone;
750 } else if (authalg & IW_AUTH_ALG_SHARED_KEY) {
751 if (authalg & IW_AUTH_ALG_OPEN_SYSTEM)
752 auth_mode = Ndis802_11AuthModeAutoSwitch;
753 else
754 auth_mode = Ndis802_11AuthModeShared;
755 } else
756 auth_mode = Ndis802_11AuthModeOpen;
757
758 tmp = cpu_to_le32(auth_mode);
759 ret = rndis_set_oid(usbdev, OID_802_11_AUTHENTICATION_MODE, &tmp,
760 sizeof(tmp));
761 if (ret != 0) {
762 devwarn(usbdev, "setting auth mode failed (%08X)", ret);
763 return ret;
764 }
765
766 priv->wpa_version = wpa_version;
767 priv->wpa_authalg = authalg;
768 return 0;
769}
770
771
772static int set_priv_filter(struct usbnet *usbdev)
773{
774 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
775 __le32 tmp;
776
777 devdbg(usbdev, "set_priv_filter: wpa_version=0x%x", priv->wpa_version);
778
779 if (priv->wpa_version & IW_AUTH_WPA_VERSION_WPA2 ||
780 priv->wpa_version & IW_AUTH_WPA_VERSION_WPA)
781 tmp = cpu_to_le32(Ndis802_11PrivFilter8021xWEP);
782 else
783 tmp = cpu_to_le32(Ndis802_11PrivFilterAcceptAll);
784
785 return rndis_set_oid(usbdev, OID_802_11_PRIVACY_FILTER, &tmp,
786 sizeof(tmp));
787}
788
789
790static int set_encr_mode(struct usbnet *usbdev, int pairwise, int groupwise)
791{
792 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
793 __le32 tmp;
794 int encr_mode, ret;
795
796 devdbg(usbdev, "set_encr_mode: cipher_pair=0x%x cipher_group=0x%x",
797 pairwise,
798 groupwise);
799
800 if (pairwise & IW_AUTH_CIPHER_CCMP)
801 encr_mode = Ndis802_11Encryption3Enabled;
802 else if (pairwise & IW_AUTH_CIPHER_TKIP)
803 encr_mode = Ndis802_11Encryption2Enabled;
804 else if (pairwise &
805 (IW_AUTH_CIPHER_WEP40 | IW_AUTH_CIPHER_WEP104))
806 encr_mode = Ndis802_11Encryption1Enabled;
807 else if (groupwise & IW_AUTH_CIPHER_CCMP)
808 encr_mode = Ndis802_11Encryption3Enabled;
809 else if (groupwise & IW_AUTH_CIPHER_TKIP)
810 encr_mode = Ndis802_11Encryption2Enabled;
811 else
812 encr_mode = Ndis802_11EncryptionDisabled;
813
814 tmp = cpu_to_le32(encr_mode);
815 ret = rndis_set_oid(usbdev, OID_802_11_ENCRYPTION_STATUS, &tmp,
816 sizeof(tmp));
817 if (ret != 0) {
818 devwarn(usbdev, "setting encr mode failed (%08X)", ret);
819 return ret;
820 }
821
822 priv->wpa_cipher_pair = pairwise;
823 priv->wpa_cipher_group = groupwise;
824 return 0;
825}
826
827
828static int set_assoc_params(struct usbnet *usbdev)
829{
830 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
831
832 set_auth_mode(usbdev, priv->wpa_version, priv->wpa_authalg);
833 set_priv_filter(usbdev);
834 set_encr_mode(usbdev, priv->wpa_cipher_pair, priv->wpa_cipher_group);
835
836 return 0;
837}
838
839
840static int set_infra_mode(struct usbnet *usbdev, int mode)
841{
842 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
843 __le32 tmp;
844 int ret, i;
845
846 devdbg(usbdev, "set_infra_mode: infra_mode=0x%x", priv->infra_mode);
847
848 tmp = cpu_to_le32(mode);
849 ret = rndis_set_oid(usbdev, OID_802_11_INFRASTRUCTURE_MODE, &tmp,
850 sizeof(tmp));
851 if (ret != 0) {
852 devwarn(usbdev, "setting infra mode failed (%08X)", ret);
853 return ret;
854 }
855
856 /* NDIS drivers clear keys when infrastructure mode is
857 * changed. But Linux tools assume otherwise. So set the
858 * keys */
859 if (priv->wpa_keymgmt == 0 ||
860 priv->wpa_keymgmt == IW_AUTH_KEY_MGMT_802_1X) {
861 for (i = 0; i < 4; i++) {
862 if (priv->encr_key_len[i] > 0)
863 add_wep_key(usbdev, priv->encr_keys[i],
864 priv->encr_key_len[i], i);
865 }
866 }
867
868 priv->infra_mode = mode;
869 return 0;
870}
871
872
873static void set_default_iw_params(struct usbnet *usbdev)
874{
875 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
876
877 priv->wpa_keymgmt = 0;
878 priv->wpa_version = 0;
879
880 set_infra_mode(usbdev, Ndis802_11Infrastructure);
881 set_auth_mode(usbdev, IW_AUTH_WPA_VERSION_DISABLED,
882 IW_AUTH_ALG_OPEN_SYSTEM);
883 set_priv_filter(usbdev);
884 set_encr_mode(usbdev, IW_AUTH_CIPHER_NONE, IW_AUTH_CIPHER_NONE);
885}
886
887
888static int deauthenticate(struct usbnet *usbdev)
889{
890 int ret;
891
892 ret = disassociate(usbdev, 1);
893 set_default_iw_params(usbdev);
894 return ret;
895}
896
897
898/* index must be 0 - N, as per NDIS */
899static int add_wep_key(struct usbnet *usbdev, char *key, int key_len, int index)
900{
901 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
902 struct NDIS_802_11_WEP ndis_key;
903 int ret;
904
905 if (key_len <= 0 || key_len > 32 || index < 0 || index >= 4)
906 return -EINVAL;
907
908 memset(&ndis_key, 0, sizeof(ndis_key));
909
910 ndis_key.Length = cpu_to_le32(sizeof(ndis_key));
911 ndis_key.KeyLength = cpu_to_le32(key_len);
912 ndis_key.KeyIndex = cpu_to_le32(index);
913 memcpy(&ndis_key.KeyMaterial, key, key_len);
914
915 if (index == priv->encr_tx_key_index) {
916 ndis_key.KeyIndex |= cpu_to_le32(1 << 31);
917 ret = set_encr_mode(usbdev, IW_AUTH_CIPHER_WEP104,
918 IW_AUTH_CIPHER_NONE);
919 if (ret)
920 devwarn(usbdev, "encryption couldn't be enabled (%08X)",
921 ret);
922 }
923
924 ret = rndis_set_oid(usbdev, OID_802_11_ADD_WEP, &ndis_key,
925 sizeof(ndis_key));
926 if (ret != 0) {
927 devwarn(usbdev, "adding encryption key %d failed (%08X)",
928 index+1, ret);
929 return ret;
930 }
931
932 priv->encr_key_len[index] = key_len;
933 memcpy(&priv->encr_keys[index], key, key_len);
934
935 return 0;
936}
937
938
939/* remove_key is for both wep and wpa */
940static int remove_key(struct usbnet *usbdev, int index, u8 bssid[ETH_ALEN])
941{
942 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
943 struct NDIS_802_11_REMOVE_KEY remove_key;
944 __le32 keyindex;
945 int ret;
946
947 if (priv->encr_key_len[index] == 0)
948 return 0;
949
950 priv->encr_key_len[index] = 0;
951 memset(&priv->encr_keys[index], 0, sizeof(priv->encr_keys[index]));
952
953 if (priv->wpa_cipher_pair == IW_AUTH_CIPHER_TKIP ||
954 priv->wpa_cipher_pair == IW_AUTH_CIPHER_CCMP ||
955 priv->wpa_cipher_group == IW_AUTH_CIPHER_TKIP ||
956 priv->wpa_cipher_group == IW_AUTH_CIPHER_CCMP) {
957 remove_key.Length = cpu_to_le32(sizeof(remove_key));
958 remove_key.KeyIndex = cpu_to_le32(index);
959 if (bssid) {
960 /* pairwise key */
961 if (memcmp(bssid, ffff_bssid, ETH_ALEN) != 0)
962 remove_key.KeyIndex |= cpu_to_le32(1 << 30);
963 memcpy(remove_key.Bssid, bssid,
964 sizeof(remove_key.Bssid));
965 } else
966 memset(remove_key.Bssid, 0xff,
967 sizeof(remove_key.Bssid));
968
969 ret = rndis_set_oid(usbdev, OID_802_11_REMOVE_KEY, &remove_key,
970 sizeof(remove_key));
971 if (ret != 0)
972 return ret;
973 } else {
974 keyindex = cpu_to_le32(index);
975 ret = rndis_set_oid(usbdev, OID_802_11_REMOVE_WEP, &keyindex,
976 sizeof(keyindex));
977 if (ret != 0) {
978 devwarn(usbdev,
979 "removing encryption key %d failed (%08X)",
980 index, ret);
981 return ret;
982 }
983 }
984
985 /* if it is transmit key, disable encryption */
986 if (index == priv->encr_tx_key_index)
987 set_encr_mode(usbdev, IW_AUTH_CIPHER_NONE, IW_AUTH_CIPHER_NONE);
988
989 return 0;
990}
991
992
993static void set_multicast_list(struct usbnet *usbdev)
994{
995 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
996 struct dev_mc_list *mclist;
997 __le32 filter;
998 int ret, i, size;
999 char *buf;
1000
1001 filter = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST;
1002
1003 if (usbdev->net->flags & IFF_PROMISC) {
1004 filter |= RNDIS_PACKET_TYPE_PROMISCUOUS |
1005 RNDIS_PACKET_TYPE_ALL_LOCAL;
1006 } else if (usbdev->net->flags & IFF_ALLMULTI ||
1007 usbdev->net->mc_count > priv->multicast_size) {
1008 filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST;
1009 } else if (usbdev->net->mc_count > 0) {
1010 size = min(priv->multicast_size, usbdev->net->mc_count);
1011 buf = kmalloc(size * ETH_ALEN, GFP_KERNEL);
1012 if (!buf) {
1013 devwarn(usbdev,
1014 "couldn't alloc %d bytes of memory",
1015 size * ETH_ALEN);
1016 return;
1017 }
1018
1019 mclist = usbdev->net->mc_list;
1020 for (i = 0; i < size && mclist; mclist = mclist->next) {
1021 if (mclist->dmi_addrlen != ETH_ALEN)
1022 continue;
1023
1024 memcpy(buf + i * ETH_ALEN, mclist->dmi_addr, ETH_ALEN);
1025 i++;
1026 }
1027
1028 ret = rndis_set_oid(usbdev, OID_802_3_MULTICAST_LIST, buf,
1029 i * ETH_ALEN);
1030 if (ret == 0 && i > 0)
1031 filter |= RNDIS_PACKET_TYPE_MULTICAST;
1032 else
1033 filter |= RNDIS_PACKET_TYPE_ALL_MULTICAST;
1034
1035 devdbg(usbdev, "OID_802_3_MULTICAST_LIST(%d, max: %d) -> %d",
1036 i, priv->multicast_size, ret);
1037
1038 kfree(buf);
1039 }
1040
1041 ret = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &filter,
1042 sizeof(filter));
1043 if (ret < 0) {
1044 devwarn(usbdev, "couldn't set packet filter: %08x",
1045 le32_to_cpu(filter));
1046 }
1047
1048 devdbg(usbdev, "OID_GEN_CURRENT_PACKET_FILTER(%08x) -> %d",
1049 le32_to_cpu(filter), ret);
1050}
1051
1052
1053/*
1054 * wireless extension handlers
1055 */
1056
1057static int rndis_iw_commit(struct net_device *dev,
1058 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1059{
1060 /* dummy op */
1061 return 0;
1062}
1063
1064
1065static int rndis_iw_get_range(struct net_device *dev,
1066 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1067{
1068 struct iw_range *range = (struct iw_range *)extra;
1069 struct usbnet *usbdev = dev->priv;
1070 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1071 int len, ret, i, j, num, has_80211g_rates;
1072 u8 rates[8];
1073 __le32 tx_power;
1074
1075 devdbg(usbdev, "SIOCGIWRANGE");
1076
1077 /* clear iw_range struct */
1078 memset(range, 0, sizeof(*range));
1079 wrqu->data.length = sizeof(*range);
1080
1081 range->txpower_capa = IW_TXPOW_MWATT;
1082 range->num_txpower = 1;
1083 if (priv->caps & CAP_SUPPORT_TXPOWER) {
1084 len = sizeof(tx_power);
1085 ret = rndis_query_oid(usbdev, OID_802_11_TX_POWER_LEVEL,
1086 &tx_power, &len);
1087 if (ret == 0 && le32_to_cpu(tx_power) != 0xFF)
1088 range->txpower[0] = le32_to_cpu(tx_power);
1089 else
1090 range->txpower[0] = get_bcm4320_power(priv);
1091 } else
1092 range->txpower[0] = get_bcm4320_power(priv);
1093
1094 len = sizeof(rates);
1095 ret = rndis_query_oid(usbdev, OID_802_11_SUPPORTED_RATES, &rates,
1096 &len);
1097 has_80211g_rates = 0;
1098 if (ret == 0) {
1099 j = 0;
1100 for (i = 0; i < len; i++) {
1101 if (rates[i] == 0)
1102 break;
1103 range->bitrate[j] = (rates[i] & 0x7f) * 500000;
1104 /* check for non 802.11b rates */
1105 if (range->bitrate[j] == 6000000 ||
1106 range->bitrate[j] == 9000000 ||
1107 (range->bitrate[j] >= 12000000 &&
1108 range->bitrate[j] != 22000000))
1109 has_80211g_rates = 1;
1110 j++;
1111 }
1112 range->num_bitrates = j;
1113 } else
1114 range->num_bitrates = 0;
1115
1116 /* fill in 802.11g rates */
1117 if (has_80211g_rates) {
1118 num = range->num_bitrates;
1119 for (i = 0; i < sizeof(rates_80211g); i++) {
1120 for (j = 0; j < num; j++) {
1121 if (range->bitrate[j] ==
1122 rates_80211g[i] * 1000000)
1123 break;
1124 }
1125 if (j == num)
1126 range->bitrate[range->num_bitrates++] =
1127 rates_80211g[i] * 1000000;
1128 if (range->num_bitrates == IW_MAX_BITRATES)
1129 break;
1130 }
1131
1132 /* estimated max real througput in bps */
1133 range->throughput = 54 * 1000 * 1000 / 2;
1134
1135 /* ~35% more with afterburner */
1136 if (priv->param_afterburner)
1137 range->throughput = range->throughput / 100 * 135;
1138 } else {
1139 /* estimated max real througput in bps */
1140 range->throughput = 11 * 1000 * 1000 / 2;
1141 }
1142
1143 range->num_channels = (sizeof(freq_chan)/sizeof(freq_chan[0]));
1144
1145 for (i = 0; i < (sizeof(freq_chan)/sizeof(freq_chan[0])) &&
1146 i < IW_MAX_FREQUENCIES; i++) {
1147 range->freq[i].i = i + 1;
1148 range->freq[i].m = freq_chan[i] * 100000;
1149 range->freq[i].e = 1;
1150 }
1151 range->num_frequency = i;
1152
1153 range->min_rts = 0;
1154 range->max_rts = 2347;
1155 range->min_frag = 256;
1156 range->max_frag = 2346;
1157
1158 range->max_qual.qual = 100;
1159 range->max_qual.level = 154;
1160 range->max_qual.updated = IW_QUAL_QUAL_UPDATED
1161 | IW_QUAL_LEVEL_UPDATED
1162 | IW_QUAL_NOISE_INVALID;
1163
1164 range->we_version_compiled = WIRELESS_EXT;
1165 range->we_version_source = WIRELESS_EXT;
1166
1167 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
1168 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
1169 return 0;
1170}
1171
1172
1173static int rndis_iw_get_name(struct net_device *dev,
1174 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1175{
1176 struct usbnet *usbdev = dev->priv;
1177 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1178
1179 strcpy(wrqu->name, priv->name);
1180 return 0;
1181}
1182
1183
1184static int rndis_iw_set_essid(struct net_device *dev,
1185 struct iw_request_info *info, union iwreq_data *wrqu, char *essid)
1186{
1187 struct NDIS_802_11_SSID ssid;
1188 int length = wrqu->essid.length;
1189 struct usbnet *usbdev = dev->priv;
1190
1191 devdbg(usbdev, "SIOCSIWESSID: [flags:%d,len:%d] '%.32s'",
1192 wrqu->essid.flags, wrqu->essid.length, essid);
1193
1194 if (length > NDIS_802_11_LENGTH_SSID)
1195 length = NDIS_802_11_LENGTH_SSID;
1196
1197 ssid.SsidLength = cpu_to_le32(length);
1198 if (length > 0)
1199 memcpy(ssid.Ssid, essid, length);
1200 else
1201 memset(ssid.Ssid, 0, NDIS_802_11_LENGTH_SSID);
1202
1203 set_assoc_params(usbdev);
1204
1205 if (!wrqu->essid.flags || length == 0)
1206 return disassociate(usbdev, 1);
1207 else
1208 return set_essid(usbdev, &ssid);
1209}
1210
1211
1212static int rndis_iw_get_essid(struct net_device *dev,
1213 struct iw_request_info *info, union iwreq_data *wrqu, char *essid)
1214{
1215 struct NDIS_802_11_SSID ssid;
1216 struct usbnet *usbdev = dev->priv;
1217 int ret;
1218
1219 ret = get_essid(usbdev, &ssid);
1220
1221 if (ret == 0 && le32_to_cpu(ssid.SsidLength) > 0) {
1222 wrqu->essid.flags = 1;
1223 wrqu->essid.length = le32_to_cpu(ssid.SsidLength);
1224 memcpy(essid, ssid.Ssid, wrqu->essid.length);
1225 essid[wrqu->essid.length] = 0;
1226 } else {
1227 memset(essid, 0, sizeof(NDIS_802_11_LENGTH_SSID));
1228 wrqu->essid.flags = 0;
1229 wrqu->essid.length = 0;
1230 }
1231 devdbg(usbdev, "SIOCGIWESSID: %s", essid);
1232 return ret;
1233}
1234
1235
1236static int rndis_iw_get_bssid(struct net_device *dev,
1237 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1238{
1239 struct usbnet *usbdev = dev->priv;
1240 unsigned char bssid[ETH_ALEN];
1241 int ret;
1242 DECLARE_MAC_BUF(mac);
1243
1244 ret = get_bssid(usbdev, bssid);
1245
1246 if (ret == 0)
1247 devdbg(usbdev, "SIOCGIWAP: %s", print_mac(mac, bssid));
1248 else
1249 devdbg(usbdev, "SIOCGIWAP: <not associated>");
1250
1251 wrqu->ap_addr.sa_family = ARPHRD_ETHER;
1252 memcpy(wrqu->ap_addr.sa_data, bssid, ETH_ALEN);
1253
1254 return ret;
1255}
1256
1257
1258static int rndis_iw_set_bssid(struct net_device *dev,
1259 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1260{
1261 struct usbnet *usbdev = dev->priv;
1262 u8 *bssid = (u8 *)wrqu->ap_addr.sa_data;
1263 DECLARE_MAC_BUF(mac);
1264 int ret;
1265
1266 devdbg(usbdev, "SIOCSIWAP: %s", print_mac(mac, bssid));
1267
1268 ret = rndis_set_oid(usbdev, OID_802_11_BSSID, bssid, ETH_ALEN);
1269
1270 /* user apps may set ap's mac address, which is not required;
1271 * they may fail to work if this function fails, so return
1272 * success */
1273 if (ret)
1274 devwarn(usbdev, "setting AP mac address failed (%08X)", ret);
1275
1276 return 0;
1277}
1278
1279
1280static int rndis_iw_set_auth(struct net_device *dev,
1281 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1282{
1283 struct iw_param *p = &wrqu->param;
1284 struct usbnet *usbdev = dev->priv;
1285 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1286 int ret = -ENOTSUPP;
1287
1288 switch (p->flags & IW_AUTH_INDEX) {
1289 case IW_AUTH_WPA_VERSION:
1290 devdbg(usbdev, "SIOCSIWAUTH: WPA_VERSION, %08x", p->value);
1291 priv->wpa_version = p->value;
1292 ret = 0;
1293 break;
1294
1295 case IW_AUTH_CIPHER_PAIRWISE:
1296 devdbg(usbdev, "SIOCSIWAUTH: CIPHER_PAIRWISE, %08x", p->value);
1297 priv->wpa_cipher_pair = p->value;
1298 ret = 0;
1299 break;
1300
1301 case IW_AUTH_CIPHER_GROUP:
1302 devdbg(usbdev, "SIOCSIWAUTH: CIPHER_GROUP, %08x", p->value);
1303 priv->wpa_cipher_group = p->value;
1304 ret = 0;
1305 break;
1306
1307 case IW_AUTH_KEY_MGMT:
1308 devdbg(usbdev, "SIOCSIWAUTH: KEY_MGMT, %08x", p->value);
1309 priv->wpa_keymgmt = p->value;
1310 ret = 0;
1311 break;
1312
1313 case IW_AUTH_TKIP_COUNTERMEASURES:
1314 devdbg(usbdev, "SIOCSIWAUTH: TKIP_COUNTERMEASURES, %08x",
1315 p->value);
1316 ret = 0;
1317 break;
1318
1319 case IW_AUTH_DROP_UNENCRYPTED:
1320 devdbg(usbdev, "SIOCSIWAUTH: DROP_UNENCRYPTED, %08x", p->value);
1321 ret = 0;
1322 break;
1323
1324 case IW_AUTH_80211_AUTH_ALG:
1325 devdbg(usbdev, "SIOCSIWAUTH: 80211_AUTH_ALG, %08x", p->value);
1326 priv->wpa_authalg = p->value;
1327 ret = 0;
1328 break;
1329
1330 case IW_AUTH_WPA_ENABLED:
1331 devdbg(usbdev, "SIOCSIWAUTH: WPA_ENABLED, %08x", p->value);
1332 if (wrqu->param.value)
1333 deauthenticate(usbdev);
1334 ret = 0;
1335 break;
1336
1337 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
1338 devdbg(usbdev, "SIOCSIWAUTH: RX_UNENCRYPTED_EAPOL, %08x",
1339 p->value);
1340 ret = 0;
1341 break;
1342
1343 case IW_AUTH_ROAMING_CONTROL:
1344 devdbg(usbdev, "SIOCSIWAUTH: ROAMING_CONTROL, %08x", p->value);
1345 ret = 0;
1346 break;
1347
1348 case IW_AUTH_PRIVACY_INVOKED:
1349 devdbg(usbdev, "SIOCSIWAUTH: invalid cmd %d",
1350 wrqu->param.flags & IW_AUTH_INDEX);
1351 return -EOPNOTSUPP;
1352
1353 default:
1354 devdbg(usbdev, "SIOCSIWAUTH: UNKNOWN %08x, %08x",
1355 p->flags & IW_AUTH_INDEX, p->value);
1356 }
1357 return ret;
1358}
1359
1360
1361static int rndis_iw_get_auth(struct net_device *dev,
1362 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1363{
1364 struct iw_param *p = &wrqu->param;
1365 struct usbnet *usbdev = dev->priv;
1366 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1367
1368 switch (p->flags & IW_AUTH_INDEX) {
1369 case IW_AUTH_WPA_VERSION:
1370 p->value = priv->wpa_version;
1371 break;
1372 case IW_AUTH_CIPHER_PAIRWISE:
1373 p->value = priv->wpa_cipher_pair;
1374 break;
1375 case IW_AUTH_CIPHER_GROUP:
1376 p->value = priv->wpa_cipher_group;
1377 break;
1378 case IW_AUTH_KEY_MGMT:
1379 p->value = priv->wpa_keymgmt;
1380 break;
1381 case IW_AUTH_80211_AUTH_ALG:
1382 p->value = priv->wpa_authalg;
1383 break;
1384 default:
1385 devdbg(usbdev, "SIOCGIWAUTH: invalid cmd %d",
1386 wrqu->param.flags & IW_AUTH_INDEX);
1387 return -EOPNOTSUPP;
1388 }
1389 return 0;
1390}
1391
1392
1393static int rndis_iw_get_mode(struct net_device *dev,
1394 struct iw_request_info *info,
1395 union iwreq_data *wrqu, char *extra)
1396{
1397 struct usbnet *usbdev = dev->priv;
1398 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1399
1400 switch (priv->infra_mode) {
1401 case Ndis802_11IBSS:
1402 wrqu->mode = IW_MODE_ADHOC;
1403 break;
1404 case Ndis802_11Infrastructure:
1405 wrqu->mode = IW_MODE_INFRA;
1406 break;
1407 /*case Ndis802_11AutoUnknown:*/
1408 default:
1409 wrqu->mode = IW_MODE_AUTO;
1410 break;
1411 }
1412 devdbg(usbdev, "SIOCGIWMODE: %08x", wrqu->mode);
1413 return 0;
1414}
1415
1416
1417static int rndis_iw_set_mode(struct net_device *dev,
1418 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1419{
1420 struct usbnet *usbdev = dev->priv;
1421 int mode;
1422
1423 devdbg(usbdev, "SIOCSIWMODE: %08x", wrqu->mode);
1424
1425 switch (wrqu->mode) {
1426 case IW_MODE_ADHOC:
1427 mode = Ndis802_11IBSS;
1428 break;
1429 case IW_MODE_INFRA:
1430 mode = Ndis802_11Infrastructure;
1431 break;
1432 /*case IW_MODE_AUTO:*/
1433 default:
1434 mode = Ndis802_11AutoUnknown;
1435 break;
1436 }
1437
1438 return set_infra_mode(usbdev, mode);
1439}
1440
1441
1442static int rndis_iw_set_encode(struct net_device *dev,
1443 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1444{
1445 struct usbnet *usbdev = dev->priv;
1446 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1447 int ret, index, key_len;
1448 u8 *key;
1449
1450 index = (wrqu->encoding.flags & IW_ENCODE_INDEX);
1451
1452 /* iwconfig gives index as 1 - N */
1453 if (index > 0)
1454 index--;
1455 else
1456 index = priv->encr_tx_key_index;
1457
1458 if (index < 0 || index >= 4) {
1459 devwarn(usbdev, "encryption index out of range (%u)", index);
1460 return -EINVAL;
1461 }
1462
1463 /* remove key if disabled */
1464 if (wrqu->data.flags & IW_ENCODE_DISABLED) {
1465 if (remove_key(usbdev, index, NULL))
1466 return -EINVAL;
1467 else
1468 return 0;
1469 }
1470
1471 /* global encryption state (for all keys) */
1472 if (wrqu->data.flags & IW_ENCODE_OPEN)
1473 ret = set_auth_mode(usbdev, IW_AUTH_WPA_VERSION_DISABLED,
1474 IW_AUTH_ALG_OPEN_SYSTEM);
1475 else /*if (wrqu->data.flags & IW_ENCODE_RESTRICTED)*/
1476 ret = set_auth_mode(usbdev, IW_AUTH_WPA_VERSION_DISABLED,
1477 IW_AUTH_ALG_SHARED_KEY);
1478 if (ret != 0)
1479 return ret;
1480
1481 if (wrqu->data.length > 0) {
1482 key_len = wrqu->data.length;
1483 key = extra;
1484 } else {
1485 /* must be set as tx key */
1486 if (priv->encr_key_len[index] == 0)
1487 return -EINVAL;
1488 key_len = priv->encr_key_len[index];
1489 key = priv->encr_keys[index];
1490 priv->encr_tx_key_index = index;
1491 }
1492
1493 if (add_wep_key(usbdev, key, key_len, index) != 0)
1494 return -EINVAL;
1495
1496 if (index == priv->encr_tx_key_index)
1497 /* ndis drivers want essid to be set after setting encr */
1498 set_essid(usbdev, &priv->essid);
1499
1500 return 0;
1501}
1502
1503
1504static int rndis_iw_set_encode_ext(struct net_device *dev,
1505 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1506{
1507 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1508 struct usbnet *usbdev = dev->priv;
1509 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1510 struct NDIS_802_11_KEY ndis_key;
1511 int i, keyidx, ret;
1512 u8 *addr;
1513
1514 keyidx = wrqu->encoding.flags & IW_ENCODE_INDEX;
1515
1516 /* iwconfig gives index as 1 - N */
1517 if (keyidx)
1518 keyidx--;
1519 else
1520 keyidx = priv->encr_tx_key_index;
1521
1522 if (keyidx < 0 || keyidx >= 4)
1523 return -EINVAL;
1524
1525 if (ext->alg == WPA_ALG_WEP) {
1526 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
1527 priv->encr_tx_key_index = keyidx;
1528 return add_wep_key(usbdev, ext->key, ext->key_len, keyidx);
1529 }
1530
1531 if ((wrqu->encoding.flags & IW_ENCODE_DISABLED) ||
1532 ext->alg == IW_ENCODE_ALG_NONE || ext->key_len == 0)
1533 return remove_key(usbdev, keyidx, NULL);
1534
1535 if (ext->key_len > sizeof(ndis_key.KeyMaterial))
1536 return -1;
1537
1538 memset(&ndis_key, 0, sizeof(ndis_key));
1539
1540 ndis_key.Length = cpu_to_le32(sizeof(ndis_key) -
1541 sizeof(ndis_key.KeyMaterial) + ext->key_len);
1542 ndis_key.KeyLength = cpu_to_le32(ext->key_len);
1543 ndis_key.KeyIndex = cpu_to_le32(keyidx);
1544
1545 if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
1546 for (i = 0; i < 6; i++)
1547 ndis_key.KeyRSC |=
1548 cpu_to_le64(ext->rx_seq[i] << (i * 8));
1549 ndis_key.KeyIndex |= cpu_to_le32(1 << 29);
1550 }
1551
1552 addr = ext->addr.sa_data;
1553 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
1554 /* group key */
1555 if (priv->infra_mode == Ndis802_11IBSS)
1556 memset(ndis_key.Bssid, 0xff, ETH_ALEN);
1557 else
1558 get_bssid(usbdev, ndis_key.Bssid);
1559 } else {
1560 /* pairwise key */
1561 ndis_key.KeyIndex |= cpu_to_le32(1 << 30);
1562 memcpy(ndis_key.Bssid, addr, ETH_ALEN);
1563 }
1564
1565 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
1566 ndis_key.KeyIndex |= cpu_to_le32(1 << 31);
1567
1568 if (ext->alg == IW_ENCODE_ALG_TKIP && ext->key_len == 32) {
1569 /* wpa_supplicant gives us the Michael MIC RX/TX keys in
1570 * different order than NDIS spec, so swap the order here. */
1571 memcpy(ndis_key.KeyMaterial, ext->key, 16);
1572 memcpy(ndis_key.KeyMaterial + 16, ext->key + 24, 8);
1573 memcpy(ndis_key.KeyMaterial + 24, ext->key + 16, 8);
1574 } else
1575 memcpy(ndis_key.KeyMaterial, ext->key, ext->key_len);
1576
1577 ret = rndis_set_oid(usbdev, OID_802_11_ADD_KEY, &ndis_key,
1578 le32_to_cpu(ndis_key.Length));
1579 devdbg(usbdev, "SIOCSIWENCODEEXT: OID_802_11_ADD_KEY -> %08X", ret);
1580 if (ret != 0)
1581 return ret;
1582
1583 priv->encr_key_len[keyidx] = ext->key_len;
1584 memcpy(&priv->encr_keys[keyidx], ndis_key.KeyMaterial, ext->key_len);
1585 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
1586 priv->encr_tx_key_index = keyidx;
1587
1588 return 0;
1589}
1590
1591
1592static int rndis_iw_set_scan(struct net_device *dev,
1593 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1594{
1595 struct iw_param *param = &wrqu->param;
1596 struct usbnet *usbdev = dev->priv;
1597 union iwreq_data evt;
1598 int ret = -EINVAL;
1599 __le32 tmp;
1600
1601 devdbg(usbdev, "SIOCSIWSCAN");
1602
1603 if (param->flags == 0) {
1604 tmp = ccpu2(1);
1605 ret = rndis_set_oid(usbdev, OID_802_11_BSSID_LIST_SCAN, &tmp,
1606 sizeof(tmp));
1607 evt.data.flags = 0;
1608 evt.data.length = 0;
1609 wireless_send_event(dev, SIOCGIWSCAN, &evt, NULL);
1610 }
1611 return ret;
1612}
1613
1614
1615static char *rndis_translate_scan(struct net_device *dev,
1616 char *cev, char *end_buf, struct NDIS_WLAN_BSSID_EX *bssid)
1617{
1618#ifdef DEBUG
1619 struct usbnet *usbdev = dev->priv;
1620#endif
1621 struct ieee80211_info_element *ie;
1622 char *current_val;
1623 int bssid_len, ie_len, i;
1624 u32 beacon, atim;
1625 struct iw_event iwe;
1626 unsigned char sbuf[32];
1627 DECLARE_MAC_BUF(mac);
1628
1629 bssid_len = le32_to_cpu(bssid->Length);
1630
1631 devdbg(usbdev, "BSSID %s", print_mac(mac, bssid->MacAddress));
1632 iwe.cmd = SIOCGIWAP;
1633 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
1634 memcpy(iwe.u.ap_addr.sa_data, bssid->MacAddress, ETH_ALEN);
1635 cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_ADDR_LEN);
1636
1637 devdbg(usbdev, "SSID(%d) %s",
1638 le32_to_cpu(bssid->Ssid.SsidLength),
1639 bssid->Ssid.Ssid);
1640 iwe.cmd = SIOCGIWESSID;
1641 iwe.u.essid.length = le32_to_cpu(bssid->Ssid.SsidLength);
1642 iwe.u.essid.flags = 1;
1643 cev = iwe_stream_add_point(cev, end_buf, &iwe,
1644 bssid->Ssid.Ssid);
1645
1646 devdbg(usbdev, "MODE %d",
1647 le32_to_cpu(bssid->InfrastructureMode));
1648 iwe.cmd = SIOCGIWMODE;
1649 switch (le32_to_cpu(bssid->InfrastructureMode)) {
1650 case Ndis802_11IBSS:
1651 iwe.u.mode = IW_MODE_ADHOC;
1652 break;
1653 case Ndis802_11Infrastructure:
1654 iwe.u.mode = IW_MODE_INFRA;
1655 break;
1656 /*case Ndis802_11AutoUnknown:*/
1657 default:
1658 iwe.u.mode = IW_MODE_AUTO;
1659 break;
1660 }
1661 cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_UINT_LEN);
1662
1663 devdbg(usbdev, "FREQ %d kHz",
1664 le32_to_cpu(bssid->Configuration.DSConfig));
1665 iwe.cmd = SIOCGIWFREQ;
1666 dsconfig_to_freq(le32_to_cpu(bssid->Configuration.DSConfig),
1667 &iwe.u.freq);
1668 cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_FREQ_LEN);
1669
1670 devdbg(usbdev, "QUAL %d", le32_to_cpu(bssid->Rssi));
1671 iwe.cmd = IWEVQUAL;
1672 iwe.u.qual.qual = level_to_qual(le32_to_cpu(bssid->Rssi));
1673 iwe.u.qual.level = le32_to_cpu(bssid->Rssi);
1674 iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED
1675 | IW_QUAL_LEVEL_UPDATED
1676 | IW_QUAL_NOISE_INVALID;
1677 cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_QUAL_LEN);
1678
1679 devdbg(usbdev, "ENCODE %d", le32_to_cpu(bssid->Privacy));
1680 iwe.cmd = SIOCGIWENCODE;
1681 iwe.u.data.length = 0;
1682 if (le32_to_cpu(bssid->Privacy) == Ndis802_11PrivFilterAcceptAll)
1683 iwe.u.data.flags = IW_ENCODE_DISABLED;
1684 else
1685 iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
1686
1687 cev = iwe_stream_add_point(cev, end_buf, &iwe, NULL);
1688
1689 devdbg(usbdev, "RATES:");
1690 current_val = cev + IW_EV_LCP_LEN;
1691 iwe.cmd = SIOCGIWRATE;
1692 for (i = 0; i < sizeof(bssid->SupportedRates); i++) {
1693 if (bssid->SupportedRates[i] & 0x7f) {
1694 iwe.u.bitrate.value =
1695 ((bssid->SupportedRates[i] & 0x7f) *
1696 500000);
1697 devdbg(usbdev, " %d", iwe.u.bitrate.value);
1698 current_val = iwe_stream_add_value(cev,
1699 current_val, end_buf, &iwe,
1700 IW_EV_PARAM_LEN);
1701 }
1702 }
1703
1704 if ((current_val - cev) > IW_EV_LCP_LEN)
1705 cev = current_val;
1706
1707 beacon = le32_to_cpu(bssid->Configuration.BeaconPeriod);
1708 devdbg(usbdev, "BCN_INT %d", beacon);
1709 iwe.cmd = IWEVCUSTOM;
1710 snprintf(sbuf, sizeof(sbuf), "bcn_int=%d", beacon);
1711 iwe.u.data.length = strlen(sbuf);
1712 cev = iwe_stream_add_point(cev, end_buf, &iwe, sbuf);
1713
1714 atim = le32_to_cpu(bssid->Configuration.ATIMWindow);
1715 devdbg(usbdev, "ATIM %d", atim);
1716 iwe.cmd = IWEVCUSTOM;
1717 snprintf(sbuf, sizeof(sbuf), "atim=%u", atim);
1718 iwe.u.data.length = strlen(sbuf);
1719 cev = iwe_stream_add_point(cev, end_buf, &iwe, sbuf);
1720
1721 ie = (void *)(bssid->IEs + sizeof(struct NDIS_802_11_FIXED_IEs));
1722 ie_len = min(bssid_len - (int)sizeof(*bssid),
1723 (int)le32_to_cpu(bssid->IELength));
1724 ie_len -= sizeof(struct NDIS_802_11_FIXED_IEs);
1725 while (ie_len >= sizeof(*ie) && sizeof(*ie) + ie->len <= ie_len) {
1726 if ((ie->id == MFIE_TYPE_GENERIC && ie->len >= 4 &&
1727 memcmp(ie->data, "\x00\x50\xf2\x01", 4) == 0) ||
1728 ie->id == MFIE_TYPE_RSN) {
1729 devdbg(usbdev, "IE: WPA%d",
1730 (ie->id == MFIE_TYPE_RSN) ? 2 : 1);
1731 iwe.cmd = IWEVGENIE;
1732 iwe.u.data.length = min(ie->len + 2, MAX_WPA_IE_LEN);
1733 cev = iwe_stream_add_point(cev, end_buf, &iwe,
1734 (u8 *)ie);
1735 }
1736
1737 ie_len -= sizeof(*ie) + ie->len;
1738 ie = (struct ieee80211_info_element *)&ie->data[ie->len];
1739 }
1740
1741 return cev;
1742}
1743
1744
1745static int rndis_iw_get_scan(struct net_device *dev,
1746 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1747{
1748 struct usbnet *usbdev = dev->priv;
1749 void *buf = NULL;
1750 char *cev = extra;
1751 struct NDIS_802_11_BSSID_LIST_EX *bssid_list;
1752 struct NDIS_WLAN_BSSID_EX *bssid;
1753 int ret = -EINVAL, len, count, bssid_len;
1754
1755 devdbg(usbdev, "SIOCGIWSCAN");
1756
1757 len = CONTROL_BUFFER_SIZE;
1758 buf = kmalloc(len, GFP_KERNEL);
1759 if (!buf) {
1760 ret = -ENOMEM;
1761 goto out;
1762 }
1763
1764 ret = rndis_query_oid(usbdev, OID_802_11_BSSID_LIST, buf, &len);
1765
1766 if (ret != 0)
1767 goto out;
1768
1769 bssid_list = buf;
1770 bssid = bssid_list->Bssid;
1771 bssid_len = le32_to_cpu(bssid->Length);
1772 count = le32_to_cpu(bssid_list->NumberOfItems);
1773 devdbg(usbdev, "SIOCGIWSCAN: %d BSSIDs found", count);
1774
1775 while (count && ((void *)bssid + bssid_len) <= (buf + len)) {
1776 cev = rndis_translate_scan(dev, cev, extra + IW_SCAN_MAX_DATA,
1777 bssid);
1778 bssid = (void *)bssid + bssid_len;
1779 bssid_len = le32_to_cpu(bssid->Length);
1780 count--;
1781 }
1782
1783out:
1784 wrqu->data.length = cev - extra;
1785 wrqu->data.flags = 0;
1786 kfree(buf);
1787 return ret;
1788}
1789
1790
1791static int rndis_iw_set_genie(struct net_device *dev,
1792 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1793{
1794 struct usbnet *usbdev = dev->priv;
1795 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1796 int ret = 0;
1797
1798#ifdef DEBUG
1799 int j;
1800 u8 *gie = extra;
1801 for (j = 0; j < wrqu->data.length; j += 8)
1802 devdbg(usbdev,
1803 "SIOCSIWGENIE %04x - "
1804 "%02x %02x %02x %02x %02x %02x %02x %02x", j,
1805 gie[j + 0], gie[j + 1], gie[j + 2], gie[j + 3],
1806 gie[j + 4], gie[j + 5], gie[j + 6], gie[j + 7]);
1807#endif
1808 /* clear existing IEs */
1809 if (priv->wpa_ie_len) {
1810 kfree(priv->wpa_ie);
1811 priv->wpa_ie_len = 0;
1812 }
1813
1814 /* set new IEs */
1815 priv->wpa_ie = kmalloc(wrqu->data.length, GFP_KERNEL);
1816 if (priv->wpa_ie) {
1817 priv->wpa_ie_len = wrqu->data.length;
1818 memcpy(priv->wpa_ie, extra, priv->wpa_ie_len);
1819 } else
1820 ret = -ENOMEM;
1821 return ret;
1822}
1823
1824
1825static int rndis_iw_get_genie(struct net_device *dev,
1826 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1827{
1828 struct usbnet *usbdev = dev->priv;
1829 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1830
1831 devdbg(usbdev, "SIOCGIWGENIE");
1832
1833 if (priv->wpa_ie_len == 0 || priv->wpa_ie == NULL) {
1834 wrqu->data.length = 0;
1835 return 0;
1836 }
1837
1838 if (wrqu->data.length < priv->wpa_ie_len)
1839 return -E2BIG;
1840
1841 wrqu->data.length = priv->wpa_ie_len;
1842 memcpy(extra, priv->wpa_ie, priv->wpa_ie_len);
1843
1844 return 0;
1845}
1846
1847
1848static int rndis_iw_set_rts(struct net_device *dev,
1849 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1850{
1851 struct usbnet *usbdev = dev->priv;
1852 __le32 tmp;
1853 devdbg(usbdev, "SIOCSIWRTS");
1854
1855 tmp = cpu_to_le32(wrqu->rts.value);
1856 return rndis_set_oid(usbdev, OID_802_11_RTS_THRESHOLD, &tmp,
1857 sizeof(tmp));
1858}
1859
1860
1861static int rndis_iw_get_rts(struct net_device *dev,
1862 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1863{
1864 struct usbnet *usbdev = dev->priv;
1865 __le32 tmp;
1866 int len, ret;
1867
1868 len = sizeof(tmp);
1869 ret = rndis_query_oid(usbdev, OID_802_11_RTS_THRESHOLD, &tmp, &len);
1870 if (ret == 0) {
1871 wrqu->rts.value = le32_to_cpu(tmp);
1872 wrqu->rts.flags = 1;
1873 wrqu->rts.disabled = 0;
1874 }
1875
1876 devdbg(usbdev, "SIOCGIWRTS: %d", wrqu->rts.value);
1877
1878 return ret;
1879}
1880
1881
1882static int rndis_iw_set_frag(struct net_device *dev,
1883 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1884{
1885 struct usbnet *usbdev = dev->priv;
1886 __le32 tmp;
1887
1888 devdbg(usbdev, "SIOCSIWFRAG");
1889
1890 tmp = cpu_to_le32(wrqu->frag.value);
1891 return rndis_set_oid(usbdev, OID_802_11_FRAGMENTATION_THRESHOLD, &tmp,
1892 sizeof(tmp));
1893}
1894
1895
1896static int rndis_iw_get_frag(struct net_device *dev,
1897 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1898{
1899 struct usbnet *usbdev = dev->priv;
1900 __le32 tmp;
1901 int len, ret;
1902
1903 len = sizeof(tmp);
1904 ret = rndis_query_oid(usbdev, OID_802_11_FRAGMENTATION_THRESHOLD, &tmp,
1905 &len);
1906 if (ret == 0) {
1907 wrqu->frag.value = le32_to_cpu(tmp);
1908 wrqu->frag.flags = 1;
1909 wrqu->frag.disabled = 0;
1910 }
1911 devdbg(usbdev, "SIOCGIWFRAG: %d", wrqu->frag.value);
1912 return ret;
1913}
1914
1915
1916static int rndis_iw_set_nick(struct net_device *dev,
1917 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1918{
1919 struct usbnet *usbdev = dev->priv;
1920 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1921
1922 devdbg(usbdev, "SIOCSIWNICK");
1923
1924 priv->nick_len = wrqu->data.length;
1925 if (priv->nick_len > 32)
1926 priv->nick_len = 32;
1927
1928 memcpy(priv->nick, extra, priv->nick_len);
1929 return 0;
1930}
1931
1932
1933static int rndis_iw_get_nick(struct net_device *dev,
1934 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1935{
1936 struct usbnet *usbdev = dev->priv;
1937 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
1938
1939 wrqu->data.flags = 1;
1940 wrqu->data.length = priv->nick_len;
1941 memcpy(extra, priv->nick, priv->nick_len);
1942
1943 devdbg(usbdev, "SIOCGIWNICK: '%s'", priv->nick);
1944
1945 return 0;
1946}
1947
1948
1949static int rndis_iw_set_freq(struct net_device *dev,
1950 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1951{
1952 struct usbnet *usbdev = dev->priv;
1953 struct NDIS_802_11_CONFIGURATION config;
1954 unsigned int dsconfig;
1955 int len, ret;
1956
1957 /* this OID is valid only when not associated */
1958 if (is_associated(usbdev))
1959 return 0;
1960
1961 dsconfig = 0;
1962 if (freq_to_dsconfig(&wrqu->freq, &dsconfig))
1963 return -EINVAL;
1964
1965 len = sizeof(config);
1966 ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len);
1967 if (ret != 0) {
1968 devdbg(usbdev, "SIOCSIWFREQ: querying configuration failed");
1969 return 0;
1970 }
1971
1972 config.DSConfig = cpu_to_le32(dsconfig);
1973
1974 devdbg(usbdev, "SIOCSIWFREQ: %d * 10^%d", wrqu->freq.m, wrqu->freq.e);
1975 return rndis_set_oid(usbdev, OID_802_11_CONFIGURATION, &config,
1976 sizeof(config));
1977}
1978
1979
1980static int rndis_iw_get_freq(struct net_device *dev,
1981 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1982{
1983 struct usbnet *usbdev = dev->priv;
1984 struct NDIS_802_11_CONFIGURATION config;
1985 int len, ret;
1986
1987 len = sizeof(config);
1988 ret = rndis_query_oid(usbdev, OID_802_11_CONFIGURATION, &config, &len);
1989 if (ret == 0)
1990 dsconfig_to_freq(le32_to_cpu(config.DSConfig), &wrqu->freq);
1991
1992 devdbg(usbdev, "SIOCGIWFREQ: %d", wrqu->freq.m);
1993 return ret;
1994}
1995
1996
1997static int rndis_iw_get_txpower(struct net_device *dev,
1998 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
1999{
2000 struct usbnet *usbdev = dev->priv;
2001 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
2002 __le32 tx_power;
2003 int ret = 0, len;
2004
2005 if (priv->radio_on) {
2006 if (priv->caps & CAP_SUPPORT_TXPOWER) {
2007 len = sizeof(tx_power);
2008 ret = rndis_query_oid(usbdev, OID_802_11_TX_POWER_LEVEL,
2009 &tx_power, &len);
2010 if (ret != 0)
2011 return ret;
2012 } else
2013 /* fake incase not supported */
2014 tx_power = cpu_to_le32(get_bcm4320_power(priv));
2015
2016 wrqu->txpower.flags = IW_TXPOW_MWATT;
2017 wrqu->txpower.value = le32_to_cpu(tx_power);
2018 wrqu->txpower.disabled = 0;
2019 } else {
2020 wrqu->txpower.flags = IW_TXPOW_MWATT;
2021 wrqu->txpower.value = 0;
2022 wrqu->txpower.disabled = 1;
2023 }
2024
2025 devdbg(usbdev, "SIOCGIWTXPOW: %d", wrqu->txpower.value);
2026
2027 return ret;
2028}
2029
2030
2031static int rndis_iw_set_txpower(struct net_device *dev,
2032 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
2033{
2034 struct usbnet *usbdev = dev->priv;
2035 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
2036 __le32 tx_power = 0;
2037 int ret = 0;
2038
2039 if (!wrqu->txpower.disabled) {
2040 if (wrqu->txpower.flags == IW_TXPOW_MWATT)
2041 tx_power = cpu_to_le32(wrqu->txpower.value);
2042 else { /* wrqu->txpower.flags == IW_TXPOW_DBM */
2043 if (wrqu->txpower.value > 20)
2044 tx_power = cpu_to_le32(128);
2045 else if (wrqu->txpower.value < -43)
2046 tx_power = cpu_to_le32(127);
2047 else {
2048 signed char tmp;
2049 tmp = wrqu->txpower.value;
2050 tmp = -12 - tmp;
2051 tmp <<= 2;
2052 tx_power = cpu_to_le32((unsigned char)tmp);
2053 }
2054 }
2055 }
2056
2057 devdbg(usbdev, "SIOCSIWTXPOW: %d", le32_to_cpu(tx_power));
2058
2059 if (le32_to_cpu(tx_power) != 0) {
2060 if (priv->caps & CAP_SUPPORT_TXPOWER) {
2061 /* turn radio on first */
2062 if (!priv->radio_on)
2063 disassociate(usbdev, 1);
2064
2065 ret = rndis_set_oid(usbdev, OID_802_11_TX_POWER_LEVEL,
2066 &tx_power, sizeof(tx_power));
2067 if (ret != 0)
2068 ret = -EOPNOTSUPP;
2069 return ret;
2070 } else {
2071 /* txpower unsupported, just turn radio on */
2072 if (!priv->radio_on)
2073 return disassociate(usbdev, 1);
2074 return 0; /* all ready on */
2075 }
2076 }
2077
2078 /* tx_power == 0, turn off radio */
2079 return disassociate(usbdev, 0);
2080}
2081
2082
2083static int rndis_iw_get_rate(struct net_device *dev,
2084 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
2085{
2086 struct usbnet *usbdev = dev->priv;
2087 __le32 tmp;
2088 int ret, len;
2089
2090 len = sizeof(tmp);
2091 ret = rndis_query_oid(usbdev, OID_GEN_LINK_SPEED, &tmp, &len);
2092 if (ret == 0) {
2093 wrqu->bitrate.value = le32_to_cpu(tmp) * 100;
2094 wrqu->bitrate.disabled = 0;
2095 wrqu->bitrate.flags = 1;
2096 }
2097 return ret;
2098}
2099
2100
2101static int rndis_iw_set_mlme(struct net_device *dev,
2102 struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
2103{
2104 struct usbnet *usbdev = dev->priv;
2105 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
2106 struct iw_mlme *mlme = (struct iw_mlme *)extra;
2107 unsigned char bssid[ETH_ALEN];
2108
2109 get_bssid(usbdev, bssid);
2110
2111 if (memcmp(bssid, mlme->addr.sa_data, ETH_ALEN))
2112 return -EINVAL;
2113
2114 switch (mlme->cmd) {
2115 case IW_MLME_DEAUTH:
2116 return deauthenticate(usbdev);
2117 case IW_MLME_DISASSOC:
2118 return disassociate(usbdev, priv->radio_on);
2119 default:
2120 return -EOPNOTSUPP;
2121 }
2122
2123 return 0;
2124}
2125
2126
2127static struct iw_statistics *rndis_get_wireless_stats(struct net_device *dev)
2128{
2129 struct usbnet *usbdev = dev->priv;
2130 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
2131 unsigned long flags;
2132
2133 spin_lock_irqsave(&priv->stats_lock, flags);
2134 memcpy(&priv->iwstats, &priv->privstats, sizeof(priv->iwstats));
2135 spin_unlock_irqrestore(&priv->stats_lock, flags);
2136
2137 return &priv->iwstats;
2138}
2139
2140
2141#define IW_IOCTL(x) [(x) - SIOCSIWCOMMIT]
2142static const iw_handler rndis_iw_handler[] =
2143{
2144 IW_IOCTL(SIOCSIWCOMMIT) = rndis_iw_commit,
2145 IW_IOCTL(SIOCGIWNAME) = rndis_iw_get_name,
2146 IW_IOCTL(SIOCSIWFREQ) = rndis_iw_set_freq,
2147 IW_IOCTL(SIOCGIWFREQ) = rndis_iw_get_freq,
2148 IW_IOCTL(SIOCSIWMODE) = rndis_iw_set_mode,
2149 IW_IOCTL(SIOCGIWMODE) = rndis_iw_get_mode,
2150 IW_IOCTL(SIOCGIWRANGE) = rndis_iw_get_range,
2151 IW_IOCTL(SIOCSIWAP) = rndis_iw_set_bssid,
2152 IW_IOCTL(SIOCGIWAP) = rndis_iw_get_bssid,
2153 IW_IOCTL(SIOCSIWSCAN) = rndis_iw_set_scan,
2154 IW_IOCTL(SIOCGIWSCAN) = rndis_iw_get_scan,
2155 IW_IOCTL(SIOCSIWESSID) = rndis_iw_set_essid,
2156 IW_IOCTL(SIOCGIWESSID) = rndis_iw_get_essid,
2157 IW_IOCTL(SIOCSIWNICKN) = rndis_iw_set_nick,
2158 IW_IOCTL(SIOCGIWNICKN) = rndis_iw_get_nick,
2159 IW_IOCTL(SIOCGIWRATE) = rndis_iw_get_rate,
2160 IW_IOCTL(SIOCSIWRTS) = rndis_iw_set_rts,
2161 IW_IOCTL(SIOCGIWRTS) = rndis_iw_get_rts,
2162 IW_IOCTL(SIOCSIWFRAG) = rndis_iw_set_frag,
2163 IW_IOCTL(SIOCGIWFRAG) = rndis_iw_get_frag,
2164 IW_IOCTL(SIOCSIWTXPOW) = rndis_iw_set_txpower,
2165 IW_IOCTL(SIOCGIWTXPOW) = rndis_iw_get_txpower,
2166 IW_IOCTL(SIOCSIWENCODE) = rndis_iw_set_encode,
2167 IW_IOCTL(SIOCSIWENCODEEXT) = rndis_iw_set_encode_ext,
2168 IW_IOCTL(SIOCSIWAUTH) = rndis_iw_set_auth,
2169 IW_IOCTL(SIOCGIWAUTH) = rndis_iw_get_auth,
2170 IW_IOCTL(SIOCSIWGENIE) = rndis_iw_set_genie,
2171 IW_IOCTL(SIOCGIWGENIE) = rndis_iw_get_genie,
2172 IW_IOCTL(SIOCSIWMLME) = rndis_iw_set_mlme,
2173};
2174
2175static const iw_handler rndis_wext_private_handler[] = {
2176};
2177
2178static const struct iw_priv_args rndis_wext_private_args[] = {
2179};
2180
2181
2182static const struct iw_handler_def rndis_iw_handlers = {
2183 .num_standard = ARRAY_SIZE(rndis_iw_handler),
2184 .num_private = ARRAY_SIZE(rndis_wext_private_handler),
2185 .num_private_args = ARRAY_SIZE(rndis_wext_private_args),
2186 .standard = (iw_handler *)rndis_iw_handler,
2187 .private = (iw_handler *)rndis_wext_private_handler,
2188 .private_args = (struct iw_priv_args *)rndis_wext_private_args,
2189 .get_wireless_stats = rndis_get_wireless_stats,
2190};
2191
2192
2193static void rndis_wext_worker(struct work_struct *work)
2194{
2195 struct rndis_wext_private *priv =
2196 container_of(work, struct rndis_wext_private, work);
2197 struct usbnet *usbdev = priv->usbdev;
2198 union iwreq_data evt;
2199 unsigned char bssid[ETH_ALEN];
2200 int ret;
2201
2202 if (test_and_clear_bit(WORK_CONNECTION_EVENT, &priv->work_pending)) {
2203 ret = get_bssid(usbdev, bssid);
2204
2205 if (!ret) {
2206 evt.data.flags = 0;
2207 evt.data.length = 0;
2208 memcpy(evt.ap_addr.sa_data, bssid, ETH_ALEN);
2209 wireless_send_event(usbdev->net, SIOCGIWAP, &evt, NULL);
2210 }
2211 }
2212
2213 if (test_and_clear_bit(WORK_SET_MULTICAST_LIST, &priv->work_pending))
2214 set_multicast_list(usbdev);
2215}
2216
2217static void rndis_wext_set_multicast_list(struct net_device *dev)
2218{
2219 struct usbnet *usbdev = dev->priv;
2220 struct rndis_wext_private *priv = get_rndis_wext_priv(usbdev);
2221
2222 set_bit(WORK_SET_MULTICAST_LIST, &priv->work_pending);
2223 queue_work(priv->workqueue, &priv->work);
2224}
2225
2226static void rndis_wext_link_change(struct usbnet *dev, int state)
2227{
2228 struct rndis_wext_private *priv = get_rndis_wext_priv(dev);
2229 union iwreq_data evt;
2230
2231 if (state) {
2232 /* queue work to avoid recursive calls into rndis_command */
2233 set_bit(WORK_CONNECTION_EVENT, &priv->work_pending);
2234 queue_work(priv->workqueue, &priv->work);
2235 } else {
2236 evt.data.flags = 0;
2237 evt.data.length = 0;
2238 memset(evt.ap_addr.sa_data, 0, ETH_ALEN);
2239 wireless_send_event(dev->net, SIOCGIWAP, &evt, NULL);
2240 }
2241}
2242
2243
2244static int rndis_wext_get_caps(struct usbnet *dev)
2245{
2246 struct {
2247 __le32 num_items;
2248 __le32 items[8];
2249 } networks_supported;
2250 int len, retval, i, n;
2251 __le32 tx_power;
2252 struct rndis_wext_private *priv = get_rndis_wext_priv(dev);
2253
2254 /* determine if supports setting txpower */
2255 len = sizeof(tx_power);
2256 retval = rndis_query_oid(dev, OID_802_11_TX_POWER_LEVEL, &tx_power,
2257 &len);
2258 if (retval == 0 && le32_to_cpu(tx_power) != 0xFF)
2259 priv->caps |= CAP_SUPPORT_TXPOWER;
2260
2261 /* determine supported modes */
2262 len = sizeof(networks_supported);
2263 retval = rndis_query_oid(dev, OID_802_11_NETWORK_TYPES_SUPPORTED,
2264 &networks_supported, &len);
2265 if (retval >= 0) {
2266 n = le32_to_cpu(networks_supported.num_items);
2267 if (n > 8)
2268 n = 8;
2269 for (i = 0; i < n; i++) {
2270 switch (le32_to_cpu(networks_supported.items[i])) {
2271 case Ndis802_11FH:
2272 case Ndis802_11DS:
2273 priv->caps |= CAP_MODE_80211B;
2274 break;
2275 case Ndis802_11OFDM5:
2276 priv->caps |= CAP_MODE_80211A;
2277 break;
2278 case Ndis802_11OFDM24:
2279 priv->caps |= CAP_MODE_80211G;
2280 break;
2281 }
2282 }
2283 if (priv->caps & CAP_MODE_80211A)
2284 strcat(priv->name, "a");
2285 if (priv->caps & CAP_MODE_80211B)
2286 strcat(priv->name, "b");
2287 if (priv->caps & CAP_MODE_80211G)
2288 strcat(priv->name, "g");
2289 }
2290
2291 return retval;
2292}
2293
2294
2295#define STATS_UPDATE_JIFFIES (HZ)
2296static void rndis_update_wireless_stats(struct work_struct *work)
2297{
2298 struct rndis_wext_private *priv =
2299 container_of(work, struct rndis_wext_private, stats_work.work);
2300 struct usbnet *usbdev = priv->usbdev;
2301 struct iw_statistics iwstats;
2302 __le32 rssi, tmp;
2303 int len, ret, bitrate, j;
2304 unsigned long flags;
2305 int update_jiffies = STATS_UPDATE_JIFFIES;
2306 void *buf;
2307
2308 spin_lock_irqsave(&priv->stats_lock, flags);
2309 memcpy(&iwstats, &priv->privstats, sizeof(iwstats));
2310 spin_unlock_irqrestore(&priv->stats_lock, flags);
2311
2312 /* only update stats when connected */
2313 if (!is_associated(usbdev)) {
2314 iwstats.qual.qual = 0;
2315 iwstats.qual.level = 0;
2316 iwstats.qual.updated = IW_QUAL_QUAL_UPDATED
2317 | IW_QUAL_LEVEL_UPDATED
2318 | IW_QUAL_NOISE_INVALID
2319 | IW_QUAL_QUAL_INVALID
2320 | IW_QUAL_LEVEL_INVALID;
2321 goto end;
2322 }
2323
2324 len = sizeof(rssi);
2325 ret = rndis_query_oid(usbdev, OID_802_11_RSSI, &rssi, &len);
2326
2327 devdbg(usbdev, "stats: OID_802_11_RSSI -> %d, rssi:%d", ret,
2328 le32_to_cpu(rssi));
2329 if (ret == 0) {
2330 memset(&iwstats.qual, 0, sizeof(iwstats.qual));
2331 iwstats.qual.qual = level_to_qual(le32_to_cpu(rssi));
2332 iwstats.qual.level = le32_to_cpu(rssi);
2333 iwstats.qual.updated = IW_QUAL_QUAL_UPDATED
2334 | IW_QUAL_LEVEL_UPDATED
2335 | IW_QUAL_NOISE_INVALID;
2336 }
2337
2338 memset(&iwstats.discard, 0, sizeof(iwstats.discard));
2339
2340 len = sizeof(tmp);
2341 ret = rndis_query_oid(usbdev, OID_GEN_XMIT_ERROR, &tmp, &len);
2342 if (ret == 0)
2343 iwstats.discard.misc += le32_to_cpu(tmp);
2344
2345 len = sizeof(tmp);
2346 ret = rndis_query_oid(usbdev, OID_GEN_RCV_ERROR, &tmp, &len);
2347 if (ret == 0)
2348 iwstats.discard.misc += le32_to_cpu(tmp);
2349
2350 len = sizeof(tmp);
2351 ret = rndis_query_oid(usbdev, OID_GEN_RCV_NO_BUFFER, &tmp, &len);
2352 if (ret == 0)
2353 iwstats.discard.misc += le32_to_cpu(tmp);
2354
2355 /* Workaround transfer stalls on poor quality links. */
2356 len = sizeof(tmp);
2357 ret = rndis_query_oid(usbdev, OID_GEN_LINK_SPEED, &tmp, &len);
2358 if (ret == 0) {
2359 bitrate = le32_to_cpu(tmp) * 100;
2360 if (bitrate > 11000000)
2361 goto end;
2362
2363 /* Decrease stats worker interval to catch stalls.
2364 * faster. Faster than 400-500ms causes packet loss,
2365 * Slower doesn't catch stalls fast enough.
2366 */
2367 j = msecs_to_jiffies(priv->param_workaround_interval);
2368 if (j > STATS_UPDATE_JIFFIES)
2369 j = STATS_UPDATE_JIFFIES;
2370 else if (j <= 0)
2371 j = 1;
2372 update_jiffies = j;
2373
2374 /* Send scan OID. Use of both OIDs is required to get device
2375 * working.
2376 */
2377 tmp = ccpu2(1);
2378 rndis_set_oid(usbdev, OID_802_11_BSSID_LIST_SCAN, &tmp,
2379 sizeof(tmp));
2380
2381 len = CONTROL_BUFFER_SIZE;
2382 buf = kmalloc(len, GFP_KERNEL);
2383 if (!buf)
2384 goto end;
2385
2386 rndis_query_oid(usbdev, OID_802_11_BSSID_LIST, buf, &len);
2387 kfree(buf);
2388 }
2389end:
2390 spin_lock_irqsave(&priv->stats_lock, flags);
2391 memcpy(&priv->privstats, &iwstats, sizeof(iwstats));
2392 spin_unlock_irqrestore(&priv->stats_lock, flags);
2393
2394 if (update_jiffies >= HZ)
2395 update_jiffies = round_jiffies_relative(update_jiffies);
2396 else {
2397 j = round_jiffies_relative(update_jiffies);
2398 if (abs(j - update_jiffies) <= 10)
2399 update_jiffies = j;
2400 }
2401
2402 queue_delayed_work(priv->workqueue, &priv->stats_work, update_jiffies);
2403}
2404
2405
2406static int bcm4320_early_init(struct usbnet *dev)
2407{
2408 struct rndis_wext_private *priv = get_rndis_wext_priv(dev);
2409 char buf[8];
2410
2411 /* Early initialization settings, setting these won't have effect
2412 * if called after generic_rndis_bind().
2413 */
2414
2415 priv->param_country[0] = modparam_country[0];
2416 priv->param_country[1] = modparam_country[1];
2417 priv->param_country[2] = 0;
2418 priv->param_frameburst = modparam_frameburst;
2419 priv->param_afterburner = modparam_afterburner;
2420 priv->param_power_save = modparam_power_save;
2421 priv->param_power_output = modparam_power_output;
2422 priv->param_roamtrigger = modparam_roamtrigger;
2423 priv->param_roamdelta = modparam_roamdelta;
2424 priv->param_workaround_interval = modparam_workaround_interval;
2425
2426 priv->param_country[0] = toupper(priv->param_country[0]);
2427 priv->param_country[1] = toupper(priv->param_country[1]);
2428 /* doesn't support EU as country code, use FI instead */
2429 if (!strcmp(priv->param_country, "EU"))
2430 strcpy(priv->param_country, "FI");
2431
2432 if (priv->param_power_save < 0)
2433 priv->param_power_save = 0;
2434 else if (priv->param_power_save > 2)
2435 priv->param_power_save = 2;
2436
2437 if (priv->param_roamtrigger < -80)
2438 priv->param_roamtrigger = -80;
2439 else if (priv->param_roamtrigger > -60)
2440 priv->param_roamtrigger = -60;
2441
2442 if (priv->param_roamdelta < 0)
2443 priv->param_roamdelta = 0;
2444 else if (priv->param_roamdelta > 2)
2445 priv->param_roamdelta = 2;
2446
2447 if (priv->param_workaround_interval < 0)
2448 priv->param_workaround_interval = 500;
2449
2450 rndis_set_config_parameter_str(dev, "Country", priv->param_country);
2451 rndis_set_config_parameter_str(dev, "FrameBursting",
2452 priv->param_frameburst ? "1" : "0");
2453 rndis_set_config_parameter_str(dev, "Afterburner",
2454 priv->param_afterburner ? "1" : "0");
2455 sprintf(buf, "%d", priv->param_power_save);
2456 rndis_set_config_parameter_str(dev, "PowerSaveMode", buf);
2457 sprintf(buf, "%d", priv->param_power_output);
2458 rndis_set_config_parameter_str(dev, "PwrOut", buf);
2459 sprintf(buf, "%d", priv->param_roamtrigger);
2460 rndis_set_config_parameter_str(dev, "RoamTrigger", buf);
2461 sprintf(buf, "%d", priv->param_roamdelta);
2462 rndis_set_config_parameter_str(dev, "RoamDelta", buf);
2463
2464 return 0;
2465}
2466
2467
2468static int rndis_wext_bind(struct usbnet *dev, struct usb_interface *intf)
2469{
2470 struct net_device *net = dev->net;
2471 struct rndis_wext_private *priv;
2472 int retval, len;
2473 __le32 tmp;
2474
2475 /* allocate rndis private data */
2476 priv = kmalloc(sizeof(struct rndis_wext_private), GFP_KERNEL);
2477 if (!priv)
2478 return -ENOMEM;
2479
2480 /* These have to be initialized before calling generic_rndis_bind().
2481 * Otherwise we'll be in big trouble in rndis_wext_early_init().
2482 */
2483 dev->driver_priv = priv;
2484 memset(priv, 0, sizeof(*priv));
2485 memset(priv->name, 0, sizeof(priv->name));
2486 strcpy(priv->name, "IEEE802.11");
2487 net->wireless_handlers = &rndis_iw_handlers;
2488 priv->usbdev = dev;
2489
2490 mutex_init(&priv->command_lock);
2491 spin_lock_init(&priv->stats_lock);
2492
2493 /* try bind rndis_host */
2494 retval = generic_rndis_bind(dev, intf, FLAG_RNDIS_PHYM_WIRELESS);
2495 if (retval < 0)
2496 goto fail;
2497
2498 /* generic_rndis_bind set packet filter to multicast_all+
2499 * promisc mode which doesn't work well for our devices (device
2500 * picks up rssi to closest station instead of to access point).
2501 *
2502 * rndis_host wants to avoid all OID as much as possible
2503 * so do promisc/multicast handling in rndis_wext.
2504 */
2505 dev->net->set_multicast_list = rndis_wext_set_multicast_list;
2506 tmp = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST;
2507 retval = rndis_set_oid(dev, OID_GEN_CURRENT_PACKET_FILTER, &tmp,
2508 sizeof(tmp));
2509
2510 len = sizeof(tmp);
2511 retval = rndis_query_oid(dev, OID_802_3_MAXIMUM_LIST_SIZE, &tmp, &len);
2512 priv->multicast_size = le32_to_cpu(tmp);
2513 if (retval < 0 || priv->multicast_size < 0)
2514 priv->multicast_size = 0;
2515 if (priv->multicast_size > 0)
2516 dev->net->flags |= IFF_MULTICAST;
2517 else
2518 dev->net->flags &= ~IFF_MULTICAST;
2519
2520 priv->iwstats.qual.qual = 0;
2521 priv->iwstats.qual.level = 0;
2522 priv->iwstats.qual.updated = IW_QUAL_QUAL_UPDATED
2523 | IW_QUAL_LEVEL_UPDATED
2524 | IW_QUAL_NOISE_INVALID
2525 | IW_QUAL_QUAL_INVALID
2526 | IW_QUAL_LEVEL_INVALID;
2527
2528 rndis_wext_get_caps(dev);
2529 set_default_iw_params(dev);
2530
2531 /* turn radio on */
2532 priv->radio_on = 1;
2533 disassociate(dev, 1);
2534
2535 /* because rndis_command() sleeps we need to use workqueue */
2536 priv->workqueue = create_singlethread_workqueue("rndis_wlan");
2537 INIT_DELAYED_WORK(&priv->stats_work, rndis_update_wireless_stats);
2538 queue_delayed_work(priv->workqueue, &priv->stats_work,
2539 round_jiffies_relative(STATS_UPDATE_JIFFIES));
2540 INIT_WORK(&priv->work, rndis_wext_worker);
2541
2542 return 0;
2543
2544fail:
2545 kfree(priv);
2546 return retval;
2547}
2548
2549
2550static void rndis_wext_unbind(struct usbnet *dev, struct usb_interface *intf)
2551{
2552 struct rndis_wext_private *priv = get_rndis_wext_priv(dev);
2553
2554 /* turn radio off */
2555 disassociate(dev, 0);
2556
2557 cancel_delayed_work_sync(&priv->stats_work);
2558 cancel_work_sync(&priv->work);
2559 flush_workqueue(priv->workqueue);
2560 destroy_workqueue(priv->workqueue);
2561
2562 if (priv && priv->wpa_ie_len)
2563 kfree(priv->wpa_ie);
2564 kfree(priv);
2565
2566 rndis_unbind(dev, intf);
2567}
2568
2569
2570static int rndis_wext_reset(struct usbnet *dev)
2571{
2572 return deauthenticate(dev);
2573}
2574
2575
2576static const struct driver_info bcm4320b_info = {
2577 .description = "Wireless RNDIS device, BCM4320b based",
2578 .flags = FLAG_WLAN | FLAG_FRAMING_RN | FLAG_NO_SETINT,
2579 .bind = rndis_wext_bind,
2580 .unbind = rndis_wext_unbind,
2581 .status = rndis_status,
2582 .rx_fixup = rndis_rx_fixup,
2583 .tx_fixup = rndis_tx_fixup,
2584 .reset = rndis_wext_reset,
2585 .early_init = bcm4320_early_init,
2586 .link_change = rndis_wext_link_change,
2587};
2588
2589static const struct driver_info bcm4320a_info = {
2590 .description = "Wireless RNDIS device, BCM4320a based",
2591 .flags = FLAG_WLAN | FLAG_FRAMING_RN | FLAG_NO_SETINT,
2592 .bind = rndis_wext_bind,
2593 .unbind = rndis_wext_unbind,
2594 .status = rndis_status,
2595 .rx_fixup = rndis_rx_fixup,
2596 .tx_fixup = rndis_tx_fixup,
2597 .reset = rndis_wext_reset,
2598 .early_init = bcm4320_early_init,
2599 .link_change = rndis_wext_link_change,
2600};
2601
2602static const struct driver_info rndis_wext_info = {
2603 .description = "Wireless RNDIS device",
2604 .flags = FLAG_WLAN | FLAG_FRAMING_RN | FLAG_NO_SETINT,
2605 .bind = rndis_wext_bind,
2606 .unbind = rndis_wext_unbind,
2607 .status = rndis_status,
2608 .rx_fixup = rndis_rx_fixup,
2609 .tx_fixup = rndis_tx_fixup,
2610 .reset = rndis_wext_reset,
2611 .early_init = bcm4320_early_init,
2612 .link_change = rndis_wext_link_change,
2613};
2614
2615/*-------------------------------------------------------------------------*/
2616
2617static const struct usb_device_id products [] = {
2618#define RNDIS_MASTER_INTERFACE \
2619 .bInterfaceClass = USB_CLASS_COMM, \
2620 .bInterfaceSubClass = 2 /* ACM */, \
2621 .bInterfaceProtocol = 0x0ff
2622
2623/* INF driver for these devices have DriverVer >= 4.xx.xx.xx and many custom
2624 * parameters available. Chipset marked as 'BCM4320SKFBG' in NDISwrapper-wiki.
2625 */
2626{
2627 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2628 | USB_DEVICE_ID_MATCH_DEVICE,
2629 .idVendor = 0x0411,
2630 .idProduct = 0x00bc, /* Buffalo WLI-U2-KG125S */
2631 RNDIS_MASTER_INTERFACE,
2632 .driver_info = (unsigned long) &bcm4320b_info,
2633}, {
2634 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2635 | USB_DEVICE_ID_MATCH_DEVICE,
2636 .idVendor = 0x0baf,
2637 .idProduct = 0x011b, /* U.S. Robotics USR5421 */
2638 RNDIS_MASTER_INTERFACE,
2639 .driver_info = (unsigned long) &bcm4320b_info,
2640}, {
2641 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2642 | USB_DEVICE_ID_MATCH_DEVICE,
2643 .idVendor = 0x050d,
2644 .idProduct = 0x011b, /* Belkin F5D7051 */
2645 RNDIS_MASTER_INTERFACE,
2646 .driver_info = (unsigned long) &bcm4320b_info,
2647}, {
2648 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2649 | USB_DEVICE_ID_MATCH_DEVICE,
2650 .idVendor = 0x1799, /* Belkin has two vendor ids */
2651 .idProduct = 0x011b, /* Belkin F5D7051 */
2652 RNDIS_MASTER_INTERFACE,
2653 .driver_info = (unsigned long) &bcm4320b_info,
2654}, {
2655 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2656 | USB_DEVICE_ID_MATCH_DEVICE,
2657 .idVendor = 0x13b1,
2658 .idProduct = 0x0014, /* Linksys WUSB54GSv2 */
2659 RNDIS_MASTER_INTERFACE,
2660 .driver_info = (unsigned long) &bcm4320b_info,
2661}, {
2662 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2663 | USB_DEVICE_ID_MATCH_DEVICE,
2664 .idVendor = 0x13b1,
2665 .idProduct = 0x0026, /* Linksys WUSB54GSC */
2666 RNDIS_MASTER_INTERFACE,
2667 .driver_info = (unsigned long) &bcm4320b_info,
2668}, {
2669 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2670 | USB_DEVICE_ID_MATCH_DEVICE,
2671 .idVendor = 0x0b05,
2672 .idProduct = 0x1717, /* Asus WL169gE */
2673 RNDIS_MASTER_INTERFACE,
2674 .driver_info = (unsigned long) &bcm4320b_info,
2675}, {
2676 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2677 | USB_DEVICE_ID_MATCH_DEVICE,
2678 .idVendor = 0x0a5c,
2679 .idProduct = 0xd11b, /* Eminent EM4045 */
2680 RNDIS_MASTER_INTERFACE,
2681 .driver_info = (unsigned long) &bcm4320b_info,
2682}, {
2683 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2684 | USB_DEVICE_ID_MATCH_DEVICE,
2685 .idVendor = 0x1690,
2686 .idProduct = 0x0715, /* BT Voyager 1055 */
2687 RNDIS_MASTER_INTERFACE,
2688 .driver_info = (unsigned long) &bcm4320b_info,
2689},
2690/* These devices have DriverVer < 4.xx.xx.xx and do not have any custom
2691 * parameters available, hardware probably contain older firmware version with
2692 * no way of updating. Chipset marked as 'BCM4320????' in NDISwrapper-wiki.
2693 */
2694{
2695 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2696 | USB_DEVICE_ID_MATCH_DEVICE,
2697 .idVendor = 0x13b1,
2698 .idProduct = 0x000e, /* Linksys WUSB54GSv1 */
2699 RNDIS_MASTER_INTERFACE,
2700 .driver_info = (unsigned long) &bcm4320a_info,
2701}, {
2702 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2703 | USB_DEVICE_ID_MATCH_DEVICE,
2704 .idVendor = 0x0baf,
2705 .idProduct = 0x0111, /* U.S. Robotics USR5420 */
2706 RNDIS_MASTER_INTERFACE,
2707 .driver_info = (unsigned long) &bcm4320a_info,
2708}, {
2709 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
2710 | USB_DEVICE_ID_MATCH_DEVICE,
2711 .idVendor = 0x0411,
2712 .idProduct = 0x004b, /* BUFFALO WLI-USB-G54 */
2713 RNDIS_MASTER_INTERFACE,
2714 .driver_info = (unsigned long) &bcm4320a_info,
2715},
2716/* Generic Wireless RNDIS devices that we don't have exact
2717 * idVendor/idProduct/chip yet.
2718 */
2719{
2720 /* RNDIS is MSFT's un-official variant of CDC ACM */
2721 USB_INTERFACE_INFO(USB_CLASS_COMM, 2 /* ACM */, 0x0ff),
2722 .driver_info = (unsigned long) &rndis_wext_info,
2723}, {
2724 /* "ActiveSync" is an undocumented variant of RNDIS, used in WM5 */
2725 USB_INTERFACE_INFO(USB_CLASS_MISC, 1, 1),
2726 .driver_info = (unsigned long) &rndis_wext_info,
2727},
2728 { }, // END
2729};
2730MODULE_DEVICE_TABLE(usb, products);
2731
2732static struct usb_driver rndis_wlan_driver = {
2733 .name = "rndis_wlan",
2734 .id_table = products,
2735 .probe = usbnet_probe,
2736 .disconnect = usbnet_disconnect,
2737 .suspend = usbnet_suspend,
2738 .resume = usbnet_resume,
2739};
2740
2741static int __init rndis_wlan_init(void)
2742{
2743 return usb_register(&rndis_wlan_driver);
2744}
2745module_init(rndis_wlan_init);
2746
2747static void __exit rndis_wlan_exit(void)
2748{
2749 usb_deregister(&rndis_wlan_driver);
2750}
2751module_exit(rndis_wlan_exit);
2752
2753MODULE_AUTHOR("Bjorge Dijkstra");
2754MODULE_AUTHOR("Jussi Kivilinna");
2755MODULE_DESCRIPTION("Driver for RNDIS based USB Wireless adapters");
2756MODULE_LICENSE("GPL");
2757
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index ab52f221cd71..b31f0c26c32b 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1736,7 +1736,8 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1736 WARNING(rt2x00dev, 1736 WARNING(rt2x00dev,
1737 "TX status report missed for entry %p\n", 1737 "TX status report missed for entry %p\n",
1738 entry_done); 1738 entry_done);
1739 rt2x00lib_txdone(entry_done, TX_FAIL_OTHER, 0); 1739 rt2x00pci_txdone(rt2x00dev, entry_done, TX_FAIL_OTHER,
1740 0);
1740 entry_done = rt2x00_get_data_entry_done(ring); 1741 entry_done = rt2x00_get_data_entry_done(ring);
1741 } 1742 }
1742 1743
diff --git a/drivers/net/wireless/rtl8180_dev.c b/drivers/net/wireless/rtl8180_dev.c
index 07f37b0ccf91..27ebd689aa21 100644
--- a/drivers/net/wireless/rtl8180_dev.c
+++ b/drivers/net/wireless/rtl8180_dev.c
@@ -36,6 +36,7 @@ MODULE_LICENSE("GPL");
36static struct pci_device_id rtl8180_table[] __devinitdata = { 36static struct pci_device_id rtl8180_table[] __devinitdata = {
37 /* rtl8185 */ 37 /* rtl8185 */
38 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8185) }, 38 { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8185) },
39 { PCI_DEVICE(PCI_VENDOR_ID_BELKIN, 0x700f) },
39 { PCI_DEVICE(PCI_VENDOR_ID_BELKIN, 0x701f) }, 40 { PCI_DEVICE(PCI_VENDOR_ID_BELKIN, 0x701f) },
40 41
41 /* rtl8180 */ 42 /* rtl8180 */
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index aad4012bbb30..0d99120ab5a2 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -1410,7 +1410,7 @@ rs68328_init(void)
1410 1410
1411 if (request_irq(uart_irqs[i], 1411 if (request_irq(uart_irqs[i],
1412 rs_interrupt, 1412 rs_interrupt,
1413 IRQ_FLG_STD, 1413 IRQF_DISABLED,
1414 "M68328_UART", NULL)) 1414 "M68328_UART", NULL))
1415 panic("Unable to attach 68328 serial interrupt\n"); 1415 panic("Unable to attach 68328 serial interrupt\n");
1416 } 1416 }
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index d962b74e3114..8a053ea21e1d 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -960,6 +960,30 @@ config SERIAL_COLDFIRE
960 This driver supports the built-in serial ports of the Motorola ColdFire 960 This driver supports the built-in serial ports of the Motorola ColdFire
961 family of CPUs. 961 family of CPUs.
962 962
963config SERIAL_MCF
964 bool "Coldfire serial support (new style driver)"
965 depends on COLDFIRE
966 select SERIAL_CORE
967 help
968 This new serial driver supports the Freescale Coldfire serial ports
969 using the new serial driver subsystem.
970
971config SERIAL_MCF_BAUDRATE
972 int "Default baudrate for Coldfire serial ports"
973 depends on SERIAL_MCF
974 default 19200
975 help
976 This setting lets you define what the default baudrate is for the
977 ColdFire serial ports. The usual default varies from board to board,
978 and this setting is a way of catering for that.
979
980config SERIAL_MCF_CONSOLE
981 bool "Coldfire serial console support"
982 depends on SERIAL_MCF
983 select SERIAL_CORE_CONSOLE
984 help
985 Enable a ColdFire internal serial port to be the system console.
986
963config SERIAL_68360_SMC 987config SERIAL_68360_SMC
964 bool "68360 SMC uart support" 988 bool "68360 SMC uart support"
965 depends on M68360 989 depends on M68360
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 7eb45534778e..2dd41b4cc8db 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_SERIAL_MUX) += mux.o
39obj-$(CONFIG_SERIAL_68328) += 68328serial.o 39obj-$(CONFIG_SERIAL_68328) += 68328serial.o
40obj-$(CONFIG_SERIAL_68360) += 68360serial.o 40obj-$(CONFIG_SERIAL_68360) += 68360serial.o
41obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o 41obj-$(CONFIG_SERIAL_COLDFIRE) += mcfserial.o
42obj-$(CONFIG_SERIAL_MCF) += mcf.o
42obj-$(CONFIG_V850E_UART) += v850e_uart.o 43obj-$(CONFIG_V850E_UART) += v850e_uart.o
43obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o 44obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o
44obj-$(CONFIG_SERIAL_LH7A40X) += serial_lh7a40x.o 45obj-$(CONFIG_SERIAL_LH7A40X) += serial_lh7a40x.o
diff --git a/drivers/serial/mcf.c b/drivers/serial/mcf.c
index a7d4360ea7df..051fcc2f5ba8 100644
--- a/drivers/serial/mcf.c
+++ b/drivers/serial/mcf.c
@@ -69,7 +69,7 @@ static unsigned int mcf_tx_empty(struct uart_port *port)
69 69
70static unsigned int mcf_get_mctrl(struct uart_port *port) 70static unsigned int mcf_get_mctrl(struct uart_port *port)
71{ 71{
72 struct mcf_uart *pp = (struct mcf_uart *) port; 72 struct mcf_uart *pp = container_of(port, struct mcf_uart, port);
73 unsigned long flags; 73 unsigned long flags;
74 unsigned int sigs; 74 unsigned int sigs;
75 75
@@ -87,7 +87,7 @@ static unsigned int mcf_get_mctrl(struct uart_port *port)
87 87
88static void mcf_set_mctrl(struct uart_port *port, unsigned int sigs) 88static void mcf_set_mctrl(struct uart_port *port, unsigned int sigs)
89{ 89{
90 struct mcf_uart *pp = (struct mcf_uart *) port; 90 struct mcf_uart *pp = container_of(port, struct mcf_uart, port);
91 unsigned long flags; 91 unsigned long flags;
92 92
93 spin_lock_irqsave(&port->lock, flags); 93 spin_lock_irqsave(&port->lock, flags);
@@ -104,7 +104,7 @@ static void mcf_set_mctrl(struct uart_port *port, unsigned int sigs)
104 104
105static void mcf_start_tx(struct uart_port *port) 105static void mcf_start_tx(struct uart_port *port)
106{ 106{
107 struct mcf_uart *pp = (struct mcf_uart *) port; 107 struct mcf_uart *pp = container_of(port, struct mcf_uart, port);
108 unsigned long flags; 108 unsigned long flags;
109 109
110 spin_lock_irqsave(&port->lock, flags); 110 spin_lock_irqsave(&port->lock, flags);
@@ -117,7 +117,7 @@ static void mcf_start_tx(struct uart_port *port)
117 117
118static void mcf_stop_tx(struct uart_port *port) 118static void mcf_stop_tx(struct uart_port *port)
119{ 119{
120 struct mcf_uart *pp = (struct mcf_uart *) port; 120 struct mcf_uart *pp = container_of(port, struct mcf_uart, port);
121 unsigned long flags; 121 unsigned long flags;
122 122
123 spin_lock_irqsave(&port->lock, flags); 123 spin_lock_irqsave(&port->lock, flags);
@@ -130,7 +130,7 @@ static void mcf_stop_tx(struct uart_port *port)
130 130
131static void mcf_stop_rx(struct uart_port *port) 131static void mcf_stop_rx(struct uart_port *port)
132{ 132{
133 struct mcf_uart *pp = (struct mcf_uart *) port; 133 struct mcf_uart *pp = container_of(port, struct mcf_uart, port);
134 unsigned long flags; 134 unsigned long flags;
135 135
136 spin_lock_irqsave(&port->lock, flags); 136 spin_lock_irqsave(&port->lock, flags);
@@ -163,7 +163,7 @@ static void mcf_enable_ms(struct uart_port *port)
163 163
164static int mcf_startup(struct uart_port *port) 164static int mcf_startup(struct uart_port *port)
165{ 165{
166 struct mcf_uart *pp = (struct mcf_uart *) port; 166 struct mcf_uart *pp = container_of(port, struct mcf_uart, port);
167 unsigned long flags; 167 unsigned long flags;
168 168
169 spin_lock_irqsave(&port->lock, flags); 169 spin_lock_irqsave(&port->lock, flags);
@@ -189,7 +189,7 @@ static int mcf_startup(struct uart_port *port)
189 189
190static void mcf_shutdown(struct uart_port *port) 190static void mcf_shutdown(struct uart_port *port)
191{ 191{
192 struct mcf_uart *pp = (struct mcf_uart *) port; 192 struct mcf_uart *pp = container_of(port, struct mcf_uart, port);
193 unsigned long flags; 193 unsigned long flags;
194 194
195 spin_lock_irqsave(&port->lock, flags); 195 spin_lock_irqsave(&port->lock, flags);
@@ -273,7 +273,7 @@ static void mcf_set_termios(struct uart_port *port, struct ktermios *termios,
273 273
274static void mcf_rx_chars(struct mcf_uart *pp) 274static void mcf_rx_chars(struct mcf_uart *pp)
275{ 275{
276 struct uart_port *port = (struct uart_port *) pp; 276 struct uart_port *port = &pp->port;
277 unsigned char status, ch, flag; 277 unsigned char status, ch, flag;
278 278
279 while ((status = readb(port->membase + MCFUART_USR)) & MCFUART_USR_RXREADY) { 279 while ((status = readb(port->membase + MCFUART_USR)) & MCFUART_USR_RXREADY) {
@@ -319,7 +319,7 @@ static void mcf_rx_chars(struct mcf_uart *pp)
319 319
320static void mcf_tx_chars(struct mcf_uart *pp) 320static void mcf_tx_chars(struct mcf_uart *pp)
321{ 321{
322 struct uart_port *port = (struct uart_port *) pp; 322 struct uart_port *port = &pp->port;
323 struct circ_buf *xmit = &port->info->xmit; 323 struct circ_buf *xmit = &port->info->xmit;
324 324
325 if (port->x_char) { 325 if (port->x_char) {
@@ -352,7 +352,7 @@ static void mcf_tx_chars(struct mcf_uart *pp)
352static irqreturn_t mcf_interrupt(int irq, void *data) 352static irqreturn_t mcf_interrupt(int irq, void *data)
353{ 353{
354 struct uart_port *port = data; 354 struct uart_port *port = data;
355 struct mcf_uart *pp = (struct mcf_uart *) port; 355 struct mcf_uart *pp = container_of(port, struct mcf_uart, port);
356 unsigned int isr; 356 unsigned int isr;
357 357
358 isr = readb(port->membase + MCFUART_UISR) & pp->imr; 358 isr = readb(port->membase + MCFUART_UISR) & pp->imr;
diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h
index 1fede7f92860..08c979319929 100644
--- a/include/asm-alpha/socket.h
+++ b/include/asm-alpha/socket.h
@@ -60,4 +60,6 @@
60#define SO_SECURITY_ENCRYPTION_TRANSPORT 20 60#define SO_SECURITY_ENCRYPTION_TRANSPORT 20
61#define SO_SECURITY_ENCRYPTION_NETWORK 21 61#define SO_SECURITY_ENCRYPTION_NETWORK 21
62 62
63#define SO_MARK 36
64
63#endif /* _ASM_SOCKET_H */ 65#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h
index 65a1a64bf934..6817be9573a6 100644
--- a/include/asm-arm/socket.h
+++ b/include/asm-arm/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-avr32/socket.h b/include/asm-avr32/socket.h
index a0d0507a5034..35863f260929 100644
--- a/include/asm-avr32/socket.h
+++ b/include/asm-avr32/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* __ASM_AVR32_SOCKET_H */ 57#endif /* __ASM_AVR32_SOCKET_H */
diff --git a/include/asm-blackfin/socket.h b/include/asm-blackfin/socket.h
index 5213c9652186..2ca702e44d47 100644
--- a/include/asm-blackfin/socket.h
+++ b/include/asm-blackfin/socket.h
@@ -50,4 +50,7 @@
50#define SO_PASSSEC 34 50#define SO_PASSSEC 34
51#define SO_TIMESTAMPNS 35 51#define SO_TIMESTAMPNS 35
52#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 52#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
53
54#define SO_MARK 36
55
53#endif /* _ASM_SOCKET_H */ 56#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-cris/socket.h b/include/asm-cris/socket.h
index 5b18dfdf1748..9df0ca82f5de 100644
--- a/include/asm-cris/socket.h
+++ b/include/asm-cris/socket.h
@@ -54,6 +54,8 @@
54#define SO_TIMESTAMPNS 35 54#define SO_TIMESTAMPNS 35
55#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 55#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
56 56
57#define SO_MARK 36
58
57#endif /* _ASM_SOCKET_H */ 59#endif /* _ASM_SOCKET_H */
58 60
59 61
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h
index a823befd11dd..e51ca67b9356 100644
--- a/include/asm-frv/socket.h
+++ b/include/asm-frv/socket.h
@@ -52,5 +52,7 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
56 58
diff --git a/include/asm-h8300/socket.h b/include/asm-h8300/socket.h
index 39911d8c9684..da2520dbf254 100644
--- a/include/asm-h8300/socket.h
+++ b/include/asm-h8300/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-ia64/socket.h b/include/asm-ia64/socket.h
index 9e42ce43cfbe..d5ef0aa3e312 100644
--- a/include/asm-ia64/socket.h
+++ b/include/asm-ia64/socket.h
@@ -61,4 +61,6 @@
61#define SO_TIMESTAMPNS 35 61#define SO_TIMESTAMPNS 35
62#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 62#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
63 63
64#define SO_MARK 36
65
64#endif /* _ASM_IA64_SOCKET_H */ 66#endif /* _ASM_IA64_SOCKET_H */
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h
index 793d5d30c850..9a0e20012224 100644
--- a/include/asm-m32r/socket.h
+++ b/include/asm-m32r/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_M32R_SOCKET_H */ 57#endif /* _ASM_M32R_SOCKET_H */
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h
index 6d21b90863ad..dbc64e92c41a 100644
--- a/include/asm-m68k/socket.h
+++ b/include/asm-m68k/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h
index 163dcb1a9689..29bc0aad2ebc 100644
--- a/include/asm-m68knommu/cacheflush.h
+++ b/include/asm-m68knommu/cacheflush.h
@@ -53,7 +53,7 @@ static inline void __flush_cache_all(void)
53#endif /* CONFIG_M5407 */ 53#endif /* CONFIG_M5407 */
54#if defined(CONFIG_M527x) || defined(CONFIG_M528x) 54#if defined(CONFIG_M527x) || defined(CONFIG_M528x)
55 __asm__ __volatile__ ( 55 __asm__ __volatile__ (
56 "movel #0x81400100, %%d0\n\t" 56 "movel #0x81000200, %%d0\n\t"
57 "movec %%d0, %%CACR\n\t" 57 "movec %%d0, %%CACR\n\t"
58 "nop\n\t" 58 "nop\n\t"
59 : : : "d0" ); 59 : : : "d0" );
diff --git a/include/asm-m68knommu/mcfcache.h b/include/asm-m68knommu/mcfcache.h
index 7b61a8a529f5..c042634fadaa 100644
--- a/include/asm-m68knommu/mcfcache.h
+++ b/include/asm-m68knommu/mcfcache.h
@@ -60,7 +60,7 @@
60 nop 60 nop
61 movel #0x0000c020, %d0 /* Set SDRAM cached only */ 61 movel #0x0000c020, %d0 /* Set SDRAM cached only */
62 movec %d0, %ACR0 62 movec %d0, %ACR0
63 movel #0xff00c000, %d0 /* Cache Flash also */ 63 movel #0x00000000, %d0 /* No other regions cached */
64 movec %d0, %ACR1 64 movec %d0, %ACR1
65 movel #0x80000200, %d0 /* Setup cache mask */ 65 movel #0x80000200, %d0 /* Setup cache mask */
66 movec %d0, %CACR /* Enable cache */ 66 movec %d0, %CACR /* Enable cache */
diff --git a/include/asm-m68knommu/mcfuart.h b/include/asm-m68knommu/mcfuart.h
index 873d0805219c..1319a81814b1 100644
--- a/include/asm-m68knommu/mcfuart.h
+++ b/include/asm-m68knommu/mcfuart.h
@@ -12,7 +12,6 @@
12#define mcfuart_h 12#define mcfuart_h
13/****************************************************************************/ 13/****************************************************************************/
14 14
15
16/* 15/*
17 * Define the base address of the UARTS within the MBAR address 16 * Define the base address of the UARTS within the MBAR address
18 * space. 17 * space.
@@ -33,7 +32,7 @@
33#define MCFUART_BASE2 0x240 /* Base address of UART2 */ 32#define MCFUART_BASE2 0x240 /* Base address of UART2 */
34#define MCFUART_BASE3 0x280 /* Base address of UART3 */ 33#define MCFUART_BASE3 0x280 /* Base address of UART3 */
35#elif defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407) 34#elif defined(CONFIG_M5249) || defined(CONFIG_M5307) || defined(CONFIG_M5407)
36#if defined(CONFIG_NETtel) || defined(CONFIG_DISKtel) || defined(CONFIG_SECUREEDGEMP3) 35#if defined(CONFIG_NETtel) || defined(CONFIG_SECUREEDGEMP3)
37#define MCFUART_BASE1 0x200 /* Base address of UART1 */ 36#define MCFUART_BASE1 0x200 /* Base address of UART1 */
38#define MCFUART_BASE2 0x1c0 /* Base address of UART2 */ 37#define MCFUART_BASE2 0x1c0 /* Base address of UART2 */
39#else 38#else
diff --git a/include/asm-mips/socket.h b/include/asm-mips/socket.h
index 95945689b1c6..63f60254d308 100644
--- a/include/asm-mips/socket.h
+++ b/include/asm-mips/socket.h
@@ -73,6 +73,8 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */
73#define SO_TIMESTAMPNS 35 73#define SO_TIMESTAMPNS 35
74#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 74#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
75 75
76#define SO_MARK 36
77
76#ifdef __KERNEL__ 78#ifdef __KERNEL__
77 79
78/** sock_type - Socket types 80/** sock_type - Socket types
diff --git a/include/asm-parisc/socket.h b/include/asm-parisc/socket.h
index 99e868f6a8f5..69a7a0d30b02 100644
--- a/include/asm-parisc/socket.h
+++ b/include/asm-parisc/socket.h
@@ -52,4 +52,6 @@
52#define SO_PEERSEC 0x401d 52#define SO_PEERSEC 0x401d
53#define SO_PASSSEC 0x401e 53#define SO_PASSSEC 0x401e
54 54
55#define SO_MARK 0x401f
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h
index 403e9fde2eb5..f5a4e168e498 100644
--- a/include/asm-powerpc/socket.h
+++ b/include/asm-powerpc/socket.h
@@ -59,4 +59,6 @@
59#define SO_TIMESTAMPNS 35 59#define SO_TIMESTAMPNS 35
60#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 60#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
61 61
62#define SO_MARK 36
63
62#endif /* _ASM_POWERPC_SOCKET_H */ 64#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/include/asm-s390/socket.h b/include/asm-s390/socket.h
index 1161ebe3dec9..c786ab623b2d 100644
--- a/include/asm-s390/socket.h
+++ b/include/asm-s390/socket.h
@@ -60,4 +60,6 @@
60#define SO_TIMESTAMPNS 35 60#define SO_TIMESTAMPNS 35
61#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 61#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
62 62
63#define SO_MARK 36
64
63#endif /* _ASM_SOCKET_H */ 65#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-sh/socket.h b/include/asm-sh/socket.h
index c48d6fc9da38..6d4bf6512959 100644
--- a/include/asm-sh/socket.h
+++ b/include/asm-sh/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* __ASM_SH_SOCKET_H */ 57#endif /* __ASM_SH_SOCKET_H */
diff --git a/include/asm-sparc/socket.h b/include/asm-sparc/socket.h
index 7c1423997cf0..2e2bd0b7c8e3 100644
--- a/include/asm-sparc/socket.h
+++ b/include/asm-sparc/socket.h
@@ -52,6 +52,8 @@
52#define SO_TIMESTAMPNS 0x0021 52#define SO_TIMESTAMPNS 0x0021
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 0x0022
56
55/* Security levels - as per NRL IPv6 - don't actually do anything */ 57/* Security levels - as per NRL IPv6 - don't actually do anything */
56#define SO_SECURITY_AUTHENTICATION 0x5001 58#define SO_SECURITY_AUTHENTICATION 0x5001
57#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 59#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
diff --git a/include/asm-sparc64/socket.h b/include/asm-sparc64/socket.h
index 986441dcb8f0..44a625af6e31 100644
--- a/include/asm-sparc64/socket.h
+++ b/include/asm-sparc64/socket.h
@@ -57,4 +57,5 @@
57#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 57#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
58#define SO_SECURITY_ENCRYPTION_NETWORK 0x5004 58#define SO_SECURITY_ENCRYPTION_NETWORK 0x5004
59 59
60#define SO_MARK 0x0022
60#endif /* _ASM_SOCKET_H */ 61#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-v850/socket.h b/include/asm-v850/socket.h
index a4c2493b025f..e199a2bf12aa 100644
--- a/include/asm-v850/socket.h
+++ b/include/asm-v850/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* __V850_SOCKET_H__ */ 57#endif /* __V850_SOCKET_H__ */
diff --git a/include/asm-x86/socket.h b/include/asm-x86/socket.h
index 99ca648b94c5..80af9c4ccad7 100644
--- a/include/asm-x86/socket.h
+++ b/include/asm-x86/socket.h
@@ -52,4 +52,6 @@
52#define SO_TIMESTAMPNS 35 52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54 54
55#define SO_MARK 36
56
55#endif /* _ASM_SOCKET_H */ 57#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-xtensa/socket.h b/include/asm-xtensa/socket.h
index 1f5aeacb9da2..6100682b1da2 100644
--- a/include/asm-xtensa/socket.h
+++ b/include/asm-xtensa/socket.h
@@ -63,4 +63,6 @@
63#define SO_TIMESTAMPNS 35 63#define SO_TIMESTAMPNS 35
64#define SCM_TIMESTAMPNS SO_TIMESTAMPNS 64#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
65 65
66#define SO_MARK 36
67
66#endif /* _XTENSA_SOCKET_H */ 68#endif /* _XTENSA_SOCKET_H */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 8d9eaaebded7..fc4e3db649e8 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -17,8 +17,6 @@ struct ipv4_devconf
17 DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1); 17 DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1);
18}; 18};
19 19
20extern struct ipv4_devconf ipv4_devconf;
21
22struct in_device 20struct in_device
23{ 21{
24 struct net_device *dev; 22 struct net_device *dev;
diff --git a/include/linux/input.h b/include/linux/input.h
index 2075d6da2a31..056a17a4f34f 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -371,6 +371,8 @@ struct input_absinfo {
371#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */ 371#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
372#define KEY_DISPLAY_OFF 245 /* display device to off state */ 372#define KEY_DISPLAY_OFF 245 /* display device to off state */
373 373
374#define KEY_WIMAX 246
375
374#define BTN_MISC 0x100 376#define BTN_MISC 0x100
375#define BTN_0 0x100 377#define BTN_0 0x100
376#define BTN_1 0x101 378#define BTN_1 0x101
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 5d35a4cc3bff..4aaefc349a4b 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -457,14 +457,22 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
457#define inet_v6_ipv6only(__sk) 0 457#define inet_v6_ipv6only(__sk) 0
458#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 458#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
459 459
460#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\ 460#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
461 (((__sk)->sk_hash == (__hash)) && \ 461 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
462 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 462 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
463 ((__sk)->sk_family == AF_INET6) && \ 463 ((__sk)->sk_family == AF_INET6) && \
464 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 464 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
465 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ 465 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
466 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 466 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
467 467
468#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \
469 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
470 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \
471 ((__sk)->sk_family == PF_INET6) && \
472 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \
473 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_rcv_saddr, (__daddr))) && \
474 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
475
468#endif /* __KERNEL__ */ 476#endif /* __KERNEL__ */
469 477
470#endif /* _IPV6_H */ 478#endif /* _IPV6_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b0813c3286b1..047d432bde55 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1414,12 +1414,16 @@ extern void dev_set_rx_mode(struct net_device *dev);
1414extern void __dev_set_rx_mode(struct net_device *dev); 1414extern void __dev_set_rx_mode(struct net_device *dev);
1415extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen); 1415extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen);
1416extern int dev_unicast_add(struct net_device *dev, void *addr, int alen); 1416extern int dev_unicast_add(struct net_device *dev, void *addr, int alen);
1417extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
1418extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
1417extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all); 1419extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
1418extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly); 1420extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
1419extern int dev_mc_sync(struct net_device *to, struct net_device *from); 1421extern int dev_mc_sync(struct net_device *to, struct net_device *from);
1420extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 1422extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
1421extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all); 1423extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
1422extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly); 1424extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
1425extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1426extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1423extern void dev_set_promiscuity(struct net_device *dev, int inc); 1427extern void dev_set_promiscuity(struct net_device *dev, int inc);
1424extern void dev_set_allmulti(struct net_device *dev, int inc); 1428extern void dev_set_allmulti(struct net_device *dev, int inc);
1425extern void netdev_state_change(struct net_device *dev); 1429extern void netdev_state_change(struct net_device *dev);
diff --git a/include/linux/netfilter/nf_conntrack_pptp.h b/include/linux/netfilter/nf_conntrack_pptp.h
index 23435496d24a..3bbde0c3a8a6 100644
--- a/include/linux/netfilter/nf_conntrack_pptp.h
+++ b/include/linux/netfilter/nf_conntrack_pptp.h
@@ -4,7 +4,7 @@
4 4
5#include <linux/netfilter/nf_conntrack_common.h> 5#include <linux/netfilter/nf_conntrack_common.h>
6 6
7extern const char *pptp_msg_name[]; 7extern const char *const pptp_msg_name[];
8 8
9/* state of the control session */ 9/* state of the control session */
10enum pptp_ctrlsess_state { 10enum pptp_ctrlsess_state {
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 9fff19779bd5..8e5ce1ca7bfc 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -30,9 +30,9 @@ extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb,
30 struct nf_conntrack_expect *exp, 30 struct nf_conntrack_expect *exp,
31 const char *dptr); 31 const char *dptr);
32 32
33extern int ct_sip_get_info(struct nf_conn *ct, const char *dptr, size_t dlen, 33extern int ct_sip_get_info(const struct nf_conn *ct, const char *dptr,
34 unsigned int *matchoff, unsigned int *matchlen, 34 size_t dlen, unsigned int *matchoff,
35 enum sip_header_pos pos); 35 unsigned int *matchlen, enum sip_header_pos pos);
36extern int ct_sip_lnlen(const char *line, const char *limit); 36extern int ct_sip_lnlen(const char *line, const char *limit);
37extern const char *ct_sip_search(const char *needle, const char *haystack, 37extern const char *ct_sip_search(const char *needle, const char *haystack,
38 size_t needle_len, size_t haystack_len, 38 size_t needle_len, size_t haystack_len,
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index b99ede51318a..b2c62cc618f5 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -214,7 +214,7 @@ struct xt_match
214 /* Free to use by each match */ 214 /* Free to use by each match */
215 unsigned long data; 215 unsigned long data;
216 216
217 char *table; 217 const char *table;
218 unsigned int matchsize; 218 unsigned int matchsize;
219 unsigned int compatsize; 219 unsigned int compatsize;
220 unsigned int hooks; 220 unsigned int hooks;
@@ -261,7 +261,7 @@ struct xt_target
261 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 261 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
262 struct module *me; 262 struct module *me;
263 263
264 char *table; 264 const char *table;
265 unsigned int targetsize; 265 unsigned int targetsize;
266 unsigned int compatsize; 266 unsigned int compatsize;
267 unsigned int hooks; 267 unsigned int hooks;
@@ -277,7 +277,7 @@ struct xt_table
277 struct list_head list; 277 struct list_head list;
278 278
279 /* A unique name... */ 279 /* A unique name... */
280 char name[XT_TABLE_MAXNAMELEN]; 280 const char name[XT_TABLE_MAXNAMELEN];
281 281
282 /* What hooks you will enter on */ 282 /* What hooks you will enter on */
283 unsigned int valid_hooks; 283 unsigned int valid_hooks;
@@ -335,9 +335,10 @@ extern int xt_check_target(const struct xt_target *target, unsigned short family
335 unsigned int size, const char *table, unsigned int hook, 335 unsigned int size, const char *table, unsigned int hook,
336 unsigned short proto, int inv_proto); 336 unsigned short proto, int inv_proto);
337 337
338extern int xt_register_table(struct xt_table *table, 338extern struct xt_table *xt_register_table(struct net *net,
339 struct xt_table_info *bootstrap, 339 struct xt_table *table,
340 struct xt_table_info *newinfo); 340 struct xt_table_info *bootstrap,
341 struct xt_table_info *newinfo);
341extern void *xt_unregister_table(struct xt_table *table); 342extern void *xt_unregister_table(struct xt_table *table);
342 343
343extern struct xt_table_info *xt_replace_table(struct xt_table *table, 344extern struct xt_table_info *xt_replace_table(struct xt_table *table,
@@ -352,11 +353,12 @@ extern struct xt_target *xt_request_find_target(int af, const char *name,
352extern int xt_find_revision(int af, const char *name, u8 revision, int target, 353extern int xt_find_revision(int af, const char *name, u8 revision, int target,
353 int *err); 354 int *err);
354 355
355extern struct xt_table *xt_find_table_lock(int af, const char *name); 356extern struct xt_table *xt_find_table_lock(struct net *net, int af,
357 const char *name);
356extern void xt_table_unlock(struct xt_table *t); 358extern void xt_table_unlock(struct xt_table *t);
357 359
358extern int xt_proto_init(int af); 360extern int xt_proto_init(struct net *net, int af);
359extern void xt_proto_fini(int af); 361extern void xt_proto_fini(struct net *net, int af);
360 362
361extern struct xt_table_info *xt_alloc_table_info(unsigned int size); 363extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
362extern void xt_free_table_info(struct xt_table_info *info); 364extern void xt_free_table_info(struct xt_table_info *info);
@@ -430,15 +432,15 @@ extern short xt_compat_calc_jump(int af, unsigned int offset);
430 432
431extern int xt_compat_match_offset(struct xt_match *match); 433extern int xt_compat_match_offset(struct xt_match *match);
432extern int xt_compat_match_from_user(struct xt_entry_match *m, 434extern int xt_compat_match_from_user(struct xt_entry_match *m,
433 void **dstptr, int *size); 435 void **dstptr, unsigned int *size);
434extern int xt_compat_match_to_user(struct xt_entry_match *m, 436extern int xt_compat_match_to_user(struct xt_entry_match *m,
435 void __user **dstptr, int *size); 437 void __user **dstptr, unsigned int *size);
436 438
437extern int xt_compat_target_offset(struct xt_target *target); 439extern int xt_compat_target_offset(struct xt_target *target);
438extern void xt_compat_target_from_user(struct xt_entry_target *t, 440extern void xt_compat_target_from_user(struct xt_entry_target *t,
439 void **dstptr, int *size); 441 void **dstptr, unsigned int *size);
440extern int xt_compat_target_to_user(struct xt_entry_target *t, 442extern int xt_compat_target_to_user(struct xt_entry_target *t,
441 void __user **dstptr, int *size); 443 void __user **dstptr, unsigned int *size);
442 444
443#endif /* CONFIG_COMPAT */ 445#endif /* CONFIG_COMPAT */
444#endif /* __KERNEL__ */ 446#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index d2492a3329be..f3fd83e46bab 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -6,9 +6,6 @@
6#define _XT_CONNTRACK_H 6#define _XT_CONNTRACK_H
7 7
8#include <linux/netfilter/nf_conntrack_tuple_common.h> 8#include <linux/netfilter/nf_conntrack_tuple_common.h>
9#ifdef __KERNEL__
10# include <linux/in.h>
11#endif
12 9
13#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) 10#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
14#define XT_CONNTRACK_STATE_INVALID (1 << 0) 11#define XT_CONNTRACK_STATE_INVALID (1 << 0)
@@ -18,14 +15,21 @@
18#define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3)) 15#define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3))
19 16
20/* flags, invflags: */ 17/* flags, invflags: */
21#define XT_CONNTRACK_STATE 0x01 18enum {
22#define XT_CONNTRACK_PROTO 0x02 19 XT_CONNTRACK_STATE = 1 << 0,
23#define XT_CONNTRACK_ORIGSRC 0x04 20 XT_CONNTRACK_PROTO = 1 << 1,
24#define XT_CONNTRACK_ORIGDST 0x08 21 XT_CONNTRACK_ORIGSRC = 1 << 2,
25#define XT_CONNTRACK_REPLSRC 0x10 22 XT_CONNTRACK_ORIGDST = 1 << 3,
26#define XT_CONNTRACK_REPLDST 0x20 23 XT_CONNTRACK_REPLSRC = 1 << 4,
27#define XT_CONNTRACK_STATUS 0x40 24 XT_CONNTRACK_REPLDST = 1 << 5,
28#define XT_CONNTRACK_EXPIRES 0x80 25 XT_CONNTRACK_STATUS = 1 << 6,
26 XT_CONNTRACK_EXPIRES = 1 << 7,
27 XT_CONNTRACK_ORIGSRC_PORT = 1 << 8,
28 XT_CONNTRACK_ORIGDST_PORT = 1 << 9,
29 XT_CONNTRACK_REPLSRC_PORT = 1 << 10,
30 XT_CONNTRACK_REPLDST_PORT = 1 << 11,
31 XT_CONNTRACK_DIRECTION = 1 << 12,
32};
29 33
30/* This is exposed to userspace, so remains frozen in time. */ 34/* This is exposed to userspace, so remains frozen in time. */
31struct ip_conntrack_old_tuple 35struct ip_conntrack_old_tuple
@@ -70,8 +74,10 @@ struct xt_conntrack_mtinfo1 {
70 union nf_inet_addr repldst_addr, repldst_mask; 74 union nf_inet_addr repldst_addr, repldst_mask;
71 u_int32_t expires_min, expires_max; 75 u_int32_t expires_min, expires_max;
72 u_int16_t l4proto; 76 u_int16_t l4proto;
77 __be16 origsrc_port, origdst_port;
78 __be16 replsrc_port, repldst_port;
79 u_int16_t match_flags, invert_flags;
73 u_int8_t state_mask, status_mask; 80 u_int8_t state_mask, status_mask;
74 u_int8_t match_flags, invert_flags;
75}; 81};
76 82
77#endif /*_XT_CONNTRACK_H*/ 83#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index c19972e4564d..58b818ee41ca 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -9,13 +9,16 @@
9/* details of this structure hidden by the implementation */ 9/* details of this structure hidden by the implementation */
10struct xt_hashlimit_htable; 10struct xt_hashlimit_htable;
11 11
12#define XT_HASHLIMIT_HASH_DIP 0x0001 12enum {
13#define XT_HASHLIMIT_HASH_DPT 0x0002 13 XT_HASHLIMIT_HASH_DIP = 1 << 0,
14#define XT_HASHLIMIT_HASH_SIP 0x0004 14 XT_HASHLIMIT_HASH_DPT = 1 << 1,
15#define XT_HASHLIMIT_HASH_SPT 0x0008 15 XT_HASHLIMIT_HASH_SIP = 1 << 2,
16 XT_HASHLIMIT_HASH_SPT = 1 << 3,
17 XT_HASHLIMIT_INVERT = 1 << 4,
18};
16 19
17struct hashlimit_cfg { 20struct hashlimit_cfg {
18 u_int32_t mode; /* bitmask of IPT_HASHLIMIT_HASH_* */ 21 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */
19 u_int32_t avg; /* Average secs between packets * scale */ 22 u_int32_t avg; /* Average secs between packets * scale */
20 u_int32_t burst; /* Period multiplier for upper limit. */ 23 u_int32_t burst; /* Period multiplier for upper limit. */
21 24
@@ -37,4 +40,28 @@ struct xt_hashlimit_info {
37 struct xt_hashlimit_info *master; 40 struct xt_hashlimit_info *master;
38 } u; 41 } u;
39}; 42};
43
44struct hashlimit_cfg1 {
45 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */
46 u_int32_t avg; /* Average secs between packets * scale */
47 u_int32_t burst; /* Period multiplier for upper limit. */
48
49 /* user specified */
50 u_int32_t size; /* how many buckets */
51 u_int32_t max; /* max number of entries */
52 u_int32_t gc_interval; /* gc interval */
53 u_int32_t expire; /* when do entries expire? */
54
55 u_int8_t srcmask, dstmask;
56};
57
58struct xt_hashlimit_mtinfo1 {
59 char name[IFNAMSIZ];
60 struct hashlimit_cfg1 cfg;
61
62 /* Used internally by the kernel */
63 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
64 struct xt_hashlimit_mtinfo1 *master __attribute__((aligned(8)));
65};
66
40#endif /*_XT_HASHLIMIT_H*/ 67#endif /*_XT_HASHLIMIT_H*/
diff --git a/include/linux/netfilter/xt_owner.h b/include/linux/netfilter/xt_owner.h
index eacd34efebd5..c84e52cfe415 100644
--- a/include/linux/netfilter/xt_owner.h
+++ b/include/linux/netfilter/xt_owner.h
@@ -8,8 +8,8 @@ enum {
8}; 8};
9 9
10struct xt_owner_match_info { 10struct xt_owner_match_info {
11 u_int32_t uid; 11 u_int32_t uid_min, uid_max;
12 u_int32_t gid; 12 u_int32_t gid_min, gid_max;
13 u_int8_t match, invert; 13 u_int8_t match, invert;
14}; 14};
15 15
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 53dd4df27aa1..db223ca92c8b 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -271,8 +271,9 @@ struct arpt_error
271 xt_register_target(tgt); }) 271 xt_register_target(tgt); })
272#define arpt_unregister_target(tgt) xt_unregister_target(tgt) 272#define arpt_unregister_target(tgt) xt_unregister_target(tgt)
273 273
274extern int arpt_register_table(struct arpt_table *table, 274extern struct arpt_table *arpt_register_table(struct net *net,
275 const struct arpt_replace *repl); 275 struct arpt_table *table,
276 const struct arpt_replace *repl);
276extern void arpt_unregister_table(struct arpt_table *table); 277extern void arpt_unregister_table(struct arpt_table *table);
277extern unsigned int arpt_do_table(struct sk_buff *skb, 278extern unsigned int arpt_do_table(struct sk_buff *skb,
278 unsigned int hook, 279 unsigned int hook,
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 45fcad91e67b..bfc889f90276 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -244,8 +244,9 @@ ipt_get_target(struct ipt_entry *e)
244#include <linux/init.h> 244#include <linux/init.h>
245extern void ipt_init(void) __init; 245extern void ipt_init(void) __init;
246 246
247extern int ipt_register_table(struct xt_table *table, 247extern struct xt_table *ipt_register_table(struct net *net,
248 const struct ipt_replace *repl); 248 struct xt_table *table,
249 const struct ipt_replace *repl);
249extern void ipt_unregister_table(struct xt_table *table); 250extern void ipt_unregister_table(struct xt_table *table);
250 251
251/* Standard entry. */ 252/* Standard entry. */
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 110801d699ee..f2507dcc5750 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -305,8 +305,9 @@ ip6t_get_target(struct ip6t_entry *e)
305#include <linux/init.h> 305#include <linux/init.h>
306extern void ip6t_init(void) __init; 306extern void ip6t_init(void) __init;
307 307
308extern int ip6t_register_table(struct xt_table *table, 308extern struct xt_table *ip6t_register_table(struct net *net,
309 const struct ip6t_replace *repl); 309 struct xt_table *table,
310 const struct ip6t_replace *repl);
310extern void ip6t_unregister_table(struct xt_table *table); 311extern void ip6t_unregister_table(struct xt_table *table);
311extern unsigned int ip6t_do_table(struct sk_buff *skb, 312extern unsigned int ip6t_do_table(struct sk_buff *skb,
312 unsigned int hook, 313 unsigned int hook,
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index bd13b6f4a98e..fb0713b6ffaf 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -219,7 +219,7 @@ struct netlink_callback
219 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); 219 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb);
220 int (*done)(struct netlink_callback *cb); 220 int (*done)(struct netlink_callback *cb);
221 int family; 221 int family;
222 long args[5]; 222 long args[6];
223}; 223};
224 224
225struct netlink_notify 225struct netlink_notify
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index d9db5f62ee48..6db69ff5d83e 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -298,6 +298,12 @@ struct sadb_x_sec_ctx {
298#define SADB_X_EALG_BLOWFISHCBC 7 298#define SADB_X_EALG_BLOWFISHCBC 7
299#define SADB_EALG_NULL 11 299#define SADB_EALG_NULL 11
300#define SADB_X_EALG_AESCBC 12 300#define SADB_X_EALG_AESCBC 12
301#define SADB_X_EALG_AES_CCM_ICV8 14
302#define SADB_X_EALG_AES_CCM_ICV12 15
303#define SADB_X_EALG_AES_CCM_ICV16 16
304#define SADB_X_EALG_AES_GCM_ICV8 18
305#define SADB_X_EALG_AES_GCM_ICV12 19
306#define SADB_X_EALG_AES_GCM_ICV16 20
301#define SADB_X_EALG_CAMELLIACBC 22 307#define SADB_X_EALG_CAMELLIACBC 22
302#define SADB_EALG_MAX 253 /* last EALG */ 308#define SADB_EALG_MAX 253 /* last EALG */
303/* private allocations should use 249-255 (RFC2407) */ 309/* private allocations should use 249-255 (RFC2407) */
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 30b8571e6b34..1c1dba9ea5fb 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -328,6 +328,56 @@ enum
328 328
329#define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) 329#define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1)
330 330
331/* Flow filter */
332
333enum
334{
335 FLOW_KEY_SRC,
336 FLOW_KEY_DST,
337 FLOW_KEY_PROTO,
338 FLOW_KEY_PROTO_SRC,
339 FLOW_KEY_PROTO_DST,
340 FLOW_KEY_IIF,
341 FLOW_KEY_PRIORITY,
342 FLOW_KEY_MARK,
343 FLOW_KEY_NFCT,
344 FLOW_KEY_NFCT_SRC,
345 FLOW_KEY_NFCT_DST,
346 FLOW_KEY_NFCT_PROTO_SRC,
347 FLOW_KEY_NFCT_PROTO_DST,
348 FLOW_KEY_RTCLASSID,
349 FLOW_KEY_SKUID,
350 FLOW_KEY_SKGID,
351 __FLOW_KEY_MAX,
352};
353
354#define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1)
355
356enum
357{
358 FLOW_MODE_MAP,
359 FLOW_MODE_HASH,
360};
361
362enum
363{
364 TCA_FLOW_UNSPEC,
365 TCA_FLOW_KEYS,
366 TCA_FLOW_MODE,
367 TCA_FLOW_BASECLASS,
368 TCA_FLOW_RSHIFT,
369 TCA_FLOW_ADDEND,
370 TCA_FLOW_MASK,
371 TCA_FLOW_XOR,
372 TCA_FLOW_DIVISOR,
373 TCA_FLOW_ACT,
374 TCA_FLOW_POLICE,
375 TCA_FLOW_EMATCHES,
376 __TCA_FLOW_MAX
377};
378
379#define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1)
380
331/* Basic filter */ 381/* Basic filter */
332 382
333enum 383enum
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 32761352e858..dbb7ac37960d 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -150,6 +150,11 @@ struct tc_sfq_qopt
150 unsigned flows; /* Maximal number of flows */ 150 unsigned flows; /* Maximal number of flows */
151}; 151};
152 152
153struct tc_sfq_xstats
154{
155 __s32 allot;
156};
157
153/* 158/*
154 * NOTE: limit, divisor and flows are hardwired to code at the moment. 159 * NOTE: limit, divisor and flows are hardwired to code at the moment.
155 * 160 *
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 0ce5e0b52dbd..e3ab21d7fc7f 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -33,11 +33,13 @@
33 * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. 33 * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
34 * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. 34 * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
35 * RFKILL_TYPE_UWB: switch is on a ultra wideband device. 35 * RFKILL_TYPE_UWB: switch is on a ultra wideband device.
36 * RFKILL_TYPE_WIMAX: switch is on a WiMAX device.
36 */ 37 */
37enum rfkill_type { 38enum rfkill_type {
38 RFKILL_TYPE_WLAN , 39 RFKILL_TYPE_WLAN ,
39 RFKILL_TYPE_BLUETOOTH, 40 RFKILL_TYPE_BLUETOOTH,
40 RFKILL_TYPE_UWB, 41 RFKILL_TYPE_UWB,
42 RFKILL_TYPE_WIMAX,
41 RFKILL_TYPE_MAX, 43 RFKILL_TYPE_MAX,
42}; 44};
43 45
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c618fbf7d173..dfe975a9967e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -108,9 +108,6 @@ struct nf_bridge_info {
108 atomic_t use; 108 atomic_t use;
109 struct net_device *physindev; 109 struct net_device *physindev;
110 struct net_device *physoutdev; 110 struct net_device *physoutdev;
111#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
112 struct net_device *netoutdev;
113#endif
114 unsigned int mask; 111 unsigned int mask;
115 unsigned long data[32 / sizeof(unsigned long)]; 112 unsigned long data[32 / sizeof(unsigned long)];
116}; 113};
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 86d3effb2836..5df62ef1280c 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -227,7 +227,7 @@ enum
227 LINUX_MIB_XFRMINNOSTATES, /* XfrmInNoStates */ 227 LINUX_MIB_XFRMINNOSTATES, /* XfrmInNoStates */
228 LINUX_MIB_XFRMINSTATEPROTOERROR, /* XfrmInStateProtoError */ 228 LINUX_MIB_XFRMINSTATEPROTOERROR, /* XfrmInStateProtoError */
229 LINUX_MIB_XFRMINSTATEMODEERROR, /* XfrmInStateModeError */ 229 LINUX_MIB_XFRMINSTATEMODEERROR, /* XfrmInStateModeError */
230 LINUX_MIB_XFRMINSEQOUTOFWINDOW, /* XfrmInSeqOutOfWindow */ 230 LINUX_MIB_XFRMINSTATESEQERROR, /* XfrmInStateSeqError */
231 LINUX_MIB_XFRMINSTATEEXPIRED, /* XfrmInStateExpired */ 231 LINUX_MIB_XFRMINSTATEEXPIRED, /* XfrmInStateExpired */
232 LINUX_MIB_XFRMINSTATEMISMATCH, /* XfrmInStateMismatch */ 232 LINUX_MIB_XFRMINSTATEMISMATCH, /* XfrmInStateMismatch */
233 LINUX_MIB_XFRMINSTATEINVALID, /* XfrmInStateInvalid */ 233 LINUX_MIB_XFRMINSTATEINVALID, /* XfrmInStateInvalid */
@@ -241,6 +241,7 @@ enum
241 LINUX_MIB_XFRMOUTNOSTATES, /* XfrmOutNoStates */ 241 LINUX_MIB_XFRMOUTNOSTATES, /* XfrmOutNoStates */
242 LINUX_MIB_XFRMOUTSTATEPROTOERROR, /* XfrmOutStateProtoError */ 242 LINUX_MIB_XFRMOUTSTATEPROTOERROR, /* XfrmOutStateProtoError */
243 LINUX_MIB_XFRMOUTSTATEMODEERROR, /* XfrmOutStateModeError */ 243 LINUX_MIB_XFRMOUTSTATEMODEERROR, /* XfrmOutStateModeError */
244 LINUX_MIB_XFRMOUTSTATESEQERROR, /* XfrmOutStateSeqError */
244 LINUX_MIB_XFRMOUTSTATEEXPIRED, /* XfrmOutStateExpired */ 245 LINUX_MIB_XFRMOUTSTATEEXPIRED, /* XfrmOutStateExpired */
245 LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ 246 LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */
246 LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ 247 LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 89faebfe48b8..bf4ae4e138f7 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -440,8 +440,8 @@ enum
440 440
441enum { 441enum {
442 NET_IPV4_ROUTE_FLUSH=1, 442 NET_IPV4_ROUTE_FLUSH=1,
443 NET_IPV4_ROUTE_MIN_DELAY=2, 443 NET_IPV4_ROUTE_MIN_DELAY=2, /* obsolete since 2.6.25 */
444 NET_IPV4_ROUTE_MAX_DELAY=3, 444 NET_IPV4_ROUTE_MAX_DELAY=3, /* obsolete since 2.6.25 */
445 NET_IPV4_ROUTE_GC_THRESH=4, 445 NET_IPV4_ROUTE_GC_THRESH=4,
446 NET_IPV4_ROUTE_MAX_SIZE=5, 446 NET_IPV4_ROUTE_MAX_SIZE=5,
447 NET_IPV4_ROUTE_GC_MIN_INTERVAL=6, 447 NET_IPV4_ROUTE_GC_MIN_INTERVAL=6,
diff --git a/include/linux/types.h b/include/linux/types.h
index f4f8d19158e4..b94c0e4efe24 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -126,7 +126,7 @@ typedef __s64 int64_t;
126#endif 126#endif
127 127
128/* this is a special 64bit data type that is 8-byte aligned */ 128/* this is a special 64bit data type that is 8-byte aligned */
129#define aligned_u64 unsigned long long __attribute__((aligned(8))) 129#define aligned_u64 __u64 __attribute__((aligned(8)))
130#define aligned_be64 __be64 __attribute__((aligned(8))) 130#define aligned_be64 __be64 __attribute__((aligned(8)))
131#define aligned_le64 __le64 __attribute__((aligned(8))) 131#define aligned_le64 __le64 __attribute__((aligned(8)))
132 132
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
new file mode 100644
index 000000000000..edc1d4a0e272
--- /dev/null
+++ b/include/linux/usb/rndis_host.h
@@ -0,0 +1,274 @@
1/*
2 * Host Side support for RNDIS Networking Links
3 * Copyright (C) 2005 by David Brownell
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20
21#ifndef __RNDIS_HOST_H
22#define __RNDIS_HOST_H
23
24
25/*
26 * CONTROL uses CDC "encapsulated commands" with funky notifications.
27 * - control-out: SEND_ENCAPSULATED
28 * - interrupt-in: RESPONSE_AVAILABLE
29 * - control-in: GET_ENCAPSULATED
30 *
31 * We'll try to ignore the RESPONSE_AVAILABLE notifications.
32 *
33 * REVISIT some RNDIS implementations seem to have curious issues still
34 * to be resolved.
35 */
36struct rndis_msg_hdr {
37 __le32 msg_type; /* RNDIS_MSG_* */
38 __le32 msg_len;
39 // followed by data that varies between messages
40 __le32 request_id;
41 __le32 status;
42 // ... and more
43} __attribute__ ((packed));
44
45/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */
46#define CONTROL_BUFFER_SIZE 1025
47
48/* RNDIS defines an (absurdly huge) 10 second control timeout,
49 * but ActiveSync seems to use a more usual 5 second timeout
50 * (which matches the USB 2.0 spec).
51 */
52#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000)
53
54
55#define ccpu2 __constant_cpu_to_le32
56
57#define RNDIS_MSG_COMPLETION ccpu2(0x80000000)
58
59/* codes for "msg_type" field of rndis messages;
60 * only the data channel uses packet messages (maybe batched);
61 * everything else goes on the control channel.
62 */
63#define RNDIS_MSG_PACKET ccpu2(0x00000001) /* 1-N packets */
64#define RNDIS_MSG_INIT ccpu2(0x00000002)
65#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
66#define RNDIS_MSG_HALT ccpu2(0x00000003)
67#define RNDIS_MSG_QUERY ccpu2(0x00000004)
68#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
69#define RNDIS_MSG_SET ccpu2(0x00000005)
70#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
71#define RNDIS_MSG_RESET ccpu2(0x00000006)
72#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
73#define RNDIS_MSG_INDICATE ccpu2(0x00000007)
74#define RNDIS_MSG_KEEPALIVE ccpu2(0x00000008)
75#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
76
77/* codes for "status" field of completion messages */
78#define RNDIS_STATUS_SUCCESS ccpu2(0x00000000)
79#define RNDIS_STATUS_FAILURE ccpu2(0xc0000001)
80#define RNDIS_STATUS_INVALID_DATA ccpu2(0xc0010015)
81#define RNDIS_STATUS_NOT_SUPPORTED ccpu2(0xc00000bb)
82#define RNDIS_STATUS_MEDIA_CONNECT ccpu2(0x4001000b)
83#define RNDIS_STATUS_MEDIA_DISCONNECT ccpu2(0x4001000c)
84
85/* codes for OID_GEN_PHYSICAL_MEDIUM */
86#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED ccpu2(0x00000000)
87#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN ccpu2(0x00000001)
88#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM ccpu2(0x00000002)
89#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE ccpu2(0x00000003)
90#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE ccpu2(0x00000004)
91#define RNDIS_PHYSICAL_MEDIUM_DSL ccpu2(0x00000005)
92#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL ccpu2(0x00000006)
93#define RNDIS_PHYSICAL_MEDIUM_1394 ccpu2(0x00000007)
94#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN ccpu2(0x00000008)
95#define RNDIS_PHYSICAL_MEDIUM_MAX ccpu2(0x00000009)
96
97struct rndis_data_hdr {
98 __le32 msg_type; /* RNDIS_MSG_PACKET */
99 __le32 msg_len; // rndis_data_hdr + data_len + pad
100 __le32 data_offset; // 36 -- right after header
101 __le32 data_len; // ... real packet size
102
103 __le32 oob_data_offset; // zero
104 __le32 oob_data_len; // zero
105 __le32 num_oob; // zero
106 __le32 packet_data_offset; // zero
107
108 __le32 packet_data_len; // zero
109 __le32 vc_handle; // zero
110 __le32 reserved; // zero
111} __attribute__ ((packed));
112
113struct rndis_init { /* OUT */
114 // header and:
115 __le32 msg_type; /* RNDIS_MSG_INIT */
116 __le32 msg_len; // 24
117 __le32 request_id;
118 __le32 major_version; // of rndis (1.0)
119 __le32 minor_version;
120 __le32 max_transfer_size;
121} __attribute__ ((packed));
122
123struct rndis_init_c { /* IN */
124 // header and:
125 __le32 msg_type; /* RNDIS_MSG_INIT_C */
126 __le32 msg_len;
127 __le32 request_id;
128 __le32 status;
129 __le32 major_version; // of rndis (1.0)
130 __le32 minor_version;
131 __le32 device_flags;
132 __le32 medium; // zero == 802.3
133 __le32 max_packets_per_message;
134 __le32 max_transfer_size;
135 __le32 packet_alignment; // max 7; (1<<n) bytes
136 __le32 af_list_offset; // zero
137 __le32 af_list_size; // zero
138} __attribute__ ((packed));
139
140struct rndis_halt { /* OUT (no reply) */
141 // header and:
142 __le32 msg_type; /* RNDIS_MSG_HALT */
143 __le32 msg_len;
144 __le32 request_id;
145} __attribute__ ((packed));
146
147struct rndis_query { /* OUT */
148 // header and:
149 __le32 msg_type; /* RNDIS_MSG_QUERY */
150 __le32 msg_len;
151 __le32 request_id;
152 __le32 oid;
153 __le32 len;
154 __le32 offset;
155/*?*/ __le32 handle; // zero
156} __attribute__ ((packed));
157
158struct rndis_query_c { /* IN */
159 // header and:
160 __le32 msg_type; /* RNDIS_MSG_QUERY_C */
161 __le32 msg_len;
162 __le32 request_id;
163 __le32 status;
164 __le32 len;
165 __le32 offset;
166} __attribute__ ((packed));
167
168struct rndis_set { /* OUT */
169 // header and:
170 __le32 msg_type; /* RNDIS_MSG_SET */
171 __le32 msg_len;
172 __le32 request_id;
173 __le32 oid;
174 __le32 len;
175 __le32 offset;
176/*?*/ __le32 handle; // zero
177} __attribute__ ((packed));
178
179struct rndis_set_c { /* IN */
180 // header and:
181 __le32 msg_type; /* RNDIS_MSG_SET_C */
182 __le32 msg_len;
183 __le32 request_id;
184 __le32 status;
185} __attribute__ ((packed));
186
187struct rndis_reset { /* IN */
188 // header and:
189 __le32 msg_type; /* RNDIS_MSG_RESET */
190 __le32 msg_len;
191 __le32 reserved;
192} __attribute__ ((packed));
193
194struct rndis_reset_c { /* OUT */
195 // header and:
196 __le32 msg_type; /* RNDIS_MSG_RESET_C */
197 __le32 msg_len;
198 __le32 status;
199 __le32 addressing_lost;
200} __attribute__ ((packed));
201
202struct rndis_indicate { /* IN (unrequested) */
203 // header and:
204 __le32 msg_type; /* RNDIS_MSG_INDICATE */
205 __le32 msg_len;
206 __le32 status;
207 __le32 length;
208 __le32 offset;
209/**/ __le32 diag_status;
210 __le32 error_offset;
211/**/ __le32 message;
212} __attribute__ ((packed));
213
214struct rndis_keepalive { /* OUT (optionally IN) */
215 // header and:
216 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */
217 __le32 msg_len;
218 __le32 request_id;
219} __attribute__ ((packed));
220
221struct rndis_keepalive_c { /* IN (optionally OUT) */
222 // header and:
223 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */
224 __le32 msg_len;
225 __le32 request_id;
226 __le32 status;
227} __attribute__ ((packed));
228
229/* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and
230 * there are gobs more that may optionally be supported. We'll avoid as much
231 * of that mess as possible.
232 */
233#define OID_802_3_PERMANENT_ADDRESS ccpu2(0x01010101)
234#define OID_GEN_MAXIMUM_FRAME_SIZE ccpu2(0x00010106)
235#define OID_GEN_CURRENT_PACKET_FILTER ccpu2(0x0001010e)
236#define OID_GEN_PHYSICAL_MEDIUM ccpu2(0x00010202)
237
238/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
239#define RNDIS_PACKET_TYPE_DIRECTED ccpu2(0x00000001)
240#define RNDIS_PACKET_TYPE_MULTICAST ccpu2(0x00000002)
241#define RNDIS_PACKET_TYPE_ALL_MULTICAST ccpu2(0x00000004)
242#define RNDIS_PACKET_TYPE_BROADCAST ccpu2(0x00000008)
243#define RNDIS_PACKET_TYPE_SOURCE_ROUTING ccpu2(0x00000010)
244#define RNDIS_PACKET_TYPE_PROMISCUOUS ccpu2(0x00000020)
245#define RNDIS_PACKET_TYPE_SMT ccpu2(0x00000040)
246#define RNDIS_PACKET_TYPE_ALL_LOCAL ccpu2(0x00000080)
247#define RNDIS_PACKET_TYPE_GROUP ccpu2(0x00001000)
248#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL ccpu2(0x00002000)
249#define RNDIS_PACKET_TYPE_FUNCTIONAL ccpu2(0x00004000)
250#define RNDIS_PACKET_TYPE_MAC_FRAME ccpu2(0x00008000)
251
252/* default filter used with RNDIS devices */
253#define RNDIS_DEFAULT_FILTER ( \
254 RNDIS_PACKET_TYPE_DIRECTED | \
255 RNDIS_PACKET_TYPE_BROADCAST | \
256 RNDIS_PACKET_TYPE_ALL_MULTICAST | \
257 RNDIS_PACKET_TYPE_PROMISCUOUS)
258
259/* Flags to require specific physical medium type for generic_rndis_bind() */
260#define FLAG_RNDIS_PHYM_NOT_WIRELESS 0x0001
261#define FLAG_RNDIS_PHYM_WIRELESS 0x0002
262
263
264extern void rndis_status(struct usbnet *dev, struct urb *urb);
265extern int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf);
266extern int
267generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags);
268extern void rndis_unbind(struct usbnet *dev, struct usb_interface *intf);
269extern int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb);
270extern struct sk_buff *
271rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
272
273#endif /* __RNDIS_HOST_H */
274
diff --git a/drivers/net/usb/usbnet.h b/include/linux/usb/usbnet.h
index 1fae4347e831..e0501da3dd11 100644
--- a/drivers/net/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -31,6 +31,7 @@ struct usbnet {
31 struct usb_interface *intf; 31 struct usb_interface *intf;
32 struct driver_info *driver_info; 32 struct driver_info *driver_info;
33 const char *driver_name; 33 const char *driver_name;
34 void *driver_priv;
34 wait_queue_head_t *wait; 35 wait_queue_head_t *wait;
35 struct mutex phy_mutex; 36 struct mutex phy_mutex;
36 unsigned char suspend_count; 37 unsigned char suspend_count;
@@ -87,6 +88,8 @@ struct driver_info {
87#define FLAG_ETHER 0x0020 /* maybe use "eth%d" names */ 88#define FLAG_ETHER 0x0020 /* maybe use "eth%d" names */
88 89
89#define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */ 90#define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */
91#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
92
90 93
91 /* init device ... can sleep, or cause probe() failure */ 94 /* init device ... can sleep, or cause probe() failure */
92 int (*bind)(struct usbnet *, struct usb_interface *); 95 int (*bind)(struct usbnet *, struct usb_interface *);
@@ -113,6 +116,15 @@ struct driver_info {
113 struct sk_buff *(*tx_fixup)(struct usbnet *dev, 116 struct sk_buff *(*tx_fixup)(struct usbnet *dev,
114 struct sk_buff *skb, gfp_t flags); 117 struct sk_buff *skb, gfp_t flags);
115 118
119 /* early initialization code, can sleep. This is for minidrivers
120 * having 'subminidrivers' that need to do extra initialization
121 * right after minidriver have initialized hardware. */
122 int (*early_init)(struct usbnet *dev);
123
124 /* called by minidriver when link state changes, state: 0=disconnect,
125 * 1=connect */
126 void (*link_change)(struct usbnet *dev, int state);
127
116 /* for new devices, use the descriptor-reading code instead */ 128 /* for new devices, use the descriptor-reading code instead */
117 int in; /* rx endpoint */ 129 int in; /* rx endpoint */
118 int out; /* tx endpoint */ 130 int out; /* tx endpoint */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 9b5b00c4ef9d..e31b8c84f2c9 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -96,6 +96,13 @@ struct xfrm_algo {
96 char alg_key[0]; 96 char alg_key[0];
97}; 97};
98 98
99struct xfrm_algo_aead {
100 char alg_name[64];
101 int alg_key_len; /* in bits */
102 int alg_icv_len; /* in bits */
103 char alg_key[0];
104};
105
99struct xfrm_stats { 106struct xfrm_stats {
100 __u32 replay_window; 107 __u32 replay_window;
101 __u32 replay; 108 __u32 replay;
@@ -270,6 +277,7 @@ enum xfrm_attr_type_t {
270 XFRMA_LASTUSED, 277 XFRMA_LASTUSED,
271 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ 278 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */
272 XFRMA_MIGRATE, 279 XFRMA_MIGRATE,
280 XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */
273 __XFRMA_MAX 281 __XFRMA_MAX
274 282
275#define XFRMA_MAX (__XFRMA_MAX - 1) 283#define XFRMA_MAX (__XFRMA_MAX - 1)
diff --git a/include/net/arp.h b/include/net/arp.h
index 752eb47b2678..c236270ec95e 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -13,15 +13,17 @@ extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
13extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); 13extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg);
14extern void arp_send(int type, int ptype, __be32 dest_ip, 14extern void arp_send(int type, int ptype, __be32 dest_ip,
15 struct net_device *dev, __be32 src_ip, 15 struct net_device *dev, __be32 src_ip,
16 unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); 16 const unsigned char *dest_hw,
17 const unsigned char *src_hw, const unsigned char *th);
17extern int arp_bind_neighbour(struct dst_entry *dst); 18extern int arp_bind_neighbour(struct dst_entry *dst);
18extern int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir); 19extern int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir);
19extern void arp_ifdown(struct net_device *dev); 20extern void arp_ifdown(struct net_device *dev);
20 21
21extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, 22extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
22 struct net_device *dev, __be32 src_ip, 23 struct net_device *dev, __be32 src_ip,
23 unsigned char *dest_hw, unsigned char *src_hw, 24 const unsigned char *dest_hw,
24 unsigned char *target_hw); 25 const unsigned char *src_hw,
26 const unsigned char *target_hw);
25extern void arp_xmit(struct sk_buff *skb); 27extern void arp_xmit(struct sk_buff *skb);
26 28
27extern struct neigh_ops arp_broken_ops; 29extern struct neigh_ops arp_broken_ops;
diff --git a/include/net/esp.h b/include/net/esp.h
index c05f529bff28..d58451331dbd 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -1,58 +1,20 @@
1#ifndef _NET_ESP_H 1#ifndef _NET_ESP_H
2#define _NET_ESP_H 2#define _NET_ESP_H
3 3
4#include <linux/crypto.h> 4#include <linux/skbuff.h>
5#include <net/xfrm.h>
6#include <linux/scatterlist.h>
7 5
8#define ESP_NUM_FAST_SG 4 6struct crypto_aead;
9 7
10struct esp_data 8struct esp_data {
11{ 9 /* 0..255 */
12 struct scatterlist sgbuf[ESP_NUM_FAST_SG]; 10 int padlen;
13 11
14 /* Confidentiality */ 12 /* Confidentiality & Integrity */
15 struct { 13 struct crypto_aead *aead;
16 int padlen; /* 0..255 */
17 /* ivlen is offset from enc_data, where encrypted data start.
18 * It is logically different of crypto_tfm_alg_ivsize(tfm).
19 * We assume that it is either zero (no ivec), or
20 * >= crypto_tfm_alg_ivsize(tfm). */
21 int ivlen;
22 int ivinitted;
23 u8 *ivec; /* ivec buffer */
24 struct crypto_blkcipher *tfm; /* crypto handle */
25 } conf;
26
27 /* Integrity. It is active when icv_full_len != 0 */
28 struct {
29 u8 *work_icv;
30 int icv_full_len;
31 int icv_trunc_len;
32 struct crypto_hash *tfm;
33 } auth;
34}; 14};
35 15
36extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len); 16extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
37 17
38static inline int esp_mac_digest(struct esp_data *esp, struct sk_buff *skb,
39 int offset, int len)
40{
41 struct hash_desc desc;
42 int err;
43
44 desc.tfm = esp->auth.tfm;
45 desc.flags = 0;
46
47 err = crypto_hash_init(&desc);
48 if (unlikely(err))
49 return err;
50 err = skb_icv_walk(skb, &desc, offset, len, crypto_hash_update);
51 if (unlikely(err))
52 return err;
53 return crypto_hash_final(&desc, esp->auth.work_icv);
54}
55
56struct ip_esp_hdr; 18struct ip_esp_hdr;
57 19
58static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb) 20static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index 668056b4bb0b..fdff630708ce 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -57,34 +57,37 @@ extern void __inet6_hash(struct inet_hashinfo *hashinfo, struct sock *sk);
57 * 57 *
58 * The sockhash lock must be held as a reader here. 58 * The sockhash lock must be held as a reader here.
59 */ 59 */
60extern struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, 60extern struct sock *__inet6_lookup_established(struct net *net,
61 struct inet_hashinfo *hashinfo,
61 const struct in6_addr *saddr, 62 const struct in6_addr *saddr,
62 const __be16 sport, 63 const __be16 sport,
63 const struct in6_addr *daddr, 64 const struct in6_addr *daddr,
64 const u16 hnum, 65 const u16 hnum,
65 const int dif); 66 const int dif);
66 67
67extern struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo, 68extern struct sock *inet6_lookup_listener(struct net *net,
69 struct inet_hashinfo *hashinfo,
68 const struct in6_addr *daddr, 70 const struct in6_addr *daddr,
69 const unsigned short hnum, 71 const unsigned short hnum,
70 const int dif); 72 const int dif);
71 73
72static inline struct sock *__inet6_lookup(struct inet_hashinfo *hashinfo, 74static inline struct sock *__inet6_lookup(struct net *net,
75 struct inet_hashinfo *hashinfo,
73 const struct in6_addr *saddr, 76 const struct in6_addr *saddr,
74 const __be16 sport, 77 const __be16 sport,
75 const struct in6_addr *daddr, 78 const struct in6_addr *daddr,
76 const u16 hnum, 79 const u16 hnum,
77 const int dif) 80 const int dif)
78{ 81{
79 struct sock *sk = __inet6_lookup_established(hashinfo, saddr, sport, 82 struct sock *sk = __inet6_lookup_established(net, hashinfo, saddr,
80 daddr, hnum, dif); 83 sport, daddr, hnum, dif);
81 if (sk) 84 if (sk)
82 return sk; 85 return sk;
83 86
84 return inet6_lookup_listener(hashinfo, daddr, hnum, dif); 87 return inet6_lookup_listener(net, hashinfo, daddr, hnum, dif);
85} 88}
86 89
87extern struct sock *inet6_lookup(struct inet_hashinfo *hashinfo, 90extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
88 const struct in6_addr *saddr, const __be16 sport, 91 const struct in6_addr *saddr, const __be16 sport,
89 const struct in6_addr *daddr, const __be16 dport, 92 const struct in6_addr *daddr, const __be16 dport,
90 const int dif); 93 const int dif);
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 761bdc01425d..c23c4ed30724 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -74,6 +74,7 @@ struct inet_ehash_bucket {
74 * ports are created in O(1) time? I thought so. ;-) -DaveM 74 * ports are created in O(1) time? I thought so. ;-) -DaveM
75 */ 75 */
76struct inet_bind_bucket { 76struct inet_bind_bucket {
77 struct net *ib_net;
77 unsigned short port; 78 unsigned short port;
78 signed short fastreuse; 79 signed short fastreuse;
79 struct hlist_node node; 80 struct hlist_node node;
@@ -194,6 +195,7 @@ static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo)
194 195
195extern struct inet_bind_bucket * 196extern struct inet_bind_bucket *
196 inet_bind_bucket_create(struct kmem_cache *cachep, 197 inet_bind_bucket_create(struct kmem_cache *cachep,
198 struct net *net,
197 struct inet_bind_hashbucket *head, 199 struct inet_bind_hashbucket *head,
198 const unsigned short snum); 200 const unsigned short snum);
199extern void inet_bind_bucket_destroy(struct kmem_cache *cachep, 201extern void inet_bind_bucket_destroy(struct kmem_cache *cachep,
@@ -300,15 +302,17 @@ out:
300 wake_up(&hashinfo->lhash_wait); 302 wake_up(&hashinfo->lhash_wait);
301} 303}
302 304
303extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, 305extern struct sock *__inet_lookup_listener(struct net *net,
306 struct inet_hashinfo *hashinfo,
304 const __be32 daddr, 307 const __be32 daddr,
305 const unsigned short hnum, 308 const unsigned short hnum,
306 const int dif); 309 const int dif);
307 310
308static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo, 311static inline struct sock *inet_lookup_listener(struct net *net,
309 __be32 daddr, __be16 dport, int dif) 312 struct inet_hashinfo *hashinfo,
313 __be32 daddr, __be16 dport, int dif)
310{ 314{
311 return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif); 315 return __inet_lookup_listener(net, hashinfo, daddr, ntohs(dport), dif);
312} 316}
313 317
314/* Socket demux engine toys. */ 318/* Socket demux engine toys. */
@@ -342,26 +346,26 @@ typedef __u64 __bitwise __addrpair;
342 (((__force __u64)(__be32)(__daddr)) << 32) | \ 346 (((__force __u64)(__be32)(__daddr)) << 32) | \
343 ((__force __u64)(__be32)(__saddr))); 347 ((__force __u64)(__be32)(__saddr)));
344#endif /* __BIG_ENDIAN */ 348#endif /* __BIG_ENDIAN */
345#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 349#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
346 (((__sk)->sk_hash == (__hash)) && \ 350 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
347 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 351 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
348 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 352 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
349 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 353 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
350#define INET_TW_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 354#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
351 (((__sk)->sk_hash == (__hash)) && \ 355 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
352 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 356 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
353 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 357 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
354 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 358 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
355#else /* 32-bit arch */ 359#else /* 32-bit arch */
356#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 360#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
357#define INET_MATCH(__sk, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ 361#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \
358 (((__sk)->sk_hash == (__hash)) && \ 362 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
359 (inet_sk(__sk)->daddr == (__saddr)) && \ 363 (inet_sk(__sk)->daddr == (__saddr)) && \
360 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 364 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
361 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 365 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
362 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 366 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
363#define INET_TW_MATCH(__sk, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 367#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
364 (((__sk)->sk_hash == (__hash)) && \ 368 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
365 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 369 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
366 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 370 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
367 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 371 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
@@ -374,32 +378,36 @@ typedef __u64 __bitwise __addrpair;
374 * 378 *
375 * Local BH must be disabled here. 379 * Local BH must be disabled here.
376 */ 380 */
377extern struct sock * __inet_lookup_established(struct inet_hashinfo *hashinfo, 381extern struct sock * __inet_lookup_established(struct net *net,
382 struct inet_hashinfo *hashinfo,
378 const __be32 saddr, const __be16 sport, 383 const __be32 saddr, const __be16 sport,
379 const __be32 daddr, const u16 hnum, const int dif); 384 const __be32 daddr, const u16 hnum, const int dif);
380 385
381static inline struct sock * 386static inline struct sock *
382 inet_lookup_established(struct inet_hashinfo *hashinfo, 387 inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo,
383 const __be32 saddr, const __be16 sport, 388 const __be32 saddr, const __be16 sport,
384 const __be32 daddr, const __be16 dport, 389 const __be32 daddr, const __be16 dport,
385 const int dif) 390 const int dif)
386{ 391{
387 return __inet_lookup_established(hashinfo, saddr, sport, daddr, 392 return __inet_lookup_established(net, hashinfo, saddr, sport, daddr,
388 ntohs(dport), dif); 393 ntohs(dport), dif);
389} 394}
390 395
391static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, 396static inline struct sock *__inet_lookup(struct net *net,
397 struct inet_hashinfo *hashinfo,
392 const __be32 saddr, const __be16 sport, 398 const __be32 saddr, const __be16 sport,
393 const __be32 daddr, const __be16 dport, 399 const __be32 daddr, const __be16 dport,
394 const int dif) 400 const int dif)
395{ 401{
396 u16 hnum = ntohs(dport); 402 u16 hnum = ntohs(dport);
397 struct sock *sk = __inet_lookup_established(hashinfo, saddr, sport, daddr, 403 struct sock *sk = __inet_lookup_established(net, hashinfo,
398 hnum, dif); 404 saddr, sport, daddr, hnum, dif);
399 return sk ? : __inet_lookup_listener(hashinfo, daddr, hnum, dif); 405
406 return sk ? : __inet_lookup_listener(net, hashinfo, daddr, hnum, dif);
400} 407}
401 408
402static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, 409static inline struct sock *inet_lookup(struct net *net,
410 struct inet_hashinfo *hashinfo,
403 const __be32 saddr, const __be16 sport, 411 const __be32 saddr, const __be16 sport,
404 const __be32 daddr, const __be16 dport, 412 const __be32 daddr, const __be16 dport,
405 const int dif) 413 const int dif)
@@ -407,12 +415,17 @@ static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo,
407 struct sock *sk; 415 struct sock *sk;
408 416
409 local_bh_disable(); 417 local_bh_disable();
410 sk = __inet_lookup(hashinfo, saddr, sport, daddr, dport, dif); 418 sk = __inet_lookup(net, hashinfo, saddr, sport, daddr, dport, dif);
411 local_bh_enable(); 419 local_bh_enable();
412 420
413 return sk; 421 return sk;
414} 422}
415 423
424extern int __inet_hash_connect(struct inet_timewait_death_row *death_row,
425 struct sock *sk,
426 int (*check_established)(struct inet_timewait_death_row *,
427 struct sock *, __u16, struct inet_timewait_sock **),
428 void (*hash)(struct inet_hashinfo *, struct sock *));
416extern int inet_hash_connect(struct inet_timewait_death_row *death_row, 429extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
417 struct sock *sk); 430 struct sock *sk);
418#endif /* _INET_HASHTABLES_H */ 431#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 9daa60b544ba..90d1175f63de 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -69,6 +69,7 @@ struct fib_nh {
69struct fib_info { 69struct fib_info {
70 struct hlist_node fib_hash; 70 struct hlist_node fib_hash;
71 struct hlist_node fib_lhash; 71 struct hlist_node fib_lhash;
72 struct net *fib_net;
72 int fib_treeref; 73 int fib_treeref;
73 atomic_t fib_clntref; 74 atomic_t fib_clntref;
74 int fib_dead; 75 int fib_dead;
@@ -218,7 +219,8 @@ extern void fib_select_default(struct net *net, const struct flowi *flp,
218 219
219/* Exported by fib_semantics.c */ 220/* Exported by fib_semantics.c */
220extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 221extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
221extern int fib_sync_down(__be32 local, struct net_device *dev, int force); 222extern int fib_sync_down_dev(struct net_device *dev, int force);
223extern int fib_sync_down_addr(struct net *net, __be32 local);
222extern int fib_sync_up(struct net_device *dev); 224extern int fib_sync_up(struct net_device *dev);
223extern __be32 __fib_res_prefsrc(struct fib_result *res); 225extern __be32 __fib_res_prefsrc(struct fib_result *res);
224extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); 226extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index b8c1d60ba9e4..28738b7d53eb 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -12,6 +12,7 @@
12#include <net/netns/packet.h> 12#include <net/netns/packet.h>
13#include <net/netns/ipv4.h> 13#include <net/netns/ipv4.h>
14#include <net/netns/ipv6.h> 14#include <net/netns/ipv6.h>
15#include <net/netns/x_tables.h>
15 16
16struct proc_dir_entry; 17struct proc_dir_entry;
17struct net_device; 18struct net_device;
@@ -56,6 +57,9 @@ struct net {
56#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 57#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
57 struct netns_ipv6 ipv6; 58 struct netns_ipv6 ipv6;
58#endif 59#endif
60#ifdef CONFIG_NETFILTER
61 struct netns_xt xt;
62#endif
59}; 63};
60 64
61#ifdef CONFIG_NET 65#ifdef CONFIG_NET
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 857d89951790..90b3e7f5df5f 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -129,6 +129,8 @@ struct nf_conn
129 129
130 /* Extensions */ 130 /* Extensions */
131 struct nf_ct_ext *ext; 131 struct nf_ct_ext *ext;
132
133 struct rcu_head rcu;
132}; 134};
133 135
134static inline struct nf_conn * 136static inline struct nf_conn *
@@ -143,7 +145,7 @@ nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash)
143 145
144/* Alter reply tuple (maybe alter helper). */ 146/* Alter reply tuple (maybe alter helper). */
145extern void 147extern void
146nf_conntrack_alter_reply(struct nf_conn *conntrack, 148nf_conntrack_alter_reply(struct nf_conn *ct,
147 const struct nf_conntrack_tuple *newreply); 149 const struct nf_conntrack_tuple *newreply);
148 150
149/* Is this tuple taken? (ignoring any belonging to the given 151/* Is this tuple taken? (ignoring any belonging to the given
@@ -171,13 +173,12 @@ static inline void nf_ct_put(struct nf_conn *ct)
171extern int nf_ct_l3proto_try_module_get(unsigned short l3proto); 173extern int nf_ct_l3proto_try_module_get(unsigned short l3proto);
172extern void nf_ct_l3proto_module_put(unsigned short l3proto); 174extern void nf_ct_l3proto_module_put(unsigned short l3proto);
173 175
174extern struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced); 176extern struct hlist_head *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced);
175extern void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced, 177extern void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced,
176 int size); 178 unsigned int size);
177 179
178extern struct nf_conntrack_tuple_hash * 180extern struct nf_conntrack_tuple_hash *
179__nf_conntrack_find(const struct nf_conntrack_tuple *tuple, 181__nf_conntrack_find(const struct nf_conntrack_tuple *tuple);
180 const struct nf_conn *ignored_conntrack);
181 182
182extern void nf_conntrack_hash_insert(struct nf_conn *ct); 183extern void nf_conntrack_hash_insert(struct nf_conn *ct);
183 184
@@ -215,9 +216,9 @@ static inline void nf_ct_refresh(struct nf_conn *ct,
215 216
216/* These are for NAT. Icky. */ 217/* These are for NAT. Icky. */
217/* Update TCP window tracking data when NAT mangles the packet */ 218/* Update TCP window tracking data when NAT mangles the packet */
218extern void nf_conntrack_tcp_update(struct sk_buff *skb, 219extern void nf_conntrack_tcp_update(const struct sk_buff *skb,
219 unsigned int dataoff, 220 unsigned int dataoff,
220 struct nf_conn *conntrack, 221 struct nf_conn *ct,
221 int dir); 222 int dir);
222 223
223/* Fake conntrack entry for untracked connections */ 224/* Fake conntrack entry for untracked connections */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 7ad0828f05cf..9ee26469c759 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -68,11 +68,11 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
68 68
69int 69int
70print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, 70print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
71 struct nf_conntrack_l3proto *l3proto, 71 const struct nf_conntrack_l3proto *l3proto,
72 struct nf_conntrack_l4proto *proto); 72 const struct nf_conntrack_l4proto *proto);
73 73
74extern struct hlist_head *nf_conntrack_hash; 74extern struct hlist_head *nf_conntrack_hash;
75extern rwlock_t nf_conntrack_lock ; 75extern spinlock_t nf_conntrack_lock ;
76extern struct hlist_head unconfirmed; 76extern struct hlist_head unconfirmed;
77 77
78#endif /* _NF_CONNTRACK_CORE_H */ 78#endif /* _NF_CONNTRACK_CORE_H */
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 6c3fd254c28e..cb608a1b44e5 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -49,6 +49,8 @@ struct nf_conntrack_expect
49 /* Direction relative to the master connection. */ 49 /* Direction relative to the master connection. */
50 enum ip_conntrack_dir dir; 50 enum ip_conntrack_dir dir;
51#endif 51#endif
52
53 struct rcu_head rcu;
52}; 54};
53 55
54#define NF_CT_EXPECT_PERMANENT 0x1 56#define NF_CT_EXPECT_PERMANENT 0x1
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 2f3af00643cf..4ca125e9b3ce 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -43,12 +43,8 @@ extern struct nf_conntrack_helper *
43__nf_ct_helper_find(const struct nf_conntrack_tuple *tuple); 43__nf_ct_helper_find(const struct nf_conntrack_tuple *tuple);
44 44
45extern struct nf_conntrack_helper * 45extern struct nf_conntrack_helper *
46nf_ct_helper_find_get( const struct nf_conntrack_tuple *tuple);
47
48extern struct nf_conntrack_helper *
49__nf_conntrack_helper_find_byname(const char *name); 46__nf_conntrack_helper_find_byname(const char *name);
50 47
51extern void nf_ct_helper_put(struct nf_conntrack_helper *helper);
52extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 48extern int nf_conntrack_helper_register(struct nf_conntrack_helper *);
53extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 49extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
54 50
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index d5526bcce147..b886e3ae6cad 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -43,7 +43,7 @@ struct nf_conntrack_l3proto
43 const struct nf_conntrack_tuple *); 43 const struct nf_conntrack_tuple *);
44 44
45 /* Returns verdict for packet, or -1 for invalid. */ 45 /* Returns verdict for packet, or -1 for invalid. */
46 int (*packet)(struct nf_conn *conntrack, 46 int (*packet)(struct nf_conn *ct,
47 const struct sk_buff *skb, 47 const struct sk_buff *skb,
48 enum ip_conntrack_info ctinfo); 48 enum ip_conntrack_info ctinfo);
49 49
@@ -51,7 +51,7 @@ struct nf_conntrack_l3proto
51 * Called when a new connection for this protocol found; 51 * Called when a new connection for this protocol found;
52 * returns TRUE if it's OK. If so, packet() called next. 52 * returns TRUE if it's OK. If so, packet() called next.
53 */ 53 */
54 int (*new)(struct nf_conn *conntrack, const struct sk_buff *skb); 54 int (*new)(struct nf_conn *ct, const struct sk_buff *skb);
55 55
56 /* 56 /*
57 * Called before tracking. 57 * Called before tracking.
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index fb50c217ba0a..efc16eccddb1 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -23,9 +23,6 @@ struct nf_conntrack_l4proto
23 /* L4 Protocol number. */ 23 /* L4 Protocol number. */
24 u_int8_t l4proto; 24 u_int8_t l4proto;
25 25
26 /* Protocol name */
27 const char *name;
28
29 /* Try to fill in the third arg: dataoff is offset past network protocol 26 /* Try to fill in the third arg: dataoff is offset past network protocol
30 hdr. Return true if possible. */ 27 hdr. Return true if possible. */
31 int (*pkt_to_tuple)(const struct sk_buff *skb, 28 int (*pkt_to_tuple)(const struct sk_buff *skb,
@@ -38,15 +35,8 @@ struct nf_conntrack_l4proto
38 int (*invert_tuple)(struct nf_conntrack_tuple *inverse, 35 int (*invert_tuple)(struct nf_conntrack_tuple *inverse,
39 const struct nf_conntrack_tuple *orig); 36 const struct nf_conntrack_tuple *orig);
40 37
41 /* Print out the per-protocol part of the tuple. Return like seq_* */
42 int (*print_tuple)(struct seq_file *s,
43 const struct nf_conntrack_tuple *);
44
45 /* Print out the private part of the conntrack. */
46 int (*print_conntrack)(struct seq_file *s, const struct nf_conn *);
47
48 /* Returns verdict for packet, or -1 for invalid. */ 38 /* Returns verdict for packet, or -1 for invalid. */
49 int (*packet)(struct nf_conn *conntrack, 39 int (*packet)(struct nf_conn *ct,
50 const struct sk_buff *skb, 40 const struct sk_buff *skb,
51 unsigned int dataoff, 41 unsigned int dataoff,
52 enum ip_conntrack_info ctinfo, 42 enum ip_conntrack_info ctinfo,
@@ -55,16 +45,23 @@ struct nf_conntrack_l4proto
55 45
56 /* Called when a new connection for this protocol found; 46 /* Called when a new connection for this protocol found;
57 * returns TRUE if it's OK. If so, packet() called next. */ 47 * returns TRUE if it's OK. If so, packet() called next. */
58 int (*new)(struct nf_conn *conntrack, const struct sk_buff *skb, 48 int (*new)(struct nf_conn *ct, const struct sk_buff *skb,
59 unsigned int dataoff); 49 unsigned int dataoff);
60 50
61 /* Called when a conntrack entry is destroyed */ 51 /* Called when a conntrack entry is destroyed */
62 void (*destroy)(struct nf_conn *conntrack); 52 void (*destroy)(struct nf_conn *ct);
63 53
64 int (*error)(struct sk_buff *skb, unsigned int dataoff, 54 int (*error)(struct sk_buff *skb, unsigned int dataoff,
65 enum ip_conntrack_info *ctinfo, 55 enum ip_conntrack_info *ctinfo,
66 int pf, unsigned int hooknum); 56 int pf, unsigned int hooknum);
67 57
58 /* Print out the per-protocol part of the tuple. Return like seq_* */
59 int (*print_tuple)(struct seq_file *s,
60 const struct nf_conntrack_tuple *);
61
62 /* Print out the private part of the conntrack. */
63 int (*print_conntrack)(struct seq_file *s, const struct nf_conn *);
64
68 /* convert protoinfo to nfnetink attributes */ 65 /* convert protoinfo to nfnetink attributes */
69 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla, 66 int (*to_nlattr)(struct sk_buff *skb, struct nlattr *nla,
70 const struct nf_conn *ct); 67 const struct nf_conn *ct);
@@ -87,6 +84,8 @@ struct nf_conntrack_l4proto
87 struct ctl_table *ctl_compat_table; 84 struct ctl_table *ctl_compat_table;
88#endif 85#endif
89#endif 86#endif
87 /* Protocol name */
88 const char *name;
90 89
91 /* Module (if any) which this is connected to. */ 90 /* Module (if any) which this is connected to. */
92 struct module *me; 91 struct module *me;
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index 45cb17cdcfd0..e69ab2e87597 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -132,34 +132,33 @@ struct nf_conntrack_tuple_hash
132 132
133#endif /* __KERNEL__ */ 133#endif /* __KERNEL__ */
134 134
135static inline int nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, 135static inline int __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1,
136 const struct nf_conntrack_tuple *t2) 136 const struct nf_conntrack_tuple *t2)
137{ 137{
138 return (t1->src.u3.all[0] == t2->src.u3.all[0] && 138 return (t1->src.u3.all[0] == t2->src.u3.all[0] &&
139 t1->src.u3.all[1] == t2->src.u3.all[1] && 139 t1->src.u3.all[1] == t2->src.u3.all[1] &&
140 t1->src.u3.all[2] == t2->src.u3.all[2] && 140 t1->src.u3.all[2] == t2->src.u3.all[2] &&
141 t1->src.u3.all[3] == t2->src.u3.all[3] && 141 t1->src.u3.all[3] == t2->src.u3.all[3] &&
142 t1->src.u.all == t2->src.u.all && 142 t1->src.u.all == t2->src.u.all &&
143 t1->src.l3num == t2->src.l3num && 143 t1->src.l3num == t2->src.l3num);
144 t1->dst.protonum == t2->dst.protonum);
145} 144}
146 145
147static inline int nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, 146static inline int __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1,
148 const struct nf_conntrack_tuple *t2) 147 const struct nf_conntrack_tuple *t2)
149{ 148{
150 return (t1->dst.u3.all[0] == t2->dst.u3.all[0] && 149 return (t1->dst.u3.all[0] == t2->dst.u3.all[0] &&
151 t1->dst.u3.all[1] == t2->dst.u3.all[1] && 150 t1->dst.u3.all[1] == t2->dst.u3.all[1] &&
152 t1->dst.u3.all[2] == t2->dst.u3.all[2] && 151 t1->dst.u3.all[2] == t2->dst.u3.all[2] &&
153 t1->dst.u3.all[3] == t2->dst.u3.all[3] && 152 t1->dst.u3.all[3] == t2->dst.u3.all[3] &&
154 t1->dst.u.all == t2->dst.u.all && 153 t1->dst.u.all == t2->dst.u.all &&
155 t1->src.l3num == t2->src.l3num &&
156 t1->dst.protonum == t2->dst.protonum); 154 t1->dst.protonum == t2->dst.protonum);
157} 155}
158 156
159static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1, 157static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1,
160 const struct nf_conntrack_tuple *t2) 158 const struct nf_conntrack_tuple *t2)
161{ 159{
162 return nf_ct_tuple_src_equal(t1, t2) && nf_ct_tuple_dst_equal(t1, t2); 160 return __nf_ct_tuple_src_equal(t1, t2) &&
161 __nf_ct_tuple_dst_equal(t1, t2);
163} 162}
164 163
165static inline int nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1, 164static inline int nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1,
@@ -199,7 +198,7 @@ static inline int nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t,
199 const struct nf_conntrack_tuple_mask *mask) 198 const struct nf_conntrack_tuple_mask *mask)
200{ 199{
201 return nf_ct_tuple_src_mask_cmp(t, tuple, mask) && 200 return nf_ct_tuple_src_mask_cmp(t, tuple, mask) &&
202 nf_ct_tuple_dst_equal(t, tuple); 201 __nf_ct_tuple_dst_equal(t, tuple);
203} 202}
204 203
205#endif /* _NF_CONNTRACK_TUPLE_H */ 204#endif /* _NF_CONNTRACK_TUPLE_H */
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h
index 037e82403f91..8c6b5ae45534 100644
--- a/include/net/netfilter/nf_log.h
+++ b/include/net/netfilter/nf_log.h
@@ -54,6 +54,6 @@ void nf_log_packet(int pf,
54 const struct net_device *in, 54 const struct net_device *in,
55 const struct net_device *out, 55 const struct net_device *out,
56 const struct nf_loginfo *li, 56 const struct nf_loginfo *li,
57 const char *fmt, ...); 57 const char *fmt, ...) __attribute__ ((format(printf,7,8)));
58 58
59#endif /* _NF_LOG_H */ 59#endif /* _NF_LOG_H */
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 15a0b052df22..a9b4f6086294 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -27,5 +27,11 @@ struct netns_ipv4 {
27 struct sock *fibnl; 27 struct sock *fibnl;
28 28
29 struct netns_frags frags; 29 struct netns_frags frags;
30#ifdef CONFIG_NETFILTER
31 struct xt_table *iptable_filter;
32 struct xt_table *iptable_mangle;
33 struct xt_table *iptable_raw;
34 struct xt_table *arptable_filter;
35#endif
30}; 36};
31#endif 37#endif
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 187c4248df22..1dd7de4e4195 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -31,5 +31,10 @@ struct netns_ipv6 {
31 struct ipv6_devconf *devconf_all; 31 struct ipv6_devconf *devconf_all;
32 struct ipv6_devconf *devconf_dflt; 32 struct ipv6_devconf *devconf_dflt;
33 struct netns_frags frags; 33 struct netns_frags frags;
34#ifdef CONFIG_NETFILTER
35 struct xt_table *ip6table_filter;
36 struct xt_table *ip6table_mangle;
37 struct xt_table *ip6table_raw;
38#endif
34}; 39};
35#endif 40#endif
diff --git a/include/net/netns/x_tables.h b/include/net/netns/x_tables.h
new file mode 100644
index 000000000000..0cb63ed2c1fc
--- /dev/null
+++ b/include/net/netns/x_tables.h
@@ -0,0 +1,10 @@
1#ifndef __NETNS_X_TABLES_H
2#define __NETNS_X_TABLES_H
3
4#include <linux/list.h>
5#include <linux/net.h>
6
7struct netns_xt {
8 struct list_head tables[NPROTO];
9};
10#endif
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 8716eb757d51..d349c66ef828 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -131,14 +131,14 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts,
131 131
132extern int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb, 132extern int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb,
133 struct nlattr *rate_tlv, struct tcf_exts *exts, 133 struct nlattr *rate_tlv, struct tcf_exts *exts,
134 struct tcf_ext_map *map); 134 const struct tcf_ext_map *map);
135extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); 135extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts);
136extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, 136extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
137 struct tcf_exts *src); 137 struct tcf_exts *src);
138extern int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts, 138extern int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts,
139 struct tcf_ext_map *map); 139 const struct tcf_ext_map *map);
140extern int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts, 140extern int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts,
141 struct tcf_ext_map *map); 141 const struct tcf_ext_map *map);
142 142
143/** 143/**
144 * struct tcf_pkt_info - packet information 144 * struct tcf_pkt_info - packet information
diff --git a/include/net/raw.h b/include/net/raw.h
index cca81d8b2d8b..1828f81fe374 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -41,7 +41,6 @@ extern void raw_proc_exit(void);
41struct raw_iter_state { 41struct raw_iter_state {
42 struct seq_net_private p; 42 struct seq_net_private p;
43 int bucket; 43 int bucket;
44 unsigned short family;
45 struct raw_hashinfo *h; 44 struct raw_hashinfo *h;
46}; 45};
47 46
@@ -49,8 +48,8 @@ struct raw_iter_state {
49void *raw_seq_start(struct seq_file *seq, loff_t *pos); 48void *raw_seq_start(struct seq_file *seq, loff_t *pos);
50void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos); 49void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos);
51void raw_seq_stop(struct seq_file *seq, void *v); 50void raw_seq_stop(struct seq_file *seq, void *v);
52int raw_seq_open(struct inode *ino, struct file *file, struct raw_hashinfo *h, 51int raw_seq_open(struct inode *ino, struct file *file,
53 unsigned short family); 52 struct raw_hashinfo *h, const struct seq_operations *ops);
54 53
55#endif 54#endif
56 55
diff --git a/include/net/route.h b/include/net/route.h
index 4eabf008413b..eadad5901429 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -27,6 +27,7 @@
27#include <net/dst.h> 27#include <net/dst.h>
28#include <net/inetpeer.h> 28#include <net/inetpeer.h>
29#include <net/flow.h> 29#include <net/flow.h>
30#include <net/sock.h>
30#include <linux/in_route.h> 31#include <linux/in_route.h>
31#include <linux/rtnetlink.h> 32#include <linux/rtnetlink.h>
32#include <linux/route.h> 33#include <linux/route.h>
@@ -61,6 +62,7 @@ struct rtable
61 62
62 struct in_device *idev; 63 struct in_device *idev;
63 64
65 int rt_genid;
64 unsigned rt_flags; 66 unsigned rt_flags;
65 __u16 rt_type; 67 __u16 rt_type;
66 68
@@ -149,6 +151,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
149 int flags) 151 int flags)
150{ 152{
151 struct flowi fl = { .oif = oif, 153 struct flowi fl = { .oif = oif,
154 .mark = sk->sk_mark,
152 .nl_u = { .ip4_u = { .daddr = dst, 155 .nl_u = { .ip4_u = { .daddr = dst,
153 .saddr = src, 156 .saddr = src,
154 .tos = tos } }, 157 .tos = tos } },
diff --git a/include/net/sock.h b/include/net/sock.h
index 902324488d0f..e3fb4c047f4c 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -262,6 +262,8 @@ struct sock {
262 __u32 sk_sndmsg_off; 262 __u32 sk_sndmsg_off;
263 int sk_write_pending; 263 int sk_write_pending;
264 void *sk_security; 264 void *sk_security;
265 __u32 sk_mark;
266 /* XXX 4 bytes hole on 64 bit */
265 void (*sk_state_change)(struct sock *sk); 267 void (*sk_state_change)(struct sock *sk);
266 void (*sk_data_ready)(struct sock *sk, int bytes); 268 void (*sk_data_ready)(struct sock *sk, int bytes);
267 void (*sk_write_space)(struct sock *sk); 269 void (*sk_write_space)(struct sock *sk);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 5ebb9ba479b1..ac72116636ca 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -159,6 +159,7 @@ struct xfrm_state
159 struct xfrm_algo *aalg; 159 struct xfrm_algo *aalg;
160 struct xfrm_algo *ealg; 160 struct xfrm_algo *ealg;
161 struct xfrm_algo *calg; 161 struct xfrm_algo *calg;
162 struct xfrm_algo_aead *aead;
162 163
163 /* Data for encapsulator */ 164 /* Data for encapsulator */
164 struct xfrm_encap_tmpl *encap; 165 struct xfrm_encap_tmpl *encap;
@@ -201,7 +202,7 @@ struct xfrm_state
201 202
202 /* Reference to data common to all the instances of this 203 /* Reference to data common to all the instances of this
203 * transformer. */ 204 * transformer. */
204 struct xfrm_type *type; 205 const struct xfrm_type *type;
205 struct xfrm_mode *inner_mode; 206 struct xfrm_mode *inner_mode;
206 struct xfrm_mode *outer_mode; 207 struct xfrm_mode *outer_mode;
207 208
@@ -278,7 +279,7 @@ struct xfrm_state_afinfo {
278 unsigned int proto; 279 unsigned int proto;
279 unsigned int eth_proto; 280 unsigned int eth_proto;
280 struct module *owner; 281 struct module *owner;
281 struct xfrm_type *type_map[IPPROTO_MAX]; 282 const struct xfrm_type *type_map[IPPROTO_MAX];
282 struct xfrm_mode *mode_map[XFRM_MODE_MAX]; 283 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
283 int (*init_flags)(struct xfrm_state *x); 284 int (*init_flags)(struct xfrm_state *x);
284 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, 285 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl,
@@ -321,8 +322,8 @@ struct xfrm_type
321 u32 (*get_mtu)(struct xfrm_state *, int size); 322 u32 (*get_mtu)(struct xfrm_state *, int size);
322}; 323};
323 324
324extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); 325extern int xfrm_register_type(const struct xfrm_type *type, unsigned short family);
325extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); 326extern int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family);
326 327
327struct xfrm_mode { 328struct xfrm_mode {
328 /* 329 /*
@@ -1108,6 +1109,10 @@ static inline int xfrm_id_proto_match(u8 proto, u8 userproto)
1108/* 1109/*
1109 * xfrm algorithm information 1110 * xfrm algorithm information
1110 */ 1111 */
1112struct xfrm_algo_aead_info {
1113 u16 icv_truncbits;
1114};
1115
1111struct xfrm_algo_auth_info { 1116struct xfrm_algo_auth_info {
1112 u16 icv_truncbits; 1117 u16 icv_truncbits;
1113 u16 icv_fullbits; 1118 u16 icv_fullbits;
@@ -1127,6 +1132,7 @@ struct xfrm_algo_desc {
1127 char *compat; 1132 char *compat;
1128 u8 available:1; 1133 u8 available:1;
1129 union { 1134 union {
1135 struct xfrm_algo_aead_info aead;
1130 struct xfrm_algo_auth_info auth; 1136 struct xfrm_algo_auth_info auth;
1131 struct xfrm_algo_encr_info encr; 1137 struct xfrm_algo_encr_info encr;
1132 struct xfrm_algo_comp_info comp; 1138 struct xfrm_algo_comp_info comp;
@@ -1343,6 +1349,8 @@ extern struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id);
1343extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe); 1349extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe);
1344extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); 1350extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe);
1345extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); 1351extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe);
1352extern struct xfrm_algo_desc *xfrm_aead_get_byname(char *name, int icv_len,
1353 int probe);
1346 1354
1347struct hash_desc; 1355struct hash_desc;
1348struct scatterlist; 1356struct scatterlist;
diff --git a/kernel/audit.c b/kernel/audit.c
index f93c2713017d..801c946dd24b 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1200,13 +1200,17 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
1200static inline int audit_expand(struct audit_buffer *ab, int extra) 1200static inline int audit_expand(struct audit_buffer *ab, int extra)
1201{ 1201{
1202 struct sk_buff *skb = ab->skb; 1202 struct sk_buff *skb = ab->skb;
1203 int ret = pskb_expand_head(skb, skb_headroom(skb), extra, 1203 int oldtail = skb_tailroom(skb);
1204 ab->gfp_mask); 1204 int ret = pskb_expand_head(skb, 0, extra, ab->gfp_mask);
1205 int newtail = skb_tailroom(skb);
1206
1205 if (ret < 0) { 1207 if (ret < 0) {
1206 audit_log_lost("out of memory in audit_expand"); 1208 audit_log_lost("out of memory in audit_expand");
1207 return 0; 1209 return 0;
1208 } 1210 }
1209 return skb_tailroom(skb); 1211
1212 skb->truesize += newtail - oldtail;
1213 return newtail;
1210} 1214}
1211 1215
1212/* 1216/*
diff --git a/net/802/tr.c b/net/802/tr.c
index 3f16b1720554..18c66475d8c3 100644
--- a/net/802/tr.c
+++ b/net/802/tr.c
@@ -76,7 +76,7 @@ static DEFINE_SPINLOCK(rif_lock);
76 76
77static struct timer_list rif_timer; 77static struct timer_list rif_timer;
78 78
79int sysctl_tr_rif_timeout = 60*10*HZ; 79static int sysctl_tr_rif_timeout = 60*10*HZ;
80 80
81static inline unsigned long rif_hash(const unsigned char *addr) 81static inline unsigned long rif_hash(const unsigned char *addr)
82{ 82{
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 8059fa42b085..77f04e49a1a0 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -563,6 +563,7 @@ static int vlan_dev_stop(struct net_device *dev)
563 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 563 struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
564 564
565 dev_mc_unsync(real_dev, dev); 565 dev_mc_unsync(real_dev, dev);
566 dev_unicast_unsync(real_dev, dev);
566 if (dev->flags & IFF_ALLMULTI) 567 if (dev->flags & IFF_ALLMULTI)
567 dev_set_allmulti(real_dev, -1); 568 dev_set_allmulti(real_dev, -1);
568 if (dev->flags & IFF_PROMISC) 569 if (dev->flags & IFF_PROMISC)
@@ -634,9 +635,10 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
634 dev_set_promiscuity(real_dev, dev->flags & IFF_PROMISC ? 1 : -1); 635 dev_set_promiscuity(real_dev, dev->flags & IFF_PROMISC ? 1 : -1);
635} 636}
636 637
637static void vlan_dev_set_multicast_list(struct net_device *vlan_dev) 638static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
638{ 639{
639 dev_mc_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev); 640 dev_mc_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev);
641 dev_unicast_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev);
640} 642}
641 643
642/* 644/*
@@ -702,7 +704,8 @@ void vlan_setup(struct net_device *dev)
702 dev->open = vlan_dev_open; 704 dev->open = vlan_dev_open;
703 dev->stop = vlan_dev_stop; 705 dev->stop = vlan_dev_stop;
704 dev->set_mac_address = vlan_dev_set_mac_address; 706 dev->set_mac_address = vlan_dev_set_mac_address;
705 dev->set_multicast_list = vlan_dev_set_multicast_list; 707 dev->set_rx_mode = vlan_dev_set_rx_mode;
708 dev->set_multicast_list = vlan_dev_set_rx_mode;
706 dev->change_rx_flags = vlan_dev_change_rx_flags; 709 dev->change_rx_flags = vlan_dev_change_rx_flags;
707 dev->do_ioctl = vlan_dev_ioctl; 710 dev->do_ioctl = vlan_dev_ioctl;
708 dev->destructor = free_netdev; 711 dev->destructor = free_netdev;
diff --git a/net/9p/conv.c b/net/9p/conv.c
index aa2aa9884f95..3fe35d532c87 100644
--- a/net/9p/conv.c
+++ b/net/9p/conv.c
@@ -128,11 +128,6 @@ static char *buf_put_stringn(struct cbuf *buf, const char *s, u16 slen)
128 return ret; 128 return ret;
129} 129}
130 130
131static inline void buf_put_string(struct cbuf *buf, const char *s)
132{
133 buf_put_stringn(buf, s, strlen(s));
134}
135
136static u8 buf_get_int8(struct cbuf *buf) 131static u8 buf_get_int8(struct cbuf *buf)
137{ 132{
138 u8 ret = 0; 133 u8 ret = 0;
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 1bc0e85f04a5..8fc64e3150a2 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1037,16 +1037,13 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
1037 int err = 0; 1037 int err = 0;
1038 1038
1039 if (addr_len != sizeof(struct sockaddr_ax25) && 1039 if (addr_len != sizeof(struct sockaddr_ax25) &&
1040 addr_len != sizeof(struct full_sockaddr_ax25)) { 1040 addr_len != sizeof(struct full_sockaddr_ax25))
1041 /* support for old structure may go away some time */ 1041 /* support for old structure may go away some time
1042 * ax25_bind(): uses old (6 digipeater) socket structure.
1043 */
1042 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) || 1044 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
1043 (addr_len > sizeof(struct full_sockaddr_ax25))) { 1045 (addr_len > sizeof(struct full_sockaddr_ax25)))
1044 return -EINVAL; 1046 return -EINVAL;
1045 }
1046
1047 printk(KERN_WARNING "ax25_bind(): %s uses old (6 digipeater) socket structure.\n",
1048 current->comm);
1049 }
1050 1047
1051 if (addr->fsa_ax25.sax25_family != AF_AX25) 1048 if (addr->fsa_ax25.sax25_family != AF_AX25)
1052 return -EINVAL; 1049 return -EINVAL;
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 17f7fb720553..e13cf5ef144c 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -12,6 +12,8 @@
12#undef BT_DBG 12#undef BT_DBG
13#define BT_DBG(D...) 13#define BT_DBG(D...)
14#endif 14#endif
15static struct workqueue_struct *btaddconn;
16static struct workqueue_struct *btdelconn;
15 17
16static inline char *typetostr(int type) 18static inline char *typetostr(int type)
17{ 19{
@@ -279,6 +281,8 @@ static void add_conn(struct work_struct *work)
279 struct hci_conn *conn = container_of(work, struct hci_conn, work); 281 struct hci_conn *conn = container_of(work, struct hci_conn, work);
280 int i; 282 int i;
281 283
284 flush_workqueue(btdelconn);
285
282 if (device_add(&conn->dev) < 0) { 286 if (device_add(&conn->dev) < 0) {
283 BT_ERR("Failed to register connection device"); 287 BT_ERR("Failed to register connection device");
284 return; 288 return;
@@ -313,7 +317,7 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
313 317
314 INIT_WORK(&conn->work, add_conn); 318 INIT_WORK(&conn->work, add_conn);
315 319
316 schedule_work(&conn->work); 320 queue_work(btaddconn, &conn->work);
317} 321}
318 322
319static int __match_tty(struct device *dev, void *data) 323static int __match_tty(struct device *dev, void *data)
@@ -349,7 +353,7 @@ void hci_conn_del_sysfs(struct hci_conn *conn)
349 353
350 INIT_WORK(&conn->work, del_conn); 354 INIT_WORK(&conn->work, del_conn);
351 355
352 schedule_work(&conn->work); 356 queue_work(btdelconn, &conn->work);
353} 357}
354 358
355int hci_register_sysfs(struct hci_dev *hdev) 359int hci_register_sysfs(struct hci_dev *hdev)
@@ -398,28 +402,54 @@ int __init bt_sysfs_init(void)
398{ 402{
399 int err; 403 int err;
400 404
405 btaddconn = create_singlethread_workqueue("btaddconn");
406 if (!btaddconn) {
407 err = -ENOMEM;
408 goto out;
409 }
410
411 btdelconn = create_singlethread_workqueue("btdelconn");
412 if (!btdelconn) {
413 err = -ENOMEM;
414 goto out_del;
415 }
416
401 bt_platform = platform_device_register_simple("bluetooth", -1, NULL, 0); 417 bt_platform = platform_device_register_simple("bluetooth", -1, NULL, 0);
402 if (IS_ERR(bt_platform)) 418 if (IS_ERR(bt_platform)) {
403 return PTR_ERR(bt_platform); 419 err = PTR_ERR(bt_platform);
420 goto out_platform;
421 }
404 422
405 err = bus_register(&bt_bus); 423 err = bus_register(&bt_bus);
406 if (err < 0) { 424 if (err < 0)
407 platform_device_unregister(bt_platform); 425 goto out_bus;
408 return err;
409 }
410 426
411 bt_class = class_create(THIS_MODULE, "bluetooth"); 427 bt_class = class_create(THIS_MODULE, "bluetooth");
412 if (IS_ERR(bt_class)) { 428 if (IS_ERR(bt_class)) {
413 bus_unregister(&bt_bus); 429 err = PTR_ERR(bt_class);
414 platform_device_unregister(bt_platform); 430 goto out_class;
415 return PTR_ERR(bt_class);
416 } 431 }
417 432
418 return 0; 433 return 0;
434
435out_class:
436 bus_unregister(&bt_bus);
437out_bus:
438 platform_device_unregister(bt_platform);
439out_platform:
440 destroy_workqueue(btdelconn);
441out_del:
442 destroy_workqueue(btaddconn);
443out:
444 return err;
419} 445}
420 446
421void bt_sysfs_cleanup(void) 447void bt_sysfs_cleanup(void)
422{ 448{
449 destroy_workqueue(btaddconn);
450
451 destroy_workqueue(btdelconn);
452
423 class_destroy(bt_class); 453 class_destroy(bt_class);
424 454
425 bus_unregister(&bt_bus); 455 bus_unregister(&bt_bus);
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 80014bab81b0..1c0efd8ad9f3 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -828,10 +828,6 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff *skb,
828 nf_bridge_pull_encap_header(skb); 828 nf_bridge_pull_encap_header(skb);
829 nf_bridge_save_header(skb); 829 nf_bridge_save_header(skb);
830 830
831#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
832 if (nf_bridge->netoutdev)
833 realoutdev = nf_bridge->netoutdev;
834#endif
835 NF_HOOK(pf, NF_INET_POST_ROUTING, skb, NULL, realoutdev, 831 NF_HOOK(pf, NF_INET_POST_ROUTING, skb, NULL, realoutdev,
836 br_nf_dev_queue_xmit); 832 br_nf_dev_queue_xmit);
837 833
diff --git a/net/bridge/netfilter/ebt_802_3.c b/net/bridge/netfilter/ebt_802_3.c
index 41a78072cd0e..98534025360f 100644
--- a/net/bridge/netfilter/ebt_802_3.c
+++ b/net/bridge/netfilter/ebt_802_3.c
@@ -15,8 +15,8 @@
15static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *in, 15static int ebt_filter_802_3(const struct sk_buff *skb, const struct net_device *in,
16 const struct net_device *out, const void *data, unsigned int datalen) 16 const struct net_device *out, const void *data, unsigned int datalen)
17{ 17{
18 struct ebt_802_3_info *info = (struct ebt_802_3_info *)data; 18 const struct ebt_802_3_info *info = data;
19 struct ebt_802_3_hdr *hdr = ebt_802_3_hdr(skb); 19 const struct ebt_802_3_hdr *hdr = ebt_802_3_hdr(skb);
20 __be16 type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type; 20 __be16 type = hdr->llc.ui.ctrl & IS_UI ? hdr->llc.ui.type : hdr->llc.ni.type;
21 21
22 if (info->bitmask & EBT_802_3_SAP) { 22 if (info->bitmask & EBT_802_3_SAP) {
@@ -40,7 +40,7 @@ static struct ebt_match filter_802_3;
40static int ebt_802_3_check(const char *tablename, unsigned int hookmask, 40static int ebt_802_3_check(const char *tablename, unsigned int hookmask,
41 const struct ebt_entry *e, void *data, unsigned int datalen) 41 const struct ebt_entry *e, void *data, unsigned int datalen)
42{ 42{
43 struct ebt_802_3_info *info = (struct ebt_802_3_info *)data; 43 const struct ebt_802_3_info *info = data;
44 44
45 if (datalen < sizeof(struct ebt_802_3_info)) 45 if (datalen < sizeof(struct ebt_802_3_info))
46 return -EINVAL; 46 return -EINVAL;
@@ -50,8 +50,7 @@ static int ebt_802_3_check(const char *tablename, unsigned int hookmask,
50 return 0; 50 return 0;
51} 51}
52 52
53static struct ebt_match filter_802_3 = 53static struct ebt_match filter_802_3 __read_mostly = {
54{
55 .name = EBT_802_3_MATCH, 54 .name = EBT_802_3_MATCH,
56 .match = ebt_filter_802_3, 55 .match = ebt_filter_802_3,
57 .check = ebt_802_3_check, 56 .check = ebt_802_3_check,
@@ -70,4 +69,5 @@ static void __exit ebt_802_3_fini(void)
70 69
71module_init(ebt_802_3_init); 70module_init(ebt_802_3_init);
72module_exit(ebt_802_3_fini); 71module_exit(ebt_802_3_fini);
72MODULE_DESCRIPTION("Ebtables: DSAP/SSAP field and SNAP type matching");
73MODULE_LICENSE("GPL"); 73MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c
index 6436d30a550e..70b6dca5ea75 100644
--- a/net/bridge/netfilter/ebt_among.c
+++ b/net/bridge/netfilter/ebt_among.c
@@ -25,7 +25,7 @@ static int ebt_mac_wormhash_contains(const struct ebt_mac_wormhash *wh,
25 const struct ebt_mac_wormhash_tuple *p; 25 const struct ebt_mac_wormhash_tuple *p;
26 int start, limit, i; 26 int start, limit, i;
27 uint32_t cmp[2] = { 0, 0 }; 27 uint32_t cmp[2] = { 0, 0 };
28 int key = (const unsigned char) mac[5]; 28 int key = ((const unsigned char *)mac)[5];
29 29
30 memcpy(((char *) cmp) + 2, mac, 6); 30 memcpy(((char *) cmp) + 2, mac, 6);
31 start = wh->table[key]; 31 start = wh->table[key];
@@ -73,15 +73,18 @@ static int ebt_mac_wormhash_check_integrity(const struct ebt_mac_wormhash
73static int get_ip_dst(const struct sk_buff *skb, __be32 *addr) 73static int get_ip_dst(const struct sk_buff *skb, __be32 *addr)
74{ 74{
75 if (eth_hdr(skb)->h_proto == htons(ETH_P_IP)) { 75 if (eth_hdr(skb)->h_proto == htons(ETH_P_IP)) {
76 struct iphdr _iph, *ih; 76 const struct iphdr *ih;
77 struct iphdr _iph;
77 78
78 ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph); 79 ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph);
79 if (ih == NULL) 80 if (ih == NULL)
80 return -1; 81 return -1;
81 *addr = ih->daddr; 82 *addr = ih->daddr;
82 } else if (eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) { 83 } else if (eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
83 struct arphdr _arph, *ah; 84 const struct arphdr *ah;
84 __be32 buf, *bp; 85 struct arphdr _arph;
86 const __be32 *bp;
87 __be32 buf;
85 88
86 ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph); 89 ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph);
87 if (ah == NULL || 90 if (ah == NULL ||
@@ -101,15 +104,18 @@ static int get_ip_dst(const struct sk_buff *skb, __be32 *addr)
101static int get_ip_src(const struct sk_buff *skb, __be32 *addr) 104static int get_ip_src(const struct sk_buff *skb, __be32 *addr)
102{ 105{
103 if (eth_hdr(skb)->h_proto == htons(ETH_P_IP)) { 106 if (eth_hdr(skb)->h_proto == htons(ETH_P_IP)) {
104 struct iphdr _iph, *ih; 107 const struct iphdr *ih;
108 struct iphdr _iph;
105 109
106 ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph); 110 ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph);
107 if (ih == NULL) 111 if (ih == NULL)
108 return -1; 112 return -1;
109 *addr = ih->saddr; 113 *addr = ih->saddr;
110 } else if (eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) { 114 } else if (eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
111 struct arphdr _arph, *ah; 115 const struct arphdr *ah;
112 __be32 buf, *bp; 116 struct arphdr _arph;
117 const __be32 *bp;
118 __be32 buf;
113 119
114 ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph); 120 ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph);
115 if (ah == NULL || 121 if (ah == NULL ||
@@ -130,7 +136,7 @@ static int ebt_filter_among(const struct sk_buff *skb,
130 const struct net_device *out, const void *data, 136 const struct net_device *out, const void *data,
131 unsigned int datalen) 137 unsigned int datalen)
132{ 138{
133 struct ebt_among_info *info = (struct ebt_among_info *) data; 139 const struct ebt_among_info *info = data;
134 const char *dmac, *smac; 140 const char *dmac, *smac;
135 const struct ebt_mac_wormhash *wh_dst, *wh_src; 141 const struct ebt_mac_wormhash *wh_dst, *wh_src;
136 __be32 dip = 0, sip = 0; 142 __be32 dip = 0, sip = 0;
@@ -175,7 +181,7 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask,
175 const struct ebt_entry *e, void *data, 181 const struct ebt_entry *e, void *data,
176 unsigned int datalen) 182 unsigned int datalen)
177{ 183{
178 struct ebt_among_info *info = (struct ebt_among_info *) data; 184 const struct ebt_among_info *info = data;
179 int expected_length = sizeof(struct ebt_among_info); 185 int expected_length = sizeof(struct ebt_among_info);
180 const struct ebt_mac_wormhash *wh_dst, *wh_src; 186 const struct ebt_mac_wormhash *wh_dst, *wh_src;
181 int err; 187 int err;
@@ -206,7 +212,7 @@ static int ebt_among_check(const char *tablename, unsigned int hookmask,
206 return 0; 212 return 0;
207} 213}
208 214
209static struct ebt_match filter_among = { 215static struct ebt_match filter_among __read_mostly = {
210 .name = EBT_AMONG_MATCH, 216 .name = EBT_AMONG_MATCH,
211 .match = ebt_filter_among, 217 .match = ebt_filter_among,
212 .check = ebt_among_check, 218 .check = ebt_among_check,
@@ -225,4 +231,5 @@ static void __exit ebt_among_fini(void)
225 231
226module_init(ebt_among_init); 232module_init(ebt_among_init);
227module_exit(ebt_among_fini); 233module_exit(ebt_among_fini);
234MODULE_DESCRIPTION("Ebtables: Combined MAC/IP address list matching");
228MODULE_LICENSE("GPL"); 235MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_arp.c b/net/bridge/netfilter/ebt_arp.c
index 18141392a9b4..7c535be75665 100644
--- a/net/bridge/netfilter/ebt_arp.c
+++ b/net/bridge/netfilter/ebt_arp.c
@@ -18,8 +18,9 @@
18static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in, 18static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in,
19 const struct net_device *out, const void *data, unsigned int datalen) 19 const struct net_device *out, const void *data, unsigned int datalen)
20{ 20{
21 struct ebt_arp_info *info = (struct ebt_arp_info *)data; 21 const struct ebt_arp_info *info = data;
22 struct arphdr _arph, *ah; 22 const struct arphdr *ah;
23 struct arphdr _arph;
23 24
24 ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph); 25 ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph);
25 if (ah == NULL) 26 if (ah == NULL)
@@ -35,7 +36,8 @@ static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in
35 return EBT_NOMATCH; 36 return EBT_NOMATCH;
36 37
37 if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_GRAT)) { 38 if (info->bitmask & (EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_GRAT)) {
38 __be32 saddr, daddr, *sap, *dap; 39 const __be32 *sap, *dap;
40 __be32 saddr, daddr;
39 41
40 if (ah->ar_pln != sizeof(__be32) || ah->ar_pro != htons(ETH_P_IP)) 42 if (ah->ar_pln != sizeof(__be32) || ah->ar_pro != htons(ETH_P_IP))
41 return EBT_NOMATCH; 43 return EBT_NOMATCH;
@@ -61,7 +63,8 @@ static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in
61 } 63 }
62 64
63 if (info->bitmask & (EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC)) { 65 if (info->bitmask & (EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC)) {
64 unsigned char _mac[ETH_ALEN], *mp; 66 const unsigned char *mp;
67 unsigned char _mac[ETH_ALEN];
65 uint8_t verdict, i; 68 uint8_t verdict, i;
66 69
67 if (ah->ar_hln != ETH_ALEN || ah->ar_hrd != htons(ARPHRD_ETHER)) 70 if (ah->ar_hln != ETH_ALEN || ah->ar_hrd != htons(ARPHRD_ETHER))
@@ -100,7 +103,7 @@ static int ebt_filter_arp(const struct sk_buff *skb, const struct net_device *in
100static int ebt_arp_check(const char *tablename, unsigned int hookmask, 103static int ebt_arp_check(const char *tablename, unsigned int hookmask,
101 const struct ebt_entry *e, void *data, unsigned int datalen) 104 const struct ebt_entry *e, void *data, unsigned int datalen)
102{ 105{
103 struct ebt_arp_info *info = (struct ebt_arp_info *)data; 106 const struct ebt_arp_info *info = data;
104 107
105 if (datalen != EBT_ALIGN(sizeof(struct ebt_arp_info))) 108 if (datalen != EBT_ALIGN(sizeof(struct ebt_arp_info)))
106 return -EINVAL; 109 return -EINVAL;
@@ -113,8 +116,7 @@ static int ebt_arp_check(const char *tablename, unsigned int hookmask,
113 return 0; 116 return 0;
114} 117}
115 118
116static struct ebt_match filter_arp = 119static struct ebt_match filter_arp __read_mostly = {
117{
118 .name = EBT_ARP_MATCH, 120 .name = EBT_ARP_MATCH,
119 .match = ebt_filter_arp, 121 .match = ebt_filter_arp,
120 .check = ebt_arp_check, 122 .check = ebt_arp_check,
@@ -133,4 +135,5 @@ static void __exit ebt_arp_fini(void)
133 135
134module_init(ebt_arp_init); 136module_init(ebt_arp_init);
135module_exit(ebt_arp_fini); 137module_exit(ebt_arp_fini);
138MODULE_DESCRIPTION("Ebtables: ARP protocol packet match");
136MODULE_LICENSE("GPL"); 139MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_arpreply.c b/net/bridge/netfilter/ebt_arpreply.c
index 48a80e423287..0c4279590fc7 100644
--- a/net/bridge/netfilter/ebt_arpreply.c
+++ b/net/bridge/netfilter/ebt_arpreply.c
@@ -19,10 +19,13 @@ static int ebt_target_reply(struct sk_buff *skb, unsigned int hooknr,
19 const struct net_device *in, const struct net_device *out, 19 const struct net_device *in, const struct net_device *out,
20 const void *data, unsigned int datalen) 20 const void *data, unsigned int datalen)
21{ 21{
22 struct ebt_arpreply_info *info = (struct ebt_arpreply_info *)data; 22 struct ebt_arpreply_info *info = (void *)data;
23 __be32 _sip, *siptr, _dip, *diptr; 23 const __be32 *siptr, *diptr;
24 struct arphdr _ah, *ap; 24 __be32 _sip, _dip;
25 unsigned char _sha[ETH_ALEN], *shp; 25 const struct arphdr *ap;
26 struct arphdr _ah;
27 const unsigned char *shp;
28 unsigned char _sha[ETH_ALEN];
26 29
27 ap = skb_header_pointer(skb, 0, sizeof(_ah), &_ah); 30 ap = skb_header_pointer(skb, 0, sizeof(_ah), &_ah);
28 if (ap == NULL) 31 if (ap == NULL)
@@ -58,7 +61,7 @@ static int ebt_target_reply(struct sk_buff *skb, unsigned int hooknr,
58static int ebt_target_reply_check(const char *tablename, unsigned int hookmask, 61static int ebt_target_reply_check(const char *tablename, unsigned int hookmask,
59 const struct ebt_entry *e, void *data, unsigned int datalen) 62 const struct ebt_entry *e, void *data, unsigned int datalen)
60{ 63{
61 struct ebt_arpreply_info *info = (struct ebt_arpreply_info *)data; 64 const struct ebt_arpreply_info *info = data;
62 65
63 if (datalen != EBT_ALIGN(sizeof(struct ebt_arpreply_info))) 66 if (datalen != EBT_ALIGN(sizeof(struct ebt_arpreply_info)))
64 return -EINVAL; 67 return -EINVAL;
@@ -73,8 +76,7 @@ static int ebt_target_reply_check(const char *tablename, unsigned int hookmask,
73 return 0; 76 return 0;
74} 77}
75 78
76static struct ebt_target reply_target = 79static struct ebt_target reply_target __read_mostly = {
77{
78 .name = EBT_ARPREPLY_TARGET, 80 .name = EBT_ARPREPLY_TARGET,
79 .target = ebt_target_reply, 81 .target = ebt_target_reply,
80 .check = ebt_target_reply_check, 82 .check = ebt_target_reply_check,
@@ -93,4 +95,5 @@ static void __exit ebt_arpreply_fini(void)
93 95
94module_init(ebt_arpreply_init); 96module_init(ebt_arpreply_init);
95module_exit(ebt_arpreply_fini); 97module_exit(ebt_arpreply_fini);
98MODULE_DESCRIPTION("Ebtables: ARP reply target");
96MODULE_LICENSE("GPL"); 99MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_dnat.c b/net/bridge/netfilter/ebt_dnat.c
index 74262e9a566a..e700cbf634c2 100644
--- a/net/bridge/netfilter/ebt_dnat.c
+++ b/net/bridge/netfilter/ebt_dnat.c
@@ -18,7 +18,7 @@ static int ebt_target_dnat(struct sk_buff *skb, unsigned int hooknr,
18 const struct net_device *in, const struct net_device *out, 18 const struct net_device *in, const struct net_device *out,
19 const void *data, unsigned int datalen) 19 const void *data, unsigned int datalen)
20{ 20{
21 struct ebt_nat_info *info = (struct ebt_nat_info *)data; 21 const struct ebt_nat_info *info = data;
22 22
23 if (skb_make_writable(skb, 0)) 23 if (skb_make_writable(skb, 0))
24 return NF_DROP; 24 return NF_DROP;
@@ -30,7 +30,7 @@ static int ebt_target_dnat(struct sk_buff *skb, unsigned int hooknr,
30static int ebt_target_dnat_check(const char *tablename, unsigned int hookmask, 30static int ebt_target_dnat_check(const char *tablename, unsigned int hookmask,
31 const struct ebt_entry *e, void *data, unsigned int datalen) 31 const struct ebt_entry *e, void *data, unsigned int datalen)
32{ 32{
33 struct ebt_nat_info *info = (struct ebt_nat_info *)data; 33 const struct ebt_nat_info *info = data;
34 34
35 if (BASE_CHAIN && info->target == EBT_RETURN) 35 if (BASE_CHAIN && info->target == EBT_RETURN)
36 return -EINVAL; 36 return -EINVAL;
@@ -46,8 +46,7 @@ static int ebt_target_dnat_check(const char *tablename, unsigned int hookmask,
46 return 0; 46 return 0;
47} 47}
48 48
49static struct ebt_target dnat = 49static struct ebt_target dnat __read_mostly = {
50{
51 .name = EBT_DNAT_TARGET, 50 .name = EBT_DNAT_TARGET,
52 .target = ebt_target_dnat, 51 .target = ebt_target_dnat,
53 .check = ebt_target_dnat_check, 52 .check = ebt_target_dnat_check,
@@ -66,4 +65,5 @@ static void __exit ebt_dnat_fini(void)
66 65
67module_init(ebt_dnat_init); 66module_init(ebt_dnat_init);
68module_exit(ebt_dnat_fini); 67module_exit(ebt_dnat_fini);
68MODULE_DESCRIPTION("Ebtables: Destination MAC address translation");
69MODULE_LICENSE("GPL"); 69MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_ip.c b/net/bridge/netfilter/ebt_ip.c
index 69f7f0ab9c76..65caa00dcf2a 100644
--- a/net/bridge/netfilter/ebt_ip.c
+++ b/net/bridge/netfilter/ebt_ip.c
@@ -28,9 +28,11 @@ static int ebt_filter_ip(const struct sk_buff *skb, const struct net_device *in,
28 const struct net_device *out, const void *data, 28 const struct net_device *out, const void *data,
29 unsigned int datalen) 29 unsigned int datalen)
30{ 30{
31 struct ebt_ip_info *info = (struct ebt_ip_info *)data; 31 const struct ebt_ip_info *info = data;
32 struct iphdr _iph, *ih; 32 const struct iphdr *ih;
33 struct tcpudphdr _ports, *pptr; 33 struct iphdr _iph;
34 const struct tcpudphdr *pptr;
35 struct tcpudphdr _ports;
34 36
35 ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph); 37 ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph);
36 if (ih == NULL) 38 if (ih == NULL)
@@ -79,7 +81,7 @@ static int ebt_filter_ip(const struct sk_buff *skb, const struct net_device *in,
79static int ebt_ip_check(const char *tablename, unsigned int hookmask, 81static int ebt_ip_check(const char *tablename, unsigned int hookmask,
80 const struct ebt_entry *e, void *data, unsigned int datalen) 82 const struct ebt_entry *e, void *data, unsigned int datalen)
81{ 83{
82 struct ebt_ip_info *info = (struct ebt_ip_info *)data; 84 const struct ebt_ip_info *info = data;
83 85
84 if (datalen != EBT_ALIGN(sizeof(struct ebt_ip_info))) 86 if (datalen != EBT_ALIGN(sizeof(struct ebt_ip_info)))
85 return -EINVAL; 87 return -EINVAL;
@@ -105,8 +107,7 @@ static int ebt_ip_check(const char *tablename, unsigned int hookmask,
105 return 0; 107 return 0;
106} 108}
107 109
108static struct ebt_match filter_ip = 110static struct ebt_match filter_ip __read_mostly = {
109{
110 .name = EBT_IP_MATCH, 111 .name = EBT_IP_MATCH,
111 .match = ebt_filter_ip, 112 .match = ebt_filter_ip,
112 .check = ebt_ip_check, 113 .check = ebt_ip_check,
@@ -125,4 +126,5 @@ static void __exit ebt_ip_fini(void)
125 126
126module_init(ebt_ip_init); 127module_init(ebt_ip_init);
127module_exit(ebt_ip_fini); 128module_exit(ebt_ip_fini);
129MODULE_DESCRIPTION("Ebtables: IPv4 protocol packet match");
128MODULE_LICENSE("GPL"); 130MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_limit.c b/net/bridge/netfilter/ebt_limit.c
index d48fa5cb26cf..8cbdc01c253e 100644
--- a/net/bridge/netfilter/ebt_limit.c
+++ b/net/bridge/netfilter/ebt_limit.c
@@ -69,7 +69,7 @@ user2credits(u_int32_t user)
69static int ebt_limit_check(const char *tablename, unsigned int hookmask, 69static int ebt_limit_check(const char *tablename, unsigned int hookmask,
70 const struct ebt_entry *e, void *data, unsigned int datalen) 70 const struct ebt_entry *e, void *data, unsigned int datalen)
71{ 71{
72 struct ebt_limit_info *info = (struct ebt_limit_info *)data; 72 struct ebt_limit_info *info = data;
73 73
74 if (datalen != EBT_ALIGN(sizeof(struct ebt_limit_info))) 74 if (datalen != EBT_ALIGN(sizeof(struct ebt_limit_info)))
75 return -EINVAL; 75 return -EINVAL;
@@ -90,8 +90,7 @@ static int ebt_limit_check(const char *tablename, unsigned int hookmask,
90 return 0; 90 return 0;
91} 91}
92 92
93static struct ebt_match ebt_limit_reg = 93static struct ebt_match ebt_limit_reg __read_mostly = {
94{
95 .name = EBT_LIMIT_MATCH, 94 .name = EBT_LIMIT_MATCH,
96 .match = ebt_limit_match, 95 .match = ebt_limit_match,
97 .check = ebt_limit_check, 96 .check = ebt_limit_check,
@@ -110,4 +109,5 @@ static void __exit ebt_limit_fini(void)
110 109
111module_init(ebt_limit_init); 110module_init(ebt_limit_init);
112module_exit(ebt_limit_fini); 111module_exit(ebt_limit_fini);
112MODULE_DESCRIPTION("Ebtables: Rate-limit match");
113MODULE_LICENSE("GPL"); 113MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_log.c b/net/bridge/netfilter/ebt_log.c
index 3be9e9898553..0b209e4aad0a 100644
--- a/net/bridge/netfilter/ebt_log.c
+++ b/net/bridge/netfilter/ebt_log.c
@@ -24,7 +24,7 @@ static DEFINE_SPINLOCK(ebt_log_lock);
24static int ebt_log_check(const char *tablename, unsigned int hookmask, 24static int ebt_log_check(const char *tablename, unsigned int hookmask,
25 const struct ebt_entry *e, void *data, unsigned int datalen) 25 const struct ebt_entry *e, void *data, unsigned int datalen)
26{ 26{
27 struct ebt_log_info *info = (struct ebt_log_info *)data; 27 struct ebt_log_info *info = data;
28 28
29 if (datalen != EBT_ALIGN(sizeof(struct ebt_log_info))) 29 if (datalen != EBT_ALIGN(sizeof(struct ebt_log_info)))
30 return -EINVAL; 30 return -EINVAL;
@@ -50,7 +50,7 @@ struct arppayload
50 unsigned char ip_dst[4]; 50 unsigned char ip_dst[4];
51}; 51};
52 52
53static void print_MAC(unsigned char *p) 53static void print_MAC(const unsigned char *p)
54{ 54{
55 int i; 55 int i;
56 56
@@ -84,7 +84,8 @@ ebt_log_packet(unsigned int pf, unsigned int hooknum,
84 84
85 if ((bitmask & EBT_LOG_IP) && eth_hdr(skb)->h_proto == 85 if ((bitmask & EBT_LOG_IP) && eth_hdr(skb)->h_proto ==
86 htons(ETH_P_IP)){ 86 htons(ETH_P_IP)){
87 struct iphdr _iph, *ih; 87 const struct iphdr *ih;
88 struct iphdr _iph;
88 89
89 ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph); 90 ih = skb_header_pointer(skb, 0, sizeof(_iph), &_iph);
90 if (ih == NULL) { 91 if (ih == NULL) {
@@ -99,7 +100,8 @@ ebt_log_packet(unsigned int pf, unsigned int hooknum,
99 ih->protocol == IPPROTO_UDPLITE || 100 ih->protocol == IPPROTO_UDPLITE ||
100 ih->protocol == IPPROTO_SCTP || 101 ih->protocol == IPPROTO_SCTP ||
101 ih->protocol == IPPROTO_DCCP) { 102 ih->protocol == IPPROTO_DCCP) {
102 struct tcpudphdr _ports, *pptr; 103 const struct tcpudphdr *pptr;
104 struct tcpudphdr _ports;
103 105
104 pptr = skb_header_pointer(skb, ih->ihl*4, 106 pptr = skb_header_pointer(skb, ih->ihl*4,
105 sizeof(_ports), &_ports); 107 sizeof(_ports), &_ports);
@@ -116,7 +118,8 @@ ebt_log_packet(unsigned int pf, unsigned int hooknum,
116 if ((bitmask & EBT_LOG_ARP) && 118 if ((bitmask & EBT_LOG_ARP) &&
117 ((eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) || 119 ((eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) ||
118 (eth_hdr(skb)->h_proto == htons(ETH_P_RARP)))) { 120 (eth_hdr(skb)->h_proto == htons(ETH_P_RARP)))) {
119 struct arphdr _arph, *ah; 121 const struct arphdr *ah;
122 struct arphdr _arph;
120 123
121 ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph); 124 ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph);
122 if (ah == NULL) { 125 if (ah == NULL) {
@@ -132,7 +135,8 @@ ebt_log_packet(unsigned int pf, unsigned int hooknum,
132 if (ah->ar_hrd == htons(1) && 135 if (ah->ar_hrd == htons(1) &&
133 ah->ar_hln == ETH_ALEN && 136 ah->ar_hln == ETH_ALEN &&
134 ah->ar_pln == sizeof(__be32)) { 137 ah->ar_pln == sizeof(__be32)) {
135 struct arppayload _arpp, *ap; 138 const struct arppayload *ap;
139 struct arppayload _arpp;
136 140
137 ap = skb_header_pointer(skb, sizeof(_arph), 141 ap = skb_header_pointer(skb, sizeof(_arph),
138 sizeof(_arpp), &_arpp); 142 sizeof(_arpp), &_arpp);
@@ -160,7 +164,7 @@ static void ebt_log(const struct sk_buff *skb, unsigned int hooknr,
160 const struct net_device *in, const struct net_device *out, 164 const struct net_device *in, const struct net_device *out,
161 const void *data, unsigned int datalen) 165 const void *data, unsigned int datalen)
162{ 166{
163 struct ebt_log_info *info = (struct ebt_log_info *)data; 167 const struct ebt_log_info *info = data;
164 struct nf_loginfo li; 168 struct nf_loginfo li;
165 169
166 li.type = NF_LOG_TYPE_LOG; 170 li.type = NF_LOG_TYPE_LOG;
@@ -208,4 +212,5 @@ static void __exit ebt_log_fini(void)
208 212
209module_init(ebt_log_init); 213module_init(ebt_log_init);
210module_exit(ebt_log_fini); 214module_exit(ebt_log_fini);
215MODULE_DESCRIPTION("Ebtables: Packet logging to syslog");
211MODULE_LICENSE("GPL"); 216MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_mark.c b/net/bridge/netfilter/ebt_mark.c
index 6cba54309c09..36723f47db0a 100644
--- a/net/bridge/netfilter/ebt_mark.c
+++ b/net/bridge/netfilter/ebt_mark.c
@@ -21,7 +21,7 @@ static int ebt_target_mark(struct sk_buff *skb, unsigned int hooknr,
21 const struct net_device *in, const struct net_device *out, 21 const struct net_device *in, const struct net_device *out,
22 const void *data, unsigned int datalen) 22 const void *data, unsigned int datalen)
23{ 23{
24 struct ebt_mark_t_info *info = (struct ebt_mark_t_info *)data; 24 const struct ebt_mark_t_info *info = data;
25 int action = info->target & -16; 25 int action = info->target & -16;
26 26
27 if (action == MARK_SET_VALUE) 27 if (action == MARK_SET_VALUE)
@@ -39,7 +39,7 @@ static int ebt_target_mark(struct sk_buff *skb, unsigned int hooknr,
39static int ebt_target_mark_check(const char *tablename, unsigned int hookmask, 39static int ebt_target_mark_check(const char *tablename, unsigned int hookmask,
40 const struct ebt_entry *e, void *data, unsigned int datalen) 40 const struct ebt_entry *e, void *data, unsigned int datalen)
41{ 41{
42 struct ebt_mark_t_info *info = (struct ebt_mark_t_info *)data; 42 const struct ebt_mark_t_info *info = data;
43 int tmp; 43 int tmp;
44 44
45 if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_t_info))) 45 if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_t_info)))
@@ -57,8 +57,7 @@ static int ebt_target_mark_check(const char *tablename, unsigned int hookmask,
57 return 0; 57 return 0;
58} 58}
59 59
60static struct ebt_target mark_target = 60static struct ebt_target mark_target __read_mostly = {
61{
62 .name = EBT_MARK_TARGET, 61 .name = EBT_MARK_TARGET,
63 .target = ebt_target_mark, 62 .target = ebt_target_mark,
64 .check = ebt_target_mark_check, 63 .check = ebt_target_mark_check,
@@ -77,4 +76,5 @@ static void __exit ebt_mark_fini(void)
77 76
78module_init(ebt_mark_init); 77module_init(ebt_mark_init);
79module_exit(ebt_mark_fini); 78module_exit(ebt_mark_fini);
79MODULE_DESCRIPTION("Ebtables: Packet mark modification");
80MODULE_LICENSE("GPL"); 80MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_mark_m.c b/net/bridge/netfilter/ebt_mark_m.c
index 6b0d2169af74..9b0a4543861f 100644
--- a/net/bridge/netfilter/ebt_mark_m.c
+++ b/net/bridge/netfilter/ebt_mark_m.c
@@ -16,7 +16,7 @@ static int ebt_filter_mark(const struct sk_buff *skb,
16 const struct net_device *in, const struct net_device *out, const void *data, 16 const struct net_device *in, const struct net_device *out, const void *data,
17 unsigned int datalen) 17 unsigned int datalen)
18{ 18{
19 struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data; 19 const struct ebt_mark_m_info *info = data;
20 20
21 if (info->bitmask & EBT_MARK_OR) 21 if (info->bitmask & EBT_MARK_OR)
22 return !(!!(skb->mark & info->mask) ^ info->invert); 22 return !(!!(skb->mark & info->mask) ^ info->invert);
@@ -26,7 +26,7 @@ static int ebt_filter_mark(const struct sk_buff *skb,
26static int ebt_mark_check(const char *tablename, unsigned int hookmask, 26static int ebt_mark_check(const char *tablename, unsigned int hookmask,
27 const struct ebt_entry *e, void *data, unsigned int datalen) 27 const struct ebt_entry *e, void *data, unsigned int datalen)
28{ 28{
29 struct ebt_mark_m_info *info = (struct ebt_mark_m_info *) data; 29 const struct ebt_mark_m_info *info = data;
30 30
31 if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_m_info))) 31 if (datalen != EBT_ALIGN(sizeof(struct ebt_mark_m_info)))
32 return -EINVAL; 32 return -EINVAL;
@@ -39,8 +39,7 @@ static int ebt_mark_check(const char *tablename, unsigned int hookmask,
39 return 0; 39 return 0;
40} 40}
41 41
42static struct ebt_match filter_mark = 42static struct ebt_match filter_mark __read_mostly = {
43{
44 .name = EBT_MARK_MATCH, 43 .name = EBT_MARK_MATCH,
45 .match = ebt_filter_mark, 44 .match = ebt_filter_mark,
46 .check = ebt_mark_check, 45 .check = ebt_mark_check,
@@ -59,4 +58,5 @@ static void __exit ebt_mark_m_fini(void)
59 58
60module_init(ebt_mark_m_init); 59module_init(ebt_mark_m_init);
61module_exit(ebt_mark_m_fini); 60module_exit(ebt_mark_m_fini);
61MODULE_DESCRIPTION("Ebtables: Packet mark match");
62MODULE_LICENSE("GPL"); 62MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_pkttype.c b/net/bridge/netfilter/ebt_pkttype.c
index 4fffd70e4da7..676db32df3d1 100644
--- a/net/bridge/netfilter/ebt_pkttype.c
+++ b/net/bridge/netfilter/ebt_pkttype.c
@@ -18,7 +18,7 @@ static int ebt_filter_pkttype(const struct sk_buff *skb,
18 const void *data, 18 const void *data,
19 unsigned int datalen) 19 unsigned int datalen)
20{ 20{
21 struct ebt_pkttype_info *info = (struct ebt_pkttype_info *)data; 21 const struct ebt_pkttype_info *info = data;
22 22
23 return (skb->pkt_type != info->pkt_type) ^ info->invert; 23 return (skb->pkt_type != info->pkt_type) ^ info->invert;
24} 24}
@@ -26,7 +26,7 @@ static int ebt_filter_pkttype(const struct sk_buff *skb,
26static int ebt_pkttype_check(const char *tablename, unsigned int hookmask, 26static int ebt_pkttype_check(const char *tablename, unsigned int hookmask,
27 const struct ebt_entry *e, void *data, unsigned int datalen) 27 const struct ebt_entry *e, void *data, unsigned int datalen)
28{ 28{
29 struct ebt_pkttype_info *info = (struct ebt_pkttype_info *)data; 29 const struct ebt_pkttype_info *info = data;
30 30
31 if (datalen != EBT_ALIGN(sizeof(struct ebt_pkttype_info))) 31 if (datalen != EBT_ALIGN(sizeof(struct ebt_pkttype_info)))
32 return -EINVAL; 32 return -EINVAL;
@@ -36,8 +36,7 @@ static int ebt_pkttype_check(const char *tablename, unsigned int hookmask,
36 return 0; 36 return 0;
37} 37}
38 38
39static struct ebt_match filter_pkttype = 39static struct ebt_match filter_pkttype __read_mostly = {
40{
41 .name = EBT_PKTTYPE_MATCH, 40 .name = EBT_PKTTYPE_MATCH,
42 .match = ebt_filter_pkttype, 41 .match = ebt_filter_pkttype,
43 .check = ebt_pkttype_check, 42 .check = ebt_pkttype_check,
@@ -56,4 +55,5 @@ static void __exit ebt_pkttype_fini(void)
56 55
57module_init(ebt_pkttype_init); 56module_init(ebt_pkttype_init);
58module_exit(ebt_pkttype_fini); 57module_exit(ebt_pkttype_fini);
58MODULE_DESCRIPTION("Ebtables: Link layer packet type match");
59MODULE_LICENSE("GPL"); 59MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_redirect.c b/net/bridge/netfilter/ebt_redirect.c
index 422cb834cff9..bfdf2fb60b1f 100644
--- a/net/bridge/netfilter/ebt_redirect.c
+++ b/net/bridge/netfilter/ebt_redirect.c
@@ -19,7 +19,7 @@ static int ebt_target_redirect(struct sk_buff *skb, unsigned int hooknr,
19 const struct net_device *in, const struct net_device *out, 19 const struct net_device *in, const struct net_device *out,
20 const void *data, unsigned int datalen) 20 const void *data, unsigned int datalen)
21{ 21{
22 struct ebt_redirect_info *info = (struct ebt_redirect_info *)data; 22 const struct ebt_redirect_info *info = data;
23 23
24 if (skb_make_writable(skb, 0)) 24 if (skb_make_writable(skb, 0))
25 return NF_DROP; 25 return NF_DROP;
@@ -36,7 +36,7 @@ static int ebt_target_redirect(struct sk_buff *skb, unsigned int hooknr,
36static int ebt_target_redirect_check(const char *tablename, unsigned int hookmask, 36static int ebt_target_redirect_check(const char *tablename, unsigned int hookmask,
37 const struct ebt_entry *e, void *data, unsigned int datalen) 37 const struct ebt_entry *e, void *data, unsigned int datalen)
38{ 38{
39 struct ebt_redirect_info *info = (struct ebt_redirect_info *)data; 39 const struct ebt_redirect_info *info = data;
40 40
41 if (datalen != EBT_ALIGN(sizeof(struct ebt_redirect_info))) 41 if (datalen != EBT_ALIGN(sizeof(struct ebt_redirect_info)))
42 return -EINVAL; 42 return -EINVAL;
@@ -51,8 +51,7 @@ static int ebt_target_redirect_check(const char *tablename, unsigned int hookmas
51 return 0; 51 return 0;
52} 52}
53 53
54static struct ebt_target redirect_target = 54static struct ebt_target redirect_target __read_mostly = {
55{
56 .name = EBT_REDIRECT_TARGET, 55 .name = EBT_REDIRECT_TARGET,
57 .target = ebt_target_redirect, 56 .target = ebt_target_redirect,
58 .check = ebt_target_redirect_check, 57 .check = ebt_target_redirect_check,
@@ -71,4 +70,5 @@ static void __exit ebt_redirect_fini(void)
71 70
72module_init(ebt_redirect_init); 71module_init(ebt_redirect_init);
73module_exit(ebt_redirect_fini); 72module_exit(ebt_redirect_fini);
73MODULE_DESCRIPTION("Ebtables: Packet redirection to localhost");
74MODULE_LICENSE("GPL"); 74MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_snat.c b/net/bridge/netfilter/ebt_snat.c
index 425ac920904d..e252dabbb143 100644
--- a/net/bridge/netfilter/ebt_snat.c
+++ b/net/bridge/netfilter/ebt_snat.c
@@ -20,7 +20,7 @@ static int ebt_target_snat(struct sk_buff *skb, unsigned int hooknr,
20 const struct net_device *in, const struct net_device *out, 20 const struct net_device *in, const struct net_device *out,
21 const void *data, unsigned int datalen) 21 const void *data, unsigned int datalen)
22{ 22{
23 struct ebt_nat_info *info = (struct ebt_nat_info *) data; 23 const struct ebt_nat_info *info = data;
24 24
25 if (skb_make_writable(skb, 0)) 25 if (skb_make_writable(skb, 0))
26 return NF_DROP; 26 return NF_DROP;
@@ -28,7 +28,8 @@ static int ebt_target_snat(struct sk_buff *skb, unsigned int hooknr,
28 memcpy(eth_hdr(skb)->h_source, info->mac, ETH_ALEN); 28 memcpy(eth_hdr(skb)->h_source, info->mac, ETH_ALEN);
29 if (!(info->target & NAT_ARP_BIT) && 29 if (!(info->target & NAT_ARP_BIT) &&
30 eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) { 30 eth_hdr(skb)->h_proto == htons(ETH_P_ARP)) {
31 struct arphdr _ah, *ap; 31 const struct arphdr *ap;
32 struct arphdr _ah;
32 33
33 ap = skb_header_pointer(skb, 0, sizeof(_ah), &_ah); 34 ap = skb_header_pointer(skb, 0, sizeof(_ah), &_ah);
34 if (ap == NULL) 35 if (ap == NULL)
@@ -45,7 +46,7 @@ out:
45static int ebt_target_snat_check(const char *tablename, unsigned int hookmask, 46static int ebt_target_snat_check(const char *tablename, unsigned int hookmask,
46 const struct ebt_entry *e, void *data, unsigned int datalen) 47 const struct ebt_entry *e, void *data, unsigned int datalen)
47{ 48{
48 struct ebt_nat_info *info = (struct ebt_nat_info *) data; 49 const struct ebt_nat_info *info = data;
49 int tmp; 50 int tmp;
50 51
51 if (datalen != EBT_ALIGN(sizeof(struct ebt_nat_info))) 52 if (datalen != EBT_ALIGN(sizeof(struct ebt_nat_info)))
@@ -67,8 +68,7 @@ static int ebt_target_snat_check(const char *tablename, unsigned int hookmask,
67 return 0; 68 return 0;
68} 69}
69 70
70static struct ebt_target snat = 71static struct ebt_target snat __read_mostly = {
71{
72 .name = EBT_SNAT_TARGET, 72 .name = EBT_SNAT_TARGET,
73 .target = ebt_target_snat, 73 .target = ebt_target_snat,
74 .check = ebt_target_snat_check, 74 .check = ebt_target_snat_check,
@@ -87,4 +87,5 @@ static void __exit ebt_snat_fini(void)
87 87
88module_init(ebt_snat_init); 88module_init(ebt_snat_init);
89module_exit(ebt_snat_fini); 89module_exit(ebt_snat_fini);
90MODULE_DESCRIPTION("Ebtables: Source MAC address translation");
90MODULE_LICENSE("GPL"); 91MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_stp.c b/net/bridge/netfilter/ebt_stp.c
index 31b77367319c..40f36d37607d 100644
--- a/net/bridge/netfilter/ebt_stp.c
+++ b/net/bridge/netfilter/ebt_stp.c
@@ -40,10 +40,10 @@ struct stp_config_pdu {
40#define NR16(p) (p[0] << 8 | p[1]) 40#define NR16(p) (p[0] << 8 | p[1])
41#define NR32(p) ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]) 41#define NR32(p) ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3])
42 42
43static int ebt_filter_config(struct ebt_stp_info *info, 43static int ebt_filter_config(const struct ebt_stp_info *info,
44 struct stp_config_pdu *stpc) 44 const struct stp_config_pdu *stpc)
45{ 45{
46 struct ebt_stp_config_info *c; 46 const struct ebt_stp_config_info *c;
47 uint16_t v16; 47 uint16_t v16;
48 uint32_t v32; 48 uint32_t v32;
49 int verdict, i; 49 int verdict, i;
@@ -122,9 +122,10 @@ static int ebt_filter_config(struct ebt_stp_info *info,
122static int ebt_filter_stp(const struct sk_buff *skb, const struct net_device *in, 122static int ebt_filter_stp(const struct sk_buff *skb, const struct net_device *in,
123 const struct net_device *out, const void *data, unsigned int datalen) 123 const struct net_device *out, const void *data, unsigned int datalen)
124{ 124{
125 struct ebt_stp_info *info = (struct ebt_stp_info *)data; 125 const struct ebt_stp_info *info = data;
126 struct stp_header _stph, *sp; 126 const struct stp_header *sp;
127 uint8_t header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00}; 127 struct stp_header _stph;
128 const uint8_t header[6] = {0x42, 0x42, 0x03, 0x00, 0x00, 0x00};
128 129
129 sp = skb_header_pointer(skb, 0, sizeof(_stph), &_stph); 130 sp = skb_header_pointer(skb, 0, sizeof(_stph), &_stph);
130 if (sp == NULL) 131 if (sp == NULL)
@@ -140,7 +141,8 @@ static int ebt_filter_stp(const struct sk_buff *skb, const struct net_device *in
140 141
141 if (sp->type == BPDU_TYPE_CONFIG && 142 if (sp->type == BPDU_TYPE_CONFIG &&
142 info->bitmask & EBT_STP_CONFIG_MASK) { 143 info->bitmask & EBT_STP_CONFIG_MASK) {
143 struct stp_config_pdu _stpc, *st; 144 const struct stp_config_pdu *st;
145 struct stp_config_pdu _stpc;
144 146
145 st = skb_header_pointer(skb, sizeof(_stph), 147 st = skb_header_pointer(skb, sizeof(_stph),
146 sizeof(_stpc), &_stpc); 148 sizeof(_stpc), &_stpc);
@@ -154,10 +156,10 @@ static int ebt_filter_stp(const struct sk_buff *skb, const struct net_device *in
154static int ebt_stp_check(const char *tablename, unsigned int hookmask, 156static int ebt_stp_check(const char *tablename, unsigned int hookmask,
155 const struct ebt_entry *e, void *data, unsigned int datalen) 157 const struct ebt_entry *e, void *data, unsigned int datalen)
156{ 158{
157 struct ebt_stp_info *info = (struct ebt_stp_info *)data; 159 const struct ebt_stp_info *info = data;
158 int len = EBT_ALIGN(sizeof(struct ebt_stp_info)); 160 const unsigned int len = EBT_ALIGN(sizeof(struct ebt_stp_info));
159 uint8_t bridge_ula[6] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 }; 161 const uint8_t bridge_ula[6] = {0x01, 0x80, 0xc2, 0x00, 0x00, 0x00};
160 uint8_t msk[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 162 const uint8_t msk[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
161 163
162 if (info->bitmask & ~EBT_STP_MASK || info->invflags & ~EBT_STP_MASK || 164 if (info->bitmask & ~EBT_STP_MASK || info->invflags & ~EBT_STP_MASK ||
163 !(info->bitmask & EBT_STP_MASK)) 165 !(info->bitmask & EBT_STP_MASK))
@@ -172,8 +174,7 @@ static int ebt_stp_check(const char *tablename, unsigned int hookmask,
172 return 0; 174 return 0;
173} 175}
174 176
175static struct ebt_match filter_stp = 177static struct ebt_match filter_stp __read_mostly = {
176{
177 .name = EBT_STP_MATCH, 178 .name = EBT_STP_MATCH,
178 .match = ebt_filter_stp, 179 .match = ebt_filter_stp,
179 .check = ebt_stp_check, 180 .check = ebt_stp_check,
@@ -192,4 +193,5 @@ static void __exit ebt_stp_fini(void)
192 193
193module_init(ebt_stp_init); 194module_init(ebt_stp_init);
194module_exit(ebt_stp_fini); 195module_exit(ebt_stp_fini);
196MODULE_DESCRIPTION("Ebtables: Spanning Tree Protocol packet match");
195MODULE_LICENSE("GPL"); 197MODULE_LICENSE("GPL");
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c
index 8e7b00b68d38..2d4c9ef909fc 100644
--- a/net/bridge/netfilter/ebt_ulog.c
+++ b/net/bridge/netfilter/ebt_ulog.c
@@ -249,7 +249,7 @@ static void ebt_ulog(const struct sk_buff *skb, unsigned int hooknr,
249 const struct net_device *in, const struct net_device *out, 249 const struct net_device *in, const struct net_device *out,
250 const void *data, unsigned int datalen) 250 const void *data, unsigned int datalen)
251{ 251{
252 struct ebt_ulog_info *uloginfo = (struct ebt_ulog_info *)data; 252 const struct ebt_ulog_info *uloginfo = data;
253 253
254 ebt_ulog_packet(hooknr, skb, in, out, uloginfo, NULL); 254 ebt_ulog_packet(hooknr, skb, in, out, uloginfo, NULL);
255} 255}
@@ -258,7 +258,7 @@ static void ebt_ulog(const struct sk_buff *skb, unsigned int hooknr,
258static int ebt_ulog_check(const char *tablename, unsigned int hookmask, 258static int ebt_ulog_check(const char *tablename, unsigned int hookmask,
259 const struct ebt_entry *e, void *data, unsigned int datalen) 259 const struct ebt_entry *e, void *data, unsigned int datalen)
260{ 260{
261 struct ebt_ulog_info *uloginfo = (struct ebt_ulog_info *)data; 261 struct ebt_ulog_info *uloginfo = data;
262 262
263 if (datalen != EBT_ALIGN(sizeof(struct ebt_ulog_info)) || 263 if (datalen != EBT_ALIGN(sizeof(struct ebt_ulog_info)) ||
264 uloginfo->nlgroup > 31) 264 uloginfo->nlgroup > 31)
@@ -272,7 +272,7 @@ static int ebt_ulog_check(const char *tablename, unsigned int hookmask,
272 return 0; 272 return 0;
273} 273}
274 274
275static struct ebt_watcher ulog = { 275static struct ebt_watcher ulog __read_mostly = {
276 .name = EBT_ULOG_WATCHER, 276 .name = EBT_ULOG_WATCHER,
277 .watcher = ebt_ulog, 277 .watcher = ebt_ulog,
278 .check = ebt_ulog_check, 278 .check = ebt_ulog_check,
@@ -340,5 +340,4 @@ module_init(ebt_ulog_init);
340module_exit(ebt_ulog_fini); 340module_exit(ebt_ulog_fini);
341MODULE_LICENSE("GPL"); 341MODULE_LICENSE("GPL");
342MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>"); 342MODULE_AUTHOR("Bart De Schuymer <bdschuym@pandora.be>");
343MODULE_DESCRIPTION("ebtables userspace logging module for bridged Ethernet" 343MODULE_DESCRIPTION("Ebtables: Packet logging to netlink using ULOG");
344 " frames");
diff --git a/net/bridge/netfilter/ebt_vlan.c b/net/bridge/netfilter/ebt_vlan.c
index 0ddf7499d496..ab60b0dade80 100644
--- a/net/bridge/netfilter/ebt_vlan.c
+++ b/net/bridge/netfilter/ebt_vlan.c
@@ -31,8 +31,7 @@ static int debug;
31module_param(debug, int, 0); 31module_param(debug, int, 0);
32MODULE_PARM_DESC(debug, "debug=1 is turn on debug messages"); 32MODULE_PARM_DESC(debug, "debug=1 is turn on debug messages");
33MODULE_AUTHOR("Nick Fedchik <nick@fedchik.org.ua>"); 33MODULE_AUTHOR("Nick Fedchik <nick@fedchik.org.ua>");
34MODULE_DESCRIPTION("802.1Q match module (ebtables extension), v" 34MODULE_DESCRIPTION("Ebtables: 802.1Q VLAN tag match");
35 MODULE_VERS);
36MODULE_LICENSE("GPL"); 35MODULE_LICENSE("GPL");
37 36
38 37
@@ -46,8 +45,9 @@ ebt_filter_vlan(const struct sk_buff *skb,
46 const struct net_device *out, 45 const struct net_device *out,
47 const void *data, unsigned int datalen) 46 const void *data, unsigned int datalen)
48{ 47{
49 struct ebt_vlan_info *info = (struct ebt_vlan_info *) data; 48 const struct ebt_vlan_info *info = data;
50 struct vlan_hdr _frame, *fp; 49 const struct vlan_hdr *fp;
50 struct vlan_hdr _frame;
51 51
52 unsigned short TCI; /* Whole TCI, given from parsed frame */ 52 unsigned short TCI; /* Whole TCI, given from parsed frame */
53 unsigned short id; /* VLAN ID, given from frame TCI */ 53 unsigned short id; /* VLAN ID, given from frame TCI */
@@ -91,7 +91,7 @@ ebt_check_vlan(const char *tablename,
91 unsigned int hooknr, 91 unsigned int hooknr,
92 const struct ebt_entry *e, void *data, unsigned int datalen) 92 const struct ebt_entry *e, void *data, unsigned int datalen)
93{ 93{
94 struct ebt_vlan_info *info = (struct ebt_vlan_info *) data; 94 struct ebt_vlan_info *info = data;
95 95
96 /* Parameters buffer overflow check */ 96 /* Parameters buffer overflow check */
97 if (datalen != EBT_ALIGN(sizeof(struct ebt_vlan_info))) { 97 if (datalen != EBT_ALIGN(sizeof(struct ebt_vlan_info))) {
@@ -169,7 +169,7 @@ ebt_check_vlan(const char *tablename,
169 return 0; 169 return 0;
170} 170}
171 171
172static struct ebt_match filter_vlan = { 172static struct ebt_match filter_vlan __read_mostly = {
173 .name = EBT_VLAN_MATCH, 173 .name = EBT_VLAN_MATCH,
174 .match = ebt_filter_vlan, 174 .match = ebt_filter_vlan,
175 .check = ebt_check_vlan, 175 .check = ebt_check_vlan,
diff --git a/net/core/dev.c b/net/core/dev.c
index c9c593e1ba6f..edaff2720e10 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2962,6 +2962,102 @@ int dev_unicast_add(struct net_device *dev, void *addr, int alen)
2962} 2962}
2963EXPORT_SYMBOL(dev_unicast_add); 2963EXPORT_SYMBOL(dev_unicast_add);
2964 2964
2965int __dev_addr_sync(struct dev_addr_list **to, int *to_count,
2966 struct dev_addr_list **from, int *from_count)
2967{
2968 struct dev_addr_list *da, *next;
2969 int err = 0;
2970
2971 da = *from;
2972 while (da != NULL) {
2973 next = da->next;
2974 if (!da->da_synced) {
2975 err = __dev_addr_add(to, to_count,
2976 da->da_addr, da->da_addrlen, 0);
2977 if (err < 0)
2978 break;
2979 da->da_synced = 1;
2980 da->da_users++;
2981 } else if (da->da_users == 1) {
2982 __dev_addr_delete(to, to_count,
2983 da->da_addr, da->da_addrlen, 0);
2984 __dev_addr_delete(from, from_count,
2985 da->da_addr, da->da_addrlen, 0);
2986 }
2987 da = next;
2988 }
2989 return err;
2990}
2991
2992void __dev_addr_unsync(struct dev_addr_list **to, int *to_count,
2993 struct dev_addr_list **from, int *from_count)
2994{
2995 struct dev_addr_list *da, *next;
2996
2997 da = *from;
2998 while (da != NULL) {
2999 next = da->next;
3000 if (da->da_synced) {
3001 __dev_addr_delete(to, to_count,
3002 da->da_addr, da->da_addrlen, 0);
3003 da->da_synced = 0;
3004 __dev_addr_delete(from, from_count,
3005 da->da_addr, da->da_addrlen, 0);
3006 }
3007 da = next;
3008 }
3009}
3010
3011/**
3012 * dev_unicast_sync - Synchronize device's unicast list to another device
3013 * @to: destination device
3014 * @from: source device
3015 *
3016 * Add newly added addresses to the destination device and release
3017 * addresses that have no users left. The source device must be
3018 * locked by netif_tx_lock_bh.
3019 *
3020 * This function is intended to be called from the dev->set_rx_mode
3021 * function of layered software devices.
3022 */
3023int dev_unicast_sync(struct net_device *to, struct net_device *from)
3024{
3025 int err = 0;
3026
3027 netif_tx_lock_bh(to);
3028 err = __dev_addr_sync(&to->uc_list, &to->uc_count,
3029 &from->uc_list, &from->uc_count);
3030 if (!err)
3031 __dev_set_rx_mode(to);
3032 netif_tx_unlock_bh(to);
3033 return err;
3034}
3035EXPORT_SYMBOL(dev_unicast_sync);
3036
3037/**
3038 * dev_unicast_unsync - Remove synchronized addresses from the destination
3039 * device
3040 * @to: destination device
3041 * @from: source device
3042 *
3043 * Remove all addresses that were added to the destination device by
3044 * dev_unicast_sync(). This function is intended to be called from the
3045 * dev->stop function of layered software devices.
3046 */
3047void dev_unicast_unsync(struct net_device *to, struct net_device *from)
3048{
3049 netif_tx_lock_bh(from);
3050 netif_tx_lock_bh(to);
3051
3052 __dev_addr_unsync(&to->uc_list, &to->uc_count,
3053 &from->uc_list, &from->uc_count);
3054 __dev_set_rx_mode(to);
3055
3056 netif_tx_unlock_bh(to);
3057 netif_tx_unlock_bh(from);
3058}
3059EXPORT_SYMBOL(dev_unicast_unsync);
3060
2965static void __dev_addr_discard(struct dev_addr_list **list) 3061static void __dev_addr_discard(struct dev_addr_list **list)
2966{ 3062{
2967 struct dev_addr_list *tmp; 3063 struct dev_addr_list *tmp;
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index cadbfbf7e7f5..cec582563e0d 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -113,32 +113,15 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
113 * locked by netif_tx_lock_bh. 113 * locked by netif_tx_lock_bh.
114 * 114 *
115 * This function is intended to be called from the dev->set_multicast_list 115 * This function is intended to be called from the dev->set_multicast_list
116 * function of layered software devices. 116 * or dev->set_rx_mode function of layered software devices.
117 */ 117 */
118int dev_mc_sync(struct net_device *to, struct net_device *from) 118int dev_mc_sync(struct net_device *to, struct net_device *from)
119{ 119{
120 struct dev_addr_list *da, *next;
121 int err = 0; 120 int err = 0;
122 121
123 netif_tx_lock_bh(to); 122 netif_tx_lock_bh(to);
124 da = from->mc_list; 123 err = __dev_addr_sync(&to->mc_list, &to->mc_count,
125 while (da != NULL) { 124 &from->mc_list, &from->mc_count);
126 next = da->next;
127 if (!da->da_synced) {
128 err = __dev_addr_add(&to->mc_list, &to->mc_count,
129 da->da_addr, da->da_addrlen, 0);
130 if (err < 0)
131 break;
132 da->da_synced = 1;
133 da->da_users++;
134 } else if (da->da_users == 1) {
135 __dev_addr_delete(&to->mc_list, &to->mc_count,
136 da->da_addr, da->da_addrlen, 0);
137 __dev_addr_delete(&from->mc_list, &from->mc_count,
138 da->da_addr, da->da_addrlen, 0);
139 }
140 da = next;
141 }
142 if (!err) 125 if (!err)
143 __dev_set_rx_mode(to); 126 __dev_set_rx_mode(to);
144 netif_tx_unlock_bh(to); 127 netif_tx_unlock_bh(to);
@@ -160,23 +143,11 @@ EXPORT_SYMBOL(dev_mc_sync);
160 */ 143 */
161void dev_mc_unsync(struct net_device *to, struct net_device *from) 144void dev_mc_unsync(struct net_device *to, struct net_device *from)
162{ 145{
163 struct dev_addr_list *da, *next;
164
165 netif_tx_lock_bh(from); 146 netif_tx_lock_bh(from);
166 netif_tx_lock_bh(to); 147 netif_tx_lock_bh(to);
167 148
168 da = from->mc_list; 149 __dev_addr_unsync(&to->mc_list, &to->mc_count,
169 while (da != NULL) { 150 &from->mc_list, &from->mc_count);
170 next = da->next;
171 if (da->da_synced) {
172 __dev_addr_delete(&to->mc_list, &to->mc_count,
173 da->da_addr, da->da_addrlen, 0);
174 da->da_synced = 0;
175 __dev_addr_delete(&from->mc_list, &from->mc_count,
176 da->da_addr, da->da_addrlen, 0);
177 }
178 da = next;
179 }
180 __dev_set_rx_mode(to); 151 __dev_set_rx_mode(to);
181 152
182 netif_tx_unlock_bh(to); 153 netif_tx_unlock_bh(to);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index eebccdbdbaca..bfcdfaebca5c 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -170,8 +170,6 @@
170 170
171#define VERSION "pktgen v2.69: Packet Generator for packet performance testing.\n" 171#define VERSION "pktgen v2.69: Packet Generator for packet performance testing.\n"
172 172
173/* The buckets are exponential in 'width' */
174#define LAT_BUCKETS_MAX 32
175#define IP_NAME_SZ 32 173#define IP_NAME_SZ 32
176#define MAX_MPLS_LABELS 16 /* This is the max label stack depth */ 174#define MAX_MPLS_LABELS 16 /* This is the max label stack depth */
177#define MPLS_STACK_BOTTOM htonl(0x00000100) 175#define MPLS_STACK_BOTTOM htonl(0x00000100)
@@ -2044,7 +2042,6 @@ static void spin(struct pktgen_dev *pkt_dev, __u64 spin_until_us)
2044 __u64 now; 2042 __u64 now;
2045 2043
2046 start = now = getCurUs(); 2044 start = now = getCurUs();
2047 printk(KERN_INFO "sleeping for %d\n", (int)(spin_until_us - now));
2048 while (now < spin_until_us) { 2045 while (now < spin_until_us) {
2049 /* TODO: optimize sleeping behavior */ 2046 /* TODO: optimize sleeping behavior */
2050 if (spin_until_us - now > jiffies_to_usecs(1) + 1) 2047 if (spin_until_us - now > jiffies_to_usecs(1) + 1)
diff --git a/net/core/sock.c b/net/core/sock.c
index 1c4b1cd16d65..433715fb141a 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -667,6 +667,13 @@ set_rcvbuf:
667 else 667 else
668 clear_bit(SOCK_PASSSEC, &sock->flags); 668 clear_bit(SOCK_PASSSEC, &sock->flags);
669 break; 669 break;
670 case SO_MARK:
671 if (!capable(CAP_NET_ADMIN))
672 ret = -EPERM;
673 else {
674 sk->sk_mark = val;
675 }
676 break;
670 677
671 /* We implement the SO_SNDLOWAT etc to 678 /* We implement the SO_SNDLOWAT etc to
672 not be settable (1003.1g 5.3) */ 679 not be settable (1003.1g 5.3) */
@@ -836,6 +843,10 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
836 case SO_PEERSEC: 843 case SO_PEERSEC:
837 return security_socket_getpeersec_stream(sock, optval, optlen, len); 844 return security_socket_getpeersec_stream(sock, optval, optlen, len);
838 845
846 case SO_MARK:
847 v.val = sk->sk_mark;
848 break;
849
839 default: 850 default:
840 return -ENOPROTOOPT; 851 return -ENOPROTOOPT;
841 } 852 }
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 9e38b0d6195c..c982ad88223d 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -218,7 +218,7 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
218 return; 218 return;
219 } 219 }
220 220
221 sk = inet_lookup(&dccp_hashinfo, iph->daddr, dh->dccph_dport, 221 sk = inet_lookup(&init_net, &dccp_hashinfo, iph->daddr, dh->dccph_dport,
222 iph->saddr, dh->dccph_sport, inet_iif(skb)); 222 iph->saddr, dh->dccph_sport, inet_iif(skb));
223 if (sk == NULL) { 223 if (sk == NULL) {
224 ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); 224 ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
@@ -436,7 +436,7 @@ static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
436 if (req != NULL) 436 if (req != NULL)
437 return dccp_check_req(sk, skb, req, prev); 437 return dccp_check_req(sk, skb, req, prev);
438 438
439 nsk = inet_lookup_established(&dccp_hashinfo, 439 nsk = inet_lookup_established(&init_net, &dccp_hashinfo,
440 iph->saddr, dh->dccph_sport, 440 iph->saddr, dh->dccph_sport,
441 iph->daddr, dh->dccph_dport, 441 iph->daddr, dh->dccph_dport,
442 inet_iif(skb)); 442 inet_iif(skb));
@@ -817,7 +817,7 @@ static int dccp_v4_rcv(struct sk_buff *skb)
817 817
818 /* Step 2: 818 /* Step 2:
819 * Look up flow ID in table and get corresponding socket */ 819 * Look up flow ID in table and get corresponding socket */
820 sk = __inet_lookup(&dccp_hashinfo, 820 sk = __inet_lookup(&init_net, &dccp_hashinfo,
821 iph->saddr, dh->dccph_sport, 821 iph->saddr, dh->dccph_sport,
822 iph->daddr, dh->dccph_dport, inet_iif(skb)); 822 iph->daddr, dh->dccph_dport, inet_iif(skb));
823 /* 823 /*
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index f42b75ce7f5c..ed0a0053a797 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -101,8 +101,8 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
101 int err; 101 int err;
102 __u64 seq; 102 __u64 seq;
103 103
104 sk = inet6_lookup(&dccp_hashinfo, &hdr->daddr, dh->dccph_dport, 104 sk = inet6_lookup(&init_net, &dccp_hashinfo, &hdr->daddr, dh->dccph_dport,
105 &hdr->saddr, dh->dccph_sport, inet6_iif(skb)); 105 &hdr->saddr, dh->dccph_sport, inet6_iif(skb));
106 106
107 if (sk == NULL) { 107 if (sk == NULL) {
108 ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), ICMP6_MIB_INERRORS); 108 ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), ICMP6_MIB_INERRORS);
@@ -366,7 +366,7 @@ static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
366 if (req != NULL) 366 if (req != NULL)
367 return dccp_check_req(sk, skb, req, prev); 367 return dccp_check_req(sk, skb, req, prev);
368 368
369 nsk = __inet6_lookup_established(&dccp_hashinfo, 369 nsk = __inet6_lookup_established(&init_net, &dccp_hashinfo,
370 &iph->saddr, dh->dccph_sport, 370 &iph->saddr, dh->dccph_sport,
371 &iph->daddr, ntohs(dh->dccph_dport), 371 &iph->daddr, ntohs(dh->dccph_dport),
372 inet6_iif(skb)); 372 inet6_iif(skb));
@@ -797,7 +797,7 @@ static int dccp_v6_rcv(struct sk_buff *skb)
797 797
798 /* Step 2: 798 /* Step 2:
799 * Look up flow ID in table and get corresponding socket */ 799 * Look up flow ID in table and get corresponding socket */
800 sk = __inet6_lookup(&dccp_hashinfo, &ipv6_hdr(skb)->saddr, 800 sk = __inet6_lookup(&init_net, &dccp_hashinfo, &ipv6_hdr(skb)->saddr,
801 dh->dccph_sport, 801 dh->dccph_sport,
802 &ipv6_hdr(skb)->daddr, ntohs(dh->dccph_dport), 802 &ipv6_hdr(skb)->daddr, ntohs(dh->dccph_dport),
803 inet6_iif(skb)); 803 inet6_iif(skb));
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 24e2b7294bf8..19880b086e71 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -343,6 +343,7 @@ config INET_ESP
343 tristate "IP: ESP transformation" 343 tristate "IP: ESP transformation"
344 select XFRM 344 select XFRM
345 select CRYPTO 345 select CRYPTO
346 select CRYPTO_AEAD
346 select CRYPTO_HMAC 347 select CRYPTO_HMAC
347 select CRYPTO_MD5 348 select CRYPTO_MD5
348 select CRYPTO_CBC 349 select CRYPTO_CBC
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index d76803a3dcae..9d4555ec0b59 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -300,7 +300,7 @@ static void ah_destroy(struct xfrm_state *x)
300} 300}
301 301
302 302
303static struct xfrm_type ah_type = 303static const struct xfrm_type ah_type =
304{ 304{
305 .description = "AH4", 305 .description = "AH4",
306 .owner = THIS_MODULE, 306 .owner = THIS_MODULE,
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 5976c598cc4b..8e17f65f4002 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -558,8 +558,9 @@ static inline int arp_fwd_proxy(struct in_device *in_dev, struct rtable *rt)
558 */ 558 */
559struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, 559struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
560 struct net_device *dev, __be32 src_ip, 560 struct net_device *dev, __be32 src_ip,
561 unsigned char *dest_hw, unsigned char *src_hw, 561 const unsigned char *dest_hw,
562 unsigned char *target_hw) 562 const unsigned char *src_hw,
563 const unsigned char *target_hw)
563{ 564{
564 struct sk_buff *skb; 565 struct sk_buff *skb;
565 struct arphdr *arp; 566 struct arphdr *arp;
@@ -672,8 +673,8 @@ void arp_xmit(struct sk_buff *skb)
672 */ 673 */
673void arp_send(int type, int ptype, __be32 dest_ip, 674void arp_send(int type, int ptype, __be32 dest_ip,
674 struct net_device *dev, __be32 src_ip, 675 struct net_device *dev, __be32 src_ip,
675 unsigned char *dest_hw, unsigned char *src_hw, 676 const unsigned char *dest_hw, const unsigned char *src_hw,
676 unsigned char *target_hw) 677 const unsigned char *target_hw)
677{ 678{
678 struct sk_buff *skb; 679 struct sk_buff *skb;
679 680
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 21f71bf912d5..f282b26f63eb 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -64,7 +64,7 @@
64#include <net/rtnetlink.h> 64#include <net/rtnetlink.h>
65#include <net/net_namespace.h> 65#include <net/net_namespace.h>
66 66
67struct ipv4_devconf ipv4_devconf = { 67static struct ipv4_devconf ipv4_devconf = {
68 .data = { 68 .data = {
69 [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1, 69 [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1,
70 [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1, 70 [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1,
@@ -485,46 +485,41 @@ errout:
485 return err; 485 return err;
486} 486}
487 487
488static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh) 488static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh)
489{ 489{
490 struct nlattr *tb[IFA_MAX+1]; 490 struct nlattr *tb[IFA_MAX+1];
491 struct in_ifaddr *ifa; 491 struct in_ifaddr *ifa;
492 struct ifaddrmsg *ifm; 492 struct ifaddrmsg *ifm;
493 struct net_device *dev; 493 struct net_device *dev;
494 struct in_device *in_dev; 494 struct in_device *in_dev;
495 int err = -EINVAL; 495 int err;
496 496
497 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy); 497 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, ifa_ipv4_policy);
498 if (err < 0) 498 if (err < 0)
499 goto errout; 499 goto errout;
500 500
501 ifm = nlmsg_data(nlh); 501 ifm = nlmsg_data(nlh);
502 if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL) { 502 err = -EINVAL;
503 err = -EINVAL; 503 if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL)
504 goto errout; 504 goto errout;
505 }
506 505
507 dev = __dev_get_by_index(&init_net, ifm->ifa_index); 506 dev = __dev_get_by_index(net, ifm->ifa_index);
508 if (dev == NULL) { 507 err = -ENODEV;
509 err = -ENODEV; 508 if (dev == NULL)
510 goto errout; 509 goto errout;
511 }
512 510
513 in_dev = __in_dev_get_rtnl(dev); 511 in_dev = __in_dev_get_rtnl(dev);
514 if (in_dev == NULL) { 512 err = -ENOBUFS;
515 err = -ENOBUFS; 513 if (in_dev == NULL)
516 goto errout; 514 goto errout;
517 }
518 515
519 ifa = inet_alloc_ifa(); 516 ifa = inet_alloc_ifa();
520 if (ifa == NULL) { 517 if (ifa == NULL)
521 /* 518 /*
522 * A potential indev allocation can be left alive, it stays 519 * A potential indev allocation can be left alive, it stays
523 * assigned to its device and is destroy with it. 520 * assigned to its device and is destroy with it.
524 */ 521 */
525 err = -ENOBUFS;
526 goto errout; 522 goto errout;
527 }
528 523
529 ipv4_devconf_setall(in_dev); 524 ipv4_devconf_setall(in_dev);
530 in_dev_hold(in_dev); 525 in_dev_hold(in_dev);
@@ -568,7 +563,7 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg
568 if (net != &init_net) 563 if (net != &init_net)
569 return -EINVAL; 564 return -EINVAL;
570 565
571 ifa = rtm_to_ifaddr(nlh); 566 ifa = rtm_to_ifaddr(net, nlh);
572 if (IS_ERR(ifa)) 567 if (IS_ERR(ifa))
573 return PTR_ERR(ifa); 568 return PTR_ERR(ifa);
574 569
@@ -1182,7 +1177,7 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
1182 1177
1183 s_ip_idx = ip_idx = cb->args[1]; 1178 s_ip_idx = ip_idx = cb->args[1];
1184 idx = 0; 1179 idx = 0;
1185 for_each_netdev(&init_net, dev) { 1180 for_each_netdev(net, dev) {
1186 if (idx < s_idx) 1181 if (idx < s_idx)
1187 goto cont; 1182 goto cont;
1188 if (idx > s_idx) 1183 if (idx > s_idx)
@@ -1216,7 +1211,9 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa, struct nlmsghdr *nlh,
1216 struct sk_buff *skb; 1211 struct sk_buff *skb;
1217 u32 seq = nlh ? nlh->nlmsg_seq : 0; 1212 u32 seq = nlh ? nlh->nlmsg_seq : 0;
1218 int err = -ENOBUFS; 1213 int err = -ENOBUFS;
1214 struct net *net;
1219 1215
1216 net = ifa->ifa_dev->dev->nd_net;
1220 skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL); 1217 skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL);
1221 if (skb == NULL) 1218 if (skb == NULL)
1222 goto errout; 1219 goto errout;
@@ -1228,10 +1225,10 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa, struct nlmsghdr *nlh,
1228 kfree_skb(skb); 1225 kfree_skb(skb);
1229 goto errout; 1226 goto errout;
1230 } 1227 }
1231 err = rtnl_notify(skb, &init_net, pid, RTNLGRP_IPV4_IFADDR, nlh, GFP_KERNEL); 1228 err = rtnl_notify(skb, net, pid, RTNLGRP_IPV4_IFADDR, nlh, GFP_KERNEL);
1232errout: 1229errout:
1233 if (err < 0) 1230 if (err < 0)
1234 rtnl_set_sk_err(&init_net, RTNLGRP_IPV4_IFADDR, err); 1231 rtnl_set_sk_err(net, RTNLGRP_IPV4_IFADDR, err);
1235} 1232}
1236 1233
1237#ifdef CONFIG_SYSCTL 1234#ifdef CONFIG_SYSCTL
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 28ea5c77ca23..258d17631b4b 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -1,27 +1,118 @@
1#include <crypto/aead.h>
2#include <crypto/authenc.h>
1#include <linux/err.h> 3#include <linux/err.h>
2#include <linux/module.h> 4#include <linux/module.h>
3#include <net/ip.h> 5#include <net/ip.h>
4#include <net/xfrm.h> 6#include <net/xfrm.h>
5#include <net/esp.h> 7#include <net/esp.h>
6#include <linux/scatterlist.h> 8#include <linux/scatterlist.h>
7#include <linux/crypto.h>
8#include <linux/kernel.h> 9#include <linux/kernel.h>
9#include <linux/pfkeyv2.h> 10#include <linux/pfkeyv2.h>
10#include <linux/random.h> 11#include <linux/rtnetlink.h>
12#include <linux/slab.h>
11#include <linux/spinlock.h> 13#include <linux/spinlock.h>
12#include <linux/in6.h> 14#include <linux/in6.h>
13#include <net/icmp.h> 15#include <net/icmp.h>
14#include <net/protocol.h> 16#include <net/protocol.h>
15#include <net/udp.h> 17#include <net/udp.h>
16 18
19struct esp_skb_cb {
20 struct xfrm_skb_cb xfrm;
21 void *tmp;
22};
23
24#define ESP_SKB_CB(__skb) ((struct esp_skb_cb *)&((__skb)->cb[0]))
25
26/*
27 * Allocate an AEAD request structure with extra space for SG and IV.
28 *
29 * For alignment considerations the IV is placed at the front, followed
30 * by the request and finally the SG list.
31 *
32 * TODO: Use spare space in skb for this where possible.
33 */
34static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags)
35{
36 unsigned int len;
37
38 len = crypto_aead_ivsize(aead);
39 if (len) {
40 len += crypto_aead_alignmask(aead) &
41 ~(crypto_tfm_ctx_alignment() - 1);
42 len = ALIGN(len, crypto_tfm_ctx_alignment());
43 }
44
45 len += sizeof(struct aead_givcrypt_request) + crypto_aead_reqsize(aead);
46 len = ALIGN(len, __alignof__(struct scatterlist));
47
48 len += sizeof(struct scatterlist) * nfrags;
49
50 return kmalloc(len, GFP_ATOMIC);
51}
52
53static inline u8 *esp_tmp_iv(struct crypto_aead *aead, void *tmp)
54{
55 return crypto_aead_ivsize(aead) ?
56 PTR_ALIGN((u8 *)tmp, crypto_aead_alignmask(aead) + 1) : tmp;
57}
58
59static inline struct aead_givcrypt_request *esp_tmp_givreq(
60 struct crypto_aead *aead, u8 *iv)
61{
62 struct aead_givcrypt_request *req;
63
64 req = (void *)PTR_ALIGN(iv + crypto_aead_ivsize(aead),
65 crypto_tfm_ctx_alignment());
66 aead_givcrypt_set_tfm(req, aead);
67 return req;
68}
69
70static inline struct aead_request *esp_tmp_req(struct crypto_aead *aead, u8 *iv)
71{
72 struct aead_request *req;
73
74 req = (void *)PTR_ALIGN(iv + crypto_aead_ivsize(aead),
75 crypto_tfm_ctx_alignment());
76 aead_request_set_tfm(req, aead);
77 return req;
78}
79
80static inline struct scatterlist *esp_req_sg(struct crypto_aead *aead,
81 struct aead_request *req)
82{
83 return (void *)ALIGN((unsigned long)(req + 1) +
84 crypto_aead_reqsize(aead),
85 __alignof__(struct scatterlist));
86}
87
88static inline struct scatterlist *esp_givreq_sg(
89 struct crypto_aead *aead, struct aead_givcrypt_request *req)
90{
91 return (void *)ALIGN((unsigned long)(req + 1) +
92 crypto_aead_reqsize(aead),
93 __alignof__(struct scatterlist));
94}
95
96static void esp_output_done(struct crypto_async_request *base, int err)
97{
98 struct sk_buff *skb = base->data;
99
100 kfree(ESP_SKB_CB(skb)->tmp);
101 xfrm_output_resume(skb, err);
102}
103
17static int esp_output(struct xfrm_state *x, struct sk_buff *skb) 104static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
18{ 105{
19 int err; 106 int err;
20 struct ip_esp_hdr *esph; 107 struct ip_esp_hdr *esph;
21 struct crypto_blkcipher *tfm; 108 struct crypto_aead *aead;
22 struct blkcipher_desc desc; 109 struct aead_givcrypt_request *req;
110 struct scatterlist *sg;
111 struct scatterlist *asg;
23 struct esp_data *esp; 112 struct esp_data *esp;
24 struct sk_buff *trailer; 113 struct sk_buff *trailer;
114 void *tmp;
115 u8 *iv;
25 u8 *tail; 116 u8 *tail;
26 int blksize; 117 int blksize;
27 int clen; 118 int clen;
@@ -36,18 +127,27 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
36 clen = skb->len; 127 clen = skb->len;
37 128
38 esp = x->data; 129 esp = x->data;
39 alen = esp->auth.icv_trunc_len; 130 aead = esp->aead;
40 tfm = esp->conf.tfm; 131 alen = crypto_aead_authsize(aead);
41 desc.tfm = tfm; 132
42 desc.flags = 0; 133 blksize = ALIGN(crypto_aead_blocksize(aead), 4);
43 blksize = ALIGN(crypto_blkcipher_blocksize(tfm), 4);
44 clen = ALIGN(clen + 2, blksize); 134 clen = ALIGN(clen + 2, blksize);
45 if (esp->conf.padlen) 135 if (esp->padlen)
46 clen = ALIGN(clen, esp->conf.padlen); 136 clen = ALIGN(clen, esp->padlen);
137
138 if ((err = skb_cow_data(skb, clen - skb->len + alen, &trailer)) < 0)
139 goto error;
140 nfrags = err;
47 141
48 if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0) 142 tmp = esp_alloc_tmp(aead, nfrags + 1);
143 if (!tmp)
49 goto error; 144 goto error;
50 145
146 iv = esp_tmp_iv(aead, tmp);
147 req = esp_tmp_givreq(aead, iv);
148 asg = esp_givreq_sg(aead, req);
149 sg = asg + 1;
150
51 /* Fill padding... */ 151 /* Fill padding... */
52 tail = skb_tail_pointer(trailer); 152 tail = skb_tail_pointer(trailer);
53 do { 153 do {
@@ -56,28 +156,34 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
56 tail[i] = i + 1; 156 tail[i] = i + 1;
57 } while (0); 157 } while (0);
58 tail[clen - skb->len - 2] = (clen - skb->len) - 2; 158 tail[clen - skb->len - 2] = (clen - skb->len) - 2;
59 pskb_put(skb, trailer, clen - skb->len); 159 tail[clen - skb->len - 1] = *skb_mac_header(skb);
160 pskb_put(skb, trailer, clen - skb->len + alen);
60 161
61 skb_push(skb, -skb_network_offset(skb)); 162 skb_push(skb, -skb_network_offset(skb));
62 esph = ip_esp_hdr(skb); 163 esph = ip_esp_hdr(skb);
63 *(skb_tail_pointer(trailer) - 1) = *skb_mac_header(skb);
64 *skb_mac_header(skb) = IPPROTO_ESP; 164 *skb_mac_header(skb) = IPPROTO_ESP;
65 165
66 spin_lock_bh(&x->lock);
67
68 /* this is non-NULL only with UDP Encapsulation */ 166 /* this is non-NULL only with UDP Encapsulation */
69 if (x->encap) { 167 if (x->encap) {
70 struct xfrm_encap_tmpl *encap = x->encap; 168 struct xfrm_encap_tmpl *encap = x->encap;
71 struct udphdr *uh; 169 struct udphdr *uh;
72 __be32 *udpdata32; 170 __be32 *udpdata32;
171 unsigned int sport, dport;
172 int encap_type;
173
174 spin_lock_bh(&x->lock);
175 sport = encap->encap_sport;
176 dport = encap->encap_dport;
177 encap_type = encap->encap_type;
178 spin_unlock_bh(&x->lock);
73 179
74 uh = (struct udphdr *)esph; 180 uh = (struct udphdr *)esph;
75 uh->source = encap->encap_sport; 181 uh->source = sport;
76 uh->dest = encap->encap_dport; 182 uh->dest = dport;
77 uh->len = htons(skb->len + alen - skb_transport_offset(skb)); 183 uh->len = htons(skb->len - skb_transport_offset(skb));
78 uh->check = 0; 184 uh->check = 0;
79 185
80 switch (encap->encap_type) { 186 switch (encap_type) {
81 default: 187 default:
82 case UDP_ENCAP_ESPINUDP: 188 case UDP_ENCAP_ESPINUDP:
83 esph = (struct ip_esp_hdr *)(uh + 1); 189 esph = (struct ip_esp_hdr *)(uh + 1);
@@ -95,131 +201,45 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
95 esph->spi = x->id.spi; 201 esph->spi = x->id.spi;
96 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq); 202 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq);
97 203
98 if (esp->conf.ivlen) { 204 sg_init_table(sg, nfrags);
99 if (unlikely(!esp->conf.ivinitted)) { 205 skb_to_sgvec(skb, sg,
100 get_random_bytes(esp->conf.ivec, esp->conf.ivlen); 206 esph->enc_data + crypto_aead_ivsize(aead) - skb->data,
101 esp->conf.ivinitted = 1; 207 clen + alen);
102 } 208 sg_init_one(asg, esph, sizeof(*esph));
103 crypto_blkcipher_set_iv(tfm, esp->conf.ivec, esp->conf.ivlen); 209
104 } 210 aead_givcrypt_set_callback(req, 0, esp_output_done, skb);
105 211 aead_givcrypt_set_crypt(req, sg, sg, clen, iv);
106 do { 212 aead_givcrypt_set_assoc(req, asg, sizeof(*esph));
107 struct scatterlist *sg = &esp->sgbuf[0]; 213 aead_givcrypt_set_giv(req, esph->enc_data, XFRM_SKB_CB(skb)->seq);
108 214
109 if (unlikely(nfrags > ESP_NUM_FAST_SG)) { 215 ESP_SKB_CB(skb)->tmp = tmp;
110 sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC); 216 err = crypto_aead_givencrypt(req);
111 if (!sg) 217 if (err == -EINPROGRESS)
112 goto unlock; 218 goto error;
113 }
114 sg_init_table(sg, nfrags);
115 skb_to_sgvec(skb, sg,
116 esph->enc_data +
117 esp->conf.ivlen -
118 skb->data, clen);
119 err = crypto_blkcipher_encrypt(&desc, sg, sg, clen);
120 if (unlikely(sg != &esp->sgbuf[0]))
121 kfree(sg);
122 } while (0);
123
124 if (unlikely(err))
125 goto unlock;
126
127 if (esp->conf.ivlen) {
128 memcpy(esph->enc_data, esp->conf.ivec, esp->conf.ivlen);
129 crypto_blkcipher_get_iv(tfm, esp->conf.ivec, esp->conf.ivlen);
130 }
131 219
132 if (esp->auth.icv_full_len) { 220 if (err == -EBUSY)
133 err = esp_mac_digest(esp, skb, (u8 *)esph - skb->data, 221 err = NET_XMIT_DROP;
134 sizeof(*esph) + esp->conf.ivlen + clen);
135 memcpy(pskb_put(skb, trailer, alen), esp->auth.work_icv, alen);
136 }
137 222
138unlock: 223 kfree(tmp);
139 spin_unlock_bh(&x->lock);
140 224
141error: 225error:
142 return err; 226 return err;
143} 227}
144 228
145/* 229static int esp_input_done2(struct sk_buff *skb, int err)
146 * Note: detecting truncated vs. non-truncated authentication data is very
147 * expensive, so we only support truncated data, which is the recommended
148 * and common case.
149 */
150static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
151{ 230{
152 struct iphdr *iph; 231 struct iphdr *iph;
153 struct ip_esp_hdr *esph; 232 struct xfrm_state *x = xfrm_input_state(skb);
154 struct esp_data *esp = x->data; 233 struct esp_data *esp = x->data;
155 struct crypto_blkcipher *tfm = esp->conf.tfm; 234 struct crypto_aead *aead = esp->aead;
156 struct blkcipher_desc desc = { .tfm = tfm }; 235 int alen = crypto_aead_authsize(aead);
157 struct sk_buff *trailer; 236 int hlen = sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead);
158 int blksize = ALIGN(crypto_blkcipher_blocksize(tfm), 4); 237 int elen = skb->len - hlen;
159 int alen = esp->auth.icv_trunc_len;
160 int elen = skb->len - sizeof(*esph) - esp->conf.ivlen - alen;
161 int nfrags;
162 int ihl; 238 int ihl;
163 u8 nexthdr[2]; 239 u8 nexthdr[2];
164 struct scatterlist *sg;
165 int padlen; 240 int padlen;
166 int err = -EINVAL;
167
168 if (!pskb_may_pull(skb, sizeof(*esph)))
169 goto out;
170
171 if (elen <= 0 || (elen & (blksize-1)))
172 goto out;
173
174 if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
175 goto out;
176 nfrags = err;
177
178 skb->ip_summed = CHECKSUM_NONE;
179
180 spin_lock(&x->lock);
181
182 /* If integrity check is required, do this. */
183 if (esp->auth.icv_full_len) {
184 u8 sum[alen];
185 241
186 err = esp_mac_digest(esp, skb, 0, skb->len - alen); 242 kfree(ESP_SKB_CB(skb)->tmp);
187 if (err)
188 goto unlock;
189
190 if (skb_copy_bits(skb, skb->len - alen, sum, alen))
191 BUG();
192
193 if (unlikely(memcmp(esp->auth.work_icv, sum, alen))) {
194 err = -EBADMSG;
195 goto unlock;
196 }
197 }
198
199 esph = (struct ip_esp_hdr *)skb->data;
200
201 /* Get ivec. This can be wrong, check against another impls. */
202 if (esp->conf.ivlen)
203 crypto_blkcipher_set_iv(tfm, esph->enc_data, esp->conf.ivlen);
204
205 sg = &esp->sgbuf[0];
206
207 if (unlikely(nfrags > ESP_NUM_FAST_SG)) {
208 err = -ENOMEM;
209 sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC);
210 if (!sg)
211 goto unlock;
212 }
213 sg_init_table(sg, nfrags);
214 skb_to_sgvec(skb, sg,
215 sizeof(*esph) + esp->conf.ivlen,
216 elen);
217 err = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
218 if (unlikely(sg != &esp->sgbuf[0]))
219 kfree(sg);
220
221unlock:
222 spin_unlock(&x->lock);
223 243
224 if (unlikely(err)) 244 if (unlikely(err))
225 goto out; 245 goto out;
@@ -229,15 +249,11 @@ unlock:
229 249
230 err = -EINVAL; 250 err = -EINVAL;
231 padlen = nexthdr[0]; 251 padlen = nexthdr[0];
232 if (padlen+2 >= elen) 252 if (padlen + 2 + alen >= elen)
233 goto out; 253 goto out;
234 254
235 /* ... check padding bits here. Silly. :-) */ 255 /* ... check padding bits here. Silly. :-) */
236 256
237 /* RFC4303: Drop dummy packets without any error */
238 if (nexthdr[1] == IPPROTO_NONE)
239 goto out;
240
241 iph = ip_hdr(skb); 257 iph = ip_hdr(skb);
242 ihl = iph->ihl * 4; 258 ihl = iph->ihl * 4;
243 259
@@ -279,10 +295,87 @@ unlock:
279 } 295 }
280 296
281 pskb_trim(skb, skb->len - alen - padlen - 2); 297 pskb_trim(skb, skb->len - alen - padlen - 2);
282 __skb_pull(skb, sizeof(*esph) + esp->conf.ivlen); 298 __skb_pull(skb, hlen);
283 skb_set_transport_header(skb, -ihl); 299 skb_set_transport_header(skb, -ihl);
284 300
285 return nexthdr[1]; 301 err = nexthdr[1];
302
303 /* RFC4303: Drop dummy packets without any error */
304 if (err == IPPROTO_NONE)
305 err = -EINVAL;
306
307out:
308 return err;
309}
310
311static void esp_input_done(struct crypto_async_request *base, int err)
312{
313 struct sk_buff *skb = base->data;
314
315 xfrm_input_resume(skb, esp_input_done2(skb, err));
316}
317
318/*
319 * Note: detecting truncated vs. non-truncated authentication data is very
320 * expensive, so we only support truncated data, which is the recommended
321 * and common case.
322 */
323static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
324{
325 struct ip_esp_hdr *esph;
326 struct esp_data *esp = x->data;
327 struct crypto_aead *aead = esp->aead;
328 struct aead_request *req;
329 struct sk_buff *trailer;
330 int elen = skb->len - sizeof(*esph) - crypto_aead_ivsize(aead);
331 int nfrags;
332 void *tmp;
333 u8 *iv;
334 struct scatterlist *sg;
335 struct scatterlist *asg;
336 int err = -EINVAL;
337
338 if (!pskb_may_pull(skb, sizeof(*esph)))
339 goto out;
340
341 if (elen <= 0)
342 goto out;
343
344 if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
345 goto out;
346 nfrags = err;
347
348 err = -ENOMEM;
349 tmp = esp_alloc_tmp(aead, nfrags + 1);
350 if (!tmp)
351 goto out;
352
353 ESP_SKB_CB(skb)->tmp = tmp;
354 iv = esp_tmp_iv(aead, tmp);
355 req = esp_tmp_req(aead, iv);
356 asg = esp_req_sg(aead, req);
357 sg = asg + 1;
358
359 skb->ip_summed = CHECKSUM_NONE;
360
361 esph = (struct ip_esp_hdr *)skb->data;
362
363 /* Get ivec. This can be wrong, check against another impls. */
364 iv = esph->enc_data;
365
366 sg_init_table(sg, nfrags);
367 skb_to_sgvec(skb, sg, sizeof(*esph) + crypto_aead_ivsize(aead), elen);
368 sg_init_one(asg, esph, sizeof(*esph));
369
370 aead_request_set_callback(req, 0, esp_input_done, skb);
371 aead_request_set_crypt(req, sg, sg, elen, iv);
372 aead_request_set_assoc(req, asg, sizeof(*esph));
373
374 err = crypto_aead_decrypt(req);
375 if (err == -EINPROGRESS)
376 goto out;
377
378 err = esp_input_done2(skb, err);
286 379
287out: 380out:
288 return err; 381 return err;
@@ -291,11 +384,11 @@ out:
291static u32 esp4_get_mtu(struct xfrm_state *x, int mtu) 384static u32 esp4_get_mtu(struct xfrm_state *x, int mtu)
292{ 385{
293 struct esp_data *esp = x->data; 386 struct esp_data *esp = x->data;
294 u32 blksize = ALIGN(crypto_blkcipher_blocksize(esp->conf.tfm), 4); 387 u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4);
295 u32 align = max_t(u32, blksize, esp->conf.padlen); 388 u32 align = max_t(u32, blksize, esp->padlen);
296 u32 rem; 389 u32 rem;
297 390
298 mtu -= x->props.header_len + esp->auth.icv_trunc_len; 391 mtu -= x->props.header_len + crypto_aead_authsize(esp->aead);
299 rem = mtu & (align - 1); 392 rem = mtu & (align - 1);
300 mtu &= ~(align - 1); 393 mtu &= ~(align - 1);
301 394
@@ -342,80 +435,143 @@ static void esp_destroy(struct xfrm_state *x)
342 if (!esp) 435 if (!esp)
343 return; 436 return;
344 437
345 crypto_free_blkcipher(esp->conf.tfm); 438 crypto_free_aead(esp->aead);
346 esp->conf.tfm = NULL;
347 kfree(esp->conf.ivec);
348 esp->conf.ivec = NULL;
349 crypto_free_hash(esp->auth.tfm);
350 esp->auth.tfm = NULL;
351 kfree(esp->auth.work_icv);
352 esp->auth.work_icv = NULL;
353 kfree(esp); 439 kfree(esp);
354} 440}
355 441
356static int esp_init_state(struct xfrm_state *x) 442static int esp_init_aead(struct xfrm_state *x)
357{ 443{
358 struct esp_data *esp = NULL; 444 struct esp_data *esp = x->data;
359 struct crypto_blkcipher *tfm; 445 struct crypto_aead *aead;
360 u32 align; 446 int err;
447
448 aead = crypto_alloc_aead(x->aead->alg_name, 0, 0);
449 err = PTR_ERR(aead);
450 if (IS_ERR(aead))
451 goto error;
452
453 esp->aead = aead;
454
455 err = crypto_aead_setkey(aead, x->aead->alg_key,
456 (x->aead->alg_key_len + 7) / 8);
457 if (err)
458 goto error;
459
460 err = crypto_aead_setauthsize(aead, x->aead->alg_icv_len / 8);
461 if (err)
462 goto error;
463
464error:
465 return err;
466}
361 467
468static int esp_init_authenc(struct xfrm_state *x)
469{
470 struct esp_data *esp = x->data;
471 struct crypto_aead *aead;
472 struct crypto_authenc_key_param *param;
473 struct rtattr *rta;
474 char *key;
475 char *p;
476 char authenc_name[CRYPTO_MAX_ALG_NAME];
477 unsigned int keylen;
478 int err;
479
480 err = -EINVAL;
362 if (x->ealg == NULL) 481 if (x->ealg == NULL)
363 goto error; 482 goto error;
364 483
365 esp = kzalloc(sizeof(*esp), GFP_KERNEL); 484 err = -ENAMETOOLONG;
366 if (esp == NULL) 485 if (snprintf(authenc_name, CRYPTO_MAX_ALG_NAME, "authenc(%s,%s)",
367 return -ENOMEM; 486 x->aalg ? x->aalg->alg_name : "digest_null",
487 x->ealg->alg_name) >= CRYPTO_MAX_ALG_NAME)
488 goto error;
489
490 aead = crypto_alloc_aead(authenc_name, 0, 0);
491 err = PTR_ERR(aead);
492 if (IS_ERR(aead))
493 goto error;
494
495 esp->aead = aead;
496
497 keylen = (x->aalg ? (x->aalg->alg_key_len + 7) / 8 : 0) +
498 (x->ealg->alg_key_len + 7) / 8 + RTA_SPACE(sizeof(*param));
499 err = -ENOMEM;
500 key = kmalloc(keylen, GFP_KERNEL);
501 if (!key)
502 goto error;
503
504 p = key;
505 rta = (void *)p;
506 rta->rta_type = CRYPTO_AUTHENC_KEYA_PARAM;
507 rta->rta_len = RTA_LENGTH(sizeof(*param));
508 param = RTA_DATA(rta);
509 p += RTA_SPACE(sizeof(*param));
368 510
369 if (x->aalg) { 511 if (x->aalg) {
370 struct xfrm_algo_desc *aalg_desc; 512 struct xfrm_algo_desc *aalg_desc;
371 struct crypto_hash *hash;
372 513
373 hash = crypto_alloc_hash(x->aalg->alg_name, 0, 514 memcpy(p, x->aalg->alg_key, (x->aalg->alg_key_len + 7) / 8);
374 CRYPTO_ALG_ASYNC); 515 p += (x->aalg->alg_key_len + 7) / 8;
375 if (IS_ERR(hash))
376 goto error;
377
378 esp->auth.tfm = hash;
379 if (crypto_hash_setkey(hash, x->aalg->alg_key,
380 (x->aalg->alg_key_len + 7) / 8))
381 goto error;
382 516
383 aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0); 517 aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0);
384 BUG_ON(!aalg_desc); 518 BUG_ON(!aalg_desc);
385 519
520 err = -EINVAL;
386 if (aalg_desc->uinfo.auth.icv_fullbits/8 != 521 if (aalg_desc->uinfo.auth.icv_fullbits/8 !=
387 crypto_hash_digestsize(hash)) { 522 crypto_aead_authsize(aead)) {
388 NETDEBUG(KERN_INFO "ESP: %s digestsize %u != %hu\n", 523 NETDEBUG(KERN_INFO "ESP: %s digestsize %u != %hu\n",
389 x->aalg->alg_name, 524 x->aalg->alg_name,
390 crypto_hash_digestsize(hash), 525 crypto_aead_authsize(aead),
391 aalg_desc->uinfo.auth.icv_fullbits/8); 526 aalg_desc->uinfo.auth.icv_fullbits/8);
392 goto error; 527 goto free_key;
393 } 528 }
394 529
395 esp->auth.icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; 530 err = crypto_aead_setauthsize(
396 esp->auth.icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; 531 aead, aalg_desc->uinfo.auth.icv_truncbits / 8);
397 532 if (err)
398 esp->auth.work_icv = kmalloc(esp->auth.icv_full_len, GFP_KERNEL); 533 goto free_key;
399 if (!esp->auth.work_icv)
400 goto error;
401 } 534 }
402 535
403 tfm = crypto_alloc_blkcipher(x->ealg->alg_name, 0, CRYPTO_ALG_ASYNC); 536 param->enckeylen = cpu_to_be32((x->ealg->alg_key_len + 7) / 8);
404 if (IS_ERR(tfm)) 537 memcpy(p, x->ealg->alg_key, (x->ealg->alg_key_len + 7) / 8);
405 goto error; 538
406 esp->conf.tfm = tfm; 539 err = crypto_aead_setkey(aead, key, keylen);
407 esp->conf.ivlen = crypto_blkcipher_ivsize(tfm); 540
408 esp->conf.padlen = 0; 541free_key:
409 if (esp->conf.ivlen) { 542 kfree(key);
410 esp->conf.ivec = kmalloc(esp->conf.ivlen, GFP_KERNEL); 543
411 if (unlikely(esp->conf.ivec == NULL)) 544error:
412 goto error; 545 return err;
413 esp->conf.ivinitted = 0; 546}
414 } 547
415 if (crypto_blkcipher_setkey(tfm, x->ealg->alg_key, 548static int esp_init_state(struct xfrm_state *x)
416 (x->ealg->alg_key_len + 7) / 8)) 549{
550 struct esp_data *esp;
551 struct crypto_aead *aead;
552 u32 align;
553 int err;
554
555 esp = kzalloc(sizeof(*esp), GFP_KERNEL);
556 if (esp == NULL)
557 return -ENOMEM;
558
559 x->data = esp;
560
561 if (x->aead)
562 err = esp_init_aead(x);
563 else
564 err = esp_init_authenc(x);
565
566 if (err)
417 goto error; 567 goto error;
418 x->props.header_len = sizeof(struct ip_esp_hdr) + esp->conf.ivlen; 568
569 aead = esp->aead;
570
571 esp->padlen = 0;
572
573 x->props.header_len = sizeof(struct ip_esp_hdr) +
574 crypto_aead_ivsize(aead);
419 if (x->props.mode == XFRM_MODE_TUNNEL) 575 if (x->props.mode == XFRM_MODE_TUNNEL)
420 x->props.header_len += sizeof(struct iphdr); 576 x->props.header_len += sizeof(struct iphdr);
421 else if (x->props.mode == XFRM_MODE_BEET) 577 else if (x->props.mode == XFRM_MODE_BEET)
@@ -434,21 +590,17 @@ static int esp_init_state(struct xfrm_state *x)
434 break; 590 break;
435 } 591 }
436 } 592 }
437 x->data = esp; 593
438 align = ALIGN(crypto_blkcipher_blocksize(esp->conf.tfm), 4); 594 align = ALIGN(crypto_aead_blocksize(aead), 4);
439 if (esp->conf.padlen) 595 if (esp->padlen)
440 align = max_t(u32, align, esp->conf.padlen); 596 align = max_t(u32, align, esp->padlen);
441 x->props.trailer_len = align + 1 + esp->auth.icv_trunc_len; 597 x->props.trailer_len = align + 1 + crypto_aead_authsize(esp->aead);
442 return 0;
443 598
444error: 599error:
445 x->data = esp; 600 return err;
446 esp_destroy(x);
447 x->data = NULL;
448 return -EINVAL;
449} 601}
450 602
451static struct xfrm_type esp_type = 603static const struct xfrm_type esp_type =
452{ 604{
453 .description = "ESP4", 605 .description = "ESP4",
454 .owner = THIS_MODULE, 606 .owner = THIS_MODULE,
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index d28261826bc2..86ff2711fc95 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -808,7 +808,7 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
808 First of all, we scan fib_info list searching 808 First of all, we scan fib_info list searching
809 for stray nexthop entries, then ignite fib_flush. 809 for stray nexthop entries, then ignite fib_flush.
810 */ 810 */
811 if (fib_sync_down(ifa->ifa_local, NULL, 0)) 811 if (fib_sync_down_addr(dev->nd_net, ifa->ifa_local))
812 fib_flush(dev->nd_net); 812 fib_flush(dev->nd_net);
813 } 813 }
814 } 814 }
@@ -898,7 +898,7 @@ static void nl_fib_lookup_exit(struct net *net)
898 898
899static void fib_disable_ip(struct net_device *dev, int force) 899static void fib_disable_ip(struct net_device *dev, int force)
900{ 900{
901 if (fib_sync_down(0, dev, force)) 901 if (fib_sync_down_dev(dev, force))
902 fib_flush(dev->nd_net); 902 fib_flush(dev->nd_net);
903 rt_cache_flush(0); 903 rt_cache_flush(0);
904 arp_ifdown(dev); 904 arp_ifdown(dev);
@@ -975,6 +975,7 @@ static struct notifier_block fib_netdev_notifier = {
975 975
976static int __net_init ip_fib_net_init(struct net *net) 976static int __net_init ip_fib_net_init(struct net *net)
977{ 977{
978 int err;
978 unsigned int i; 979 unsigned int i;
979 980
980 net->ipv4.fib_table_hash = kzalloc( 981 net->ipv4.fib_table_hash = kzalloc(
@@ -985,7 +986,14 @@ static int __net_init ip_fib_net_init(struct net *net)
985 for (i = 0; i < FIB_TABLE_HASHSZ; i++) 986 for (i = 0; i < FIB_TABLE_HASHSZ; i++)
986 INIT_HLIST_HEAD(&net->ipv4.fib_table_hash[i]); 987 INIT_HLIST_HEAD(&net->ipv4.fib_table_hash[i]);
987 988
988 return fib4_rules_init(net); 989 err = fib4_rules_init(net);
990 if (err < 0)
991 goto fail;
992 return 0;
993
994fail:
995 kfree(net->ipv4.fib_table_hash);
996 return err;
989} 997}
990 998
991static void __net_exit ip_fib_net_exit(struct net *net) 999static void __net_exit ip_fib_net_exit(struct net *net)
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index a15b2f1b2721..76b9c684cccd 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -424,19 +424,43 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
424 424
425 if (fa && fa->fa_tos == tos && 425 if (fa && fa->fa_tos == tos &&
426 fa->fa_info->fib_priority == fi->fib_priority) { 426 fa->fa_info->fib_priority == fi->fib_priority) {
427 struct fib_alias *fa_orig; 427 struct fib_alias *fa_first, *fa_match;
428 428
429 err = -EEXIST; 429 err = -EEXIST;
430 if (cfg->fc_nlflags & NLM_F_EXCL) 430 if (cfg->fc_nlflags & NLM_F_EXCL)
431 goto out; 431 goto out;
432 432
433 /* We have 2 goals:
434 * 1. Find exact match for type, scope, fib_info to avoid
435 * duplicate routes
436 * 2. Find next 'fa' (or head), NLM_F_APPEND inserts before it
437 */
438 fa_match = NULL;
439 fa_first = fa;
440 fa = list_entry(fa->fa_list.prev, struct fib_alias, fa_list);
441 list_for_each_entry_continue(fa, &f->fn_alias, fa_list) {
442 if (fa->fa_tos != tos)
443 break;
444 if (fa->fa_info->fib_priority != fi->fib_priority)
445 break;
446 if (fa->fa_type == cfg->fc_type &&
447 fa->fa_scope == cfg->fc_scope &&
448 fa->fa_info == fi) {
449 fa_match = fa;
450 break;
451 }
452 }
453
433 if (cfg->fc_nlflags & NLM_F_REPLACE) { 454 if (cfg->fc_nlflags & NLM_F_REPLACE) {
434 struct fib_info *fi_drop; 455 struct fib_info *fi_drop;
435 u8 state; 456 u8 state;
436 457
437 if (fi->fib_treeref > 1) 458 fa = fa_first;
459 if (fa_match) {
460 if (fa == fa_match)
461 err = 0;
438 goto out; 462 goto out;
439 463 }
440 write_lock_bh(&fib_hash_lock); 464 write_lock_bh(&fib_hash_lock);
441 fi_drop = fa->fa_info; 465 fi_drop = fa->fa_info;
442 fa->fa_info = fi; 466 fa->fa_info = fi;
@@ -459,20 +483,11 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
459 * uses the same scope, type, and nexthop 483 * uses the same scope, type, and nexthop
460 * information. 484 * information.
461 */ 485 */
462 fa_orig = fa; 486 if (fa_match)
463 fa = list_entry(fa->fa_list.prev, struct fib_alias, fa_list); 487 goto out;
464 list_for_each_entry_continue(fa, &f->fn_alias, fa_list) { 488
465 if (fa->fa_tos != tos)
466 break;
467 if (fa->fa_info->fib_priority != fi->fib_priority)
468 break;
469 if (fa->fa_type == cfg->fc_type &&
470 fa->fa_scope == cfg->fc_scope &&
471 fa->fa_info == fi)
472 goto out;
473 }
474 if (!(cfg->fc_nlflags & NLM_F_APPEND)) 489 if (!(cfg->fc_nlflags & NLM_F_APPEND))
475 fa = fa_orig; 490 fa = fa_first;
476 } 491 }
477 492
478 err = -ENOENT; 493 err = -ENOENT;
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index c7912866d987..a13c84763d4c 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -229,6 +229,8 @@ static struct fib_info *fib_find_info(const struct fib_info *nfi)
229 head = &fib_info_hash[hash]; 229 head = &fib_info_hash[hash];
230 230
231 hlist_for_each_entry(fi, node, head, fib_hash) { 231 hlist_for_each_entry(fi, node, head, fib_hash) {
232 if (fi->fib_net != nfi->fib_net)
233 continue;
232 if (fi->fib_nhs != nfi->fib_nhs) 234 if (fi->fib_nhs != nfi->fib_nhs)
233 continue; 235 continue;
234 if (nfi->fib_protocol == fi->fib_protocol && 236 if (nfi->fib_protocol == fi->fib_protocol &&
@@ -687,6 +689,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
687 struct fib_info *fi = NULL; 689 struct fib_info *fi = NULL;
688 struct fib_info *ofi; 690 struct fib_info *ofi;
689 int nhs = 1; 691 int nhs = 1;
692 struct net *net = cfg->fc_nlinfo.nl_net;
690 693
691 /* Fast check to catch the most weird cases */ 694 /* Fast check to catch the most weird cases */
692 if (fib_props[cfg->fc_type].scope > cfg->fc_scope) 695 if (fib_props[cfg->fc_type].scope > cfg->fc_scope)
@@ -727,6 +730,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
727 goto failure; 730 goto failure;
728 fib_info_cnt++; 731 fib_info_cnt++;
729 732
733 fi->fib_net = net;
730 fi->fib_protocol = cfg->fc_protocol; 734 fi->fib_protocol = cfg->fc_protocol;
731 fi->fib_flags = cfg->fc_flags; 735 fi->fib_flags = cfg->fc_flags;
732 fi->fib_priority = cfg->fc_priority; 736 fi->fib_priority = cfg->fc_priority;
@@ -798,8 +802,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
798 if (nhs != 1 || nh->nh_gw) 802 if (nhs != 1 || nh->nh_gw)
799 goto err_inval; 803 goto err_inval;
800 nh->nh_scope = RT_SCOPE_NOWHERE; 804 nh->nh_scope = RT_SCOPE_NOWHERE;
801 nh->nh_dev = dev_get_by_index(cfg->fc_nlinfo.nl_net, 805 nh->nh_dev = dev_get_by_index(net, fi->fib_nh->nh_oif);
802 fi->fib_nh->nh_oif);
803 err = -ENODEV; 806 err = -ENODEV;
804 if (nh->nh_dev == NULL) 807 if (nh->nh_dev == NULL)
805 goto failure; 808 goto failure;
@@ -813,8 +816,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
813 if (fi->fib_prefsrc) { 816 if (fi->fib_prefsrc) {
814 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst || 817 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||
815 fi->fib_prefsrc != cfg->fc_dst) 818 fi->fib_prefsrc != cfg->fc_dst)
816 if (inet_addr_type(cfg->fc_nlinfo.nl_net, 819 if (inet_addr_type(net, fi->fib_prefsrc) != RTN_LOCAL)
817 fi->fib_prefsrc) != RTN_LOCAL)
818 goto err_inval; 820 goto err_inval;
819 } 821 }
820 822
@@ -1031,70 +1033,74 @@ nla_put_failure:
1031 referring to it. 1033 referring to it.
1032 - device went down -> we must shutdown all nexthops going via it. 1034 - device went down -> we must shutdown all nexthops going via it.
1033 */ 1035 */
1034 1036int fib_sync_down_addr(struct net *net, __be32 local)
1035int fib_sync_down(__be32 local, struct net_device *dev, int force)
1036{ 1037{
1037 int ret = 0; 1038 int ret = 0;
1038 int scope = RT_SCOPE_NOWHERE; 1039 unsigned int hash = fib_laddr_hashfn(local);
1039 1040 struct hlist_head *head = &fib_info_laddrhash[hash];
1040 if (force) 1041 struct hlist_node *node;
1041 scope = -1; 1042 struct fib_info *fi;
1042 1043
1043 if (local && fib_info_laddrhash) { 1044 if (fib_info_laddrhash == NULL || local == 0)
1044 unsigned int hash = fib_laddr_hashfn(local); 1045 return 0;
1045 struct hlist_head *head = &fib_info_laddrhash[hash];
1046 struct hlist_node *node;
1047 struct fib_info *fi;
1048 1046
1049 hlist_for_each_entry(fi, node, head, fib_lhash) { 1047 hlist_for_each_entry(fi, node, head, fib_lhash) {
1050 if (fi->fib_prefsrc == local) { 1048 if (fi->fib_net != net)
1051 fi->fib_flags |= RTNH_F_DEAD; 1049 continue;
1052 ret++; 1050 if (fi->fib_prefsrc == local) {
1053 } 1051 fi->fib_flags |= RTNH_F_DEAD;
1052 ret++;
1054 } 1053 }
1055 } 1054 }
1055 return ret;
1056}
1056 1057
1057 if (dev) { 1058int fib_sync_down_dev(struct net_device *dev, int force)
1058 struct fib_info *prev_fi = NULL; 1059{
1059 unsigned int hash = fib_devindex_hashfn(dev->ifindex); 1060 int ret = 0;
1060 struct hlist_head *head = &fib_info_devhash[hash]; 1061 int scope = RT_SCOPE_NOWHERE;
1061 struct hlist_node *node; 1062 struct fib_info *prev_fi = NULL;
1062 struct fib_nh *nh; 1063 unsigned int hash = fib_devindex_hashfn(dev->ifindex);
1064 struct hlist_head *head = &fib_info_devhash[hash];
1065 struct hlist_node *node;
1066 struct fib_nh *nh;
1063 1067
1064 hlist_for_each_entry(nh, node, head, nh_hash) { 1068 if (force)
1065 struct fib_info *fi = nh->nh_parent; 1069 scope = -1;
1066 int dead;
1067 1070
1068 BUG_ON(!fi->fib_nhs); 1071 hlist_for_each_entry(nh, node, head, nh_hash) {
1069 if (nh->nh_dev != dev || fi == prev_fi) 1072 struct fib_info *fi = nh->nh_parent;
1070 continue; 1073 int dead;
1071 prev_fi = fi; 1074
1072 dead = 0; 1075 BUG_ON(!fi->fib_nhs);
1073 change_nexthops(fi) { 1076 if (nh->nh_dev != dev || fi == prev_fi)
1074 if (nh->nh_flags&RTNH_F_DEAD) 1077 continue;
1075 dead++; 1078 prev_fi = fi;
1076 else if (nh->nh_dev == dev && 1079 dead = 0;
1077 nh->nh_scope != scope) { 1080 change_nexthops(fi) {
1078 nh->nh_flags |= RTNH_F_DEAD; 1081 if (nh->nh_flags&RTNH_F_DEAD)
1082 dead++;
1083 else if (nh->nh_dev == dev &&
1084 nh->nh_scope != scope) {
1085 nh->nh_flags |= RTNH_F_DEAD;
1079#ifdef CONFIG_IP_ROUTE_MULTIPATH 1086#ifdef CONFIG_IP_ROUTE_MULTIPATH
1080 spin_lock_bh(&fib_multipath_lock); 1087 spin_lock_bh(&fib_multipath_lock);
1081 fi->fib_power -= nh->nh_power; 1088 fi->fib_power -= nh->nh_power;
1082 nh->nh_power = 0; 1089 nh->nh_power = 0;
1083 spin_unlock_bh(&fib_multipath_lock); 1090 spin_unlock_bh(&fib_multipath_lock);
1084#endif 1091#endif
1085 dead++; 1092 dead++;
1086 } 1093 }
1087#ifdef CONFIG_IP_ROUTE_MULTIPATH 1094#ifdef CONFIG_IP_ROUTE_MULTIPATH
1088 if (force > 1 && nh->nh_dev == dev) { 1095 if (force > 1 && nh->nh_dev == dev) {
1089 dead = fi->fib_nhs; 1096 dead = fi->fib_nhs;
1090 break; 1097 break;
1091 }
1092#endif
1093 } endfor_nexthops(fi)
1094 if (dead == fi->fib_nhs) {
1095 fi->fib_flags |= RTNH_F_DEAD;
1096 ret++;
1097 } 1098 }
1099#endif
1100 } endfor_nexthops(fi)
1101 if (dead == fi->fib_nhs) {
1102 fi->fib_flags |= RTNH_F_DEAD;
1103 ret++;
1098 } 1104 }
1099 } 1105 }
1100 1106
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index f2f47033f31f..35851c96bdfb 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1205,20 +1205,45 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1205 * and we need to allocate a new one of those as well. 1205 * and we need to allocate a new one of those as well.
1206 */ 1206 */
1207 1207
1208 if (fa && fa->fa_info->fib_priority == fi->fib_priority) { 1208 if (fa && fa->fa_tos == tos &&
1209 struct fib_alias *fa_orig; 1209 fa->fa_info->fib_priority == fi->fib_priority) {
1210 struct fib_alias *fa_first, *fa_match;
1210 1211
1211 err = -EEXIST; 1212 err = -EEXIST;
1212 if (cfg->fc_nlflags & NLM_F_EXCL) 1213 if (cfg->fc_nlflags & NLM_F_EXCL)
1213 goto out; 1214 goto out;
1214 1215
1216 /* We have 2 goals:
1217 * 1. Find exact match for type, scope, fib_info to avoid
1218 * duplicate routes
1219 * 2. Find next 'fa' (or head), NLM_F_APPEND inserts before it
1220 */
1221 fa_match = NULL;
1222 fa_first = fa;
1223 fa = list_entry(fa->fa_list.prev, struct fib_alias, fa_list);
1224 list_for_each_entry_continue(fa, fa_head, fa_list) {
1225 if (fa->fa_tos != tos)
1226 break;
1227 if (fa->fa_info->fib_priority != fi->fib_priority)
1228 break;
1229 if (fa->fa_type == cfg->fc_type &&
1230 fa->fa_scope == cfg->fc_scope &&
1231 fa->fa_info == fi) {
1232 fa_match = fa;
1233 break;
1234 }
1235 }
1236
1215 if (cfg->fc_nlflags & NLM_F_REPLACE) { 1237 if (cfg->fc_nlflags & NLM_F_REPLACE) {
1216 struct fib_info *fi_drop; 1238 struct fib_info *fi_drop;
1217 u8 state; 1239 u8 state;
1218 1240
1219 if (fi->fib_treeref > 1) 1241 fa = fa_first;
1242 if (fa_match) {
1243 if (fa == fa_match)
1244 err = 0;
1220 goto out; 1245 goto out;
1221 1246 }
1222 err = -ENOBUFS; 1247 err = -ENOBUFS;
1223 new_fa = kmem_cache_alloc(fn_alias_kmem, GFP_KERNEL); 1248 new_fa = kmem_cache_alloc(fn_alias_kmem, GFP_KERNEL);
1224 if (new_fa == NULL) 1249 if (new_fa == NULL)
@@ -1230,7 +1255,7 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1230 new_fa->fa_type = cfg->fc_type; 1255 new_fa->fa_type = cfg->fc_type;
1231 new_fa->fa_scope = cfg->fc_scope; 1256 new_fa->fa_scope = cfg->fc_scope;
1232 state = fa->fa_state; 1257 state = fa->fa_state;
1233 new_fa->fa_state &= ~FA_S_ACCESSED; 1258 new_fa->fa_state = state & ~FA_S_ACCESSED;
1234 1259
1235 list_replace_rcu(&fa->fa_list, &new_fa->fa_list); 1260 list_replace_rcu(&fa->fa_list, &new_fa->fa_list);
1236 alias_free_mem_rcu(fa); 1261 alias_free_mem_rcu(fa);
@@ -1247,20 +1272,11 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1247 * uses the same scope, type, and nexthop 1272 * uses the same scope, type, and nexthop
1248 * information. 1273 * information.
1249 */ 1274 */
1250 fa_orig = fa; 1275 if (fa_match)
1251 list_for_each_entry(fa, fa_orig->fa_list.prev, fa_list) { 1276 goto out;
1252 if (fa->fa_tos != tos)
1253 break;
1254 if (fa->fa_info->fib_priority != fi->fib_priority)
1255 break;
1256 if (fa->fa_type == cfg->fc_type &&
1257 fa->fa_scope == cfg->fc_scope &&
1258 fa->fa_info == fi)
1259 goto out;
1260 }
1261 1277
1262 if (!(cfg->fc_nlflags & NLM_F_APPEND)) 1278 if (!(cfg->fc_nlflags & NLM_F_APPEND))
1263 fa = fa_orig; 1279 fa = fa_first;
1264 } 1280 }
1265 err = -ENOENT; 1281 err = -ENOENT;
1266 if (!(cfg->fc_nlflags & NLM_F_CREATE)) 1282 if (!(cfg->fc_nlflags & NLM_F_CREATE))
@@ -1600,9 +1616,8 @@ static int fn_trie_delete(struct fib_table *tb, struct fib_config *cfg)
1600 pr_debug("Deleting %08x/%d tos=%d t=%p\n", key, plen, tos, t); 1616 pr_debug("Deleting %08x/%d tos=%d t=%p\n", key, plen, tos, t);
1601 1617
1602 fa_to_delete = NULL; 1618 fa_to_delete = NULL;
1603 fa_head = fa->fa_list.prev; 1619 fa = list_entry(fa->fa_list.prev, struct fib_alias, fa_list);
1604 1620 list_for_each_entry_continue(fa, fa_head, fa_list) {
1605 list_for_each_entry(fa, fa_head, fa_list) {
1606 struct fib_info *fi = fa->fa_info; 1621 struct fib_info *fi = fa->fa_info;
1607 1622
1608 if (fa->fa_tos != tos) 1623 if (fa->fa_tos != tos)
@@ -1743,6 +1758,19 @@ static struct leaf *trie_nextleaf(struct leaf *l)
1743 return leaf_walk_rcu(p, c); 1758 return leaf_walk_rcu(p, c);
1744} 1759}
1745 1760
1761static struct leaf *trie_leafindex(struct trie *t, int index)
1762{
1763 struct leaf *l = trie_firstleaf(t);
1764
1765 while (index-- > 0) {
1766 l = trie_nextleaf(l);
1767 if (!l)
1768 break;
1769 }
1770 return l;
1771}
1772
1773
1746/* 1774/*
1747 * Caller must hold RTNL. 1775 * Caller must hold RTNL.
1748 */ 1776 */
@@ -1848,7 +1876,7 @@ static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah,
1848 struct fib_alias *fa; 1876 struct fib_alias *fa;
1849 __be32 xkey = htonl(key); 1877 __be32 xkey = htonl(key);
1850 1878
1851 s_i = cb->args[4]; 1879 s_i = cb->args[5];
1852 i = 0; 1880 i = 0;
1853 1881
1854 /* rcu_read_lock is hold by caller */ 1882 /* rcu_read_lock is hold by caller */
@@ -1869,12 +1897,12 @@ static int fn_trie_dump_fa(t_key key, int plen, struct list_head *fah,
1869 plen, 1897 plen,
1870 fa->fa_tos, 1898 fa->fa_tos,
1871 fa->fa_info, NLM_F_MULTI) < 0) { 1899 fa->fa_info, NLM_F_MULTI) < 0) {
1872 cb->args[4] = i; 1900 cb->args[5] = i;
1873 return -1; 1901 return -1;
1874 } 1902 }
1875 i++; 1903 i++;
1876 } 1904 }
1877 cb->args[4] = i; 1905 cb->args[5] = i;
1878 return skb->len; 1906 return skb->len;
1879} 1907}
1880 1908
@@ -1885,7 +1913,7 @@ static int fn_trie_dump_leaf(struct leaf *l, struct fib_table *tb,
1885 struct hlist_node *node; 1913 struct hlist_node *node;
1886 int i, s_i; 1914 int i, s_i;
1887 1915
1888 s_i = cb->args[3]; 1916 s_i = cb->args[4];
1889 i = 0; 1917 i = 0;
1890 1918
1891 /* rcu_read_lock is hold by caller */ 1919 /* rcu_read_lock is hold by caller */
@@ -1896,19 +1924,19 @@ static int fn_trie_dump_leaf(struct leaf *l, struct fib_table *tb,
1896 } 1924 }
1897 1925
1898 if (i > s_i) 1926 if (i > s_i)
1899 cb->args[4] = 0; 1927 cb->args[5] = 0;
1900 1928
1901 if (list_empty(&li->falh)) 1929 if (list_empty(&li->falh))
1902 continue; 1930 continue;
1903 1931
1904 if (fn_trie_dump_fa(l->key, li->plen, &li->falh, tb, skb, cb) < 0) { 1932 if (fn_trie_dump_fa(l->key, li->plen, &li->falh, tb, skb, cb) < 0) {
1905 cb->args[3] = i; 1933 cb->args[4] = i;
1906 return -1; 1934 return -1;
1907 } 1935 }
1908 i++; 1936 i++;
1909 } 1937 }
1910 1938
1911 cb->args[3] = i; 1939 cb->args[4] = i;
1912 return skb->len; 1940 return skb->len;
1913} 1941}
1914 1942
@@ -1918,35 +1946,37 @@ static int fn_trie_dump(struct fib_table *tb, struct sk_buff *skb,
1918 struct leaf *l; 1946 struct leaf *l;
1919 struct trie *t = (struct trie *) tb->tb_data; 1947 struct trie *t = (struct trie *) tb->tb_data;
1920 t_key key = cb->args[2]; 1948 t_key key = cb->args[2];
1949 int count = cb->args[3];
1921 1950
1922 rcu_read_lock(); 1951 rcu_read_lock();
1923 /* Dump starting at last key. 1952 /* Dump starting at last key.
1924 * Note: 0.0.0.0/0 (ie default) is first key. 1953 * Note: 0.0.0.0/0 (ie default) is first key.
1925 */ 1954 */
1926 if (!key) 1955 if (count == 0)
1927 l = trie_firstleaf(t); 1956 l = trie_firstleaf(t);
1928 else { 1957 else {
1958 /* Normally, continue from last key, but if that is missing
1959 * fallback to using slow rescan
1960 */
1929 l = fib_find_node(t, key); 1961 l = fib_find_node(t, key);
1930 if (!l) { 1962 if (!l)
1931 /* The table changed during the dump, rather than 1963 l = trie_leafindex(t, count);
1932 * giving partial data, just make application retry.
1933 */
1934 rcu_read_unlock();
1935 return -EBUSY;
1936 }
1937 } 1964 }
1938 1965
1939 while (l) { 1966 while (l) {
1940 cb->args[2] = l->key; 1967 cb->args[2] = l->key;
1941 if (fn_trie_dump_leaf(l, tb, skb, cb) < 0) { 1968 if (fn_trie_dump_leaf(l, tb, skb, cb) < 0) {
1969 cb->args[3] = count;
1942 rcu_read_unlock(); 1970 rcu_read_unlock();
1943 return -1; 1971 return -1;
1944 } 1972 }
1945 1973
1974 ++count;
1946 l = trie_nextleaf(l); 1975 l = trie_nextleaf(l);
1947 memset(&cb->args[3], 0, 1976 memset(&cb->args[4], 0,
1948 sizeof(cb->args) - 3*sizeof(cb->args[0])); 1977 sizeof(cb->args) - 4*sizeof(cb->args[0]));
1949 } 1978 }
1979 cb->args[3] = count;
1950 rcu_read_unlock(); 1980 rcu_read_unlock();
1951 1981
1952 return skb->len; 1982 return skb->len;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 7801cceb2d1b..de5a41de191a 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -87,6 +87,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo,
87 struct hlist_node *node; 87 struct hlist_node *node;
88 struct inet_bind_bucket *tb; 88 struct inet_bind_bucket *tb;
89 int ret; 89 int ret;
90 struct net *net = sk->sk_net;
90 91
91 local_bh_disable(); 92 local_bh_disable();
92 if (!snum) { 93 if (!snum) {
@@ -100,7 +101,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo,
100 head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)]; 101 head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)];
101 spin_lock(&head->lock); 102 spin_lock(&head->lock);
102 inet_bind_bucket_for_each(tb, node, &head->chain) 103 inet_bind_bucket_for_each(tb, node, &head->chain)
103 if (tb->port == rover) 104 if (tb->ib_net == net && tb->port == rover)
104 goto next; 105 goto next;
105 break; 106 break;
106 next: 107 next:
@@ -127,7 +128,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo,
127 head = &hashinfo->bhash[inet_bhashfn(snum, hashinfo->bhash_size)]; 128 head = &hashinfo->bhash[inet_bhashfn(snum, hashinfo->bhash_size)];
128 spin_lock(&head->lock); 129 spin_lock(&head->lock);
129 inet_bind_bucket_for_each(tb, node, &head->chain) 130 inet_bind_bucket_for_each(tb, node, &head->chain)
130 if (tb->port == snum) 131 if (tb->ib_net == net && tb->port == snum)
131 goto tb_found; 132 goto tb_found;
132 } 133 }
133 tb = NULL; 134 tb = NULL;
@@ -147,7 +148,8 @@ tb_found:
147 } 148 }
148tb_not_found: 149tb_not_found:
149 ret = 1; 150 ret = 1;
150 if (!tb && (tb = inet_bind_bucket_create(hashinfo->bind_bucket_cachep, head, snum)) == NULL) 151 if (!tb && (tb = inet_bind_bucket_create(hashinfo->bind_bucket_cachep,
152 net, head, snum)) == NULL)
151 goto fail_unlock; 153 goto fail_unlock;
152 if (hlist_empty(&tb->owners)) { 154 if (hlist_empty(&tb->owners)) {
153 if (sk->sk_reuse && sk->sk_state != TCP_LISTEN) 155 if (sk->sk_reuse && sk->sk_state != TCP_LISTEN)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 605ed2cd7972..da97695e7096 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -259,20 +259,22 @@ static int inet_diag_get_exact(struct sk_buff *in_skb,
259 const struct inet_diag_handler *handler; 259 const struct inet_diag_handler *handler;
260 260
261 handler = inet_diag_lock_handler(nlh->nlmsg_type); 261 handler = inet_diag_lock_handler(nlh->nlmsg_type);
262 if (!handler) 262 if (IS_ERR(handler)) {
263 return -ENOENT; 263 err = PTR_ERR(handler);
264 goto unlock;
265 }
264 266
265 hashinfo = handler->idiag_hashinfo; 267 hashinfo = handler->idiag_hashinfo;
266 err = -EINVAL; 268 err = -EINVAL;
267 269
268 if (req->idiag_family == AF_INET) { 270 if (req->idiag_family == AF_INET) {
269 sk = inet_lookup(hashinfo, req->id.idiag_dst[0], 271 sk = inet_lookup(&init_net, hashinfo, req->id.idiag_dst[0],
270 req->id.idiag_dport, req->id.idiag_src[0], 272 req->id.idiag_dport, req->id.idiag_src[0],
271 req->id.idiag_sport, req->id.idiag_if); 273 req->id.idiag_sport, req->id.idiag_if);
272 } 274 }
273#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 275#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
274 else if (req->idiag_family == AF_INET6) { 276 else if (req->idiag_family == AF_INET6) {
275 sk = inet6_lookup(hashinfo, 277 sk = inet6_lookup(&init_net, hashinfo,
276 (struct in6_addr *)req->id.idiag_dst, 278 (struct in6_addr *)req->id.idiag_dst,
277 req->id.idiag_dport, 279 req->id.idiag_dport,
278 (struct in6_addr *)req->id.idiag_src, 280 (struct in6_addr *)req->id.idiag_src,
@@ -708,8 +710,8 @@ static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
708 struct inet_hashinfo *hashinfo; 710 struct inet_hashinfo *hashinfo;
709 711
710 handler = inet_diag_lock_handler(cb->nlh->nlmsg_type); 712 handler = inet_diag_lock_handler(cb->nlh->nlmsg_type);
711 if (!handler) 713 if (IS_ERR(handler))
712 goto no_handler; 714 goto unlock;
713 715
714 hashinfo = handler->idiag_hashinfo; 716 hashinfo = handler->idiag_hashinfo;
715 717
@@ -838,7 +840,6 @@ done:
838 cb->args[2] = num; 840 cb->args[2] = num;
839unlock: 841unlock:
840 inet_diag_unlock_handler(handler); 842 inet_diag_unlock_handler(handler);
841no_handler:
842 return skb->len; 843 return skb->len;
843} 844}
844 845
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 619c63c6948a..48d45008f749 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -28,12 +28,14 @@
28 * The bindhash mutex for snum's hash chain must be held here. 28 * The bindhash mutex for snum's hash chain must be held here.
29 */ 29 */
30struct inet_bind_bucket *inet_bind_bucket_create(struct kmem_cache *cachep, 30struct inet_bind_bucket *inet_bind_bucket_create(struct kmem_cache *cachep,
31 struct net *net,
31 struct inet_bind_hashbucket *head, 32 struct inet_bind_hashbucket *head,
32 const unsigned short snum) 33 const unsigned short snum)
33{ 34{
34 struct inet_bind_bucket *tb = kmem_cache_alloc(cachep, GFP_ATOMIC); 35 struct inet_bind_bucket *tb = kmem_cache_alloc(cachep, GFP_ATOMIC);
35 36
36 if (tb != NULL) { 37 if (tb != NULL) {
38 tb->ib_net = net;
37 tb->port = snum; 39 tb->port = snum;
38 tb->fastreuse = 0; 40 tb->fastreuse = 0;
39 INIT_HLIST_HEAD(&tb->owners); 41 INIT_HLIST_HEAD(&tb->owners);
@@ -125,7 +127,8 @@ EXPORT_SYMBOL(inet_listen_wlock);
125 * remote address for the connection. So always assume those are both 127 * remote address for the connection. So always assume those are both
126 * wildcarded during the search since they can never be otherwise. 128 * wildcarded during the search since they can never be otherwise.
127 */ 129 */
128static struct sock *inet_lookup_listener_slow(const struct hlist_head *head, 130static struct sock *inet_lookup_listener_slow(struct net *net,
131 const struct hlist_head *head,
129 const __be32 daddr, 132 const __be32 daddr,
130 const unsigned short hnum, 133 const unsigned short hnum,
131 const int dif) 134 const int dif)
@@ -137,7 +140,8 @@ static struct sock *inet_lookup_listener_slow(const struct hlist_head *head,
137 sk_for_each(sk, node, head) { 140 sk_for_each(sk, node, head) {
138 const struct inet_sock *inet = inet_sk(sk); 141 const struct inet_sock *inet = inet_sk(sk);
139 142
140 if (inet->num == hnum && !ipv6_only_sock(sk)) { 143 if (sk->sk_net == net && inet->num == hnum &&
144 !ipv6_only_sock(sk)) {
141 const __be32 rcv_saddr = inet->rcv_saddr; 145 const __be32 rcv_saddr = inet->rcv_saddr;
142 int score = sk->sk_family == PF_INET ? 1 : 0; 146 int score = sk->sk_family == PF_INET ? 1 : 0;
143 147
@@ -163,7 +167,8 @@ static struct sock *inet_lookup_listener_slow(const struct hlist_head *head,
163} 167}
164 168
165/* Optimize the common listener case. */ 169/* Optimize the common listener case. */
166struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, 170struct sock *__inet_lookup_listener(struct net *net,
171 struct inet_hashinfo *hashinfo,
167 const __be32 daddr, const unsigned short hnum, 172 const __be32 daddr, const unsigned short hnum,
168 const int dif) 173 const int dif)
169{ 174{
@@ -178,9 +183,9 @@ struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo,
178 if (inet->num == hnum && !sk->sk_node.next && 183 if (inet->num == hnum && !sk->sk_node.next &&
179 (!inet->rcv_saddr || inet->rcv_saddr == daddr) && 184 (!inet->rcv_saddr || inet->rcv_saddr == daddr) &&
180 (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) && 185 (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) &&
181 !sk->sk_bound_dev_if) 186 !sk->sk_bound_dev_if && sk->sk_net == net)
182 goto sherry_cache; 187 goto sherry_cache;
183 sk = inet_lookup_listener_slow(head, daddr, hnum, dif); 188 sk = inet_lookup_listener_slow(net, head, daddr, hnum, dif);
184 } 189 }
185 if (sk) { 190 if (sk) {
186sherry_cache: 191sherry_cache:
@@ -191,7 +196,8 @@ sherry_cache:
191} 196}
192EXPORT_SYMBOL_GPL(__inet_lookup_listener); 197EXPORT_SYMBOL_GPL(__inet_lookup_listener);
193 198
194struct sock * __inet_lookup_established(struct inet_hashinfo *hashinfo, 199struct sock * __inet_lookup_established(struct net *net,
200 struct inet_hashinfo *hashinfo,
195 const __be32 saddr, const __be16 sport, 201 const __be32 saddr, const __be16 sport,
196 const __be32 daddr, const u16 hnum, 202 const __be32 daddr, const u16 hnum,
197 const int dif) 203 const int dif)
@@ -210,13 +216,15 @@ struct sock * __inet_lookup_established(struct inet_hashinfo *hashinfo,
210 prefetch(head->chain.first); 216 prefetch(head->chain.first);
211 read_lock(lock); 217 read_lock(lock);
212 sk_for_each(sk, node, &head->chain) { 218 sk_for_each(sk, node, &head->chain) {
213 if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) 219 if (INET_MATCH(sk, net, hash, acookie,
220 saddr, daddr, ports, dif))
214 goto hit; /* You sunk my battleship! */ 221 goto hit; /* You sunk my battleship! */
215 } 222 }
216 223
217 /* Must check for a TIME_WAIT'er before going to listener hash. */ 224 /* Must check for a TIME_WAIT'er before going to listener hash. */
218 sk_for_each(sk, node, &head->twchain) { 225 sk_for_each(sk, node, &head->twchain) {
219 if (INET_TW_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) 226 if (INET_TW_MATCH(sk, net, hash, acookie,
227 saddr, daddr, ports, dif))
220 goto hit; 228 goto hit;
221 } 229 }
222 sk = NULL; 230 sk = NULL;
@@ -247,6 +255,7 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row,
247 struct sock *sk2; 255 struct sock *sk2;
248 const struct hlist_node *node; 256 const struct hlist_node *node;
249 struct inet_timewait_sock *tw; 257 struct inet_timewait_sock *tw;
258 struct net *net = sk->sk_net;
250 259
251 prefetch(head->chain.first); 260 prefetch(head->chain.first);
252 write_lock(lock); 261 write_lock(lock);
@@ -255,7 +264,8 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row,
255 sk_for_each(sk2, node, &head->twchain) { 264 sk_for_each(sk2, node, &head->twchain) {
256 tw = inet_twsk(sk2); 265 tw = inet_twsk(sk2);
257 266
258 if (INET_TW_MATCH(sk2, hash, acookie, saddr, daddr, ports, dif)) { 267 if (INET_TW_MATCH(sk2, net, hash, acookie,
268 saddr, daddr, ports, dif)) {
259 if (twsk_unique(sk, sk2, twp)) 269 if (twsk_unique(sk, sk2, twp))
260 goto unique; 270 goto unique;
261 else 271 else
@@ -266,7 +276,8 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row,
266 276
267 /* And established part... */ 277 /* And established part... */
268 sk_for_each(sk2, node, &head->chain) { 278 sk_for_each(sk2, node, &head->chain) {
269 if (INET_MATCH(sk2, hash, acookie, saddr, daddr, ports, dif)) 279 if (INET_MATCH(sk2, net, hash, acookie,
280 saddr, daddr, ports, dif))
270 goto not_unique; 281 goto not_unique;
271 } 282 }
272 283
@@ -348,17 +359,18 @@ void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk)
348} 359}
349EXPORT_SYMBOL_GPL(__inet_hash); 360EXPORT_SYMBOL_GPL(__inet_hash);
350 361
351/* 362int __inet_hash_connect(struct inet_timewait_death_row *death_row,
352 * Bind a port for a connect operation and hash it. 363 struct sock *sk,
353 */ 364 int (*check_established)(struct inet_timewait_death_row *,
354int inet_hash_connect(struct inet_timewait_death_row *death_row, 365 struct sock *, __u16, struct inet_timewait_sock **),
355 struct sock *sk) 366 void (*hash)(struct inet_hashinfo *, struct sock *))
356{ 367{
357 struct inet_hashinfo *hinfo = death_row->hashinfo; 368 struct inet_hashinfo *hinfo = death_row->hashinfo;
358 const unsigned short snum = inet_sk(sk)->num; 369 const unsigned short snum = inet_sk(sk)->num;
359 struct inet_bind_hashbucket *head; 370 struct inet_bind_hashbucket *head;
360 struct inet_bind_bucket *tb; 371 struct inet_bind_bucket *tb;
361 int ret; 372 int ret;
373 struct net *net = sk->sk_net;
362 374
363 if (!snum) { 375 if (!snum) {
364 int i, remaining, low, high, port; 376 int i, remaining, low, high, port;
@@ -381,19 +393,19 @@ int inet_hash_connect(struct inet_timewait_death_row *death_row,
381 * unique enough. 393 * unique enough.
382 */ 394 */
383 inet_bind_bucket_for_each(tb, node, &head->chain) { 395 inet_bind_bucket_for_each(tb, node, &head->chain) {
384 if (tb->port == port) { 396 if (tb->ib_net == net && tb->port == port) {
385 BUG_TRAP(!hlist_empty(&tb->owners)); 397 BUG_TRAP(!hlist_empty(&tb->owners));
386 if (tb->fastreuse >= 0) 398 if (tb->fastreuse >= 0)
387 goto next_port; 399 goto next_port;
388 if (!__inet_check_established(death_row, 400 if (!check_established(death_row, sk,
389 sk, port, 401 port, &tw))
390 &tw))
391 goto ok; 402 goto ok;
392 goto next_port; 403 goto next_port;
393 } 404 }
394 } 405 }
395 406
396 tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, head, port); 407 tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep,
408 net, head, port);
397 if (!tb) { 409 if (!tb) {
398 spin_unlock(&head->lock); 410 spin_unlock(&head->lock);
399 break; 411 break;
@@ -415,7 +427,7 @@ ok:
415 inet_bind_hash(sk, tb, port); 427 inet_bind_hash(sk, tb, port);
416 if (sk_unhashed(sk)) { 428 if (sk_unhashed(sk)) {
417 inet_sk(sk)->sport = htons(port); 429 inet_sk(sk)->sport = htons(port);
418 __inet_hash_nolisten(hinfo, sk); 430 hash(hinfo, sk);
419 } 431 }
420 spin_unlock(&head->lock); 432 spin_unlock(&head->lock);
421 433
@@ -432,17 +444,28 @@ ok:
432 tb = inet_csk(sk)->icsk_bind_hash; 444 tb = inet_csk(sk)->icsk_bind_hash;
433 spin_lock_bh(&head->lock); 445 spin_lock_bh(&head->lock);
434 if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) { 446 if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) {
435 __inet_hash_nolisten(hinfo, sk); 447 hash(hinfo, sk);
436 spin_unlock_bh(&head->lock); 448 spin_unlock_bh(&head->lock);
437 return 0; 449 return 0;
438 } else { 450 } else {
439 spin_unlock(&head->lock); 451 spin_unlock(&head->lock);
440 /* No definite answer... Walk to established hash table */ 452 /* No definite answer... Walk to established hash table */
441 ret = __inet_check_established(death_row, sk, snum, NULL); 453 ret = check_established(death_row, sk, snum, NULL);
442out: 454out:
443 local_bh_enable(); 455 local_bh_enable();
444 return ret; 456 return ret;
445 } 457 }
446} 458}
459EXPORT_SYMBOL_GPL(__inet_hash_connect);
460
461/*
462 * Bind a port for a connect operation and hash it.
463 */
464int inet_hash_connect(struct inet_timewait_death_row *death_row,
465 struct sock *sk)
466{
467 return __inet_hash_connect(death_row, sk,
468 __inet_check_established, __inet_hash_nolisten);
469}
447 470
448EXPORT_SYMBOL_GPL(inet_hash_connect); 471EXPORT_SYMBOL_GPL(inet_hash_connect);
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 18070ca65771..341779e685d9 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -168,6 +168,7 @@ int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
168 } 168 }
169 169
170 skb->priority = sk->sk_priority; 170 skb->priority = sk->sk_priority;
171 skb->mark = sk->sk_mark;
171 172
172 /* Send it out. */ 173 /* Send it out. */
173 return ip_local_out(skb); 174 return ip_local_out(skb);
@@ -385,6 +386,7 @@ packet_routed:
385 (skb_shinfo(skb)->gso_segs ?: 1) - 1); 386 (skb_shinfo(skb)->gso_segs ?: 1) - 1);
386 387
387 skb->priority = sk->sk_priority; 388 skb->priority = sk->sk_priority;
389 skb->mark = sk->sk_mark;
388 390
389 return ip_local_out(skb); 391 return ip_local_out(skb);
390 392
@@ -476,6 +478,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
476 if (skb_shinfo(skb)->frag_list) { 478 if (skb_shinfo(skb)->frag_list) {
477 struct sk_buff *frag; 479 struct sk_buff *frag;
478 int first_len = skb_pagelen(skb); 480 int first_len = skb_pagelen(skb);
481 int truesizes = 0;
479 482
480 if (first_len - hlen > mtu || 483 if (first_len - hlen > mtu ||
481 ((first_len - hlen) & 7) || 484 ((first_len - hlen) & 7) ||
@@ -499,7 +502,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
499 sock_hold(skb->sk); 502 sock_hold(skb->sk);
500 frag->sk = skb->sk; 503 frag->sk = skb->sk;
501 frag->destructor = sock_wfree; 504 frag->destructor = sock_wfree;
502 skb->truesize -= frag->truesize; 505 truesizes += frag->truesize;
503 } 506 }
504 } 507 }
505 508
@@ -510,6 +513,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
510 frag = skb_shinfo(skb)->frag_list; 513 frag = skb_shinfo(skb)->frag_list;
511 skb_shinfo(skb)->frag_list = NULL; 514 skb_shinfo(skb)->frag_list = NULL;
512 skb->data_len = first_len - skb_headlen(skb); 515 skb->data_len = first_len - skb_headlen(skb);
516 skb->truesize -= truesizes;
513 skb->len = first_len; 517 skb->len = first_len;
514 iph->tot_len = htons(first_len); 518 iph->tot_len = htons(first_len);
515 iph->frag_off = htons(IP_MF); 519 iph->frag_off = htons(IP_MF);
@@ -1284,6 +1288,7 @@ int ip_push_pending_frames(struct sock *sk)
1284 iph->daddr = rt->rt_dst; 1288 iph->daddr = rt->rt_dst;
1285 1289
1286 skb->priority = sk->sk_priority; 1290 skb->priority = sk->sk_priority;
1291 skb->mark = sk->sk_mark;
1287 skb->dst = dst_clone(&rt->u.dst); 1292 skb->dst = dst_clone(&rt->u.dst);
1288 1293
1289 if (iph->protocol == IPPROTO_ICMP) 1294 if (iph->protocol == IPPROTO_ICMP)
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index f4af99ad8fdb..ae1f45fc23b9 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -74,6 +74,7 @@ out:
74 74
75static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb) 75static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb)
76{ 76{
77 int nexthdr;
77 int err = -ENOMEM; 78 int err = -ENOMEM;
78 struct ip_comp_hdr *ipch; 79 struct ip_comp_hdr *ipch;
79 80
@@ -84,13 +85,15 @@ static int ipcomp_input(struct xfrm_state *x, struct sk_buff *skb)
84 85
85 /* Remove ipcomp header and decompress original payload */ 86 /* Remove ipcomp header and decompress original payload */
86 ipch = (void *)skb->data; 87 ipch = (void *)skb->data;
88 nexthdr = ipch->nexthdr;
89
87 skb->transport_header = skb->network_header + sizeof(*ipch); 90 skb->transport_header = skb->network_header + sizeof(*ipch);
88 __skb_pull(skb, sizeof(*ipch)); 91 __skb_pull(skb, sizeof(*ipch));
89 err = ipcomp_decompress(x, skb); 92 err = ipcomp_decompress(x, skb);
90 if (err) 93 if (err)
91 goto out; 94 goto out;
92 95
93 err = ipch->nexthdr; 96 err = nexthdr;
94 97
95out: 98out:
96 return err; 99 return err;
@@ -434,7 +437,7 @@ error:
434 goto out; 437 goto out;
435} 438}
436 439
437static struct xfrm_type ipcomp_type = { 440static const struct xfrm_type ipcomp_type = {
438 .description = "IPCOMP4", 441 .description = "IPCOMP4",
439 .owner = THIS_MODULE, 442 .owner = THIS_MODULE,
440 .proto = IPPROTO_COMP, 443 .proto = IPPROTO_COMP,
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index b4a810c28ac8..a7591ce344d2 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -22,6 +22,7 @@
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <net/compat.h> 24#include <net/compat.h>
25#include <net/sock.h>
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26 27
27#include <linux/netfilter/x_tables.h> 28#include <linux/netfilter/x_tables.h>
@@ -850,7 +851,7 @@ static int compat_table_info(const struct xt_table_info *info,
850} 851}
851#endif 852#endif
852 853
853static int get_info(void __user *user, int *len, int compat) 854static int get_info(struct net *net, void __user *user, int *len, int compat)
854{ 855{
855 char name[ARPT_TABLE_MAXNAMELEN]; 856 char name[ARPT_TABLE_MAXNAMELEN];
856 struct arpt_table *t; 857 struct arpt_table *t;
@@ -870,7 +871,7 @@ static int get_info(void __user *user, int *len, int compat)
870 if (compat) 871 if (compat)
871 xt_compat_lock(NF_ARP); 872 xt_compat_lock(NF_ARP);
872#endif 873#endif
873 t = try_then_request_module(xt_find_table_lock(NF_ARP, name), 874 t = try_then_request_module(xt_find_table_lock(net, NF_ARP, name),
874 "arptable_%s", name); 875 "arptable_%s", name);
875 if (t && !IS_ERR(t)) { 876 if (t && !IS_ERR(t)) {
876 struct arpt_getinfo info; 877 struct arpt_getinfo info;
@@ -908,7 +909,8 @@ static int get_info(void __user *user, int *len, int compat)
908 return ret; 909 return ret;
909} 910}
910 911
911static int get_entries(struct arpt_get_entries __user *uptr, int *len) 912static int get_entries(struct net *net, struct arpt_get_entries __user *uptr,
913 int *len)
912{ 914{
913 int ret; 915 int ret;
914 struct arpt_get_entries get; 916 struct arpt_get_entries get;
@@ -926,7 +928,7 @@ static int get_entries(struct arpt_get_entries __user *uptr, int *len)
926 return -EINVAL; 928 return -EINVAL;
927 } 929 }
928 930
929 t = xt_find_table_lock(NF_ARP, get.name); 931 t = xt_find_table_lock(net, NF_ARP, get.name);
930 if (t && !IS_ERR(t)) { 932 if (t && !IS_ERR(t)) {
931 struct xt_table_info *private = t->private; 933 struct xt_table_info *private = t->private;
932 duprintf("t->private->number = %u\n", 934 duprintf("t->private->number = %u\n",
@@ -947,7 +949,8 @@ static int get_entries(struct arpt_get_entries __user *uptr, int *len)
947 return ret; 949 return ret;
948} 950}
949 951
950static int __do_replace(const char *name, unsigned int valid_hooks, 952static int __do_replace(struct net *net, const char *name,
953 unsigned int valid_hooks,
951 struct xt_table_info *newinfo, 954 struct xt_table_info *newinfo,
952 unsigned int num_counters, 955 unsigned int num_counters,
953 void __user *counters_ptr) 956 void __user *counters_ptr)
@@ -966,7 +969,7 @@ static int __do_replace(const char *name, unsigned int valid_hooks,
966 goto out; 969 goto out;
967 } 970 }
968 971
969 t = try_then_request_module(xt_find_table_lock(NF_ARP, name), 972 t = try_then_request_module(xt_find_table_lock(net, NF_ARP, name),
970 "arptable_%s", name); 973 "arptable_%s", name);
971 if (!t || IS_ERR(t)) { 974 if (!t || IS_ERR(t)) {
972 ret = t ? PTR_ERR(t) : -ENOENT; 975 ret = t ? PTR_ERR(t) : -ENOENT;
@@ -1019,7 +1022,7 @@ static int __do_replace(const char *name, unsigned int valid_hooks,
1019 return ret; 1022 return ret;
1020} 1023}
1021 1024
1022static int do_replace(void __user *user, unsigned int len) 1025static int do_replace(struct net *net, void __user *user, unsigned int len)
1023{ 1026{
1024 int ret; 1027 int ret;
1025 struct arpt_replace tmp; 1028 struct arpt_replace tmp;
@@ -1053,7 +1056,7 @@ static int do_replace(void __user *user, unsigned int len)
1053 1056
1054 duprintf("arp_tables: Translated table\n"); 1057 duprintf("arp_tables: Translated table\n");
1055 1058
1056 ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, 1059 ret = __do_replace(net, tmp.name, tmp.valid_hooks, newinfo,
1057 tmp.num_counters, tmp.counters); 1060 tmp.num_counters, tmp.counters);
1058 if (ret) 1061 if (ret)
1059 goto free_newinfo_untrans; 1062 goto free_newinfo_untrans;
@@ -1080,7 +1083,8 @@ static inline int add_counter_to_entry(struct arpt_entry *e,
1080 return 0; 1083 return 0;
1081} 1084}
1082 1085
1083static int do_add_counters(void __user *user, unsigned int len, int compat) 1086static int do_add_counters(struct net *net, void __user *user, unsigned int len,
1087 int compat)
1084{ 1088{
1085 unsigned int i; 1089 unsigned int i;
1086 struct xt_counters_info tmp; 1090 struct xt_counters_info tmp;
@@ -1132,7 +1136,7 @@ static int do_add_counters(void __user *user, unsigned int len, int compat)
1132 goto free; 1136 goto free;
1133 } 1137 }
1134 1138
1135 t = xt_find_table_lock(NF_ARP, name); 1139 t = xt_find_table_lock(net, NF_ARP, name);
1136 if (!t || IS_ERR(t)) { 1140 if (!t || IS_ERR(t)) {
1137 ret = t ? PTR_ERR(t) : -ENOENT; 1141 ret = t ? PTR_ERR(t) : -ENOENT;
1138 goto free; 1142 goto free;
@@ -1435,7 +1439,8 @@ struct compat_arpt_replace {
1435 struct compat_arpt_entry entries[0]; 1439 struct compat_arpt_entry entries[0];
1436}; 1440};
1437 1441
1438static int compat_do_replace(void __user *user, unsigned int len) 1442static int compat_do_replace(struct net *net, void __user *user,
1443 unsigned int len)
1439{ 1444{
1440 int ret; 1445 int ret;
1441 struct compat_arpt_replace tmp; 1446 struct compat_arpt_replace tmp;
@@ -1471,7 +1476,7 @@ static int compat_do_replace(void __user *user, unsigned int len)
1471 1476
1472 duprintf("compat_do_replace: Translated table\n"); 1477 duprintf("compat_do_replace: Translated table\n");
1473 1478
1474 ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, 1479 ret = __do_replace(net, tmp.name, tmp.valid_hooks, newinfo,
1475 tmp.num_counters, compat_ptr(tmp.counters)); 1480 tmp.num_counters, compat_ptr(tmp.counters));
1476 if (ret) 1481 if (ret)
1477 goto free_newinfo_untrans; 1482 goto free_newinfo_untrans;
@@ -1494,11 +1499,11 @@ static int compat_do_arpt_set_ctl(struct sock *sk, int cmd, void __user *user,
1494 1499
1495 switch (cmd) { 1500 switch (cmd) {
1496 case ARPT_SO_SET_REPLACE: 1501 case ARPT_SO_SET_REPLACE:
1497 ret = compat_do_replace(user, len); 1502 ret = compat_do_replace(sk->sk_net, user, len);
1498 break; 1503 break;
1499 1504
1500 case ARPT_SO_SET_ADD_COUNTERS: 1505 case ARPT_SO_SET_ADD_COUNTERS:
1501 ret = do_add_counters(user, len, 1); 1506 ret = do_add_counters(sk->sk_net, user, len, 1);
1502 break; 1507 break;
1503 1508
1504 default: 1509 default:
@@ -1584,7 +1589,8 @@ struct compat_arpt_get_entries {
1584 struct compat_arpt_entry entrytable[0]; 1589 struct compat_arpt_entry entrytable[0];
1585}; 1590};
1586 1591
1587static int compat_get_entries(struct compat_arpt_get_entries __user *uptr, 1592static int compat_get_entries(struct net *net,
1593 struct compat_arpt_get_entries __user *uptr,
1588 int *len) 1594 int *len)
1589{ 1595{
1590 int ret; 1596 int ret;
@@ -1604,7 +1610,7 @@ static int compat_get_entries(struct compat_arpt_get_entries __user *uptr,
1604 } 1610 }
1605 1611
1606 xt_compat_lock(NF_ARP); 1612 xt_compat_lock(NF_ARP);
1607 t = xt_find_table_lock(NF_ARP, get.name); 1613 t = xt_find_table_lock(net, NF_ARP, get.name);
1608 if (t && !IS_ERR(t)) { 1614 if (t && !IS_ERR(t)) {
1609 struct xt_table_info *private = t->private; 1615 struct xt_table_info *private = t->private;
1610 struct xt_table_info info; 1616 struct xt_table_info info;
@@ -1641,10 +1647,10 @@ static int compat_do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user,
1641 1647
1642 switch (cmd) { 1648 switch (cmd) {
1643 case ARPT_SO_GET_INFO: 1649 case ARPT_SO_GET_INFO:
1644 ret = get_info(user, len, 1); 1650 ret = get_info(sk->sk_net, user, len, 1);
1645 break; 1651 break;
1646 case ARPT_SO_GET_ENTRIES: 1652 case ARPT_SO_GET_ENTRIES:
1647 ret = compat_get_entries(user, len); 1653 ret = compat_get_entries(sk->sk_net, user, len);
1648 break; 1654 break;
1649 default: 1655 default:
1650 ret = do_arpt_get_ctl(sk, cmd, user, len); 1656 ret = do_arpt_get_ctl(sk, cmd, user, len);
@@ -1662,11 +1668,11 @@ static int do_arpt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned
1662 1668
1663 switch (cmd) { 1669 switch (cmd) {
1664 case ARPT_SO_SET_REPLACE: 1670 case ARPT_SO_SET_REPLACE:
1665 ret = do_replace(user, len); 1671 ret = do_replace(sk->sk_net, user, len);
1666 break; 1672 break;
1667 1673
1668 case ARPT_SO_SET_ADD_COUNTERS: 1674 case ARPT_SO_SET_ADD_COUNTERS:
1669 ret = do_add_counters(user, len, 0); 1675 ret = do_add_counters(sk->sk_net, user, len, 0);
1670 break; 1676 break;
1671 1677
1672 default: 1678 default:
@@ -1686,11 +1692,11 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len
1686 1692
1687 switch (cmd) { 1693 switch (cmd) {
1688 case ARPT_SO_GET_INFO: 1694 case ARPT_SO_GET_INFO:
1689 ret = get_info(user, len, 0); 1695 ret = get_info(sk->sk_net, user, len, 0);
1690 break; 1696 break;
1691 1697
1692 case ARPT_SO_GET_ENTRIES: 1698 case ARPT_SO_GET_ENTRIES:
1693 ret = get_entries(user, len); 1699 ret = get_entries(sk->sk_net, user, len);
1694 break; 1700 break;
1695 1701
1696 case ARPT_SO_GET_REVISION_TARGET: { 1702 case ARPT_SO_GET_REVISION_TARGET: {
@@ -1719,19 +1725,21 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len
1719 return ret; 1725 return ret;
1720} 1726}
1721 1727
1722int arpt_register_table(struct arpt_table *table, 1728struct arpt_table *arpt_register_table(struct net *net,
1723 const struct arpt_replace *repl) 1729 struct arpt_table *table,
1730 const struct arpt_replace *repl)
1724{ 1731{
1725 int ret; 1732 int ret;
1726 struct xt_table_info *newinfo; 1733 struct xt_table_info *newinfo;
1727 struct xt_table_info bootstrap 1734 struct xt_table_info bootstrap
1728 = { 0, 0, 0, { 0 }, { 0 }, { } }; 1735 = { 0, 0, 0, { 0 }, { 0 }, { } };
1729 void *loc_cpu_entry; 1736 void *loc_cpu_entry;
1737 struct xt_table *new_table;
1730 1738
1731 newinfo = xt_alloc_table_info(repl->size); 1739 newinfo = xt_alloc_table_info(repl->size);
1732 if (!newinfo) { 1740 if (!newinfo) {
1733 ret = -ENOMEM; 1741 ret = -ENOMEM;
1734 return ret; 1742 goto out;
1735 } 1743 }
1736 1744
1737 /* choose the copy on our node/cpu */ 1745 /* choose the copy on our node/cpu */
@@ -1745,24 +1753,27 @@ int arpt_register_table(struct arpt_table *table,
1745 repl->underflow); 1753 repl->underflow);
1746 1754
1747 duprintf("arpt_register_table: translate table gives %d\n", ret); 1755 duprintf("arpt_register_table: translate table gives %d\n", ret);
1748 if (ret != 0) { 1756 if (ret != 0)
1749 xt_free_table_info(newinfo); 1757 goto out_free;
1750 return ret;
1751 }
1752 1758
1753 ret = xt_register_table(table, &bootstrap, newinfo); 1759 new_table = xt_register_table(net, table, &bootstrap, newinfo);
1754 if (ret != 0) { 1760 if (IS_ERR(new_table)) {
1755 xt_free_table_info(newinfo); 1761 ret = PTR_ERR(new_table);
1756 return ret; 1762 goto out_free;
1757 } 1763 }
1764 return new_table;
1758 1765
1759 return 0; 1766out_free:
1767 xt_free_table_info(newinfo);
1768out:
1769 return ERR_PTR(ret);
1760} 1770}
1761 1771
1762void arpt_unregister_table(struct arpt_table *table) 1772void arpt_unregister_table(struct arpt_table *table)
1763{ 1773{
1764 struct xt_table_info *private; 1774 struct xt_table_info *private;
1765 void *loc_cpu_entry; 1775 void *loc_cpu_entry;
1776 struct module *table_owner = table->me;
1766 1777
1767 private = xt_unregister_table(table); 1778 private = xt_unregister_table(table);
1768 1779
@@ -1770,6 +1781,8 @@ void arpt_unregister_table(struct arpt_table *table)
1770 loc_cpu_entry = private->entries[raw_smp_processor_id()]; 1781 loc_cpu_entry = private->entries[raw_smp_processor_id()];
1771 ARPT_ENTRY_ITERATE(loc_cpu_entry, private->size, 1782 ARPT_ENTRY_ITERATE(loc_cpu_entry, private->size,
1772 cleanup_entry, NULL); 1783 cleanup_entry, NULL);
1784 if (private->number > private->initial_entries)
1785 module_put(table_owner);
1773 xt_free_table_info(private); 1786 xt_free_table_info(private);
1774} 1787}
1775 1788
@@ -1809,11 +1822,26 @@ static struct nf_sockopt_ops arpt_sockopts = {
1809 .owner = THIS_MODULE, 1822 .owner = THIS_MODULE,
1810}; 1823};
1811 1824
1825static int __net_init arp_tables_net_init(struct net *net)
1826{
1827 return xt_proto_init(net, NF_ARP);
1828}
1829
1830static void __net_exit arp_tables_net_exit(struct net *net)
1831{
1832 xt_proto_fini(net, NF_ARP);
1833}
1834
1835static struct pernet_operations arp_tables_net_ops = {
1836 .init = arp_tables_net_init,
1837 .exit = arp_tables_net_exit,
1838};
1839
1812static int __init arp_tables_init(void) 1840static int __init arp_tables_init(void)
1813{ 1841{
1814 int ret; 1842 int ret;
1815 1843
1816 ret = xt_proto_init(NF_ARP); 1844 ret = register_pernet_subsys(&arp_tables_net_ops);
1817 if (ret < 0) 1845 if (ret < 0)
1818 goto err1; 1846 goto err1;
1819 1847
@@ -1838,7 +1866,7 @@ err4:
1838err3: 1866err3:
1839 xt_unregister_target(&arpt_standard_target); 1867 xt_unregister_target(&arpt_standard_target);
1840err2: 1868err2:
1841 xt_proto_fini(NF_ARP); 1869 unregister_pernet_subsys(&arp_tables_net_ops);
1842err1: 1870err1:
1843 return ret; 1871 return ret;
1844} 1872}
@@ -1848,7 +1876,7 @@ static void __exit arp_tables_fini(void)
1848 nf_unregister_sockopt(&arpt_sockopts); 1876 nf_unregister_sockopt(&arpt_sockopts);
1849 xt_unregister_target(&arpt_error_target); 1877 xt_unregister_target(&arpt_error_target);
1850 xt_unregister_target(&arpt_standard_target); 1878 xt_unregister_target(&arpt_standard_target);
1851 xt_proto_fini(NF_ARP); 1879 unregister_pernet_subsys(&arp_tables_net_ops);
1852} 1880}
1853 1881
1854EXPORT_SYMBOL(arpt_register_table); 1882EXPORT_SYMBOL(arpt_register_table);
diff --git a/net/ipv4/netfilter/arptable_filter.c b/net/ipv4/netfilter/arptable_filter.c
index 7201511d54d2..4e9c496a30c2 100644
--- a/net/ipv4/netfilter/arptable_filter.c
+++ b/net/ipv4/netfilter/arptable_filter.c
@@ -20,7 +20,7 @@ static struct
20 struct arpt_replace repl; 20 struct arpt_replace repl;
21 struct arpt_standard entries[3]; 21 struct arpt_standard entries[3];
22 struct arpt_error term; 22 struct arpt_error term;
23} initial_table __initdata = { 23} initial_table __net_initdata = {
24 .repl = { 24 .repl = {
25 .name = "filter", 25 .name = "filter",
26 .valid_hooks = FILTER_VALID_HOOKS, 26 .valid_hooks = FILTER_VALID_HOOKS,
@@ -61,7 +61,7 @@ static unsigned int arpt_hook(unsigned int hook,
61 const struct net_device *out, 61 const struct net_device *out,
62 int (*okfn)(struct sk_buff *)) 62 int (*okfn)(struct sk_buff *))
63{ 63{
64 return arpt_do_table(skb, hook, in, out, &packet_filter); 64 return arpt_do_table(skb, hook, in, out, init_net.ipv4.arptable_filter);
65} 65}
66 66
67static struct nf_hook_ops arpt_ops[] __read_mostly = { 67static struct nf_hook_ops arpt_ops[] __read_mostly = {
@@ -85,12 +85,31 @@ static struct nf_hook_ops arpt_ops[] __read_mostly = {
85 }, 85 },
86}; 86};
87 87
88static int __net_init arptable_filter_net_init(struct net *net)
89{
90 /* Register table */
91 net->ipv4.arptable_filter =
92 arpt_register_table(net, &packet_filter, &initial_table.repl);
93 if (IS_ERR(net->ipv4.arptable_filter))
94 return PTR_ERR(net->ipv4.arptable_filter);
95 return 0;
96}
97
98static void __net_exit arptable_filter_net_exit(struct net *net)
99{
100 arpt_unregister_table(net->ipv4.arptable_filter);
101}
102
103static struct pernet_operations arptable_filter_net_ops = {
104 .init = arptable_filter_net_init,
105 .exit = arptable_filter_net_exit,
106};
107
88static int __init arptable_filter_init(void) 108static int __init arptable_filter_init(void)
89{ 109{
90 int ret; 110 int ret;
91 111
92 /* Register table */ 112 ret = register_pernet_subsys(&arptable_filter_net_ops);
93 ret = arpt_register_table(&packet_filter, &initial_table.repl);
94 if (ret < 0) 113 if (ret < 0)
95 return ret; 114 return ret;
96 115
@@ -100,14 +119,14 @@ static int __init arptable_filter_init(void)
100 return ret; 119 return ret;
101 120
102cleanup_table: 121cleanup_table:
103 arpt_unregister_table(&packet_filter); 122 unregister_pernet_subsys(&arptable_filter_net_ops);
104 return ret; 123 return ret;
105} 124}
106 125
107static void __exit arptable_filter_fini(void) 126static void __exit arptable_filter_fini(void)
108{ 127{
109 nf_unregister_hooks(arpt_ops, ARRAY_SIZE(arpt_ops)); 128 nf_unregister_hooks(arpt_ops, ARRAY_SIZE(arpt_ops));
110 arpt_unregister_table(&packet_filter); 129 unregister_pernet_subsys(&arptable_filter_net_ops);
111} 130}
112 131
113module_init(arptable_filter_init); 132module_init(arptable_filter_init);
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index 5109839da222..6bda1102851b 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -512,6 +512,7 @@ static struct notifier_block ipq_nl_notifier = {
512 .notifier_call = ipq_rcv_nl_event, 512 .notifier_call = ipq_rcv_nl_event,
513}; 513};
514 514
515#ifdef CONFIG_SYSCTL
515static struct ctl_table_header *ipq_sysctl_header; 516static struct ctl_table_header *ipq_sysctl_header;
516 517
517static ctl_table ipq_table[] = { 518static ctl_table ipq_table[] = {
@@ -525,7 +526,9 @@ static ctl_table ipq_table[] = {
525 }, 526 },
526 { .ctl_name = 0 } 527 { .ctl_name = 0 }
527}; 528};
529#endif
528 530
531#ifdef CONFIG_PROC_FS
529static int ip_queue_show(struct seq_file *m, void *v) 532static int ip_queue_show(struct seq_file *m, void *v)
530{ 533{
531 read_lock_bh(&queue_lock); 534 read_lock_bh(&queue_lock);
@@ -562,6 +565,7 @@ static const struct file_operations ip_queue_proc_fops = {
562 .release = single_release, 565 .release = single_release,
563 .owner = THIS_MODULE, 566 .owner = THIS_MODULE,
564}; 567};
568#endif
565 569
566static const struct nf_queue_handler nfqh = { 570static const struct nf_queue_handler nfqh = {
567 .name = "ip_queue", 571 .name = "ip_queue",
@@ -571,7 +575,7 @@ static const struct nf_queue_handler nfqh = {
571static int __init ip_queue_init(void) 575static int __init ip_queue_init(void)
572{ 576{
573 int status = -ENOMEM; 577 int status = -ENOMEM;
574 struct proc_dir_entry *proc; 578 struct proc_dir_entry *proc __maybe_unused;
575 579
576 netlink_register_notifier(&ipq_nl_notifier); 580 netlink_register_notifier(&ipq_nl_notifier);
577 ipqnl = netlink_kernel_create(&init_net, NETLINK_FIREWALL, 0, 581 ipqnl = netlink_kernel_create(&init_net, NETLINK_FIREWALL, 0,
@@ -581,6 +585,7 @@ static int __init ip_queue_init(void)
581 goto cleanup_netlink_notifier; 585 goto cleanup_netlink_notifier;
582 } 586 }
583 587
588#ifdef CONFIG_PROC_FS
584 proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); 589 proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net);
585 if (proc) { 590 if (proc) {
586 proc->owner = THIS_MODULE; 591 proc->owner = THIS_MODULE;
@@ -589,10 +594,11 @@ static int __init ip_queue_init(void)
589 printk(KERN_ERR "ip_queue: failed to create proc entry\n"); 594 printk(KERN_ERR "ip_queue: failed to create proc entry\n");
590 goto cleanup_ipqnl; 595 goto cleanup_ipqnl;
591 } 596 }
592 597#endif
593 register_netdevice_notifier(&ipq_dev_notifier); 598 register_netdevice_notifier(&ipq_dev_notifier);
599#ifdef CONFIG_SYSCTL
594 ipq_sysctl_header = register_sysctl_paths(net_ipv4_ctl_path, ipq_table); 600 ipq_sysctl_header = register_sysctl_paths(net_ipv4_ctl_path, ipq_table);
595 601#endif
596 status = nf_register_queue_handler(PF_INET, &nfqh); 602 status = nf_register_queue_handler(PF_INET, &nfqh);
597 if (status < 0) { 603 if (status < 0) {
598 printk(KERN_ERR "ip_queue: failed to register queue handler\n"); 604 printk(KERN_ERR "ip_queue: failed to register queue handler\n");
@@ -601,10 +607,12 @@ static int __init ip_queue_init(void)
601 return status; 607 return status;
602 608
603cleanup_sysctl: 609cleanup_sysctl:
610#ifdef CONFIG_SYSCTL
604 unregister_sysctl_table(ipq_sysctl_header); 611 unregister_sysctl_table(ipq_sysctl_header);
612#endif
605 unregister_netdevice_notifier(&ipq_dev_notifier); 613 unregister_netdevice_notifier(&ipq_dev_notifier);
606 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 614 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
607cleanup_ipqnl: 615cleanup_ipqnl: __maybe_unused
608 netlink_kernel_release(ipqnl); 616 netlink_kernel_release(ipqnl);
609 mutex_lock(&ipqnl_mutex); 617 mutex_lock(&ipqnl_mutex);
610 mutex_unlock(&ipqnl_mutex); 618 mutex_unlock(&ipqnl_mutex);
@@ -620,7 +628,9 @@ static void __exit ip_queue_fini(void)
620 synchronize_net(); 628 synchronize_net();
621 ipq_flush(NULL, 0); 629 ipq_flush(NULL, 0);
622 630
631#ifdef CONFIG_SYSCTL
623 unregister_sysctl_table(ipq_sysctl_header); 632 unregister_sysctl_table(ipq_sysctl_header);
633#endif
624 unregister_netdevice_notifier(&ipq_dev_notifier); 634 unregister_netdevice_notifier(&ipq_dev_notifier);
625 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 635 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
626 636
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 982b7f986291..600737f122d2 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -291,7 +291,7 @@ static void trace_packet(struct sk_buff *skb,
291 unsigned int hook, 291 unsigned int hook,
292 const struct net_device *in, 292 const struct net_device *in,
293 const struct net_device *out, 293 const struct net_device *out,
294 char *tablename, 294 const char *tablename,
295 struct xt_table_info *private, 295 struct xt_table_info *private,
296 struct ipt_entry *e) 296 struct ipt_entry *e)
297{ 297{
@@ -1092,7 +1092,7 @@ static int compat_table_info(const struct xt_table_info *info,
1092} 1092}
1093#endif 1093#endif
1094 1094
1095static int get_info(void __user *user, int *len, int compat) 1095static int get_info(struct net *net, void __user *user, int *len, int compat)
1096{ 1096{
1097 char name[IPT_TABLE_MAXNAMELEN]; 1097 char name[IPT_TABLE_MAXNAMELEN];
1098 struct xt_table *t; 1098 struct xt_table *t;
@@ -1112,7 +1112,7 @@ static int get_info(void __user *user, int *len, int compat)
1112 if (compat) 1112 if (compat)
1113 xt_compat_lock(AF_INET); 1113 xt_compat_lock(AF_INET);
1114#endif 1114#endif
1115 t = try_then_request_module(xt_find_table_lock(AF_INET, name), 1115 t = try_then_request_module(xt_find_table_lock(net, AF_INET, name),
1116 "iptable_%s", name); 1116 "iptable_%s", name);
1117 if (t && !IS_ERR(t)) { 1117 if (t && !IS_ERR(t)) {
1118 struct ipt_getinfo info; 1118 struct ipt_getinfo info;
@@ -1152,7 +1152,7 @@ static int get_info(void __user *user, int *len, int compat)
1152} 1152}
1153 1153
1154static int 1154static int
1155get_entries(struct ipt_get_entries __user *uptr, int *len) 1155get_entries(struct net *net, struct ipt_get_entries __user *uptr, int *len)
1156{ 1156{
1157 int ret; 1157 int ret;
1158 struct ipt_get_entries get; 1158 struct ipt_get_entries get;
@@ -1170,7 +1170,7 @@ get_entries(struct ipt_get_entries __user *uptr, int *len)
1170 return -EINVAL; 1170 return -EINVAL;
1171 } 1171 }
1172 1172
1173 t = xt_find_table_lock(AF_INET, get.name); 1173 t = xt_find_table_lock(net, AF_INET, get.name);
1174 if (t && !IS_ERR(t)) { 1174 if (t && !IS_ERR(t)) {
1175 struct xt_table_info *private = t->private; 1175 struct xt_table_info *private = t->private;
1176 duprintf("t->private->number = %u\n", private->number); 1176 duprintf("t->private->number = %u\n", private->number);
@@ -1191,7 +1191,7 @@ get_entries(struct ipt_get_entries __user *uptr, int *len)
1191} 1191}
1192 1192
1193static int 1193static int
1194__do_replace(const char *name, unsigned int valid_hooks, 1194__do_replace(struct net *net, const char *name, unsigned int valid_hooks,
1195 struct xt_table_info *newinfo, unsigned int num_counters, 1195 struct xt_table_info *newinfo, unsigned int num_counters,
1196 void __user *counters_ptr) 1196 void __user *counters_ptr)
1197{ 1197{
@@ -1208,7 +1208,7 @@ __do_replace(const char *name, unsigned int valid_hooks,
1208 goto out; 1208 goto out;
1209 } 1209 }
1210 1210
1211 t = try_then_request_module(xt_find_table_lock(AF_INET, name), 1211 t = try_then_request_module(xt_find_table_lock(net, AF_INET, name),
1212 "iptable_%s", name); 1212 "iptable_%s", name);
1213 if (!t || IS_ERR(t)) { 1213 if (!t || IS_ERR(t)) {
1214 ret = t ? PTR_ERR(t) : -ENOENT; 1214 ret = t ? PTR_ERR(t) : -ENOENT;
@@ -1261,7 +1261,7 @@ __do_replace(const char *name, unsigned int valid_hooks,
1261} 1261}
1262 1262
1263static int 1263static int
1264do_replace(void __user *user, unsigned int len) 1264do_replace(struct net *net, void __user *user, unsigned int len)
1265{ 1265{
1266 int ret; 1266 int ret;
1267 struct ipt_replace tmp; 1267 struct ipt_replace tmp;
@@ -1295,7 +1295,7 @@ do_replace(void __user *user, unsigned int len)
1295 1295
1296 duprintf("ip_tables: Translated table\n"); 1296 duprintf("ip_tables: Translated table\n");
1297 1297
1298 ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, 1298 ret = __do_replace(net, tmp.name, tmp.valid_hooks, newinfo,
1299 tmp.num_counters, tmp.counters); 1299 tmp.num_counters, tmp.counters);
1300 if (ret) 1300 if (ret)
1301 goto free_newinfo_untrans; 1301 goto free_newinfo_untrans;
@@ -1331,7 +1331,7 @@ add_counter_to_entry(struct ipt_entry *e,
1331} 1331}
1332 1332
1333static int 1333static int
1334do_add_counters(void __user *user, unsigned int len, int compat) 1334do_add_counters(struct net *net, void __user *user, unsigned int len, int compat)
1335{ 1335{
1336 unsigned int i; 1336 unsigned int i;
1337 struct xt_counters_info tmp; 1337 struct xt_counters_info tmp;
@@ -1383,7 +1383,7 @@ do_add_counters(void __user *user, unsigned int len, int compat)
1383 goto free; 1383 goto free;
1384 } 1384 }
1385 1385
1386 t = xt_find_table_lock(AF_INET, name); 1386 t = xt_find_table_lock(net, AF_INET, name);
1387 if (!t || IS_ERR(t)) { 1387 if (!t || IS_ERR(t)) {
1388 ret = t ? PTR_ERR(t) : -ENOENT; 1388 ret = t ? PTR_ERR(t) : -ENOENT;
1389 goto free; 1389 goto free;
@@ -1429,7 +1429,7 @@ struct compat_ipt_replace {
1429 1429
1430static int 1430static int
1431compat_copy_entry_to_user(struct ipt_entry *e, void __user **dstptr, 1431compat_copy_entry_to_user(struct ipt_entry *e, void __user **dstptr,
1432 compat_uint_t *size, struct xt_counters *counters, 1432 unsigned int *size, struct xt_counters *counters,
1433 unsigned int *i) 1433 unsigned int *i)
1434{ 1434{
1435 struct ipt_entry_target *t; 1435 struct ipt_entry_target *t;
@@ -1476,7 +1476,7 @@ compat_find_calc_match(struct ipt_entry_match *m,
1476 const char *name, 1476 const char *name,
1477 const struct ipt_ip *ip, 1477 const struct ipt_ip *ip,
1478 unsigned int hookmask, 1478 unsigned int hookmask,
1479 int *size, int *i) 1479 int *size, unsigned int *i)
1480{ 1480{
1481 struct xt_match *match; 1481 struct xt_match *match;
1482 1482
@@ -1534,7 +1534,8 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e,
1534 struct ipt_entry_target *t; 1534 struct ipt_entry_target *t;
1535 struct xt_target *target; 1535 struct xt_target *target;
1536 unsigned int entry_offset; 1536 unsigned int entry_offset;
1537 int ret, off, h, j; 1537 unsigned int j;
1538 int ret, off, h;
1538 1539
1539 duprintf("check_compat_entry_size_and_hooks %p\n", e); 1540 duprintf("check_compat_entry_size_and_hooks %p\n", e);
1540 if ((unsigned long)e % __alignof__(struct compat_ipt_entry) != 0 1541 if ((unsigned long)e % __alignof__(struct compat_ipt_entry) != 0
@@ -1647,7 +1648,8 @@ static int
1647compat_check_entry(struct ipt_entry *e, const char *name, 1648compat_check_entry(struct ipt_entry *e, const char *name,
1648 unsigned int *i) 1649 unsigned int *i)
1649{ 1650{
1650 int j, ret; 1651 unsigned int j;
1652 int ret;
1651 1653
1652 j = 0; 1654 j = 0;
1653 ret = IPT_MATCH_ITERATE(e, check_match, name, &e->ip, 1655 ret = IPT_MATCH_ITERATE(e, check_match, name, &e->ip,
@@ -1789,7 +1791,7 @@ out_unlock:
1789} 1791}
1790 1792
1791static int 1793static int
1792compat_do_replace(void __user *user, unsigned int len) 1794compat_do_replace(struct net *net, void __user *user, unsigned int len)
1793{ 1795{
1794 int ret; 1796 int ret;
1795 struct compat_ipt_replace tmp; 1797 struct compat_ipt_replace tmp;
@@ -1826,7 +1828,7 @@ compat_do_replace(void __user *user, unsigned int len)
1826 1828
1827 duprintf("compat_do_replace: Translated table\n"); 1829 duprintf("compat_do_replace: Translated table\n");
1828 1830
1829 ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, 1831 ret = __do_replace(net, tmp.name, tmp.valid_hooks, newinfo,
1830 tmp.num_counters, compat_ptr(tmp.counters)); 1832 tmp.num_counters, compat_ptr(tmp.counters));
1831 if (ret) 1833 if (ret)
1832 goto free_newinfo_untrans; 1834 goto free_newinfo_untrans;
@@ -1850,11 +1852,11 @@ compat_do_ipt_set_ctl(struct sock *sk, int cmd, void __user *user,
1850 1852
1851 switch (cmd) { 1853 switch (cmd) {
1852 case IPT_SO_SET_REPLACE: 1854 case IPT_SO_SET_REPLACE:
1853 ret = compat_do_replace(user, len); 1855 ret = compat_do_replace(sk->sk_net, user, len);
1854 break; 1856 break;
1855 1857
1856 case IPT_SO_SET_ADD_COUNTERS: 1858 case IPT_SO_SET_ADD_COUNTERS:
1857 ret = do_add_counters(user, len, 1); 1859 ret = do_add_counters(sk->sk_net, user, len, 1);
1858 break; 1860 break;
1859 1861
1860 default: 1862 default:
@@ -1903,7 +1905,8 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table,
1903} 1905}
1904 1906
1905static int 1907static int
1906compat_get_entries(struct compat_ipt_get_entries __user *uptr, int *len) 1908compat_get_entries(struct net *net, struct compat_ipt_get_entries __user *uptr,
1909 int *len)
1907{ 1910{
1908 int ret; 1911 int ret;
1909 struct compat_ipt_get_entries get; 1912 struct compat_ipt_get_entries get;
@@ -1924,7 +1927,7 @@ compat_get_entries(struct compat_ipt_get_entries __user *uptr, int *len)
1924 } 1927 }
1925 1928
1926 xt_compat_lock(AF_INET); 1929 xt_compat_lock(AF_INET);
1927 t = xt_find_table_lock(AF_INET, get.name); 1930 t = xt_find_table_lock(net, AF_INET, get.name);
1928 if (t && !IS_ERR(t)) { 1931 if (t && !IS_ERR(t)) {
1929 struct xt_table_info *private = t->private; 1932 struct xt_table_info *private = t->private;
1930 struct xt_table_info info; 1933 struct xt_table_info info;
@@ -1960,10 +1963,10 @@ compat_do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
1960 1963
1961 switch (cmd) { 1964 switch (cmd) {
1962 case IPT_SO_GET_INFO: 1965 case IPT_SO_GET_INFO:
1963 ret = get_info(user, len, 1); 1966 ret = get_info(sk->sk_net, user, len, 1);
1964 break; 1967 break;
1965 case IPT_SO_GET_ENTRIES: 1968 case IPT_SO_GET_ENTRIES:
1966 ret = compat_get_entries(user, len); 1969 ret = compat_get_entries(sk->sk_net, user, len);
1967 break; 1970 break;
1968 default: 1971 default:
1969 ret = do_ipt_get_ctl(sk, cmd, user, len); 1972 ret = do_ipt_get_ctl(sk, cmd, user, len);
@@ -1982,11 +1985,11 @@ do_ipt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
1982 1985
1983 switch (cmd) { 1986 switch (cmd) {
1984 case IPT_SO_SET_REPLACE: 1987 case IPT_SO_SET_REPLACE:
1985 ret = do_replace(user, len); 1988 ret = do_replace(sk->sk_net, user, len);
1986 break; 1989 break;
1987 1990
1988 case IPT_SO_SET_ADD_COUNTERS: 1991 case IPT_SO_SET_ADD_COUNTERS:
1989 ret = do_add_counters(user, len, 0); 1992 ret = do_add_counters(sk->sk_net, user, len, 0);
1990 break; 1993 break;
1991 1994
1992 default: 1995 default:
@@ -2007,11 +2010,11 @@ do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
2007 2010
2008 switch (cmd) { 2011 switch (cmd) {
2009 case IPT_SO_GET_INFO: 2012 case IPT_SO_GET_INFO:
2010 ret = get_info(user, len, 0); 2013 ret = get_info(sk->sk_net, user, len, 0);
2011 break; 2014 break;
2012 2015
2013 case IPT_SO_GET_ENTRIES: 2016 case IPT_SO_GET_ENTRIES:
2014 ret = get_entries(user, len); 2017 ret = get_entries(sk->sk_net, user, len);
2015 break; 2018 break;
2016 2019
2017 case IPT_SO_GET_REVISION_MATCH: 2020 case IPT_SO_GET_REVISION_MATCH:
@@ -2048,17 +2051,21 @@ do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
2048 return ret; 2051 return ret;
2049} 2052}
2050 2053
2051int ipt_register_table(struct xt_table *table, const struct ipt_replace *repl) 2054struct xt_table *ipt_register_table(struct net *net, struct xt_table *table,
2055 const struct ipt_replace *repl)
2052{ 2056{
2053 int ret; 2057 int ret;
2054 struct xt_table_info *newinfo; 2058 struct xt_table_info *newinfo;
2055 struct xt_table_info bootstrap 2059 struct xt_table_info bootstrap
2056 = { 0, 0, 0, { 0 }, { 0 }, { } }; 2060 = { 0, 0, 0, { 0 }, { 0 }, { } };
2057 void *loc_cpu_entry; 2061 void *loc_cpu_entry;
2062 struct xt_table *new_table;
2058 2063
2059 newinfo = xt_alloc_table_info(repl->size); 2064 newinfo = xt_alloc_table_info(repl->size);
2060 if (!newinfo) 2065 if (!newinfo) {
2061 return -ENOMEM; 2066 ret = -ENOMEM;
2067 goto out;
2068 }
2062 2069
2063 /* choose the copy on our node/cpu, but dont care about preemption */ 2070 /* choose the copy on our node/cpu, but dont care about preemption */
2064 loc_cpu_entry = newinfo->entries[raw_smp_processor_id()]; 2071 loc_cpu_entry = newinfo->entries[raw_smp_processor_id()];
@@ -2069,30 +2076,36 @@ int ipt_register_table(struct xt_table *table, const struct ipt_replace *repl)
2069 repl->num_entries, 2076 repl->num_entries,
2070 repl->hook_entry, 2077 repl->hook_entry,
2071 repl->underflow); 2078 repl->underflow);
2072 if (ret != 0) { 2079 if (ret != 0)
2073 xt_free_table_info(newinfo); 2080 goto out_free;
2074 return ret;
2075 }
2076 2081
2077 ret = xt_register_table(table, &bootstrap, newinfo); 2082 new_table = xt_register_table(net, table, &bootstrap, newinfo);
2078 if (ret != 0) { 2083 if (IS_ERR(new_table)) {
2079 xt_free_table_info(newinfo); 2084 ret = PTR_ERR(new_table);
2080 return ret; 2085 goto out_free;
2081 } 2086 }
2082 2087
2083 return 0; 2088 return new_table;
2089
2090out_free:
2091 xt_free_table_info(newinfo);
2092out:
2093 return ERR_PTR(ret);
2084} 2094}
2085 2095
2086void ipt_unregister_table(struct xt_table *table) 2096void ipt_unregister_table(struct xt_table *table)
2087{ 2097{
2088 struct xt_table_info *private; 2098 struct xt_table_info *private;
2089 void *loc_cpu_entry; 2099 void *loc_cpu_entry;
2100 struct module *table_owner = table->me;
2090 2101
2091 private = xt_unregister_table(table); 2102 private = xt_unregister_table(table);
2092 2103
2093 /* Decrease module usage counts and free resources */ 2104 /* Decrease module usage counts and free resources */
2094 loc_cpu_entry = private->entries[raw_smp_processor_id()]; 2105 loc_cpu_entry = private->entries[raw_smp_processor_id()];
2095 IPT_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL); 2106 IPT_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL);
2107 if (private->number > private->initial_entries)
2108 module_put(table_owner);
2096 xt_free_table_info(private); 2109 xt_free_table_info(private);
2097} 2110}
2098 2111
@@ -2200,11 +2213,26 @@ static struct xt_match icmp_matchstruct __read_mostly = {
2200 .family = AF_INET, 2213 .family = AF_INET,
2201}; 2214};
2202 2215
2216static int __net_init ip_tables_net_init(struct net *net)
2217{
2218 return xt_proto_init(net, AF_INET);
2219}
2220
2221static void __net_exit ip_tables_net_exit(struct net *net)
2222{
2223 xt_proto_fini(net, AF_INET);
2224}
2225
2226static struct pernet_operations ip_tables_net_ops = {
2227 .init = ip_tables_net_init,
2228 .exit = ip_tables_net_exit,
2229};
2230
2203static int __init ip_tables_init(void) 2231static int __init ip_tables_init(void)
2204{ 2232{
2205 int ret; 2233 int ret;
2206 2234
2207 ret = xt_proto_init(AF_INET); 2235 ret = register_pernet_subsys(&ip_tables_net_ops);
2208 if (ret < 0) 2236 if (ret < 0)
2209 goto err1; 2237 goto err1;
2210 2238
@@ -2234,7 +2262,7 @@ err4:
2234err3: 2262err3:
2235 xt_unregister_target(&ipt_standard_target); 2263 xt_unregister_target(&ipt_standard_target);
2236err2: 2264err2:
2237 xt_proto_fini(AF_INET); 2265 unregister_pernet_subsys(&ip_tables_net_ops);
2238err1: 2266err1:
2239 return ret; 2267 return ret;
2240} 2268}
@@ -2247,7 +2275,7 @@ static void __exit ip_tables_fini(void)
2247 xt_unregister_target(&ipt_error_target); 2275 xt_unregister_target(&ipt_error_target);
2248 xt_unregister_target(&ipt_standard_target); 2276 xt_unregister_target(&ipt_standard_target);
2249 2277
2250 xt_proto_fini(AF_INET); 2278 unregister_pernet_subsys(&ip_tables_net_ops);
2251} 2279}
2252 2280
2253EXPORT_SYMBOL(ipt_register_table); 2281EXPORT_SYMBOL(ipt_register_table);
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 1b31f7d14d46..c6cf84c77611 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -76,13 +76,6 @@ clusterip_config_put(struct clusterip_config *c)
76 kfree(c); 76 kfree(c);
77} 77}
78 78
79/* increase the count of entries(rules) using/referencing this config */
80static inline void
81clusterip_config_entry_get(struct clusterip_config *c)
82{
83 atomic_inc(&c->entries);
84}
85
86/* decrease the count of entries using/referencing this config. If last 79/* decrease the count of entries using/referencing this config. If last
87 * entry(rule) is removed, remove the config from lists, but don't free it 80 * entry(rule) is removed, remove the config from lists, but don't free it
88 * yet, since proc-files could still be holding references */ 81 * yet, since proc-files could still be holding references */
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c
index e3154a99c08a..68cbe3ca01ce 100644
--- a/net/ipv4/netfilter/ipt_recent.c
+++ b/net/ipv4/netfilter/ipt_recent.c
@@ -212,11 +212,11 @@ recent_mt(const struct sk_buff *skb, const struct net_device *in,
212 recent_entry_remove(t, e); 212 recent_entry_remove(t, e);
213 ret = !ret; 213 ret = !ret;
214 } else if (info->check_set & (IPT_RECENT_CHECK | IPT_RECENT_UPDATE)) { 214 } else if (info->check_set & (IPT_RECENT_CHECK | IPT_RECENT_UPDATE)) {
215 unsigned long t = jiffies - info->seconds * HZ; 215 unsigned long time = jiffies - info->seconds * HZ;
216 unsigned int i, hits = 0; 216 unsigned int i, hits = 0;
217 217
218 for (i = 0; i < e->nstamps; i++) { 218 for (i = 0; i < e->nstamps; i++) {
219 if (info->seconds && time_after(t, e->stamps[i])) 219 if (info->seconds && time_after(time, e->stamps[i]))
220 continue; 220 continue;
221 if (++hits >= info->hit_count) { 221 if (++hits >= info->hit_count) {
222 ret = !ret; 222 ret = !ret;
@@ -320,6 +320,7 @@ struct recent_iter_state {
320}; 320};
321 321
322static void *recent_seq_start(struct seq_file *seq, loff_t *pos) 322static void *recent_seq_start(struct seq_file *seq, loff_t *pos)
323 __acquires(recent_lock)
323{ 324{
324 struct recent_iter_state *st = seq->private; 325 struct recent_iter_state *st = seq->private;
325 const struct recent_table *t = st->table; 326 const struct recent_table *t = st->table;
@@ -352,6 +353,7 @@ static void *recent_seq_next(struct seq_file *seq, void *v, loff_t *pos)
352} 353}
353 354
354static void recent_seq_stop(struct seq_file *s, void *v) 355static void recent_seq_stop(struct seq_file *s, void *v)
356 __releases(recent_lock)
355{ 357{
356 spin_unlock_bh(&recent_lock); 358 spin_unlock_bh(&recent_lock);
357} 359}
diff --git a/net/ipv4/netfilter/iptable_filter.c b/net/ipv4/netfilter/iptable_filter.c
index 29bb4f9fbda0..69f3d7e6e96f 100644
--- a/net/ipv4/netfilter/iptable_filter.c
+++ b/net/ipv4/netfilter/iptable_filter.c
@@ -28,7 +28,7 @@ static struct
28 struct ipt_replace repl; 28 struct ipt_replace repl;
29 struct ipt_standard entries[3]; 29 struct ipt_standard entries[3];
30 struct ipt_error term; 30 struct ipt_error term;
31} initial_table __initdata = { 31} initial_table __net_initdata = {
32 .repl = { 32 .repl = {
33 .name = "filter", 33 .name = "filter",
34 .valid_hooks = FILTER_VALID_HOOKS, 34 .valid_hooks = FILTER_VALID_HOOKS,
@@ -69,7 +69,7 @@ ipt_hook(unsigned int hook,
69 const struct net_device *out, 69 const struct net_device *out,
70 int (*okfn)(struct sk_buff *)) 70 int (*okfn)(struct sk_buff *))
71{ 71{
72 return ipt_do_table(skb, hook, in, out, &packet_filter); 72 return ipt_do_table(skb, hook, in, out, init_net.ipv4.iptable_filter);
73} 73}
74 74
75static unsigned int 75static unsigned int
@@ -88,7 +88,7 @@ ipt_local_out_hook(unsigned int hook,
88 return NF_ACCEPT; 88 return NF_ACCEPT;
89 } 89 }
90 90
91 return ipt_do_table(skb, hook, in, out, &packet_filter); 91 return ipt_do_table(skb, hook, in, out, init_net.ipv4.iptable_filter);
92} 92}
93 93
94static struct nf_hook_ops ipt_ops[] __read_mostly = { 94static struct nf_hook_ops ipt_ops[] __read_mostly = {
@@ -119,6 +119,26 @@ static struct nf_hook_ops ipt_ops[] __read_mostly = {
119static int forward = NF_ACCEPT; 119static int forward = NF_ACCEPT;
120module_param(forward, bool, 0000); 120module_param(forward, bool, 0000);
121 121
122static int __net_init iptable_filter_net_init(struct net *net)
123{
124 /* Register table */
125 net->ipv4.iptable_filter =
126 ipt_register_table(net, &packet_filter, &initial_table.repl);
127 if (IS_ERR(net->ipv4.iptable_filter))
128 return PTR_ERR(net->ipv4.iptable_filter);
129 return 0;
130}
131
132static void __net_exit iptable_filter_net_exit(struct net *net)
133{
134 ipt_unregister_table(net->ipv4.iptable_filter);
135}
136
137static struct pernet_operations iptable_filter_net_ops = {
138 .init = iptable_filter_net_init,
139 .exit = iptable_filter_net_exit,
140};
141
122static int __init iptable_filter_init(void) 142static int __init iptable_filter_init(void)
123{ 143{
124 int ret; 144 int ret;
@@ -131,8 +151,7 @@ static int __init iptable_filter_init(void)
131 /* Entry 1 is the FORWARD hook */ 151 /* Entry 1 is the FORWARD hook */
132 initial_table.entries[1].target.verdict = -forward - 1; 152 initial_table.entries[1].target.verdict = -forward - 1;
133 153
134 /* Register table */ 154 ret = register_pernet_subsys(&iptable_filter_net_ops);
135 ret = ipt_register_table(&packet_filter, &initial_table.repl);
136 if (ret < 0) 155 if (ret < 0)
137 return ret; 156 return ret;
138 157
@@ -144,14 +163,14 @@ static int __init iptable_filter_init(void)
144 return ret; 163 return ret;
145 164
146 cleanup_table: 165 cleanup_table:
147 ipt_unregister_table(&packet_filter); 166 unregister_pernet_subsys(&iptable_filter_net_ops);
148 return ret; 167 return ret;
149} 168}
150 169
151static void __exit iptable_filter_fini(void) 170static void __exit iptable_filter_fini(void)
152{ 171{
153 nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops)); 172 nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops));
154 ipt_unregister_table(&packet_filter); 173 unregister_pernet_subsys(&iptable_filter_net_ops);
155} 174}
156 175
157module_init(iptable_filter_init); 176module_init(iptable_filter_init);
diff --git a/net/ipv4/netfilter/iptable_mangle.c b/net/ipv4/netfilter/iptable_mangle.c
index 5c4be202430c..c55a210853a7 100644
--- a/net/ipv4/netfilter/iptable_mangle.c
+++ b/net/ipv4/netfilter/iptable_mangle.c
@@ -33,7 +33,7 @@ static struct
33 struct ipt_replace repl; 33 struct ipt_replace repl;
34 struct ipt_standard entries[5]; 34 struct ipt_standard entries[5];
35 struct ipt_error term; 35 struct ipt_error term;
36} initial_table __initdata = { 36} initial_table __net_initdata = {
37 .repl = { 37 .repl = {
38 .name = "mangle", 38 .name = "mangle",
39 .valid_hooks = MANGLE_VALID_HOOKS, 39 .valid_hooks = MANGLE_VALID_HOOKS,
@@ -80,7 +80,7 @@ ipt_route_hook(unsigned int hook,
80 const struct net_device *out, 80 const struct net_device *out,
81 int (*okfn)(struct sk_buff *)) 81 int (*okfn)(struct sk_buff *))
82{ 82{
83 return ipt_do_table(skb, hook, in, out, &packet_mangler); 83 return ipt_do_table(skb, hook, in, out, init_net.ipv4.iptable_mangle);
84} 84}
85 85
86static unsigned int 86static unsigned int
@@ -112,7 +112,7 @@ ipt_local_hook(unsigned int hook,
112 daddr = iph->daddr; 112 daddr = iph->daddr;
113 tos = iph->tos; 113 tos = iph->tos;
114 114
115 ret = ipt_do_table(skb, hook, in, out, &packet_mangler); 115 ret = ipt_do_table(skb, hook, in, out, init_net.ipv4.iptable_mangle);
116 /* Reroute for ANY change. */ 116 /* Reroute for ANY change. */
117 if (ret != NF_DROP && ret != NF_STOLEN && ret != NF_QUEUE) { 117 if (ret != NF_DROP && ret != NF_STOLEN && ret != NF_QUEUE) {
118 iph = ip_hdr(skb); 118 iph = ip_hdr(skb);
@@ -166,12 +166,31 @@ static struct nf_hook_ops ipt_ops[] __read_mostly = {
166 }, 166 },
167}; 167};
168 168
169static int __net_init iptable_mangle_net_init(struct net *net)
170{
171 /* Register table */
172 net->ipv4.iptable_mangle =
173 ipt_register_table(net, &packet_mangler, &initial_table.repl);
174 if (IS_ERR(net->ipv4.iptable_mangle))
175 return PTR_ERR(net->ipv4.iptable_mangle);
176 return 0;
177}
178
179static void __net_exit iptable_mangle_net_exit(struct net *net)
180{
181 ipt_unregister_table(net->ipv4.iptable_mangle);
182}
183
184static struct pernet_operations iptable_mangle_net_ops = {
185 .init = iptable_mangle_net_init,
186 .exit = iptable_mangle_net_exit,
187};
188
169static int __init iptable_mangle_init(void) 189static int __init iptable_mangle_init(void)
170{ 190{
171 int ret; 191 int ret;
172 192
173 /* Register table */ 193 ret = register_pernet_subsys(&iptable_mangle_net_ops);
174 ret = ipt_register_table(&packet_mangler, &initial_table.repl);
175 if (ret < 0) 194 if (ret < 0)
176 return ret; 195 return ret;
177 196
@@ -183,14 +202,14 @@ static int __init iptable_mangle_init(void)
183 return ret; 202 return ret;
184 203
185 cleanup_table: 204 cleanup_table:
186 ipt_unregister_table(&packet_mangler); 205 unregister_pernet_subsys(&iptable_mangle_net_ops);
187 return ret; 206 return ret;
188} 207}
189 208
190static void __exit iptable_mangle_fini(void) 209static void __exit iptable_mangle_fini(void)
191{ 210{
192 nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops)); 211 nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops));
193 ipt_unregister_table(&packet_mangler); 212 unregister_pernet_subsys(&iptable_mangle_net_ops);
194} 213}
195 214
196module_init(iptable_mangle_init); 215module_init(iptable_mangle_init);
diff --git a/net/ipv4/netfilter/iptable_raw.c b/net/ipv4/netfilter/iptable_raw.c
index dc34aa274533..e41fe8ca4e1c 100644
--- a/net/ipv4/netfilter/iptable_raw.c
+++ b/net/ipv4/netfilter/iptable_raw.c
@@ -14,7 +14,7 @@ static struct
14 struct ipt_replace repl; 14 struct ipt_replace repl;
15 struct ipt_standard entries[2]; 15 struct ipt_standard entries[2];
16 struct ipt_error term; 16 struct ipt_error term;
17} initial_table __initdata = { 17} initial_table __net_initdata = {
18 .repl = { 18 .repl = {
19 .name = "raw", 19 .name = "raw",
20 .valid_hooks = RAW_VALID_HOOKS, 20 .valid_hooks = RAW_VALID_HOOKS,
@@ -52,7 +52,7 @@ ipt_hook(unsigned int hook,
52 const struct net_device *out, 52 const struct net_device *out,
53 int (*okfn)(struct sk_buff *)) 53 int (*okfn)(struct sk_buff *))
54{ 54{
55 return ipt_do_table(skb, hook, in, out, &packet_raw); 55 return ipt_do_table(skb, hook, in, out, init_net.ipv4.iptable_raw);
56} 56}
57 57
58static unsigned int 58static unsigned int
@@ -70,7 +70,7 @@ ipt_local_hook(unsigned int hook,
70 "packet.\n"); 70 "packet.\n");
71 return NF_ACCEPT; 71 return NF_ACCEPT;
72 } 72 }
73 return ipt_do_table(skb, hook, in, out, &packet_raw); 73 return ipt_do_table(skb, hook, in, out, init_net.ipv4.iptable_raw);
74} 74}
75 75
76/* 'raw' is the very first table. */ 76/* 'raw' is the very first table. */
@@ -91,12 +91,31 @@ static struct nf_hook_ops ipt_ops[] __read_mostly = {
91 }, 91 },
92}; 92};
93 93
94static int __net_init iptable_raw_net_init(struct net *net)
95{
96 /* Register table */
97 net->ipv4.iptable_raw =
98 ipt_register_table(net, &packet_raw, &initial_table.repl);
99 if (IS_ERR(net->ipv4.iptable_raw))
100 return PTR_ERR(net->ipv4.iptable_raw);
101 return 0;
102}
103
104static void __net_exit iptable_raw_net_exit(struct net *net)
105{
106 ipt_unregister_table(net->ipv4.iptable_raw);
107}
108
109static struct pernet_operations iptable_raw_net_ops = {
110 .init = iptable_raw_net_init,
111 .exit = iptable_raw_net_exit,
112};
113
94static int __init iptable_raw_init(void) 114static int __init iptable_raw_init(void)
95{ 115{
96 int ret; 116 int ret;
97 117
98 /* Register table */ 118 ret = register_pernet_subsys(&iptable_raw_net_ops);
99 ret = ipt_register_table(&packet_raw, &initial_table.repl);
100 if (ret < 0) 119 if (ret < 0)
101 return ret; 120 return ret;
102 121
@@ -108,14 +127,14 @@ static int __init iptable_raw_init(void)
108 return ret; 127 return ret;
109 128
110 cleanup_table: 129 cleanup_table:
111 ipt_unregister_table(&packet_raw); 130 unregister_pernet_subsys(&iptable_raw_net_ops);
112 return ret; 131 return ret;
113} 132}
114 133
115static void __exit iptable_raw_fini(void) 134static void __exit iptable_raw_fini(void)
116{ 135{
117 nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops)); 136 nf_unregister_hooks(ipt_ops, ARRAY_SIZE(ipt_ops));
118 ipt_unregister_table(&packet_raw); 137 unregister_pernet_subsys(&iptable_raw_net_ops);
119} 138}
120 139
121module_init(iptable_raw_init); 140module_init(iptable_raw_init);
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index ac3d61d8026e..a65b845c5f15 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -27,7 +27,8 @@
27static int ipv4_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, 27static int ipv4_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff,
28 struct nf_conntrack_tuple *tuple) 28 struct nf_conntrack_tuple *tuple)
29{ 29{
30 __be32 _addrs[2], *ap; 30 const __be32 *ap;
31 __be32 _addrs[2];
31 ap = skb_header_pointer(skb, nhoff + offsetof(struct iphdr, saddr), 32 ap = skb_header_pointer(skb, nhoff + offsetof(struct iphdr, saddr),
32 sizeof(u_int32_t) * 2, _addrs); 33 sizeof(u_int32_t) * 2, _addrs);
33 if (ap == NULL) 34 if (ap == NULL)
@@ -76,7 +77,8 @@ static int nf_ct_ipv4_gather_frags(struct sk_buff *skb, u_int32_t user)
76static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, 77static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
77 unsigned int *dataoff, u_int8_t *protonum) 78 unsigned int *dataoff, u_int8_t *protonum)
78{ 79{
79 struct iphdr _iph, *iph; 80 const struct iphdr *iph;
81 struct iphdr _iph;
80 82
81 iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); 83 iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
82 if (iph == NULL) 84 if (iph == NULL)
@@ -111,8 +113,8 @@ static unsigned int ipv4_conntrack_help(unsigned int hooknum,
111{ 113{
112 struct nf_conn *ct; 114 struct nf_conn *ct;
113 enum ip_conntrack_info ctinfo; 115 enum ip_conntrack_info ctinfo;
114 struct nf_conn_help *help; 116 const struct nf_conn_help *help;
115 struct nf_conntrack_helper *helper; 117 const struct nf_conntrack_helper *helper;
116 118
117 /* This is where we call the helper: as the packet goes out. */ 119 /* This is where we call the helper: as the packet goes out. */
118 ct = nf_ct_get(skb, &ctinfo); 120 ct = nf_ct_get(skb, &ctinfo);
@@ -299,8 +301,8 @@ static ctl_table ip_ct_sysctl_table[] = {
299static int 301static int
300getorigdst(struct sock *sk, int optval, void __user *user, int *len) 302getorigdst(struct sock *sk, int optval, void __user *user, int *len)
301{ 303{
302 struct inet_sock *inet = inet_sk(sk); 304 const struct inet_sock *inet = inet_sk(sk);
303 struct nf_conntrack_tuple_hash *h; 305 const struct nf_conntrack_tuple_hash *h;
304 struct nf_conntrack_tuple tuple; 306 struct nf_conntrack_tuple tuple;
305 307
306 NF_CT_TUPLE_U_BLANK(&tuple); 308 NF_CT_TUPLE_U_BLANK(&tuple);
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
index 543c02b74c96..089252e82c01 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
@@ -39,12 +39,14 @@ struct ct_iter_state {
39static struct hlist_node *ct_get_first(struct seq_file *seq) 39static struct hlist_node *ct_get_first(struct seq_file *seq)
40{ 40{
41 struct ct_iter_state *st = seq->private; 41 struct ct_iter_state *st = seq->private;
42 struct hlist_node *n;
42 43
43 for (st->bucket = 0; 44 for (st->bucket = 0;
44 st->bucket < nf_conntrack_htable_size; 45 st->bucket < nf_conntrack_htable_size;
45 st->bucket++) { 46 st->bucket++) {
46 if (!hlist_empty(&nf_conntrack_hash[st->bucket])) 47 n = rcu_dereference(nf_conntrack_hash[st->bucket].first);
47 return nf_conntrack_hash[st->bucket].first; 48 if (n)
49 return n;
48 } 50 }
49 return NULL; 51 return NULL;
50} 52}
@@ -54,11 +56,11 @@ static struct hlist_node *ct_get_next(struct seq_file *seq,
54{ 56{
55 struct ct_iter_state *st = seq->private; 57 struct ct_iter_state *st = seq->private;
56 58
57 head = head->next; 59 head = rcu_dereference(head->next);
58 while (head == NULL) { 60 while (head == NULL) {
59 if (++st->bucket >= nf_conntrack_htable_size) 61 if (++st->bucket >= nf_conntrack_htable_size)
60 return NULL; 62 return NULL;
61 head = nf_conntrack_hash[st->bucket].first; 63 head = rcu_dereference(nf_conntrack_hash[st->bucket].first);
62 } 64 }
63 return head; 65 return head;
64} 66}
@@ -74,8 +76,9 @@ static struct hlist_node *ct_get_idx(struct seq_file *seq, loff_t pos)
74} 76}
75 77
76static void *ct_seq_start(struct seq_file *seq, loff_t *pos) 78static void *ct_seq_start(struct seq_file *seq, loff_t *pos)
79 __acquires(RCU)
77{ 80{
78 read_lock_bh(&nf_conntrack_lock); 81 rcu_read_lock();
79 return ct_get_idx(seq, *pos); 82 return ct_get_idx(seq, *pos);
80} 83}
81 84
@@ -86,16 +89,17 @@ static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos)
86} 89}
87 90
88static void ct_seq_stop(struct seq_file *s, void *v) 91static void ct_seq_stop(struct seq_file *s, void *v)
92 __releases(RCU)
89{ 93{
90 read_unlock_bh(&nf_conntrack_lock); 94 rcu_read_unlock();
91} 95}
92 96
93static int ct_seq_show(struct seq_file *s, void *v) 97static int ct_seq_show(struct seq_file *s, void *v)
94{ 98{
95 const struct nf_conntrack_tuple_hash *hash = v; 99 const struct nf_conntrack_tuple_hash *hash = v;
96 const struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(hash); 100 const struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(hash);
97 struct nf_conntrack_l3proto *l3proto; 101 const struct nf_conntrack_l3proto *l3proto;
98 struct nf_conntrack_l4proto *l4proto; 102 const struct nf_conntrack_l4proto *l4proto;
99 103
100 NF_CT_ASSERT(ct); 104 NF_CT_ASSERT(ct);
101 105
@@ -191,10 +195,12 @@ struct ct_expect_iter_state {
191static struct hlist_node *ct_expect_get_first(struct seq_file *seq) 195static struct hlist_node *ct_expect_get_first(struct seq_file *seq)
192{ 196{
193 struct ct_expect_iter_state *st = seq->private; 197 struct ct_expect_iter_state *st = seq->private;
198 struct hlist_node *n;
194 199
195 for (st->bucket = 0; st->bucket < nf_ct_expect_hsize; st->bucket++) { 200 for (st->bucket = 0; st->bucket < nf_ct_expect_hsize; st->bucket++) {
196 if (!hlist_empty(&nf_ct_expect_hash[st->bucket])) 201 n = rcu_dereference(nf_ct_expect_hash[st->bucket].first);
197 return nf_ct_expect_hash[st->bucket].first; 202 if (n)
203 return n;
198 } 204 }
199 return NULL; 205 return NULL;
200} 206}
@@ -204,11 +210,11 @@ static struct hlist_node *ct_expect_get_next(struct seq_file *seq,
204{ 210{
205 struct ct_expect_iter_state *st = seq->private; 211 struct ct_expect_iter_state *st = seq->private;
206 212
207 head = head->next; 213 head = rcu_dereference(head->next);
208 while (head == NULL) { 214 while (head == NULL) {
209 if (++st->bucket >= nf_ct_expect_hsize) 215 if (++st->bucket >= nf_ct_expect_hsize)
210 return NULL; 216 return NULL;
211 head = nf_ct_expect_hash[st->bucket].first; 217 head = rcu_dereference(nf_ct_expect_hash[st->bucket].first);
212 } 218 }
213 return head; 219 return head;
214} 220}
@@ -224,8 +230,9 @@ static struct hlist_node *ct_expect_get_idx(struct seq_file *seq, loff_t pos)
224} 230}
225 231
226static void *exp_seq_start(struct seq_file *seq, loff_t *pos) 232static void *exp_seq_start(struct seq_file *seq, loff_t *pos)
233 __acquires(RCU)
227{ 234{
228 read_lock_bh(&nf_conntrack_lock); 235 rcu_read_lock();
229 return ct_expect_get_idx(seq, *pos); 236 return ct_expect_get_idx(seq, *pos);
230} 237}
231 238
@@ -236,14 +243,15 @@ static void *exp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
236} 243}
237 244
238static void exp_seq_stop(struct seq_file *seq, void *v) 245static void exp_seq_stop(struct seq_file *seq, void *v)
246 __releases(RCU)
239{ 247{
240 read_unlock_bh(&nf_conntrack_lock); 248 rcu_read_unlock();
241} 249}
242 250
243static int exp_seq_show(struct seq_file *s, void *v) 251static int exp_seq_show(struct seq_file *s, void *v)
244{ 252{
245 struct nf_conntrack_expect *exp; 253 struct nf_conntrack_expect *exp;
246 struct hlist_node *n = v; 254 const struct hlist_node *n = v;
247 255
248 exp = hlist_entry(n, struct nf_conntrack_expect, hnode); 256 exp = hlist_entry(n, struct nf_conntrack_expect, hnode);
249 257
@@ -324,7 +332,7 @@ static void ct_cpu_seq_stop(struct seq_file *seq, void *v)
324static int ct_cpu_seq_show(struct seq_file *seq, void *v) 332static int ct_cpu_seq_show(struct seq_file *seq, void *v)
325{ 333{
326 unsigned int nr_conntracks = atomic_read(&nf_conntrack_count); 334 unsigned int nr_conntracks = atomic_read(&nf_conntrack_count);
327 struct ip_conntrack_stat *st = v; 335 const struct ip_conntrack_stat *st = v;
328 336
329 if (v == SEQ_START_TOKEN) { 337 if (v == SEQ_START_TOKEN) {
330 seq_printf(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete\n"); 338 seq_printf(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete\n");
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
index 4004a04c5510..6873fddb3529 100644
--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
@@ -26,7 +26,8 @@ static int icmp_pkt_to_tuple(const struct sk_buff *skb,
26 unsigned int dataoff, 26 unsigned int dataoff,
27 struct nf_conntrack_tuple *tuple) 27 struct nf_conntrack_tuple *tuple)
28{ 28{
29 struct icmphdr _hdr, *hp; 29 const struct icmphdr *hp;
30 struct icmphdr _hdr;
30 31
31 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); 32 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr);
32 if (hp == NULL) 33 if (hp == NULL)
@@ -100,7 +101,7 @@ static int icmp_packet(struct nf_conn *ct,
100} 101}
101 102
102/* Called when a new connection for this protocol found. */ 103/* Called when a new connection for this protocol found. */
103static int icmp_new(struct nf_conn *conntrack, 104static int icmp_new(struct nf_conn *ct,
104 const struct sk_buff *skb, unsigned int dataoff) 105 const struct sk_buff *skb, unsigned int dataoff)
105{ 106{
106 static const u_int8_t valid_new[] = { 107 static const u_int8_t valid_new[] = {
@@ -110,15 +111,15 @@ static int icmp_new(struct nf_conn *conntrack,
110 [ICMP_ADDRESS] = 1 111 [ICMP_ADDRESS] = 1
111 }; 112 };
112 113
113 if (conntrack->tuplehash[0].tuple.dst.u.icmp.type >= sizeof(valid_new) 114 if (ct->tuplehash[0].tuple.dst.u.icmp.type >= sizeof(valid_new)
114 || !valid_new[conntrack->tuplehash[0].tuple.dst.u.icmp.type]) { 115 || !valid_new[ct->tuplehash[0].tuple.dst.u.icmp.type]) {
115 /* Can't create a new ICMP `conn' with this. */ 116 /* Can't create a new ICMP `conn' with this. */
116 pr_debug("icmp: can't create new conn with type %u\n", 117 pr_debug("icmp: can't create new conn with type %u\n",
117 conntrack->tuplehash[0].tuple.dst.u.icmp.type); 118 ct->tuplehash[0].tuple.dst.u.icmp.type);
118 NF_CT_DUMP_TUPLE(&conntrack->tuplehash[0].tuple); 119 NF_CT_DUMP_TUPLE(&ct->tuplehash[0].tuple);
119 return 0; 120 return 0;
120 } 121 }
121 atomic_set(&conntrack->proto.icmp.count, 0); 122 atomic_set(&ct->proto.icmp.count, 0);
122 return 1; 123 return 1;
123} 124}
124 125
@@ -129,8 +130,8 @@ icmp_error_message(struct sk_buff *skb,
129 unsigned int hooknum) 130 unsigned int hooknum)
130{ 131{
131 struct nf_conntrack_tuple innertuple, origtuple; 132 struct nf_conntrack_tuple innertuple, origtuple;
132 struct nf_conntrack_l4proto *innerproto; 133 const struct nf_conntrack_l4proto *innerproto;
133 struct nf_conntrack_tuple_hash *h; 134 const struct nf_conntrack_tuple_hash *h;
134 135
135 NF_CT_ASSERT(skb->nfct == NULL); 136 NF_CT_ASSERT(skb->nfct == NULL);
136 137
@@ -176,7 +177,8 @@ static int
176icmp_error(struct sk_buff *skb, unsigned int dataoff, 177icmp_error(struct sk_buff *skb, unsigned int dataoff,
177 enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum) 178 enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum)
178{ 179{
179 struct icmphdr _ih, *icmph; 180 const struct icmphdr *icmph;
181 struct icmphdr _ih;
180 182
181 /* Not enough header? */ 183 /* Not enough header? */
182 icmph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_ih), &_ih); 184 icmph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_ih), &_ih);
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index e53ae1ef8f5e..dd07362d2b8f 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -31,7 +31,7 @@
31#include <net/netfilter/nf_conntrack_l3proto.h> 31#include <net/netfilter/nf_conntrack_l3proto.h>
32#include <net/netfilter/nf_conntrack_l4proto.h> 32#include <net/netfilter/nf_conntrack_l4proto.h>
33 33
34static DEFINE_RWLOCK(nf_nat_lock); 34static DEFINE_SPINLOCK(nf_nat_lock);
35 35
36static struct nf_conntrack_l3proto *l3proto __read_mostly; 36static struct nf_conntrack_l3proto *l3proto __read_mostly;
37 37
@@ -154,8 +154,8 @@ find_appropriate_src(const struct nf_conntrack_tuple *tuple,
154 struct nf_conn *ct; 154 struct nf_conn *ct;
155 struct hlist_node *n; 155 struct hlist_node *n;
156 156
157 read_lock_bh(&nf_nat_lock); 157 rcu_read_lock();
158 hlist_for_each_entry(nat, n, &bysource[h], bysource) { 158 hlist_for_each_entry_rcu(nat, n, &bysource[h], bysource) {
159 ct = nat->ct; 159 ct = nat->ct;
160 if (same_src(ct, tuple)) { 160 if (same_src(ct, tuple)) {
161 /* Copy source part from reply tuple. */ 161 /* Copy source part from reply tuple. */
@@ -164,12 +164,12 @@ find_appropriate_src(const struct nf_conntrack_tuple *tuple,
164 result->dst = tuple->dst; 164 result->dst = tuple->dst;
165 165
166 if (in_range(result, range)) { 166 if (in_range(result, range)) {
167 read_unlock_bh(&nf_nat_lock); 167 rcu_read_unlock();
168 return 1; 168 return 1;
169 } 169 }
170 } 170 }
171 } 171 }
172 read_unlock_bh(&nf_nat_lock); 172 rcu_read_unlock();
173 return 0; 173 return 0;
174} 174}
175 175
@@ -330,12 +330,12 @@ nf_nat_setup_info(struct nf_conn *ct,
330 unsigned int srchash; 330 unsigned int srchash;
331 331
332 srchash = hash_by_src(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); 332 srchash = hash_by_src(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
333 write_lock_bh(&nf_nat_lock); 333 spin_lock_bh(&nf_nat_lock);
334 /* nf_conntrack_alter_reply might re-allocate exntension aera */ 334 /* nf_conntrack_alter_reply might re-allocate exntension aera */
335 nat = nfct_nat(ct); 335 nat = nfct_nat(ct);
336 nat->ct = ct; 336 nat->ct = ct;
337 hlist_add_head(&nat->bysource, &bysource[srchash]); 337 hlist_add_head_rcu(&nat->bysource, &bysource[srchash]);
338 write_unlock_bh(&nf_nat_lock); 338 spin_unlock_bh(&nf_nat_lock);
339 } 339 }
340 340
341 /* It's done. */ 341 /* It's done. */
@@ -521,14 +521,14 @@ int nf_nat_protocol_register(const struct nf_nat_protocol *proto)
521{ 521{
522 int ret = 0; 522 int ret = 0;
523 523
524 write_lock_bh(&nf_nat_lock); 524 spin_lock_bh(&nf_nat_lock);
525 if (nf_nat_protos[proto->protonum] != &nf_nat_unknown_protocol) { 525 if (nf_nat_protos[proto->protonum] != &nf_nat_unknown_protocol) {
526 ret = -EBUSY; 526 ret = -EBUSY;
527 goto out; 527 goto out;
528 } 528 }
529 rcu_assign_pointer(nf_nat_protos[proto->protonum], proto); 529 rcu_assign_pointer(nf_nat_protos[proto->protonum], proto);
530 out: 530 out:
531 write_unlock_bh(&nf_nat_lock); 531 spin_unlock_bh(&nf_nat_lock);
532 return ret; 532 return ret;
533} 533}
534EXPORT_SYMBOL(nf_nat_protocol_register); 534EXPORT_SYMBOL(nf_nat_protocol_register);
@@ -536,10 +536,10 @@ EXPORT_SYMBOL(nf_nat_protocol_register);
536/* Noone stores the protocol anywhere; simply delete it. */ 536/* Noone stores the protocol anywhere; simply delete it. */
537void nf_nat_protocol_unregister(const struct nf_nat_protocol *proto) 537void nf_nat_protocol_unregister(const struct nf_nat_protocol *proto)
538{ 538{
539 write_lock_bh(&nf_nat_lock); 539 spin_lock_bh(&nf_nat_lock);
540 rcu_assign_pointer(nf_nat_protos[proto->protonum], 540 rcu_assign_pointer(nf_nat_protos[proto->protonum],
541 &nf_nat_unknown_protocol); 541 &nf_nat_unknown_protocol);
542 write_unlock_bh(&nf_nat_lock); 542 spin_unlock_bh(&nf_nat_lock);
543 synchronize_rcu(); 543 synchronize_rcu();
544} 544}
545EXPORT_SYMBOL(nf_nat_protocol_unregister); 545EXPORT_SYMBOL(nf_nat_protocol_unregister);
@@ -594,10 +594,10 @@ static void nf_nat_cleanup_conntrack(struct nf_conn *ct)
594 594
595 NF_CT_ASSERT(nat->ct->status & IPS_NAT_DONE_MASK); 595 NF_CT_ASSERT(nat->ct->status & IPS_NAT_DONE_MASK);
596 596
597 write_lock_bh(&nf_nat_lock); 597 spin_lock_bh(&nf_nat_lock);
598 hlist_del(&nat->bysource); 598 hlist_del_rcu(&nat->bysource);
599 nat->ct = NULL; 599 nat->ct = NULL;
600 write_unlock_bh(&nf_nat_lock); 600 spin_unlock_bh(&nf_nat_lock);
601} 601}
602 602
603static void nf_nat_move_storage(struct nf_conn *conntrack, void *old) 603static void nf_nat_move_storage(struct nf_conn *conntrack, void *old)
@@ -609,10 +609,10 @@ static void nf_nat_move_storage(struct nf_conn *conntrack, void *old)
609 if (!ct || !(ct->status & IPS_NAT_DONE_MASK)) 609 if (!ct || !(ct->status & IPS_NAT_DONE_MASK))
610 return; 610 return;
611 611
612 write_lock_bh(&nf_nat_lock); 612 spin_lock_bh(&nf_nat_lock);
613 hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource); 613 hlist_replace_rcu(&old_nat->bysource, &new_nat->bysource);
614 new_nat->ct = ct; 614 new_nat->ct = ct;
615 write_unlock_bh(&nf_nat_lock); 615 spin_unlock_bh(&nf_nat_lock);
616} 616}
617 617
618static struct nf_ct_ext_type nat_extend __read_mostly = { 618static struct nf_ct_ext_type nat_extend __read_mostly = {
@@ -646,17 +646,13 @@ static int __init nf_nat_init(void)
646 } 646 }
647 647
648 /* Sew in builtin protocols. */ 648 /* Sew in builtin protocols. */
649 write_lock_bh(&nf_nat_lock); 649 spin_lock_bh(&nf_nat_lock);
650 for (i = 0; i < MAX_IP_NAT_PROTO; i++) 650 for (i = 0; i < MAX_IP_NAT_PROTO; i++)
651 rcu_assign_pointer(nf_nat_protos[i], &nf_nat_unknown_protocol); 651 rcu_assign_pointer(nf_nat_protos[i], &nf_nat_unknown_protocol);
652 rcu_assign_pointer(nf_nat_protos[IPPROTO_TCP], &nf_nat_protocol_tcp); 652 rcu_assign_pointer(nf_nat_protos[IPPROTO_TCP], &nf_nat_protocol_tcp);
653 rcu_assign_pointer(nf_nat_protos[IPPROTO_UDP], &nf_nat_protocol_udp); 653 rcu_assign_pointer(nf_nat_protos[IPPROTO_UDP], &nf_nat_protocol_udp);
654 rcu_assign_pointer(nf_nat_protos[IPPROTO_ICMP], &nf_nat_protocol_icmp); 654 rcu_assign_pointer(nf_nat_protos[IPPROTO_ICMP], &nf_nat_protocol_icmp);
655 write_unlock_bh(&nf_nat_lock); 655 spin_unlock_bh(&nf_nat_lock);
656
657 for (i = 0; i < nf_nat_htable_size; i++) {
658 INIT_HLIST_HEAD(&bysource[i]);
659 }
660 656
661 /* Initialize fake conntrack so that NAT will skip it */ 657 /* Initialize fake conntrack so that NAT will skip it */
662 nf_conntrack_untracked.status |= IPS_NAT_DONE_MASK; 658 nf_conntrack_untracked.status |= IPS_NAT_DONE_MASK;
diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c
index a121989fdad7..ee47bf28c825 100644
--- a/net/ipv4/netfilter/nf_nat_h323.c
+++ b/net/ipv4/netfilter/nf_nat_h323.c
@@ -32,7 +32,8 @@ static int set_addr(struct sk_buff *skb,
32 __be32 ip; 32 __be32 ip;
33 __be16 port; 33 __be16 port;
34 } __attribute__ ((__packed__)) buf; 34 } __attribute__ ((__packed__)) buf;
35 struct tcphdr _tcph, *th; 35 const struct tcphdr *th;
36 struct tcphdr _tcph;
36 37
37 buf.ip = ip; 38 buf.ip = ip;
38 buf.port = port; 39 buf.port = port;
@@ -99,7 +100,7 @@ static int set_sig_addr(struct sk_buff *skb, struct nf_conn *ct,
99 unsigned char **data, 100 unsigned char **data,
100 TransportAddress *taddr, int count) 101 TransportAddress *taddr, int count)
101{ 102{
102 struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info; 103 const struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
103 int dir = CTINFO2DIR(ctinfo); 104 int dir = CTINFO2DIR(ctinfo);
104 int i; 105 int i;
105 __be16 port; 106 __be16 port;
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
index 4c0232842e75..ca57f47bbd25 100644
--- a/net/ipv4/netfilter/nf_nat_helper.c
+++ b/net/ipv4/netfilter/nf_nat_helper.c
@@ -44,8 +44,7 @@ adjust_tcp_sequence(u32 seq,
44 struct nf_nat_seq *this_way, *other_way; 44 struct nf_nat_seq *this_way, *other_way;
45 struct nf_conn_nat *nat = nfct_nat(ct); 45 struct nf_conn_nat *nat = nfct_nat(ct);
46 46
47 pr_debug("adjust_tcp_sequence: seq = %u, sizediff = %d\n", 47 pr_debug("adjust_tcp_sequence: seq = %u, sizediff = %d\n", seq, seq);
48 ntohl(seq), seq);
49 48
50 dir = CTINFO2DIR(ctinfo); 49 dir = CTINFO2DIR(ctinfo);
51 50
diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c
index e63b944a2ebb..3a1e6d6afc0a 100644
--- a/net/ipv4/netfilter/nf_nat_pptp.c
+++ b/net/ipv4/netfilter/nf_nat_pptp.c
@@ -40,11 +40,11 @@ MODULE_ALIAS("ip_nat_pptp");
40static void pptp_nat_expected(struct nf_conn *ct, 40static void pptp_nat_expected(struct nf_conn *ct,
41 struct nf_conntrack_expect *exp) 41 struct nf_conntrack_expect *exp)
42{ 42{
43 struct nf_conn *master = ct->master; 43 const struct nf_conn *master = ct->master;
44 struct nf_conntrack_expect *other_exp; 44 struct nf_conntrack_expect *other_exp;
45 struct nf_conntrack_tuple t; 45 struct nf_conntrack_tuple t;
46 struct nf_ct_pptp_master *ct_pptp_info; 46 const struct nf_ct_pptp_master *ct_pptp_info;
47 struct nf_nat_pptp *nat_pptp_info; 47 const struct nf_nat_pptp *nat_pptp_info;
48 struct nf_nat_range range; 48 struct nf_nat_range range;
49 49
50 ct_pptp_info = &nfct_help(master)->help.ct_pptp_info; 50 ct_pptp_info = &nfct_help(master)->help.ct_pptp_info;
@@ -186,7 +186,7 @@ static void
186pptp_exp_gre(struct nf_conntrack_expect *expect_orig, 186pptp_exp_gre(struct nf_conntrack_expect *expect_orig,
187 struct nf_conntrack_expect *expect_reply) 187 struct nf_conntrack_expect *expect_reply)
188{ 188{
189 struct nf_conn *ct = expect_orig->master; 189 const struct nf_conn *ct = expect_orig->master;
190 struct nf_ct_pptp_master *ct_pptp_info; 190 struct nf_ct_pptp_master *ct_pptp_info;
191 struct nf_nat_pptp *nat_pptp_info; 191 struct nf_nat_pptp *nat_pptp_info;
192 192
@@ -217,7 +217,7 @@ pptp_inbound_pkt(struct sk_buff *skb,
217 struct PptpControlHeader *ctlh, 217 struct PptpControlHeader *ctlh,
218 union pptp_ctrl_union *pptpReq) 218 union pptp_ctrl_union *pptpReq)
219{ 219{
220 struct nf_nat_pptp *nat_pptp_info; 220 const struct nf_nat_pptp *nat_pptp_info;
221 u_int16_t msg; 221 u_int16_t msg;
222 __be16 new_pcid; 222 __be16 new_pcid;
223 unsigned int pcid_off; 223 unsigned int pcid_off;
diff --git a/net/ipv4/netfilter/nf_nat_proto_gre.c b/net/ipv4/netfilter/nf_nat_proto_gre.c
index 9fa272e73113..a1e4da16da2e 100644
--- a/net/ipv4/netfilter/nf_nat_proto_gre.c
+++ b/net/ipv4/netfilter/nf_nat_proto_gre.c
@@ -59,7 +59,7 @@ static int
59gre_unique_tuple(struct nf_conntrack_tuple *tuple, 59gre_unique_tuple(struct nf_conntrack_tuple *tuple,
60 const struct nf_nat_range *range, 60 const struct nf_nat_range *range,
61 enum nf_nat_manip_type maniptype, 61 enum nf_nat_manip_type maniptype,
62 const struct nf_conn *conntrack) 62 const struct nf_conn *ct)
63{ 63{
64 static u_int16_t key; 64 static u_int16_t key;
65 __be16 *keyptr; 65 __be16 *keyptr;
@@ -67,7 +67,7 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple,
67 67
68 /* If there is no master conntrack we are not PPTP, 68 /* If there is no master conntrack we are not PPTP,
69 do not change tuples */ 69 do not change tuples */
70 if (!conntrack->master) 70 if (!ct->master)
71 return 0; 71 return 0;
72 72
73 if (maniptype == IP_NAT_MANIP_SRC) 73 if (maniptype == IP_NAT_MANIP_SRC)
@@ -76,7 +76,7 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple,
76 keyptr = &tuple->dst.u.gre.key; 76 keyptr = &tuple->dst.u.gre.key;
77 77
78 if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED)) { 78 if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED)) {
79 pr_debug("%p: NATing GRE PPTP\n", conntrack); 79 pr_debug("%p: NATing GRE PPTP\n", ct);
80 min = 1; 80 min = 1;
81 range_size = 0xffff; 81 range_size = 0xffff;
82 } else { 82 } else {
@@ -88,11 +88,11 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple,
88 88
89 for (i = 0; i < range_size; i++, key++) { 89 for (i = 0; i < range_size; i++, key++) {
90 *keyptr = htons(min + key % range_size); 90 *keyptr = htons(min + key % range_size);
91 if (!nf_nat_used_tuple(tuple, conntrack)) 91 if (!nf_nat_used_tuple(tuple, ct))
92 return 1; 92 return 1;
93 } 93 }
94 94
95 pr_debug("%p: no NAT mapping\n", conntrack); 95 pr_debug("%p: no NAT mapping\n", ct);
96 return 0; 96 return 0;
97} 97}
98 98
@@ -104,7 +104,7 @@ gre_manip_pkt(struct sk_buff *skb, unsigned int iphdroff,
104{ 104{
105 struct gre_hdr *greh; 105 struct gre_hdr *greh;
106 struct gre_hdr_pptp *pgreh; 106 struct gre_hdr_pptp *pgreh;
107 struct iphdr *iph = (struct iphdr *)(skb->data + iphdroff); 107 const struct iphdr *iph = (struct iphdr *)(skb->data + iphdroff);
108 unsigned int hdroff = iphdroff + iph->ihl * 4; 108 unsigned int hdroff = iphdroff + iph->ihl * 4;
109 109
110 /* pgreh includes two optional 32bit fields which are not required 110 /* pgreh includes two optional 32bit fields which are not required
@@ -148,12 +148,12 @@ static const struct nf_nat_protocol gre = {
148#endif 148#endif
149}; 149};
150 150
151int __init nf_nat_proto_gre_init(void) 151static int __init nf_nat_proto_gre_init(void)
152{ 152{
153 return nf_nat_protocol_register(&gre); 153 return nf_nat_protocol_register(&gre);
154} 154}
155 155
156void __exit nf_nat_proto_gre_fini(void) 156static void __exit nf_nat_proto_gre_fini(void)
157{ 157{
158 nf_nat_protocol_unregister(&gre); 158 nf_nat_protocol_unregister(&gre);
159} 159}
diff --git a/net/ipv4/netfilter/nf_nat_proto_icmp.c b/net/ipv4/netfilter/nf_nat_proto_icmp.c
index a0e44c953cb6..03a02969aa57 100644
--- a/net/ipv4/netfilter/nf_nat_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_nat_proto_icmp.c
@@ -57,7 +57,7 @@ icmp_manip_pkt(struct sk_buff *skb,
57 const struct nf_conntrack_tuple *tuple, 57 const struct nf_conntrack_tuple *tuple,
58 enum nf_nat_manip_type maniptype) 58 enum nf_nat_manip_type maniptype)
59{ 59{
60 struct iphdr *iph = (struct iphdr *)(skb->data + iphdroff); 60 const struct iphdr *iph = (struct iphdr *)(skb->data + iphdroff);
61 struct icmphdr *hdr; 61 struct icmphdr *hdr;
62 unsigned int hdroff = iphdroff + iph->ihl*4; 62 unsigned int hdroff = iphdroff + iph->ihl*4;
63 63
diff --git a/net/ipv4/netfilter/nf_nat_proto_tcp.c b/net/ipv4/netfilter/nf_nat_proto_tcp.c
index da23e9fbe679..ffd5d1589eca 100644
--- a/net/ipv4/netfilter/nf_nat_proto_tcp.c
+++ b/net/ipv4/netfilter/nf_nat_proto_tcp.c
@@ -93,7 +93,7 @@ tcp_manip_pkt(struct sk_buff *skb,
93 const struct nf_conntrack_tuple *tuple, 93 const struct nf_conntrack_tuple *tuple,
94 enum nf_nat_manip_type maniptype) 94 enum nf_nat_manip_type maniptype)
95{ 95{
96 struct iphdr *iph = (struct iphdr *)(skb->data + iphdroff); 96 const struct iphdr *iph = (struct iphdr *)(skb->data + iphdroff);
97 struct tcphdr *hdr; 97 struct tcphdr *hdr;
98 unsigned int hdroff = iphdroff + iph->ihl*4; 98 unsigned int hdroff = iphdroff + iph->ihl*4;
99 __be32 oldip, newip; 99 __be32 oldip, newip;
diff --git a/net/ipv4/netfilter/nf_nat_proto_udp.c b/net/ipv4/netfilter/nf_nat_proto_udp.c
index 10df4db078af..4b8f49910ff2 100644
--- a/net/ipv4/netfilter/nf_nat_proto_udp.c
+++ b/net/ipv4/netfilter/nf_nat_proto_udp.c
@@ -91,7 +91,7 @@ udp_manip_pkt(struct sk_buff *skb,
91 const struct nf_conntrack_tuple *tuple, 91 const struct nf_conntrack_tuple *tuple,
92 enum nf_nat_manip_type maniptype) 92 enum nf_nat_manip_type maniptype)
93{ 93{
94 struct iphdr *iph = (struct iphdr *)(skb->data + iphdroff); 94 const struct iphdr *iph = (struct iphdr *)(skb->data + iphdroff);
95 struct udphdr *hdr; 95 struct udphdr *hdr;
96 unsigned int hdroff = iphdroff + iph->ihl*4; 96 unsigned int hdroff = iphdroff + iph->ihl*4;
97 __be32 oldip, newip; 97 __be32 oldip, newip;
diff --git a/net/ipv4/netfilter/nf_nat_rule.c b/net/ipv4/netfilter/nf_nat_rule.c
index 519182269e76..f8fda57ba20b 100644
--- a/net/ipv4/netfilter/nf_nat_rule.c
+++ b/net/ipv4/netfilter/nf_nat_rule.c
@@ -58,13 +58,14 @@ static struct
58 .term = IPT_ERROR_INIT, /* ERROR */ 58 .term = IPT_ERROR_INIT, /* ERROR */
59}; 59};
60 60
61static struct xt_table nat_table = { 61static struct xt_table __nat_table = {
62 .name = "nat", 62 .name = "nat",
63 .valid_hooks = NAT_VALID_HOOKS, 63 .valid_hooks = NAT_VALID_HOOKS,
64 .lock = RW_LOCK_UNLOCKED, 64 .lock = RW_LOCK_UNLOCKED,
65 .me = THIS_MODULE, 65 .me = THIS_MODULE,
66 .af = AF_INET, 66 .af = AF_INET,
67}; 67};
68static struct xt_table *nat_table;
68 69
69/* Source NAT */ 70/* Source NAT */
70static unsigned int ipt_snat_target(struct sk_buff *skb, 71static unsigned int ipt_snat_target(struct sk_buff *skb,
@@ -214,7 +215,7 @@ int nf_nat_rule_find(struct sk_buff *skb,
214{ 215{
215 int ret; 216 int ret;
216 217
217 ret = ipt_do_table(skb, hooknum, in, out, &nat_table); 218 ret = ipt_do_table(skb, hooknum, in, out, nat_table);
218 219
219 if (ret == NF_ACCEPT) { 220 if (ret == NF_ACCEPT) {
220 if (!nf_nat_initialized(ct, HOOK2MANIP(hooknum))) 221 if (!nf_nat_initialized(ct, HOOK2MANIP(hooknum)))
@@ -248,9 +249,10 @@ int __init nf_nat_rule_init(void)
248{ 249{
249 int ret; 250 int ret;
250 251
251 ret = ipt_register_table(&nat_table, &nat_initial_table.repl); 252 nat_table = ipt_register_table(&init_net, &__nat_table,
252 if (ret != 0) 253 &nat_initial_table.repl);
253 return ret; 254 if (IS_ERR(nat_table))
255 return PTR_ERR(nat_table);
254 ret = xt_register_target(&ipt_snat_reg); 256 ret = xt_register_target(&ipt_snat_reg);
255 if (ret != 0) 257 if (ret != 0)
256 goto unregister_table; 258 goto unregister_table;
@@ -264,7 +266,7 @@ int __init nf_nat_rule_init(void)
264 unregister_snat: 266 unregister_snat:
265 xt_unregister_target(&ipt_snat_reg); 267 xt_unregister_target(&ipt_snat_reg);
266 unregister_table: 268 unregister_table:
267 ipt_unregister_table(&nat_table); 269 ipt_unregister_table(nat_table);
268 270
269 return ret; 271 return ret;
270} 272}
@@ -273,5 +275,5 @@ void nf_nat_rule_cleanup(void)
273{ 275{
274 xt_unregister_target(&ipt_dnat_reg); 276 xt_unregister_target(&ipt_dnat_reg);
275 xt_unregister_target(&ipt_snat_reg); 277 xt_unregister_target(&ipt_snat_reg);
276 ipt_unregister_table(&nat_table); 278 ipt_unregister_table(nat_table);
277} 279}
diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c
index 606a170bf4ca..b4c8d4968bb2 100644
--- a/net/ipv4/netfilter/nf_nat_sip.c
+++ b/net/ipv4/netfilter/nf_nat_sip.c
@@ -35,9 +35,9 @@ struct addr_map {
35 } addr[IP_CT_DIR_MAX]; 35 } addr[IP_CT_DIR_MAX];
36}; 36};
37 37
38static void addr_map_init(struct nf_conn *ct, struct addr_map *map) 38static void addr_map_init(const struct nf_conn *ct, struct addr_map *map)
39{ 39{
40 struct nf_conntrack_tuple *t; 40 const struct nf_conntrack_tuple *t;
41 enum ip_conntrack_dir dir; 41 enum ip_conntrack_dir dir;
42 unsigned int n; 42 unsigned int n;
43 43
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
index 07f2a49926d4..540ce6ae887c 100644
--- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
@@ -260,7 +260,7 @@ static unsigned char asn1_eoc_decode(struct asn1_ctx *ctx, unsigned char *eoc)
260{ 260{
261 unsigned char ch; 261 unsigned char ch;
262 262
263 if (eoc == 0) { 263 if (eoc == NULL) {
264 if (!asn1_octet_decode(ctx, &ch)) 264 if (!asn1_octet_decode(ctx, &ch))
265 return 0; 265 return 0;
266 266
diff --git a/net/ipv4/netfilter/nf_nat_tftp.c b/net/ipv4/netfilter/nf_nat_tftp.c
index 1360a94766dd..b096e81500ae 100644
--- a/net/ipv4/netfilter/nf_nat_tftp.c
+++ b/net/ipv4/netfilter/nf_nat_tftp.c
@@ -24,7 +24,7 @@ static unsigned int help(struct sk_buff *skb,
24 enum ip_conntrack_info ctinfo, 24 enum ip_conntrack_info ctinfo,
25 struct nf_conntrack_expect *exp) 25 struct nf_conntrack_expect *exp)
26{ 26{
27 struct nf_conn *ct = exp->master; 27 const struct nf_conn *ct = exp->master;
28 28
29 exp->saved_proto.udp.port 29 exp->saved_proto.udp.port
30 = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.udp.port; 30 = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u.udp.port;
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 85c08696abbe..a3002fe65b7f 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -352,6 +352,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
352 skb_reserve(skb, hh_len); 352 skb_reserve(skb, hh_len);
353 353
354 skb->priority = sk->sk_priority; 354 skb->priority = sk->sk_priority;
355 skb->mark = sk->sk_mark;
355 skb->dst = dst_clone(&rt->u.dst); 356 skb->dst = dst_clone(&rt->u.dst);
356 357
357 skb_reset_network_header(skb); 358 skb_reset_network_header(skb);
@@ -544,6 +545,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
544 545
545 { 546 {
546 struct flowi fl = { .oif = ipc.oif, 547 struct flowi fl = { .oif = ipc.oif,
548 .mark = sk->sk_mark,
547 .nl_u = { .ip4_u = 549 .nl_u = { .ip4_u =
548 { .daddr = daddr, 550 { .daddr = daddr,
549 .saddr = saddr, 551 .saddr = saddr,
@@ -860,8 +862,7 @@ static struct sock *raw_get_first(struct seq_file *seq)
860 struct hlist_node *node; 862 struct hlist_node *node;
861 863
862 sk_for_each(sk, node, &state->h->ht[state->bucket]) 864 sk_for_each(sk, node, &state->h->ht[state->bucket])
863 if (sk->sk_net == state->p.net && 865 if (sk->sk_net == state->p.net)
864 sk->sk_family == state->family)
865 goto found; 866 goto found;
866 } 867 }
867 sk = NULL; 868 sk = NULL;
@@ -877,8 +878,7 @@ static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk)
877 sk = sk_next(sk); 878 sk = sk_next(sk);
878try_again: 879try_again:
879 ; 880 ;
880 } while (sk && sk->sk_net != state->p.net && 881 } while (sk && sk->sk_net != state->p.net);
881 sk->sk_family != state->family);
882 882
883 if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { 883 if (!sk && ++state->bucket < RAW_HTABLE_SIZE) {
884 sk = sk_head(&state->h->ht[state->bucket]); 884 sk = sk_head(&state->h->ht[state->bucket]);
@@ -927,7 +927,7 @@ void raw_seq_stop(struct seq_file *seq, void *v)
927} 927}
928EXPORT_SYMBOL_GPL(raw_seq_stop); 928EXPORT_SYMBOL_GPL(raw_seq_stop);
929 929
930static __inline__ char *get_raw_sock(struct sock *sp, char *tmpbuf, int i) 930static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i)
931{ 931{
932 struct inet_sock *inet = inet_sk(sp); 932 struct inet_sock *inet = inet_sk(sp);
933 __be32 dest = inet->daddr, 933 __be32 dest = inet->daddr,
@@ -935,33 +935,23 @@ static __inline__ char *get_raw_sock(struct sock *sp, char *tmpbuf, int i)
935 __u16 destp = 0, 935 __u16 destp = 0,
936 srcp = inet->num; 936 srcp = inet->num;
937 937
938 sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X" 938 seq_printf(seq, "%4d: %08X:%04X %08X:%04X"
939 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d", 939 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d",
940 i, src, srcp, dest, destp, sp->sk_state, 940 i, src, srcp, dest, destp, sp->sk_state,
941 atomic_read(&sp->sk_wmem_alloc), 941 atomic_read(&sp->sk_wmem_alloc),
942 atomic_read(&sp->sk_rmem_alloc), 942 atomic_read(&sp->sk_rmem_alloc),
943 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp), 943 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
944 atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops)); 944 atomic_read(&sp->sk_refcnt), sp, atomic_read(&sp->sk_drops));
945 return tmpbuf;
946} 945}
947 946
948#define TMPSZ 128
949
950static int raw_seq_show(struct seq_file *seq, void *v) 947static int raw_seq_show(struct seq_file *seq, void *v)
951{ 948{
952 char tmpbuf[TMPSZ+1];
953
954 if (v == SEQ_START_TOKEN) 949 if (v == SEQ_START_TOKEN)
955 seq_printf(seq, "%-*s\n", TMPSZ-1, 950 seq_printf(seq, " sl local_address rem_address st tx_queue "
956 " sl local_address rem_address st tx_queue " 951 "rx_queue tr tm->when retrnsmt uid timeout "
957 "rx_queue tr tm->when retrnsmt uid timeout " 952 "inode drops\n");
958 "inode drops"); 953 else
959 else { 954 raw_sock_seq_show(seq, v, raw_seq_private(seq)->bucket);
960 struct raw_iter_state *state = raw_seq_private(seq);
961
962 seq_printf(seq, "%-*s\n", TMPSZ-1,
963 get_raw_sock(v, tmpbuf, state->bucket));
964 }
965 return 0; 955 return 0;
966} 956}
967 957
@@ -972,27 +962,25 @@ static const struct seq_operations raw_seq_ops = {
972 .show = raw_seq_show, 962 .show = raw_seq_show,
973}; 963};
974 964
975int raw_seq_open(struct inode *ino, struct file *file, struct raw_hashinfo *h, 965int raw_seq_open(struct inode *ino, struct file *file,
976 unsigned short family) 966 struct raw_hashinfo *h, const struct seq_operations *ops)
977{ 967{
978 int err; 968 int err;
979 struct raw_iter_state *i; 969 struct raw_iter_state *i;
980 970
981 err = seq_open_net(ino, file, &raw_seq_ops, 971 err = seq_open_net(ino, file, ops, sizeof(struct raw_iter_state));
982 sizeof(struct raw_iter_state));
983 if (err < 0) 972 if (err < 0)
984 return err; 973 return err;
985 974
986 i = raw_seq_private((struct seq_file *)file->private_data); 975 i = raw_seq_private((struct seq_file *)file->private_data);
987 i->h = h; 976 i->h = h;
988 i->family = family;
989 return 0; 977 return 0;
990} 978}
991EXPORT_SYMBOL_GPL(raw_seq_open); 979EXPORT_SYMBOL_GPL(raw_seq_open);
992 980
993static int raw_v4_seq_open(struct inode *inode, struct file *file) 981static int raw_v4_seq_open(struct inode *inode, struct file *file)
994{ 982{
995 return raw_seq_open(inode, file, &raw_v4_hashinfo, PF_INET); 983 return raw_seq_open(inode, file, &raw_v4_hashinfo, &raw_seq_ops);
996} 984}
997 985
998static const struct file_operations raw_seq_fops = { 986static const struct file_operations raw_seq_fops = {
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 896c768e41a2..8842ecb9be48 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -117,8 +117,6 @@
117 117
118#define RT_GC_TIMEOUT (300*HZ) 118#define RT_GC_TIMEOUT (300*HZ)
119 119
120static int ip_rt_min_delay = 2 * HZ;
121static int ip_rt_max_delay = 10 * HZ;
122static int ip_rt_max_size; 120static int ip_rt_max_size;
123static int ip_rt_gc_timeout = RT_GC_TIMEOUT; 121static int ip_rt_gc_timeout = RT_GC_TIMEOUT;
124static int ip_rt_gc_interval = 60 * HZ; 122static int ip_rt_gc_interval = 60 * HZ;
@@ -133,12 +131,9 @@ static int ip_rt_mtu_expires = 10 * 60 * HZ;
133static int ip_rt_min_pmtu = 512 + 20 + 20; 131static int ip_rt_min_pmtu = 512 + 20 + 20;
134static int ip_rt_min_advmss = 256; 132static int ip_rt_min_advmss = 256;
135static int ip_rt_secret_interval = 10 * 60 * HZ; 133static int ip_rt_secret_interval = 10 * 60 * HZ;
136static int ip_rt_flush_expected;
137static unsigned long rt_deadline;
138 134
139#define RTprint(a...) printk(KERN_DEBUG a) 135#define RTprint(a...) printk(KERN_DEBUG a)
140 136
141static struct timer_list rt_flush_timer;
142static void rt_worker_func(struct work_struct *work); 137static void rt_worker_func(struct work_struct *work);
143static DECLARE_DELAYED_WORK(expires_work, rt_worker_func); 138static DECLARE_DELAYED_WORK(expires_work, rt_worker_func);
144static struct timer_list rt_secret_timer; 139static struct timer_list rt_secret_timer;
@@ -169,6 +164,7 @@ static struct dst_ops ipv4_dst_ops = {
169 .update_pmtu = ip_rt_update_pmtu, 164 .update_pmtu = ip_rt_update_pmtu,
170 .local_out = ip_local_out, 165 .local_out = ip_local_out,
171 .entry_size = sizeof(struct rtable), 166 .entry_size = sizeof(struct rtable),
167 .entries = ATOMIC_INIT(0),
172}; 168};
173 169
174#define ECN_OR_COST(class) TC_PRIO_##class 170#define ECN_OR_COST(class) TC_PRIO_##class
@@ -259,19 +255,16 @@ static inline void rt_hash_lock_init(void)
259static struct rt_hash_bucket *rt_hash_table; 255static struct rt_hash_bucket *rt_hash_table;
260static unsigned rt_hash_mask; 256static unsigned rt_hash_mask;
261static unsigned int rt_hash_log; 257static unsigned int rt_hash_log;
262static unsigned int rt_hash_rnd; 258static atomic_t rt_genid;
263 259
264static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); 260static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
265#define RT_CACHE_STAT_INC(field) \ 261#define RT_CACHE_STAT_INC(field) \
266 (__raw_get_cpu_var(rt_cache_stat).field++) 262 (__raw_get_cpu_var(rt_cache_stat).field++)
267 263
268static int rt_intern_hash(unsigned hash, struct rtable *rth,
269 struct rtable **res);
270
271static unsigned int rt_hash_code(u32 daddr, u32 saddr) 264static unsigned int rt_hash_code(u32 daddr, u32 saddr)
272{ 265{
273 return (jhash_2words(daddr, saddr, rt_hash_rnd) 266 return jhash_2words(daddr, saddr, atomic_read(&rt_genid))
274 & rt_hash_mask); 267 & rt_hash_mask;
275} 268}
276 269
277#define rt_hash(daddr, saddr, idx) \ 270#define rt_hash(daddr, saddr, idx) \
@@ -281,27 +274,28 @@ static unsigned int rt_hash_code(u32 daddr, u32 saddr)
281#ifdef CONFIG_PROC_FS 274#ifdef CONFIG_PROC_FS
282struct rt_cache_iter_state { 275struct rt_cache_iter_state {
283 int bucket; 276 int bucket;
277 int genid;
284}; 278};
285 279
286static struct rtable *rt_cache_get_first(struct seq_file *seq) 280static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st)
287{ 281{
288 struct rtable *r = NULL; 282 struct rtable *r = NULL;
289 struct rt_cache_iter_state *st = seq->private;
290 283
291 for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) { 284 for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) {
292 rcu_read_lock_bh(); 285 rcu_read_lock_bh();
293 r = rt_hash_table[st->bucket].chain; 286 r = rcu_dereference(rt_hash_table[st->bucket].chain);
294 if (r) 287 while (r) {
295 break; 288 if (r->rt_genid == st->genid)
289 return r;
290 r = rcu_dereference(r->u.dst.rt_next);
291 }
296 rcu_read_unlock_bh(); 292 rcu_read_unlock_bh();
297 } 293 }
298 return rcu_dereference(r); 294 return r;
299} 295}
300 296
301static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r) 297static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st, struct rtable *r)
302{ 298{
303 struct rt_cache_iter_state *st = seq->private;
304
305 r = r->u.dst.rt_next; 299 r = r->u.dst.rt_next;
306 while (!r) { 300 while (!r) {
307 rcu_read_unlock_bh(); 301 rcu_read_unlock_bh();
@@ -313,29 +307,38 @@ static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r)
313 return rcu_dereference(r); 307 return rcu_dereference(r);
314} 308}
315 309
316static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos) 310static struct rtable *rt_cache_get_idx(struct rt_cache_iter_state *st, loff_t pos)
317{ 311{
318 struct rtable *r = rt_cache_get_first(seq); 312 struct rtable *r = rt_cache_get_first(st);
319 313
320 if (r) 314 if (r)
321 while (pos && (r = rt_cache_get_next(seq, r))) 315 while (pos && (r = rt_cache_get_next(st, r))) {
316 if (r->rt_genid != st->genid)
317 continue;
322 --pos; 318 --pos;
319 }
323 return pos ? NULL : r; 320 return pos ? NULL : r;
324} 321}
325 322
326static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) 323static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
327{ 324{
328 return *pos ? rt_cache_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; 325 struct rt_cache_iter_state *st = seq->private;
326
327 if (*pos)
328 return rt_cache_get_idx(st, *pos - 1);
329 st->genid = atomic_read(&rt_genid);
330 return SEQ_START_TOKEN;
329} 331}
330 332
331static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos) 333static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos)
332{ 334{
333 struct rtable *r = NULL; 335 struct rtable *r;
336 struct rt_cache_iter_state *st = seq->private;
334 337
335 if (v == SEQ_START_TOKEN) 338 if (v == SEQ_START_TOKEN)
336 r = rt_cache_get_first(seq); 339 r = rt_cache_get_first(st);
337 else 340 else
338 r = rt_cache_get_next(seq, v); 341 r = rt_cache_get_next(st, v);
339 ++*pos; 342 ++*pos;
340 return r; 343 return r;
341} 344}
@@ -708,6 +711,11 @@ static void rt_check_expire(void)
708 continue; 711 continue;
709 spin_lock_bh(rt_hash_lock_addr(i)); 712 spin_lock_bh(rt_hash_lock_addr(i));
710 while ((rth = *rthp) != NULL) { 713 while ((rth = *rthp) != NULL) {
714 if (rth->rt_genid != atomic_read(&rt_genid)) {
715 *rthp = rth->u.dst.rt_next;
716 rt_free(rth);
717 continue;
718 }
711 if (rth->u.dst.expires) { 719 if (rth->u.dst.expires) {
712 /* Entry is expired even if it is in use */ 720 /* Entry is expired even if it is in use */
713 if (time_before_eq(jiffies, rth->u.dst.expires)) { 721 if (time_before_eq(jiffies, rth->u.dst.expires)) {
@@ -732,83 +740,45 @@ static void rt_check_expire(void)
732 740
733/* 741/*
734 * rt_worker_func() is run in process context. 742 * rt_worker_func() is run in process context.
735 * If a whole flush was scheduled, it is done. 743 * we call rt_check_expire() to scan part of the hash table
736 * Else, we call rt_check_expire() to scan part of the hash table
737 */ 744 */
738static void rt_worker_func(struct work_struct *work) 745static void rt_worker_func(struct work_struct *work)
739{ 746{
740 if (ip_rt_flush_expected) { 747 rt_check_expire();
741 ip_rt_flush_expected = 0;
742 rt_do_flush(1);
743 } else
744 rt_check_expire();
745 schedule_delayed_work(&expires_work, ip_rt_gc_interval); 748 schedule_delayed_work(&expires_work, ip_rt_gc_interval);
746} 749}
747 750
748/* This can run from both BH and non-BH contexts, the latter 751/*
749 * in the case of a forced flush event. 752 * Pertubation of rt_genid by a small quantity [1..256]
753 * Using 8 bits of shuffling ensure we can call rt_cache_invalidate()
754 * many times (2^24) without giving recent rt_genid.
755 * Jenkins hash is strong enough that litle changes of rt_genid are OK.
750 */ 756 */
751static void rt_run_flush(unsigned long process_context) 757static void rt_cache_invalidate(void)
752{ 758{
753 rt_deadline = 0; 759 unsigned char shuffle;
754
755 get_random_bytes(&rt_hash_rnd, 4);
756 760
757 rt_do_flush(process_context); 761 get_random_bytes(&shuffle, sizeof(shuffle));
762 atomic_add(shuffle + 1U, &rt_genid);
758} 763}
759 764
760static DEFINE_SPINLOCK(rt_flush_lock); 765/*
761 766 * delay < 0 : invalidate cache (fast : entries will be deleted later)
767 * delay >= 0 : invalidate & flush cache (can be long)
768 */
762void rt_cache_flush(int delay) 769void rt_cache_flush(int delay)
763{ 770{
764 unsigned long now = jiffies; 771 rt_cache_invalidate();
765 int user_mode = !in_softirq(); 772 if (delay >= 0)
766 773 rt_do_flush(!in_softirq());
767 if (delay < 0)
768 delay = ip_rt_min_delay;
769
770 spin_lock_bh(&rt_flush_lock);
771
772 if (del_timer(&rt_flush_timer) && delay > 0 && rt_deadline) {
773 long tmo = (long)(rt_deadline - now);
774
775 /* If flush timer is already running
776 and flush request is not immediate (delay > 0):
777
778 if deadline is not achieved, prolongate timer to "delay",
779 otherwise fire it at deadline time.
780 */
781
782 if (user_mode && tmo < ip_rt_max_delay-ip_rt_min_delay)
783 tmo = 0;
784
785 if (delay > tmo)
786 delay = tmo;
787 }
788
789 if (delay <= 0) {
790 spin_unlock_bh(&rt_flush_lock);
791 rt_run_flush(user_mode);
792 return;
793 }
794
795 if (rt_deadline == 0)
796 rt_deadline = now + ip_rt_max_delay;
797
798 mod_timer(&rt_flush_timer, now+delay);
799 spin_unlock_bh(&rt_flush_lock);
800} 774}
801 775
802/* 776/*
803 * We change rt_hash_rnd and ask next rt_worker_func() invocation 777 * We change rt_genid and let gc do the cleanup
804 * to perform a flush in process context
805 */ 778 */
806static void rt_secret_rebuild(unsigned long dummy) 779static void rt_secret_rebuild(unsigned long dummy)
807{ 780{
808 get_random_bytes(&rt_hash_rnd, 4); 781 rt_cache_invalidate();
809 ip_rt_flush_expected = 1;
810 cancel_delayed_work(&expires_work);
811 schedule_delayed_work(&expires_work, HZ/10);
812 mod_timer(&rt_secret_timer, jiffies + ip_rt_secret_interval); 782 mod_timer(&rt_secret_timer, jiffies + ip_rt_secret_interval);
813} 783}
814 784
@@ -885,7 +855,8 @@ static int rt_garbage_collect(struct dst_ops *ops)
885 rthp = &rt_hash_table[k].chain; 855 rthp = &rt_hash_table[k].chain;
886 spin_lock_bh(rt_hash_lock_addr(k)); 856 spin_lock_bh(rt_hash_lock_addr(k));
887 while ((rth = *rthp) != NULL) { 857 while ((rth = *rthp) != NULL) {
888 if (!rt_may_expire(rth, tmo, expire)) { 858 if (rth->rt_genid == atomic_read(&rt_genid) &&
859 !rt_may_expire(rth, tmo, expire)) {
889 tmo >>= 1; 860 tmo >>= 1;
890 rthp = &rth->u.dst.rt_next; 861 rthp = &rth->u.dst.rt_next;
891 continue; 862 continue;
@@ -966,6 +937,11 @@ restart:
966 937
967 spin_lock_bh(rt_hash_lock_addr(hash)); 938 spin_lock_bh(rt_hash_lock_addr(hash));
968 while ((rth = *rthp) != NULL) { 939 while ((rth = *rthp) != NULL) {
940 if (rth->rt_genid != atomic_read(&rt_genid)) {
941 *rthp = rth->u.dst.rt_next;
942 rt_free(rth);
943 continue;
944 }
969 if (compare_keys(&rth->fl, &rt->fl) && compare_netns(rth, rt)) { 945 if (compare_keys(&rth->fl, &rt->fl) && compare_netns(rth, rt)) {
970 /* Put it first */ 946 /* Put it first */
971 *rthp = rth->u.dst.rt_next; 947 *rthp = rth->u.dst.rt_next;
@@ -1131,17 +1107,19 @@ void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more)
1131 1107
1132static void rt_del(unsigned hash, struct rtable *rt) 1108static void rt_del(unsigned hash, struct rtable *rt)
1133{ 1109{
1134 struct rtable **rthp; 1110 struct rtable **rthp, *aux;
1135 1111
1112 rthp = &rt_hash_table[hash].chain;
1136 spin_lock_bh(rt_hash_lock_addr(hash)); 1113 spin_lock_bh(rt_hash_lock_addr(hash));
1137 ip_rt_put(rt); 1114 ip_rt_put(rt);
1138 for (rthp = &rt_hash_table[hash].chain; *rthp; 1115 while ((aux = *rthp) != NULL) {
1139 rthp = &(*rthp)->u.dst.rt_next) 1116 if (aux == rt || (aux->rt_genid != atomic_read(&rt_genid))) {
1140 if (*rthp == rt) { 1117 *rthp = aux->u.dst.rt_next;
1141 *rthp = rt->u.dst.rt_next; 1118 rt_free(aux);
1142 rt_free(rt); 1119 continue;
1143 break;
1144 } 1120 }
1121 rthp = &aux->u.dst.rt_next;
1122 }
1145 spin_unlock_bh(rt_hash_lock_addr(hash)); 1123 spin_unlock_bh(rt_hash_lock_addr(hash));
1146} 1124}
1147 1125
@@ -1186,7 +1164,8 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1186 if (rth->fl.fl4_dst != daddr || 1164 if (rth->fl.fl4_dst != daddr ||
1187 rth->fl.fl4_src != skeys[i] || 1165 rth->fl.fl4_src != skeys[i] ||
1188 rth->fl.oif != ikeys[k] || 1166 rth->fl.oif != ikeys[k] ||
1189 rth->fl.iif != 0) { 1167 rth->fl.iif != 0 ||
1168 rth->rt_genid != atomic_read(&rt_genid)) {
1190 rthp = &rth->u.dst.rt_next; 1169 rthp = &rth->u.dst.rt_next;
1191 continue; 1170 continue;
1192 } 1171 }
@@ -1224,7 +1203,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1224 rt->u.dst.neighbour = NULL; 1203 rt->u.dst.neighbour = NULL;
1225 rt->u.dst.hh = NULL; 1204 rt->u.dst.hh = NULL;
1226 rt->u.dst.xfrm = NULL; 1205 rt->u.dst.xfrm = NULL;
1227 1206 rt->rt_genid = atomic_read(&rt_genid);
1228 rt->rt_flags |= RTCF_REDIRECTED; 1207 rt->rt_flags |= RTCF_REDIRECTED;
1229 1208
1230 /* Gateway is different ... */ 1209 /* Gateway is different ... */
@@ -1445,7 +1424,8 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph,
1445 rth->rt_src == iph->saddr && 1424 rth->rt_src == iph->saddr &&
1446 rth->fl.iif == 0 && 1425 rth->fl.iif == 0 &&
1447 !(dst_metric_locked(&rth->u.dst, RTAX_MTU)) && 1426 !(dst_metric_locked(&rth->u.dst, RTAX_MTU)) &&
1448 rth->u.dst.dev->nd_net == net) { 1427 rth->u.dst.dev->nd_net == net &&
1428 rth->rt_genid == atomic_read(&rt_genid)) {
1449 unsigned short mtu = new_mtu; 1429 unsigned short mtu = new_mtu;
1450 1430
1451 if (new_mtu < 68 || new_mtu >= old_mtu) { 1431 if (new_mtu < 68 || new_mtu >= old_mtu) {
@@ -1680,8 +1660,9 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1680 rth->fl.oif = 0; 1660 rth->fl.oif = 0;
1681 rth->rt_gateway = daddr; 1661 rth->rt_gateway = daddr;
1682 rth->rt_spec_dst= spec_dst; 1662 rth->rt_spec_dst= spec_dst;
1683 rth->rt_type = RTN_MULTICAST; 1663 rth->rt_genid = atomic_read(&rt_genid);
1684 rth->rt_flags = RTCF_MULTICAST; 1664 rth->rt_flags = RTCF_MULTICAST;
1665 rth->rt_type = RTN_MULTICAST;
1685 if (our) { 1666 if (our) {
1686 rth->u.dst.input= ip_local_deliver; 1667 rth->u.dst.input= ip_local_deliver;
1687 rth->rt_flags |= RTCF_LOCAL; 1668 rth->rt_flags |= RTCF_LOCAL;
@@ -1820,6 +1801,7 @@ static inline int __mkroute_input(struct sk_buff *skb,
1820 1801
1821 rth->u.dst.input = ip_forward; 1802 rth->u.dst.input = ip_forward;
1822 rth->u.dst.output = ip_output; 1803 rth->u.dst.output = ip_output;
1804 rth->rt_genid = atomic_read(&rt_genid);
1823 1805
1824 rt_set_nexthop(rth, res, itag); 1806 rt_set_nexthop(rth, res, itag);
1825 1807
@@ -1980,6 +1962,7 @@ local_input:
1980 goto e_nobufs; 1962 goto e_nobufs;
1981 1963
1982 rth->u.dst.output= ip_rt_bug; 1964 rth->u.dst.output= ip_rt_bug;
1965 rth->rt_genid = atomic_read(&rt_genid);
1983 1966
1984 atomic_set(&rth->u.dst.__refcnt, 1); 1967 atomic_set(&rth->u.dst.__refcnt, 1);
1985 rth->u.dst.flags= DST_HOST; 1968 rth->u.dst.flags= DST_HOST;
@@ -2071,7 +2054,8 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
2071 rth->fl.oif == 0 && 2054 rth->fl.oif == 0 &&
2072 rth->fl.mark == skb->mark && 2055 rth->fl.mark == skb->mark &&
2073 rth->fl.fl4_tos == tos && 2056 rth->fl.fl4_tos == tos &&
2074 rth->u.dst.dev->nd_net == net) { 2057 rth->u.dst.dev->nd_net == net &&
2058 rth->rt_genid == atomic_read(&rt_genid)) {
2075 dst_use(&rth->u.dst, jiffies); 2059 dst_use(&rth->u.dst, jiffies);
2076 RT_CACHE_STAT_INC(in_hit); 2060 RT_CACHE_STAT_INC(in_hit);
2077 rcu_read_unlock(); 2061 rcu_read_unlock();
@@ -2199,6 +2183,7 @@ static inline int __mkroute_output(struct rtable **result,
2199 rth->rt_spec_dst= fl->fl4_src; 2183 rth->rt_spec_dst= fl->fl4_src;
2200 2184
2201 rth->u.dst.output=ip_output; 2185 rth->u.dst.output=ip_output;
2186 rth->rt_genid = atomic_read(&rt_genid);
2202 2187
2203 RT_CACHE_STAT_INC(out_slow_tot); 2188 RT_CACHE_STAT_INC(out_slow_tot);
2204 2189
@@ -2471,7 +2456,8 @@ int __ip_route_output_key(struct net *net, struct rtable **rp,
2471 rth->fl.mark == flp->mark && 2456 rth->fl.mark == flp->mark &&
2472 !((rth->fl.fl4_tos ^ flp->fl4_tos) & 2457 !((rth->fl.fl4_tos ^ flp->fl4_tos) &
2473 (IPTOS_RT_MASK | RTO_ONLINK)) && 2458 (IPTOS_RT_MASK | RTO_ONLINK)) &&
2474 rth->u.dst.dev->nd_net == net) { 2459 rth->u.dst.dev->nd_net == net &&
2460 rth->rt_genid == atomic_read(&rt_genid)) {
2475 dst_use(&rth->u.dst, jiffies); 2461 dst_use(&rth->u.dst, jiffies);
2476 RT_CACHE_STAT_INC(out_hit); 2462 RT_CACHE_STAT_INC(out_hit);
2477 rcu_read_unlock_bh(); 2463 rcu_read_unlock_bh();
@@ -2498,6 +2484,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = {
2498 .check = ipv4_dst_check, 2484 .check = ipv4_dst_check,
2499 .update_pmtu = ipv4_rt_blackhole_update_pmtu, 2485 .update_pmtu = ipv4_rt_blackhole_update_pmtu,
2500 .entry_size = sizeof(struct rtable), 2486 .entry_size = sizeof(struct rtable),
2487 .entries = ATOMIC_INIT(0),
2501}; 2488};
2502 2489
2503 2490
@@ -2525,6 +2512,7 @@ static int ipv4_dst_blackhole(struct rtable **rp, struct flowi *flp, struct sock
2525 rt->idev = ort->idev; 2512 rt->idev = ort->idev;
2526 if (rt->idev) 2513 if (rt->idev)
2527 in_dev_hold(rt->idev); 2514 in_dev_hold(rt->idev);
2515 rt->rt_genid = atomic_read(&rt_genid);
2528 rt->rt_flags = ort->rt_flags; 2516 rt->rt_flags = ort->rt_flags;
2529 rt->rt_type = ort->rt_type; 2517 rt->rt_type = ort->rt_type;
2530 rt->rt_dst = ort->rt_dst; 2518 rt->rt_dst = ort->rt_dst;
@@ -2779,6 +2767,8 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
2779 rt = rcu_dereference(rt->u.dst.rt_next), idx++) { 2767 rt = rcu_dereference(rt->u.dst.rt_next), idx++) {
2780 if (idx < s_idx) 2768 if (idx < s_idx)
2781 continue; 2769 continue;
2770 if (rt->rt_genid != atomic_read(&rt_genid))
2771 continue;
2782 skb->dst = dst_clone(&rt->u.dst); 2772 skb->dst = dst_clone(&rt->u.dst);
2783 if (rt_fill_info(skb, NETLINK_CB(cb->skb).pid, 2773 if (rt_fill_info(skb, NETLINK_CB(cb->skb).pid,
2784 cb->nlh->nlmsg_seq, RTM_NEWROUTE, 2774 cb->nlh->nlmsg_seq, RTM_NEWROUTE,
@@ -2848,24 +2838,6 @@ ctl_table ipv4_route_table[] = {
2848 .strategy = &ipv4_sysctl_rtcache_flush_strategy, 2838 .strategy = &ipv4_sysctl_rtcache_flush_strategy,
2849 }, 2839 },
2850 { 2840 {
2851 .ctl_name = NET_IPV4_ROUTE_MIN_DELAY,
2852 .procname = "min_delay",
2853 .data = &ip_rt_min_delay,
2854 .maxlen = sizeof(int),
2855 .mode = 0644,
2856 .proc_handler = &proc_dointvec_jiffies,
2857 .strategy = &sysctl_jiffies,
2858 },
2859 {
2860 .ctl_name = NET_IPV4_ROUTE_MAX_DELAY,
2861 .procname = "max_delay",
2862 .data = &ip_rt_max_delay,
2863 .maxlen = sizeof(int),
2864 .mode = 0644,
2865 .proc_handler = &proc_dointvec_jiffies,
2866 .strategy = &sysctl_jiffies,
2867 },
2868 {
2869 .ctl_name = NET_IPV4_ROUTE_GC_THRESH, 2841 .ctl_name = NET_IPV4_ROUTE_GC_THRESH,
2870 .procname = "gc_thresh", 2842 .procname = "gc_thresh",
2871 .data = &ipv4_dst_ops.gc_thresh, 2843 .data = &ipv4_dst_ops.gc_thresh,
@@ -3023,8 +2995,8 @@ int __init ip_rt_init(void)
3023{ 2995{
3024 int rc = 0; 2996 int rc = 0;
3025 2997
3026 rt_hash_rnd = (int) ((num_physpages ^ (num_physpages>>8)) ^ 2998 atomic_set(&rt_genid, (int) ((num_physpages ^ (num_physpages>>8)) ^
3027 (jiffies ^ (jiffies >> 7))); 2999 (jiffies ^ (jiffies >> 7))));
3028 3000
3029#ifdef CONFIG_NET_CLS_ROUTE 3001#ifdef CONFIG_NET_CLS_ROUTE
3030 ip_rt_acct = __alloc_percpu(256 * sizeof(struct ip_rt_acct)); 3002 ip_rt_acct = __alloc_percpu(256 * sizeof(struct ip_rt_acct));
@@ -3057,7 +3029,6 @@ int __init ip_rt_init(void)
3057 devinet_init(); 3029 devinet_init();
3058 ip_fib_init(); 3030 ip_fib_init();
3059 3031
3060 setup_timer(&rt_flush_timer, rt_run_flush, 0);
3061 setup_timer(&rt_secret_timer, rt_secret_rebuild, 0); 3032 setup_timer(&rt_secret_timer, rt_secret_rebuild, 0);
3062 3033
3063 /* All the timers, started at system startup tend 3034 /* All the timers, started at system startup tend
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 82cdf23837e3..88286f35d1e2 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -185,7 +185,7 @@ static int strategy_allowed_congestion_control(ctl_table *table, int __user *nam
185 185
186 tcp_get_available_congestion_control(tbl.data, tbl.maxlen); 186 tcp_get_available_congestion_control(tbl.data, tbl.maxlen);
187 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen); 187 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
188 if (ret == 0 && newval && newlen) 188 if (ret == 1 && newval && newlen)
189 ret = tcp_set_allowed_congestion_control(tbl.data); 189 ret = tcp_set_allowed_congestion_control(tbl.data);
190 kfree(tbl.data); 190 kfree(tbl.data);
191 191
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index fa2c85ca5bc3..19c449f62672 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2153,7 +2153,7 @@ static void tcp_mark_head_lost(struct sock *sk, int packets, int fast_rexmit)
2153 tp->lost_skb_hint = skb; 2153 tp->lost_skb_hint = skb;
2154 tp->lost_cnt_hint = cnt; 2154 tp->lost_cnt_hint = cnt;
2155 2155
2156 if (tcp_is_fack(tp) || 2156 if (tcp_is_fack(tp) || tcp_is_reno(tp) ||
2157 (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)) 2157 (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED))
2158 cnt += tcp_skb_pcount(skb); 2158 cnt += tcp_skb_pcount(skb);
2159 2159
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 9aea88b8d4fc..77c1939a2b0d 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -369,8 +369,8 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
369 return; 369 return;
370 } 370 }
371 371
372 sk = inet_lookup(&tcp_hashinfo, iph->daddr, th->dest, iph->saddr, 372 sk = inet_lookup(skb->dev->nd_net, &tcp_hashinfo, iph->daddr, th->dest,
373 th->source, inet_iif(skb)); 373 iph->saddr, th->source, inet_iif(skb));
374 if (!sk) { 374 if (!sk) {
375 ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); 375 ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
376 return; 376 return;
@@ -1503,8 +1503,8 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
1503 if (req) 1503 if (req)
1504 return tcp_check_req(sk, skb, req, prev); 1504 return tcp_check_req(sk, skb, req, prev);
1505 1505
1506 nsk = inet_lookup_established(&tcp_hashinfo, iph->saddr, th->source, 1506 nsk = inet_lookup_established(sk->sk_net, &tcp_hashinfo, iph->saddr,
1507 iph->daddr, th->dest, inet_iif(skb)); 1507 th->source, iph->daddr, th->dest, inet_iif(skb));
1508 1508
1509 if (nsk) { 1509 if (nsk) {
1510 if (nsk->sk_state != TCP_TIME_WAIT) { 1510 if (nsk->sk_state != TCP_TIME_WAIT) {
@@ -1661,8 +1661,8 @@ int tcp_v4_rcv(struct sk_buff *skb)
1661 TCP_SKB_CB(skb)->flags = iph->tos; 1661 TCP_SKB_CB(skb)->flags = iph->tos;
1662 TCP_SKB_CB(skb)->sacked = 0; 1662 TCP_SKB_CB(skb)->sacked = 0;
1663 1663
1664 sk = __inet_lookup(&tcp_hashinfo, iph->saddr, th->source, 1664 sk = __inet_lookup(skb->dev->nd_net, &tcp_hashinfo, iph->saddr,
1665 iph->daddr, th->dest, inet_iif(skb)); 1665 th->source, iph->daddr, th->dest, inet_iif(skb));
1666 if (!sk) 1666 if (!sk)
1667 goto no_tcp_socket; 1667 goto no_tcp_socket;
1668 1668
@@ -1735,7 +1735,8 @@ do_time_wait:
1735 } 1735 }
1736 switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) { 1736 switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) {
1737 case TCP_TW_SYN: { 1737 case TCP_TW_SYN: {
1738 struct sock *sk2 = inet_lookup_listener(&tcp_hashinfo, 1738 struct sock *sk2 = inet_lookup_listener(skb->dev->nd_net,
1739 &tcp_hashinfo,
1739 iph->daddr, th->dest, 1740 iph->daddr, th->dest,
1740 inet_iif(skb)); 1741 inet_iif(skb));
1741 if (sk2) { 1742 if (sk2) {
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 89f0188885c7..ed750f9ceb07 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2564,5 +2564,4 @@ EXPORT_SYMBOL(tcp_connect);
2564EXPORT_SYMBOL(tcp_make_synack); 2564EXPORT_SYMBOL(tcp_make_synack);
2565EXPORT_SYMBOL(tcp_simple_retransmit); 2565EXPORT_SYMBOL(tcp_simple_retransmit);
2566EXPORT_SYMBOL(tcp_sync_mss); 2566EXPORT_SYMBOL(tcp_sync_mss);
2567EXPORT_SYMBOL(sysctl_tcp_tso_win_divisor);
2568EXPORT_SYMBOL(tcp_mtup_init); 2567EXPORT_SYMBOL(tcp_mtup_init);
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 2fb8d731026b..7ea1b67b6de1 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -130,14 +130,14 @@ EXPORT_SYMBOL(sysctl_udp_wmem_min);
130atomic_t udp_memory_allocated; 130atomic_t udp_memory_allocated;
131EXPORT_SYMBOL(udp_memory_allocated); 131EXPORT_SYMBOL(udp_memory_allocated);
132 132
133static inline int __udp_lib_lport_inuse(__u16 num, 133static inline int __udp_lib_lport_inuse(struct net *net, __u16 num,
134 const struct hlist_head udptable[]) 134 const struct hlist_head udptable[])
135{ 135{
136 struct sock *sk; 136 struct sock *sk;
137 struct hlist_node *node; 137 struct hlist_node *node;
138 138
139 sk_for_each(sk, node, &udptable[num & (UDP_HTABLE_SIZE - 1)]) 139 sk_for_each(sk, node, &udptable[num & (UDP_HTABLE_SIZE - 1)])
140 if (sk->sk_hash == num) 140 if (sk->sk_net == net && sk->sk_hash == num)
141 return 1; 141 return 1;
142 return 0; 142 return 0;
143} 143}
@@ -159,6 +159,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
159 struct hlist_head *head; 159 struct hlist_head *head;
160 struct sock *sk2; 160 struct sock *sk2;
161 int error = 1; 161 int error = 1;
162 struct net *net = sk->sk_net;
162 163
163 write_lock_bh(&udp_hash_lock); 164 write_lock_bh(&udp_hash_lock);
164 165
@@ -198,7 +199,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
198 /* 2nd pass: find hole in shortest hash chain */ 199 /* 2nd pass: find hole in shortest hash chain */
199 rover = best; 200 rover = best;
200 for (i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++) { 201 for (i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++) {
201 if (! __udp_lib_lport_inuse(rover, udptable)) 202 if (! __udp_lib_lport_inuse(net, rover, udptable))
202 goto gotit; 203 goto gotit;
203 rover += UDP_HTABLE_SIZE; 204 rover += UDP_HTABLE_SIZE;
204 if (rover > high) 205 if (rover > high)
@@ -218,6 +219,7 @@ gotit:
218 sk_for_each(sk2, node, head) 219 sk_for_each(sk2, node, head)
219 if (sk2->sk_hash == snum && 220 if (sk2->sk_hash == snum &&
220 sk2 != sk && 221 sk2 != sk &&
222 sk2->sk_net == net &&
221 (!sk2->sk_reuse || !sk->sk_reuse) && 223 (!sk2->sk_reuse || !sk->sk_reuse) &&
222 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if 224 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if
223 || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && 225 || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
@@ -261,9 +263,9 @@ static inline int udp_v4_get_port(struct sock *sk, unsigned short snum)
261/* UDP is nearly always wildcards out the wazoo, it makes no sense to try 263/* UDP is nearly always wildcards out the wazoo, it makes no sense to try
262 * harder than this. -DaveM 264 * harder than this. -DaveM
263 */ 265 */
264static struct sock *__udp4_lib_lookup(__be32 saddr, __be16 sport, 266static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
265 __be32 daddr, __be16 dport, 267 __be16 sport, __be32 daddr, __be16 dport,
266 int dif, struct hlist_head udptable[]) 268 int dif, struct hlist_head udptable[])
267{ 269{
268 struct sock *sk, *result = NULL; 270 struct sock *sk, *result = NULL;
269 struct hlist_node *node; 271 struct hlist_node *node;
@@ -274,7 +276,8 @@ static struct sock *__udp4_lib_lookup(__be32 saddr, __be16 sport,
274 sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { 276 sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) {
275 struct inet_sock *inet = inet_sk(sk); 277 struct inet_sock *inet = inet_sk(sk);
276 278
277 if (sk->sk_hash == hnum && !ipv6_only_sock(sk)) { 279 if (sk->sk_net == net && sk->sk_hash == hnum &&
280 !ipv6_only_sock(sk)) {
278 int score = (sk->sk_family == PF_INET ? 1 : 0); 281 int score = (sk->sk_family == PF_INET ? 1 : 0);
279 if (inet->rcv_saddr) { 282 if (inet->rcv_saddr) {
280 if (inet->rcv_saddr != daddr) 283 if (inet->rcv_saddr != daddr)
@@ -361,8 +364,8 @@ void __udp4_lib_err(struct sk_buff *skb, u32 info, struct hlist_head udptable[])
361 int harderr; 364 int harderr;
362 int err; 365 int err;
363 366
364 sk = __udp4_lib_lookup(iph->daddr, uh->dest, iph->saddr, uh->source, 367 sk = __udp4_lib_lookup(skb->dev->nd_net, iph->daddr, uh->dest,
365 skb->dev->ifindex, udptable ); 368 iph->saddr, uh->source, skb->dev->ifindex, udptable);
366 if (sk == NULL) { 369 if (sk == NULL) {
367 ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); 370 ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
368 return; /* No socket for error */ 371 return; /* No socket for error */
@@ -1185,8 +1188,8 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1185 if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) 1188 if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
1186 return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); 1189 return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable);
1187 1190
1188 sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest, 1191 sk = __udp4_lib_lookup(skb->dev->nd_net, saddr, uh->source, daddr,
1189 inet_iif(skb), udptable); 1192 uh->dest, inet_iif(skb), udptable);
1190 1193
1191 if (sk != NULL) { 1194 if (sk != NULL) {
1192 int ret = 0; 1195 int ret = 0;
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 3783e3ee56a4..10ed70491434 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -247,6 +247,7 @@ static struct dst_ops xfrm4_dst_ops = {
247 .local_out = __ip_local_out, 247 .local_out = __ip_local_out,
248 .gc_thresh = 1024, 248 .gc_thresh = 1024,
249 .entry_size = sizeof(struct xfrm_dst), 249 .entry_size = sizeof(struct xfrm_dst),
250 .entries = ATOMIC_INIT(0),
250}; 251};
251 252
252static struct xfrm_policy_afinfo xfrm4_policy_afinfo = { 253static struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c
index 326845195620..41f5982d2087 100644
--- a/net/ipv4/xfrm4_tunnel.c
+++ b/net/ipv4/xfrm4_tunnel.c
@@ -38,7 +38,7 @@ static void ipip_destroy(struct xfrm_state *x)
38{ 38{
39} 39}
40 40
41static struct xfrm_type ipip_type = { 41static const struct xfrm_type ipip_type = {
42 .description = "IPIP", 42 .description = "IPIP",
43 .owner = THIS_MODULE, 43 .owner = THIS_MODULE,
44 .proto = IPPROTO_IPIP, 44 .proto = IPPROTO_IPIP,
@@ -50,7 +50,7 @@ static struct xfrm_type ipip_type = {
50 50
51static int xfrm_tunnel_rcv(struct sk_buff *skb) 51static int xfrm_tunnel_rcv(struct sk_buff *skb)
52{ 52{
53 return xfrm4_rcv_spi(skb, IPPROTO_IP, ip_hdr(skb)->saddr); 53 return xfrm4_rcv_spi(skb, IPPROTO_IPIP, ip_hdr(skb)->saddr);
54} 54}
55 55
56static int xfrm_tunnel_err(struct sk_buff *skb, u32 info) 56static int xfrm_tunnel_err(struct sk_buff *skb, u32 info)
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig
index eb0b8085949b..3ffb0323668c 100644
--- a/net/ipv6/Kconfig
+++ b/net/ipv6/Kconfig
@@ -85,6 +85,7 @@ config INET6_ESP
85 depends on IPV6 85 depends on IPV6
86 select XFRM 86 select XFRM
87 select CRYPTO 87 select CRYPTO
88 select CRYPTO_AEAD
88 select CRYPTO_HMAC 89 select CRYPTO_HMAC
89 select CRYPTO_MD5 90 select CRYPTO_MD5
90 select CRYPTO_CBC 91 select CRYPTO_CBC
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index fb0d07a15e93..379c8e04c36c 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -515,7 +515,7 @@ static void ah6_destroy(struct xfrm_state *x)
515 kfree(ahp); 515 kfree(ahp);
516} 516}
517 517
518static struct xfrm_type ah6_type = 518static const struct xfrm_type ah6_type =
519{ 519{
520 .description = "AH6", 520 .description = "AH6",
521 .owner = THIS_MODULE, 521 .owner = THIS_MODULE,
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 5bd5292ad9fa..8e0f1428c716 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -24,33 +24,124 @@
24 * This file is derived from net/ipv4/esp.c 24 * This file is derived from net/ipv4/esp.c
25 */ 25 */
26 26
27#include <crypto/aead.h>
28#include <crypto/authenc.h>
27#include <linux/err.h> 29#include <linux/err.h>
28#include <linux/module.h> 30#include <linux/module.h>
29#include <net/ip.h> 31#include <net/ip.h>
30#include <net/xfrm.h> 32#include <net/xfrm.h>
31#include <net/esp.h> 33#include <net/esp.h>
32#include <linux/scatterlist.h> 34#include <linux/scatterlist.h>
33#include <linux/crypto.h>
34#include <linux/kernel.h> 35#include <linux/kernel.h>
35#include <linux/pfkeyv2.h> 36#include <linux/pfkeyv2.h>
36#include <linux/random.h> 37#include <linux/random.h>
38#include <linux/slab.h>
37#include <linux/spinlock.h> 39#include <linux/spinlock.h>
38#include <net/icmp.h> 40#include <net/icmp.h>
39#include <net/ipv6.h> 41#include <net/ipv6.h>
40#include <net/protocol.h> 42#include <net/protocol.h>
41#include <linux/icmpv6.h> 43#include <linux/icmpv6.h>
42 44
45struct esp_skb_cb {
46 struct xfrm_skb_cb xfrm;
47 void *tmp;
48};
49
50#define ESP_SKB_CB(__skb) ((struct esp_skb_cb *)&((__skb)->cb[0]))
51
52/*
53 * Allocate an AEAD request structure with extra space for SG and IV.
54 *
55 * For alignment considerations the IV is placed at the front, followed
56 * by the request and finally the SG list.
57 *
58 * TODO: Use spare space in skb for this where possible.
59 */
60static void *esp_alloc_tmp(struct crypto_aead *aead, int nfrags)
61{
62 unsigned int len;
63
64 len = crypto_aead_ivsize(aead);
65 if (len) {
66 len += crypto_aead_alignmask(aead) &
67 ~(crypto_tfm_ctx_alignment() - 1);
68 len = ALIGN(len, crypto_tfm_ctx_alignment());
69 }
70
71 len += sizeof(struct aead_givcrypt_request) + crypto_aead_reqsize(aead);
72 len = ALIGN(len, __alignof__(struct scatterlist));
73
74 len += sizeof(struct scatterlist) * nfrags;
75
76 return kmalloc(len, GFP_ATOMIC);
77}
78
79static inline u8 *esp_tmp_iv(struct crypto_aead *aead, void *tmp)
80{
81 return crypto_aead_ivsize(aead) ?
82 PTR_ALIGN((u8 *)tmp, crypto_aead_alignmask(aead) + 1) : tmp;
83}
84
85static inline struct aead_givcrypt_request *esp_tmp_givreq(
86 struct crypto_aead *aead, u8 *iv)
87{
88 struct aead_givcrypt_request *req;
89
90 req = (void *)PTR_ALIGN(iv + crypto_aead_ivsize(aead),
91 crypto_tfm_ctx_alignment());
92 aead_givcrypt_set_tfm(req, aead);
93 return req;
94}
95
96static inline struct aead_request *esp_tmp_req(struct crypto_aead *aead, u8 *iv)
97{
98 struct aead_request *req;
99
100 req = (void *)PTR_ALIGN(iv + crypto_aead_ivsize(aead),
101 crypto_tfm_ctx_alignment());
102 aead_request_set_tfm(req, aead);
103 return req;
104}
105
106static inline struct scatterlist *esp_req_sg(struct crypto_aead *aead,
107 struct aead_request *req)
108{
109 return (void *)ALIGN((unsigned long)(req + 1) +
110 crypto_aead_reqsize(aead),
111 __alignof__(struct scatterlist));
112}
113
114static inline struct scatterlist *esp_givreq_sg(
115 struct crypto_aead *aead, struct aead_givcrypt_request *req)
116{
117 return (void *)ALIGN((unsigned long)(req + 1) +
118 crypto_aead_reqsize(aead),
119 __alignof__(struct scatterlist));
120}
121
122static void esp_output_done(struct crypto_async_request *base, int err)
123{
124 struct sk_buff *skb = base->data;
125
126 kfree(ESP_SKB_CB(skb)->tmp);
127 xfrm_output_resume(skb, err);
128}
129
43static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) 130static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
44{ 131{
45 int err; 132 int err;
46 struct ip_esp_hdr *esph; 133 struct ip_esp_hdr *esph;
47 struct crypto_blkcipher *tfm; 134 struct crypto_aead *aead;
48 struct blkcipher_desc desc; 135 struct aead_givcrypt_request *req;
136 struct scatterlist *sg;
137 struct scatterlist *asg;
49 struct sk_buff *trailer; 138 struct sk_buff *trailer;
139 void *tmp;
50 int blksize; 140 int blksize;
51 int clen; 141 int clen;
52 int alen; 142 int alen;
53 int nfrags; 143 int nfrags;
144 u8 *iv;
54 u8 *tail; 145 u8 *tail;
55 struct esp_data *esp = x->data; 146 struct esp_data *esp = x->data;
56 147
@@ -60,18 +151,26 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
60 /* Round to block size */ 151 /* Round to block size */
61 clen = skb->len; 152 clen = skb->len;
62 153
63 alen = esp->auth.icv_trunc_len; 154 aead = esp->aead;
64 tfm = esp->conf.tfm; 155 alen = crypto_aead_authsize(aead);
65 desc.tfm = tfm; 156
66 desc.flags = 0; 157 blksize = ALIGN(crypto_aead_blocksize(aead), 4);
67 blksize = ALIGN(crypto_blkcipher_blocksize(tfm), 4);
68 clen = ALIGN(clen + 2, blksize); 158 clen = ALIGN(clen + 2, blksize);
69 if (esp->conf.padlen) 159 if (esp->padlen)
70 clen = ALIGN(clen, esp->conf.padlen); 160 clen = ALIGN(clen, esp->padlen);
71 161
72 if ((nfrags = skb_cow_data(skb, clen-skb->len+alen, &trailer)) < 0) { 162 if ((err = skb_cow_data(skb, clen - skb->len + alen, &trailer)) < 0)
73 goto error; 163 goto error;
74 } 164 nfrags = err;
165
166 tmp = esp_alloc_tmp(aead, nfrags + 1);
167 if (!tmp)
168 goto error;
169
170 iv = esp_tmp_iv(aead, tmp);
171 req = esp_tmp_givreq(aead, iv);
172 asg = esp_givreq_sg(aead, req);
173 sg = asg + 1;
75 174
76 /* Fill padding... */ 175 /* Fill padding... */
77 tail = skb_tail_pointer(trailer); 176 tail = skb_tail_pointer(trailer);
@@ -81,86 +180,113 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
81 tail[i] = i + 1; 180 tail[i] = i + 1;
82 } while (0); 181 } while (0);
83 tail[clen-skb->len - 2] = (clen - skb->len) - 2; 182 tail[clen-skb->len - 2] = (clen - skb->len) - 2;
84 pskb_put(skb, trailer, clen - skb->len); 183 tail[clen - skb->len - 1] = *skb_mac_header(skb);
184 pskb_put(skb, trailer, clen - skb->len + alen);
85 185
86 skb_push(skb, -skb_network_offset(skb)); 186 skb_push(skb, -skb_network_offset(skb));
87 esph = ip_esp_hdr(skb); 187 esph = ip_esp_hdr(skb);
88 *(skb_tail_pointer(trailer) - 1) = *skb_mac_header(skb);
89 *skb_mac_header(skb) = IPPROTO_ESP; 188 *skb_mac_header(skb) = IPPROTO_ESP;
90 189
91 esph->spi = x->id.spi; 190 esph->spi = x->id.spi;
92 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq); 191 esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq);
93 192
94 spin_lock_bh(&x->lock); 193 sg_init_table(sg, nfrags);
194 skb_to_sgvec(skb, sg,
195 esph->enc_data + crypto_aead_ivsize(aead) - skb->data,
196 clen + alen);
197 sg_init_one(asg, esph, sizeof(*esph));
95 198
96 if (esp->conf.ivlen) { 199 aead_givcrypt_set_callback(req, 0, esp_output_done, skb);
97 if (unlikely(!esp->conf.ivinitted)) { 200 aead_givcrypt_set_crypt(req, sg, sg, clen, iv);
98 get_random_bytes(esp->conf.ivec, esp->conf.ivlen); 201 aead_givcrypt_set_assoc(req, asg, sizeof(*esph));
99 esp->conf.ivinitted = 1; 202 aead_givcrypt_set_giv(req, esph->enc_data, XFRM_SKB_CB(skb)->seq);
100 }
101 crypto_blkcipher_set_iv(tfm, esp->conf.ivec, esp->conf.ivlen);
102 }
103 203
104 do { 204 ESP_SKB_CB(skb)->tmp = tmp;
105 struct scatterlist *sg = &esp->sgbuf[0]; 205 err = crypto_aead_givencrypt(req);
206 if (err == -EINPROGRESS)
207 goto error;
106 208
107 if (unlikely(nfrags > ESP_NUM_FAST_SG)) { 209 if (err == -EBUSY)
108 sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC); 210 err = NET_XMIT_DROP;
109 if (!sg) 211
110 goto unlock; 212 kfree(tmp);
111 } 213
112 sg_init_table(sg, nfrags); 214error:
113 skb_to_sgvec(skb, sg, 215 return err;
114 esph->enc_data + 216}
115 esp->conf.ivlen - 217
116 skb->data, clen); 218static int esp_input_done2(struct sk_buff *skb, int err)
117 err = crypto_blkcipher_encrypt(&desc, sg, sg, clen); 219{
118 if (unlikely(sg != &esp->sgbuf[0])) 220 struct xfrm_state *x = xfrm_input_state(skb);
119 kfree(sg); 221 struct esp_data *esp = x->data;
120 } while (0); 222 struct crypto_aead *aead = esp->aead;
223 int alen = crypto_aead_authsize(aead);
224 int hlen = sizeof(struct ip_esp_hdr) + crypto_aead_ivsize(aead);
225 int elen = skb->len - hlen;
226 int hdr_len = skb_network_header_len(skb);
227 int padlen;
228 u8 nexthdr[2];
229
230 kfree(ESP_SKB_CB(skb)->tmp);
121 231
122 if (unlikely(err)) 232 if (unlikely(err))
123 goto unlock; 233 goto out;
124 234
125 if (esp->conf.ivlen) { 235 if (skb_copy_bits(skb, skb->len - alen - 2, nexthdr, 2))
126 memcpy(esph->enc_data, esp->conf.ivec, esp->conf.ivlen); 236 BUG();
127 crypto_blkcipher_get_iv(tfm, esp->conf.ivec, esp->conf.ivlen);
128 }
129 237
130 if (esp->auth.icv_full_len) { 238 err = -EINVAL;
131 err = esp_mac_digest(esp, skb, (u8 *)esph - skb->data, 239 padlen = nexthdr[0];
132 sizeof(*esph) + esp->conf.ivlen + clen); 240 if (padlen + 2 + alen >= elen) {
133 memcpy(pskb_put(skb, trailer, alen), esp->auth.work_icv, alen); 241 LIMIT_NETDEBUG(KERN_WARNING "ipsec esp packet is garbage "
242 "padlen=%d, elen=%d\n", padlen + 2, elen - alen);
243 goto out;
134 } 244 }
135 245
136unlock: 246 /* ... check padding bits here. Silly. :-) */
137 spin_unlock_bh(&x->lock);
138 247
139error: 248 pskb_trim(skb, skb->len - alen - padlen - 2);
249 __skb_pull(skb, hlen);
250 skb_set_transport_header(skb, -hdr_len);
251
252 err = nexthdr[1];
253
254 /* RFC4303: Drop dummy packets without any error */
255 if (err == IPPROTO_NONE)
256 err = -EINVAL;
257
258out:
140 return err; 259 return err;
141} 260}
142 261
262static void esp_input_done(struct crypto_async_request *base, int err)
263{
264 struct sk_buff *skb = base->data;
265
266 xfrm_input_resume(skb, esp_input_done2(skb, err));
267}
268
143static int esp6_input(struct xfrm_state *x, struct sk_buff *skb) 269static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
144{ 270{
145 struct ipv6hdr *iph;
146 struct ip_esp_hdr *esph; 271 struct ip_esp_hdr *esph;
147 struct esp_data *esp = x->data; 272 struct esp_data *esp = x->data;
148 struct crypto_blkcipher *tfm = esp->conf.tfm; 273 struct crypto_aead *aead = esp->aead;
149 struct blkcipher_desc desc = { .tfm = tfm }; 274 struct aead_request *req;
150 struct sk_buff *trailer; 275 struct sk_buff *trailer;
151 int blksize = ALIGN(crypto_blkcipher_blocksize(tfm), 4); 276 int elen = skb->len - sizeof(*esph) - crypto_aead_ivsize(aead);
152 int alen = esp->auth.icv_trunc_len;
153 int elen = skb->len - sizeof(*esph) - esp->conf.ivlen - alen;
154 int hdr_len = skb_network_header_len(skb);
155 int nfrags; 277 int nfrags;
156 int ret = 0; 278 int ret = 0;
279 void *tmp;
280 u8 *iv;
281 struct scatterlist *sg;
282 struct scatterlist *asg;
157 283
158 if (!pskb_may_pull(skb, sizeof(*esph))) { 284 if (!pskb_may_pull(skb, sizeof(*esph))) {
159 ret = -EINVAL; 285 ret = -EINVAL;
160 goto out; 286 goto out;
161 } 287 }
162 288
163 if (elen <= 0 || (elen & (blksize-1))) { 289 if (elen <= 0) {
164 ret = -EINVAL; 290 ret = -EINVAL;
165 goto out; 291 goto out;
166 } 292 }
@@ -170,86 +296,38 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
170 goto out; 296 goto out;
171 } 297 }
172 298
173 skb->ip_summed = CHECKSUM_NONE; 299 ret = -ENOMEM;
174 300 tmp = esp_alloc_tmp(aead, nfrags + 1);
175 spin_lock(&x->lock); 301 if (!tmp)
176 302 goto out;
177 /* If integrity check is required, do this. */
178 if (esp->auth.icv_full_len) {
179 u8 sum[alen];
180
181 ret = esp_mac_digest(esp, skb, 0, skb->len - alen);
182 if (ret)
183 goto unlock;
184 303
185 if (skb_copy_bits(skb, skb->len - alen, sum, alen)) 304 ESP_SKB_CB(skb)->tmp = tmp;
186 BUG(); 305 iv = esp_tmp_iv(aead, tmp);
306 req = esp_tmp_req(aead, iv);
307 asg = esp_req_sg(aead, req);
308 sg = asg + 1;
187 309
188 if (unlikely(memcmp(esp->auth.work_icv, sum, alen))) { 310 skb->ip_summed = CHECKSUM_NONE;
189 ret = -EBADMSG;
190 goto unlock;
191 }
192 }
193 311
194 esph = (struct ip_esp_hdr *)skb->data; 312 esph = (struct ip_esp_hdr *)skb->data;
195 iph = ipv6_hdr(skb);
196 313
197 /* Get ivec. This can be wrong, check against another impls. */ 314 /* Get ivec. This can be wrong, check against another impls. */
198 if (esp->conf.ivlen) 315 iv = esph->enc_data;
199 crypto_blkcipher_set_iv(tfm, esph->enc_data, esp->conf.ivlen);
200
201 {
202 struct scatterlist *sg = &esp->sgbuf[0];
203
204 if (unlikely(nfrags > ESP_NUM_FAST_SG)) {
205 sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC);
206 if (!sg) {
207 ret = -ENOMEM;
208 goto unlock;
209 }
210 }
211 sg_init_table(sg, nfrags);
212 skb_to_sgvec(skb, sg,
213 sizeof(*esph) + esp->conf.ivlen,
214 elen);
215 ret = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
216 if (unlikely(sg != &esp->sgbuf[0]))
217 kfree(sg);
218 }
219 316
220unlock: 317 sg_init_table(sg, nfrags);
221 spin_unlock(&x->lock); 318 skb_to_sgvec(skb, sg, sizeof(*esph) + crypto_aead_ivsize(aead), elen);
319 sg_init_one(asg, esph, sizeof(*esph));
222 320
223 if (unlikely(ret)) 321 aead_request_set_callback(req, 0, esp_input_done, skb);
224 goto out; 322 aead_request_set_crypt(req, sg, sg, elen, iv);
225 323 aead_request_set_assoc(req, asg, sizeof(*esph));
226 {
227 u8 nexthdr[2];
228 u8 padlen;
229
230 if (skb_copy_bits(skb, skb->len-alen-2, nexthdr, 2))
231 BUG();
232
233 padlen = nexthdr[0];
234 if (padlen+2 >= elen) {
235 LIMIT_NETDEBUG(KERN_WARNING "ipsec esp packet is garbage padlen=%d, elen=%d\n", padlen+2, elen);
236 ret = -EINVAL;
237 goto out;
238 }
239 /* ... check padding bits here. Silly. :-) */
240 324
241 /* RFC4303: Drop dummy packets without any error */ 325 ret = crypto_aead_decrypt(req);
242 if (nexthdr[1] == IPPROTO_NONE) { 326 if (ret == -EINPROGRESS)
243 ret = -EINVAL; 327 goto out;
244 goto out;
245 }
246 328
247 pskb_trim(skb, skb->len - alen - padlen - 2); 329 ret = esp_input_done2(skb, ret);
248 ret = nexthdr[1];
249 }
250 330
251 __skb_pull(skb, sizeof(*esph) + esp->conf.ivlen);
252 skb_set_transport_header(skb, -hdr_len);
253out: 331out:
254 return ret; 332 return ret;
255} 333}
@@ -257,11 +335,11 @@ out:
257static u32 esp6_get_mtu(struct xfrm_state *x, int mtu) 335static u32 esp6_get_mtu(struct xfrm_state *x, int mtu)
258{ 336{
259 struct esp_data *esp = x->data; 337 struct esp_data *esp = x->data;
260 u32 blksize = ALIGN(crypto_blkcipher_blocksize(esp->conf.tfm), 4); 338 u32 blksize = ALIGN(crypto_aead_blocksize(esp->aead), 4);
261 u32 align = max_t(u32, blksize, esp->conf.padlen); 339 u32 align = max_t(u32, blksize, esp->padlen);
262 u32 rem; 340 u32 rem;
263 341
264 mtu -= x->props.header_len + esp->auth.icv_trunc_len; 342 mtu -= x->props.header_len + crypto_aead_authsize(esp->aead);
265 rem = mtu & (align - 1); 343 rem = mtu & (align - 1);
266 mtu &= ~(align - 1); 344 mtu &= ~(align - 1);
267 345
@@ -300,81 +378,146 @@ static void esp6_destroy(struct xfrm_state *x)
300 if (!esp) 378 if (!esp)
301 return; 379 return;
302 380
303 crypto_free_blkcipher(esp->conf.tfm); 381 crypto_free_aead(esp->aead);
304 esp->conf.tfm = NULL;
305 kfree(esp->conf.ivec);
306 esp->conf.ivec = NULL;
307 crypto_free_hash(esp->auth.tfm);
308 esp->auth.tfm = NULL;
309 kfree(esp->auth.work_icv);
310 esp->auth.work_icv = NULL;
311 kfree(esp); 382 kfree(esp);
312} 383}
313 384
314static int esp6_init_state(struct xfrm_state *x) 385static int esp_init_aead(struct xfrm_state *x)
386{
387 struct esp_data *esp = x->data;
388 struct crypto_aead *aead;
389 int err;
390
391 aead = crypto_alloc_aead(x->aead->alg_name, 0, 0);
392 err = PTR_ERR(aead);
393 if (IS_ERR(aead))
394 goto error;
395
396 esp->aead = aead;
397
398 err = crypto_aead_setkey(aead, x->aead->alg_key,
399 (x->aead->alg_key_len + 7) / 8);
400 if (err)
401 goto error;
402
403 err = crypto_aead_setauthsize(aead, x->aead->alg_icv_len / 8);
404 if (err)
405 goto error;
406
407error:
408 return err;
409}
410
411static int esp_init_authenc(struct xfrm_state *x)
315{ 412{
316 struct esp_data *esp = NULL; 413 struct esp_data *esp = x->data;
317 struct crypto_blkcipher *tfm; 414 struct crypto_aead *aead;
415 struct crypto_authenc_key_param *param;
416 struct rtattr *rta;
417 char *key;
418 char *p;
419 char authenc_name[CRYPTO_MAX_ALG_NAME];
420 unsigned int keylen;
421 int err;
318 422
423 err = -EINVAL;
319 if (x->ealg == NULL) 424 if (x->ealg == NULL)
320 goto error; 425 goto error;
321 426
322 if (x->encap) 427 err = -ENAMETOOLONG;
428 if (snprintf(authenc_name, CRYPTO_MAX_ALG_NAME, "authenc(%s,%s)",
429 x->aalg ? x->aalg->alg_name : "digest_null",
430 x->ealg->alg_name) >= CRYPTO_MAX_ALG_NAME)
323 goto error; 431 goto error;
324 432
325 esp = kzalloc(sizeof(*esp), GFP_KERNEL); 433 aead = crypto_alloc_aead(authenc_name, 0, 0);
326 if (esp == NULL) 434 err = PTR_ERR(aead);
327 return -ENOMEM; 435 if (IS_ERR(aead))
436 goto error;
437
438 esp->aead = aead;
439
440 keylen = (x->aalg ? (x->aalg->alg_key_len + 7) / 8 : 0) +
441 (x->ealg->alg_key_len + 7) / 8 + RTA_SPACE(sizeof(*param));
442 err = -ENOMEM;
443 key = kmalloc(keylen, GFP_KERNEL);
444 if (!key)
445 goto error;
446
447 p = key;
448 rta = (void *)p;
449 rta->rta_type = CRYPTO_AUTHENC_KEYA_PARAM;
450 rta->rta_len = RTA_LENGTH(sizeof(*param));
451 param = RTA_DATA(rta);
452 p += RTA_SPACE(sizeof(*param));
328 453
329 if (x->aalg) { 454 if (x->aalg) {
330 struct xfrm_algo_desc *aalg_desc; 455 struct xfrm_algo_desc *aalg_desc;
331 struct crypto_hash *hash;
332
333 hash = crypto_alloc_hash(x->aalg->alg_name, 0,
334 CRYPTO_ALG_ASYNC);
335 if (IS_ERR(hash))
336 goto error;
337 456
338 esp->auth.tfm = hash; 457 memcpy(p, x->aalg->alg_key, (x->aalg->alg_key_len + 7) / 8);
339 if (crypto_hash_setkey(hash, x->aalg->alg_key, 458 p += (x->aalg->alg_key_len + 7) / 8;
340 (x->aalg->alg_key_len + 7) / 8))
341 goto error;
342 459
343 aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0); 460 aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0);
344 BUG_ON(!aalg_desc); 461 BUG_ON(!aalg_desc);
345 462
463 err = -EINVAL;
346 if (aalg_desc->uinfo.auth.icv_fullbits/8 != 464 if (aalg_desc->uinfo.auth.icv_fullbits/8 !=
347 crypto_hash_digestsize(hash)) { 465 crypto_aead_authsize(aead)) {
348 NETDEBUG(KERN_INFO "ESP: %s digestsize %u != %hu\n", 466 NETDEBUG(KERN_INFO "ESP: %s digestsize %u != %hu\n",
349 x->aalg->alg_name, 467 x->aalg->alg_name,
350 crypto_hash_digestsize(hash), 468 crypto_aead_authsize(aead),
351 aalg_desc->uinfo.auth.icv_fullbits/8); 469 aalg_desc->uinfo.auth.icv_fullbits/8);
352 goto error; 470 goto free_key;
353 } 471 }
354 472
355 esp->auth.icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8; 473 err = crypto_aead_setauthsize(
356 esp->auth.icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8; 474 aead, aalg_desc->uinfo.auth.icv_truncbits / 8);
357 475 if (err)
358 esp->auth.work_icv = kmalloc(esp->auth.icv_full_len, GFP_KERNEL); 476 goto free_key;
359 if (!esp->auth.work_icv)
360 goto error;
361 }
362 tfm = crypto_alloc_blkcipher(x->ealg->alg_name, 0, CRYPTO_ALG_ASYNC);
363 if (IS_ERR(tfm))
364 goto error;
365 esp->conf.tfm = tfm;
366 esp->conf.ivlen = crypto_blkcipher_ivsize(tfm);
367 esp->conf.padlen = 0;
368 if (esp->conf.ivlen) {
369 esp->conf.ivec = kmalloc(esp->conf.ivlen, GFP_KERNEL);
370 if (unlikely(esp->conf.ivec == NULL))
371 goto error;
372 esp->conf.ivinitted = 0;
373 } 477 }
374 if (crypto_blkcipher_setkey(tfm, x->ealg->alg_key, 478
375 (x->ealg->alg_key_len + 7) / 8)) 479 param->enckeylen = cpu_to_be32((x->ealg->alg_key_len + 7) / 8);
480 memcpy(p, x->ealg->alg_key, (x->ealg->alg_key_len + 7) / 8);
481
482 err = crypto_aead_setkey(aead, key, keylen);
483
484free_key:
485 kfree(key);
486
487error:
488 return err;
489}
490
491static int esp6_init_state(struct xfrm_state *x)
492{
493 struct esp_data *esp;
494 struct crypto_aead *aead;
495 u32 align;
496 int err;
497
498 if (x->encap)
499 return -EINVAL;
500
501 esp = kzalloc(sizeof(*esp), GFP_KERNEL);
502 if (esp == NULL)
503 return -ENOMEM;
504
505 x->data = esp;
506
507 if (x->aead)
508 err = esp_init_aead(x);
509 else
510 err = esp_init_authenc(x);
511
512 if (err)
376 goto error; 513 goto error;
377 x->props.header_len = sizeof(struct ip_esp_hdr) + esp->conf.ivlen; 514
515 aead = esp->aead;
516
517 esp->padlen = 0;
518
519 x->props.header_len = sizeof(struct ip_esp_hdr) +
520 crypto_aead_ivsize(aead);
378 switch (x->props.mode) { 521 switch (x->props.mode) {
379 case XFRM_MODE_BEET: 522 case XFRM_MODE_BEET:
380 case XFRM_MODE_TRANSPORT: 523 case XFRM_MODE_TRANSPORT:
@@ -385,17 +528,17 @@ static int esp6_init_state(struct xfrm_state *x)
385 default: 528 default:
386 goto error; 529 goto error;
387 } 530 }
388 x->data = esp; 531
389 return 0; 532 align = ALIGN(crypto_aead_blocksize(aead), 4);
533 if (esp->padlen)
534 align = max_t(u32, align, esp->padlen);
535 x->props.trailer_len = align + 1 + crypto_aead_authsize(esp->aead);
390 536
391error: 537error:
392 x->data = esp; 538 return err;
393 esp6_destroy(x);
394 x->data = NULL;
395 return -EINVAL;
396} 539}
397 540
398static struct xfrm_type esp6_type = 541static const struct xfrm_type esp6_type =
399{ 542{
400 .description = "ESP6", 543 .description = "ESP6",
401 .owner = THIS_MODULE, 544 .owner = THIS_MODULE,
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index a66a7d8e2811..d325a9958909 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -54,7 +54,8 @@ EXPORT_SYMBOL(__inet6_hash);
54 * 54 *
55 * The sockhash lock must be held as a reader here. 55 * The sockhash lock must be held as a reader here.
56 */ 56 */
57struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, 57struct sock *__inet6_lookup_established(struct net *net,
58 struct inet_hashinfo *hashinfo,
58 const struct in6_addr *saddr, 59 const struct in6_addr *saddr,
59 const __be16 sport, 60 const __be16 sport,
60 const struct in6_addr *daddr, 61 const struct in6_addr *daddr,
@@ -75,22 +76,13 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo,
75 read_lock(lock); 76 read_lock(lock);
76 sk_for_each(sk, node, &head->chain) { 77 sk_for_each(sk, node, &head->chain) {
77 /* For IPV6 do the cheaper port and family tests first. */ 78 /* For IPV6 do the cheaper port and family tests first. */
78 if (INET6_MATCH(sk, hash, saddr, daddr, ports, dif)) 79 if (INET6_MATCH(sk, net, hash, saddr, daddr, ports, dif))
79 goto hit; /* You sunk my battleship! */ 80 goto hit; /* You sunk my battleship! */
80 } 81 }
81 /* Must check for a TIME_WAIT'er before going to listener hash. */ 82 /* Must check for a TIME_WAIT'er before going to listener hash. */
82 sk_for_each(sk, node, &head->twchain) { 83 sk_for_each(sk, node, &head->twchain) {
83 const struct inet_timewait_sock *tw = inet_twsk(sk); 84 if (INET6_TW_MATCH(sk, net, hash, saddr, daddr, ports, dif))
84 85 goto hit;
85 if(*((__portpair *)&(tw->tw_dport)) == ports &&
86 sk->sk_family == PF_INET6) {
87 const struct inet6_timewait_sock *tw6 = inet6_twsk(sk);
88
89 if (ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) &&
90 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
91 (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif))
92 goto hit;
93 }
94 } 86 }
95 read_unlock(lock); 87 read_unlock(lock);
96 return NULL; 88 return NULL;
@@ -102,9 +94,9 @@ hit:
102} 94}
103EXPORT_SYMBOL(__inet6_lookup_established); 95EXPORT_SYMBOL(__inet6_lookup_established);
104 96
105struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo, 97struct sock *inet6_lookup_listener(struct net *net,
106 const struct in6_addr *daddr, 98 struct inet_hashinfo *hashinfo, const struct in6_addr *daddr,
107 const unsigned short hnum, const int dif) 99 const unsigned short hnum, const int dif)
108{ 100{
109 struct sock *sk; 101 struct sock *sk;
110 const struct hlist_node *node; 102 const struct hlist_node *node;
@@ -113,7 +105,8 @@ struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo,
113 105
114 read_lock(&hashinfo->lhash_lock); 106 read_lock(&hashinfo->lhash_lock);
115 sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) { 107 sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) {
116 if (inet_sk(sk)->num == hnum && sk->sk_family == PF_INET6) { 108 if (sk->sk_net == net && inet_sk(sk)->num == hnum &&
109 sk->sk_family == PF_INET6) {
117 const struct ipv6_pinfo *np = inet6_sk(sk); 110 const struct ipv6_pinfo *np = inet6_sk(sk);
118 111
119 score = 1; 112 score = 1;
@@ -145,7 +138,7 @@ struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo,
145 138
146EXPORT_SYMBOL_GPL(inet6_lookup_listener); 139EXPORT_SYMBOL_GPL(inet6_lookup_listener);
147 140
148struct sock *inet6_lookup(struct inet_hashinfo *hashinfo, 141struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
149 const struct in6_addr *saddr, const __be16 sport, 142 const struct in6_addr *saddr, const __be16 sport,
150 const struct in6_addr *daddr, const __be16 dport, 143 const struct in6_addr *daddr, const __be16 dport,
151 const int dif) 144 const int dif)
@@ -153,7 +146,7 @@ struct sock *inet6_lookup(struct inet_hashinfo *hashinfo,
153 struct sock *sk; 146 struct sock *sk;
154 147
155 local_bh_disable(); 148 local_bh_disable();
156 sk = __inet6_lookup(hashinfo, saddr, sport, daddr, ntohs(dport), dif); 149 sk = __inet6_lookup(net, hashinfo, saddr, sport, daddr, ntohs(dport), dif);
157 local_bh_enable(); 150 local_bh_enable();
158 151
159 return sk; 152 return sk;
@@ -179,21 +172,16 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
179 struct sock *sk2; 172 struct sock *sk2;
180 const struct hlist_node *node; 173 const struct hlist_node *node;
181 struct inet_timewait_sock *tw; 174 struct inet_timewait_sock *tw;
175 struct net *net = sk->sk_net;
182 176
183 prefetch(head->chain.first); 177 prefetch(head->chain.first);
184 write_lock(lock); 178 write_lock(lock);
185 179
186 /* Check TIME-WAIT sockets first. */ 180 /* Check TIME-WAIT sockets first. */
187 sk_for_each(sk2, node, &head->twchain) { 181 sk_for_each(sk2, node, &head->twchain) {
188 const struct inet6_timewait_sock *tw6 = inet6_twsk(sk2);
189
190 tw = inet_twsk(sk2); 182 tw = inet_twsk(sk2);
191 183
192 if(*((__portpair *)&(tw->tw_dport)) == ports && 184 if (INET6_TW_MATCH(sk2, net, hash, saddr, daddr, ports, dif)) {
193 sk2->sk_family == PF_INET6 &&
194 ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) &&
195 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
196 (!sk2->sk_bound_dev_if || sk2->sk_bound_dev_if == dif)) {
197 if (twsk_unique(sk, sk2, twp)) 185 if (twsk_unique(sk, sk2, twp))
198 goto unique; 186 goto unique;
199 else 187 else
@@ -204,7 +192,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
204 192
205 /* And established part... */ 193 /* And established part... */
206 sk_for_each(sk2, node, &head->chain) { 194 sk_for_each(sk2, node, &head->chain) {
207 if (INET6_MATCH(sk2, hash, saddr, daddr, ports, dif)) 195 if (INET6_MATCH(sk2, net, hash, saddr, daddr, ports, dif))
208 goto not_unique; 196 goto not_unique;
209 } 197 }
210 198
@@ -248,97 +236,8 @@ static inline u32 inet6_sk_port_offset(const struct sock *sk)
248int inet6_hash_connect(struct inet_timewait_death_row *death_row, 236int inet6_hash_connect(struct inet_timewait_death_row *death_row,
249 struct sock *sk) 237 struct sock *sk)
250{ 238{
251 struct inet_hashinfo *hinfo = death_row->hashinfo; 239 return __inet_hash_connect(death_row, sk,
252 const unsigned short snum = inet_sk(sk)->num; 240 __inet6_check_established, __inet6_hash);
253 struct inet_bind_hashbucket *head;
254 struct inet_bind_bucket *tb;
255 int ret;
256
257 if (snum == 0) {
258 int i, port, low, high, remaining;
259 static u32 hint;
260 const u32 offset = hint + inet6_sk_port_offset(sk);
261 struct hlist_node *node;
262 struct inet_timewait_sock *tw = NULL;
263
264 inet_get_local_port_range(&low, &high);
265 remaining = (high - low) + 1;
266
267 local_bh_disable();
268 for (i = 1; i <= remaining; i++) {
269 port = low + (i + offset) % remaining;
270 head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)];
271 spin_lock(&head->lock);
272
273 /* Does not bother with rcv_saddr checks,
274 * because the established check is already
275 * unique enough.
276 */
277 inet_bind_bucket_for_each(tb, node, &head->chain) {
278 if (tb->port == port) {
279 BUG_TRAP(!hlist_empty(&tb->owners));
280 if (tb->fastreuse >= 0)
281 goto next_port;
282 if (!__inet6_check_established(death_row,
283 sk, port,
284 &tw))
285 goto ok;
286 goto next_port;
287 }
288 }
289
290 tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep,
291 head, port);
292 if (!tb) {
293 spin_unlock(&head->lock);
294 break;
295 }
296 tb->fastreuse = -1;
297 goto ok;
298
299 next_port:
300 spin_unlock(&head->lock);
301 }
302 local_bh_enable();
303
304 return -EADDRNOTAVAIL;
305
306ok:
307 hint += i;
308
309 /* Head lock still held and bh's disabled */
310 inet_bind_hash(sk, tb, port);
311 if (sk_unhashed(sk)) {
312 inet_sk(sk)->sport = htons(port);
313 __inet6_hash(hinfo, sk);
314 }
315 spin_unlock(&head->lock);
316
317 if (tw) {
318 inet_twsk_deschedule(tw, death_row);
319 inet_twsk_put(tw);
320 }
321
322 ret = 0;
323 goto out;
324 }
325
326 head = &hinfo->bhash[inet_bhashfn(snum, hinfo->bhash_size)];
327 tb = inet_csk(sk)->icsk_bind_hash;
328 spin_lock_bh(&head->lock);
329
330 if (sk_head(&tb->owners) == sk && sk->sk_bind_node.next == NULL) {
331 __inet6_hash(hinfo, sk);
332 spin_unlock_bh(&head->lock);
333 return 0;
334 } else {
335 spin_unlock(&head->lock);
336 /* No definite answer... Walk to established hash table */
337 ret = __inet6_check_established(death_row, sk, snum, NULL);
338out:
339 local_bh_enable();
340 return ret;
341 }
342} 241}
343 242
344EXPORT_SYMBOL_GPL(inet6_hash_connect); 243EXPORT_SYMBOL_GPL(inet6_hash_connect);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 15c4f6cee3e6..9ac6ca2521c3 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -257,6 +257,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
257 ipv6_addr_copy(&hdr->daddr, first_hop); 257 ipv6_addr_copy(&hdr->daddr, first_hop);
258 258
259 skb->priority = sk->sk_priority; 259 skb->priority = sk->sk_priority;
260 skb->mark = sk->sk_mark;
260 261
261 mtu = dst_mtu(dst); 262 mtu = dst_mtu(dst);
262 if ((skb->len <= mtu) || ipfragok || skb_is_gso(skb)) { 263 if ((skb->len <= mtu) || ipfragok || skb_is_gso(skb)) {
@@ -636,6 +637,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
636 637
637 if (skb_shinfo(skb)->frag_list) { 638 if (skb_shinfo(skb)->frag_list) {
638 int first_len = skb_pagelen(skb); 639 int first_len = skb_pagelen(skb);
640 int truesizes = 0;
639 641
640 if (first_len - hlen > mtu || 642 if (first_len - hlen > mtu ||
641 ((first_len - hlen) & 7) || 643 ((first_len - hlen) & 7) ||
@@ -658,7 +660,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
658 sock_hold(skb->sk); 660 sock_hold(skb->sk);
659 frag->sk = skb->sk; 661 frag->sk = skb->sk;
660 frag->destructor = sock_wfree; 662 frag->destructor = sock_wfree;
661 skb->truesize -= frag->truesize; 663 truesizes += frag->truesize;
662 } 664 }
663 } 665 }
664 666
@@ -689,6 +691,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
689 691
690 first_len = skb_pagelen(skb); 692 first_len = skb_pagelen(skb);
691 skb->data_len = first_len - skb_headlen(skb); 693 skb->data_len = first_len - skb_headlen(skb);
694 skb->truesize -= truesizes;
692 skb->len = first_len; 695 skb->len = first_len;
693 ipv6_hdr(skb)->payload_len = htons(first_len - 696 ipv6_hdr(skb)->payload_len = htons(first_len -
694 sizeof(struct ipv6hdr)); 697 sizeof(struct ipv6hdr));
@@ -1437,6 +1440,7 @@ int ip6_push_pending_frames(struct sock *sk)
1437 ipv6_addr_copy(&hdr->daddr, final_dst); 1440 ipv6_addr_copy(&hdr->daddr, final_dst);
1438 1441
1439 skb->priority = sk->sk_priority; 1442 skb->priority = sk->sk_priority;
1443 skb->mark = sk->sk_mark;
1440 1444
1441 skb->dst = dst_clone(&rt->u.dst); 1445 skb->dst = dst_clone(&rt->u.dst);
1442 IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); 1446 IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS);
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index b276d04d6db5..b90039593a7f 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -64,6 +64,7 @@ static LIST_HEAD(ipcomp6_tfms_list);
64 64
65static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb) 65static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb)
66{ 66{
67 int nexthdr;
67 int err = -ENOMEM; 68 int err = -ENOMEM;
68 struct ip_comp_hdr *ipch; 69 struct ip_comp_hdr *ipch;
69 int plen, dlen; 70 int plen, dlen;
@@ -79,6 +80,8 @@ static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb)
79 80
80 /* Remove ipcomp header and decompress original payload */ 81 /* Remove ipcomp header and decompress original payload */
81 ipch = (void *)skb->data; 82 ipch = (void *)skb->data;
83 nexthdr = ipch->nexthdr;
84
82 skb->transport_header = skb->network_header + sizeof(*ipch); 85 skb->transport_header = skb->network_header + sizeof(*ipch);
83 __skb_pull(skb, sizeof(*ipch)); 86 __skb_pull(skb, sizeof(*ipch));
84 87
@@ -108,7 +111,7 @@ static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb)
108 skb->truesize += dlen - plen; 111 skb->truesize += dlen - plen;
109 __skb_put(skb, dlen - plen); 112 __skb_put(skb, dlen - plen);
110 skb_copy_to_linear_data(skb, scratch, dlen); 113 skb_copy_to_linear_data(skb, scratch, dlen);
111 err = ipch->nexthdr; 114 err = nexthdr;
112 115
113out_put_cpu: 116out_put_cpu:
114 put_cpu(); 117 put_cpu();
@@ -450,7 +453,7 @@ error:
450 goto out; 453 goto out;
451} 454}
452 455
453static struct xfrm_type ipcomp6_type = 456static const struct xfrm_type ipcomp6_type =
454{ 457{
455 .description = "IPCOMP6", 458 .description = "IPCOMP6",
456 .owner = THIS_MODULE, 459 .owner = THIS_MODULE,
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index 49d396620eac..cd8a5bda13cd 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -330,7 +330,7 @@ static void mip6_destopt_destroy(struct xfrm_state *x)
330{ 330{
331} 331}
332 332
333static struct xfrm_type mip6_destopt_type = 333static const struct xfrm_type mip6_destopt_type =
334{ 334{
335 .description = "MIP6DESTOPT", 335 .description = "MIP6DESTOPT",
336 .owner = THIS_MODULE, 336 .owner = THIS_MODULE,
@@ -462,7 +462,7 @@ static void mip6_rthdr_destroy(struct xfrm_state *x)
462{ 462{
463} 463}
464 464
465static struct xfrm_type mip6_rthdr_type = 465static const struct xfrm_type mip6_rthdr_type =
466{ 466{
467 .description = "MIP6RT", 467 .description = "MIP6RT",
468 .owner = THIS_MODULE, 468 .owner = THIS_MODULE,
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 56b4ea6d29ed..e869916b05f1 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -515,6 +515,7 @@ static struct notifier_block ipq_nl_notifier = {
515 .notifier_call = ipq_rcv_nl_event, 515 .notifier_call = ipq_rcv_nl_event,
516}; 516};
517 517
518#ifdef CONFIG_SYSCTL
518static struct ctl_table_header *ipq_sysctl_header; 519static struct ctl_table_header *ipq_sysctl_header;
519 520
520static ctl_table ipq_table[] = { 521static ctl_table ipq_table[] = {
@@ -528,7 +529,9 @@ static ctl_table ipq_table[] = {
528 }, 529 },
529 { .ctl_name = 0 } 530 { .ctl_name = 0 }
530}; 531};
532#endif
531 533
534#ifdef CONFIG_PROC_FS
532static int ip6_queue_show(struct seq_file *m, void *v) 535static int ip6_queue_show(struct seq_file *m, void *v)
533{ 536{
534 read_lock_bh(&queue_lock); 537 read_lock_bh(&queue_lock);
@@ -565,6 +568,7 @@ static const struct file_operations ip6_queue_proc_fops = {
565 .release = single_release, 568 .release = single_release,
566 .owner = THIS_MODULE, 569 .owner = THIS_MODULE,
567}; 570};
571#endif
568 572
569static const struct nf_queue_handler nfqh = { 573static const struct nf_queue_handler nfqh = {
570 .name = "ip6_queue", 574 .name = "ip6_queue",
@@ -574,7 +578,7 @@ static const struct nf_queue_handler nfqh = {
574static int __init ip6_queue_init(void) 578static int __init ip6_queue_init(void)
575{ 579{
576 int status = -ENOMEM; 580 int status = -ENOMEM;
577 struct proc_dir_entry *proc; 581 struct proc_dir_entry *proc __maybe_unused;
578 582
579 netlink_register_notifier(&ipq_nl_notifier); 583 netlink_register_notifier(&ipq_nl_notifier);
580 ipqnl = netlink_kernel_create(&init_net, NETLINK_IP6_FW, 0, 584 ipqnl = netlink_kernel_create(&init_net, NETLINK_IP6_FW, 0,
@@ -584,6 +588,7 @@ static int __init ip6_queue_init(void)
584 goto cleanup_netlink_notifier; 588 goto cleanup_netlink_notifier;
585 } 589 }
586 590
591#ifdef CONFIG_PROC_FS
587 proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); 592 proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net);
588 if (proc) { 593 if (proc) {
589 proc->owner = THIS_MODULE; 594 proc->owner = THIS_MODULE;
@@ -592,10 +597,11 @@ static int __init ip6_queue_init(void)
592 printk(KERN_ERR "ip6_queue: failed to create proc entry\n"); 597 printk(KERN_ERR "ip6_queue: failed to create proc entry\n");
593 goto cleanup_ipqnl; 598 goto cleanup_ipqnl;
594 } 599 }
595 600#endif
596 register_netdevice_notifier(&ipq_dev_notifier); 601 register_netdevice_notifier(&ipq_dev_notifier);
602#ifdef CONFIG_SYSCTL
597 ipq_sysctl_header = register_sysctl_paths(net_ipv6_ctl_path, ipq_table); 603 ipq_sysctl_header = register_sysctl_paths(net_ipv6_ctl_path, ipq_table);
598 604#endif
599 status = nf_register_queue_handler(PF_INET6, &nfqh); 605 status = nf_register_queue_handler(PF_INET6, &nfqh);
600 if (status < 0) { 606 if (status < 0) {
601 printk(KERN_ERR "ip6_queue: failed to register queue handler\n"); 607 printk(KERN_ERR "ip6_queue: failed to register queue handler\n");
@@ -604,11 +610,13 @@ static int __init ip6_queue_init(void)
604 return status; 610 return status;
605 611
606cleanup_sysctl: 612cleanup_sysctl:
613#ifdef CONFIG_SYSCTL
607 unregister_sysctl_table(ipq_sysctl_header); 614 unregister_sysctl_table(ipq_sysctl_header);
615#endif
608 unregister_netdevice_notifier(&ipq_dev_notifier); 616 unregister_netdevice_notifier(&ipq_dev_notifier);
609 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 617 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
610 618
611cleanup_ipqnl: 619cleanup_ipqnl: __maybe_unused
612 netlink_kernel_release(ipqnl); 620 netlink_kernel_release(ipqnl);
613 mutex_lock(&ipqnl_mutex); 621 mutex_lock(&ipqnl_mutex);
614 mutex_unlock(&ipqnl_mutex); 622 mutex_unlock(&ipqnl_mutex);
@@ -624,7 +632,9 @@ static void __exit ip6_queue_fini(void)
624 synchronize_net(); 632 synchronize_net();
625 ipq_flush(NULL, 0); 633 ipq_flush(NULL, 0);
626 634
635#ifdef CONFIG_SYSCTL
627 unregister_sysctl_table(ipq_sysctl_header); 636 unregister_sysctl_table(ipq_sysctl_header);
637#endif
628 unregister_netdevice_notifier(&ipq_dev_notifier); 638 unregister_netdevice_notifier(&ipq_dev_notifier);
629 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 639 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
630 640
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index dd7860fea61f..bf9bb6e55bb5 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -320,7 +320,7 @@ static void trace_packet(struct sk_buff *skb,
320 unsigned int hook, 320 unsigned int hook,
321 const struct net_device *in, 321 const struct net_device *in,
322 const struct net_device *out, 322 const struct net_device *out,
323 char *tablename, 323 const char *tablename,
324 struct xt_table_info *private, 324 struct xt_table_info *private,
325 struct ip6t_entry *e) 325 struct ip6t_entry *e)
326{ 326{
@@ -1118,7 +1118,7 @@ static int compat_table_info(const struct xt_table_info *info,
1118} 1118}
1119#endif 1119#endif
1120 1120
1121static int get_info(void __user *user, int *len, int compat) 1121static int get_info(struct net *net, void __user *user, int *len, int compat)
1122{ 1122{
1123 char name[IP6T_TABLE_MAXNAMELEN]; 1123 char name[IP6T_TABLE_MAXNAMELEN];
1124 struct xt_table *t; 1124 struct xt_table *t;
@@ -1138,7 +1138,7 @@ static int get_info(void __user *user, int *len, int compat)
1138 if (compat) 1138 if (compat)
1139 xt_compat_lock(AF_INET6); 1139 xt_compat_lock(AF_INET6);
1140#endif 1140#endif
1141 t = try_then_request_module(xt_find_table_lock(AF_INET6, name), 1141 t = try_then_request_module(xt_find_table_lock(net, AF_INET6, name),
1142 "ip6table_%s", name); 1142 "ip6table_%s", name);
1143 if (t && !IS_ERR(t)) { 1143 if (t && !IS_ERR(t)) {
1144 struct ip6t_getinfo info; 1144 struct ip6t_getinfo info;
@@ -1178,7 +1178,7 @@ static int get_info(void __user *user, int *len, int compat)
1178} 1178}
1179 1179
1180static int 1180static int
1181get_entries(struct ip6t_get_entries __user *uptr, int *len) 1181get_entries(struct net *net, struct ip6t_get_entries __user *uptr, int *len)
1182{ 1182{
1183 int ret; 1183 int ret;
1184 struct ip6t_get_entries get; 1184 struct ip6t_get_entries get;
@@ -1196,7 +1196,7 @@ get_entries(struct ip6t_get_entries __user *uptr, int *len)
1196 return -EINVAL; 1196 return -EINVAL;
1197 } 1197 }
1198 1198
1199 t = xt_find_table_lock(AF_INET6, get.name); 1199 t = xt_find_table_lock(net, AF_INET6, get.name);
1200 if (t && !IS_ERR(t)) { 1200 if (t && !IS_ERR(t)) {
1201 struct xt_table_info *private = t->private; 1201 struct xt_table_info *private = t->private;
1202 duprintf("t->private->number = %u\n", private->number); 1202 duprintf("t->private->number = %u\n", private->number);
@@ -1217,7 +1217,7 @@ get_entries(struct ip6t_get_entries __user *uptr, int *len)
1217} 1217}
1218 1218
1219static int 1219static int
1220__do_replace(const char *name, unsigned int valid_hooks, 1220__do_replace(struct net *net, const char *name, unsigned int valid_hooks,
1221 struct xt_table_info *newinfo, unsigned int num_counters, 1221 struct xt_table_info *newinfo, unsigned int num_counters,
1222 void __user *counters_ptr) 1222 void __user *counters_ptr)
1223{ 1223{
@@ -1235,7 +1235,7 @@ __do_replace(const char *name, unsigned int valid_hooks,
1235 goto out; 1235 goto out;
1236 } 1236 }
1237 1237
1238 t = try_then_request_module(xt_find_table_lock(AF_INET6, name), 1238 t = try_then_request_module(xt_find_table_lock(net, AF_INET6, name),
1239 "ip6table_%s", name); 1239 "ip6table_%s", name);
1240 if (!t || IS_ERR(t)) { 1240 if (!t || IS_ERR(t)) {
1241 ret = t ? PTR_ERR(t) : -ENOENT; 1241 ret = t ? PTR_ERR(t) : -ENOENT;
@@ -1288,7 +1288,7 @@ __do_replace(const char *name, unsigned int valid_hooks,
1288} 1288}
1289 1289
1290static int 1290static int
1291do_replace(void __user *user, unsigned int len) 1291do_replace(struct net *net, void __user *user, unsigned int len)
1292{ 1292{
1293 int ret; 1293 int ret;
1294 struct ip6t_replace tmp; 1294 struct ip6t_replace tmp;
@@ -1322,7 +1322,7 @@ do_replace(void __user *user, unsigned int len)
1322 1322
1323 duprintf("ip_tables: Translated table\n"); 1323 duprintf("ip_tables: Translated table\n");
1324 1324
1325 ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, 1325 ret = __do_replace(net, tmp.name, tmp.valid_hooks, newinfo,
1326 tmp.num_counters, tmp.counters); 1326 tmp.num_counters, tmp.counters);
1327 if (ret) 1327 if (ret)
1328 goto free_newinfo_untrans; 1328 goto free_newinfo_untrans;
@@ -1358,7 +1358,8 @@ add_counter_to_entry(struct ip6t_entry *e,
1358} 1358}
1359 1359
1360static int 1360static int
1361do_add_counters(void __user *user, unsigned int len, int compat) 1361do_add_counters(struct net *net, void __user *user, unsigned int len,
1362 int compat)
1362{ 1363{
1363 unsigned int i; 1364 unsigned int i;
1364 struct xt_counters_info tmp; 1365 struct xt_counters_info tmp;
@@ -1410,7 +1411,7 @@ do_add_counters(void __user *user, unsigned int len, int compat)
1410 goto free; 1411 goto free;
1411 } 1412 }
1412 1413
1413 t = xt_find_table_lock(AF_INET6, name); 1414 t = xt_find_table_lock(net, AF_INET6, name);
1414 if (!t || IS_ERR(t)) { 1415 if (!t || IS_ERR(t)) {
1415 ret = t ? PTR_ERR(t) : -ENOENT; 1416 ret = t ? PTR_ERR(t) : -ENOENT;
1416 goto free; 1417 goto free;
@@ -1456,7 +1457,7 @@ struct compat_ip6t_replace {
1456 1457
1457static int 1458static int
1458compat_copy_entry_to_user(struct ip6t_entry *e, void __user **dstptr, 1459compat_copy_entry_to_user(struct ip6t_entry *e, void __user **dstptr,
1459 compat_uint_t *size, struct xt_counters *counters, 1460 unsigned int *size, struct xt_counters *counters,
1460 unsigned int *i) 1461 unsigned int *i)
1461{ 1462{
1462 struct ip6t_entry_target *t; 1463 struct ip6t_entry_target *t;
@@ -1503,7 +1504,7 @@ compat_find_calc_match(struct ip6t_entry_match *m,
1503 const char *name, 1504 const char *name,
1504 const struct ip6t_ip6 *ipv6, 1505 const struct ip6t_ip6 *ipv6,
1505 unsigned int hookmask, 1506 unsigned int hookmask,
1506 int *size, int *i) 1507 int *size, unsigned int *i)
1507{ 1508{
1508 struct xt_match *match; 1509 struct xt_match *match;
1509 1510
@@ -1561,7 +1562,8 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e,
1561 struct ip6t_entry_target *t; 1562 struct ip6t_entry_target *t;
1562 struct xt_target *target; 1563 struct xt_target *target;
1563 unsigned int entry_offset; 1564 unsigned int entry_offset;
1564 int ret, off, h, j; 1565 unsigned int j;
1566 int ret, off, h;
1565 1567
1566 duprintf("check_compat_entry_size_and_hooks %p\n", e); 1568 duprintf("check_compat_entry_size_and_hooks %p\n", e);
1567 if ((unsigned long)e % __alignof__(struct compat_ip6t_entry) != 0 1569 if ((unsigned long)e % __alignof__(struct compat_ip6t_entry) != 0
@@ -1673,7 +1675,8 @@ compat_copy_entry_from_user(struct compat_ip6t_entry *e, void **dstptr,
1673static int compat_check_entry(struct ip6t_entry *e, const char *name, 1675static int compat_check_entry(struct ip6t_entry *e, const char *name,
1674 unsigned int *i) 1676 unsigned int *i)
1675{ 1677{
1676 int j, ret; 1678 unsigned int j;
1679 int ret;
1677 1680
1678 j = 0; 1681 j = 0;
1679 ret = IP6T_MATCH_ITERATE(e, check_match, name, &e->ipv6, 1682 ret = IP6T_MATCH_ITERATE(e, check_match, name, &e->ipv6,
@@ -1815,7 +1818,7 @@ out_unlock:
1815} 1818}
1816 1819
1817static int 1820static int
1818compat_do_replace(void __user *user, unsigned int len) 1821compat_do_replace(struct net *net, void __user *user, unsigned int len)
1819{ 1822{
1820 int ret; 1823 int ret;
1821 struct compat_ip6t_replace tmp; 1824 struct compat_ip6t_replace tmp;
@@ -1852,7 +1855,7 @@ compat_do_replace(void __user *user, unsigned int len)
1852 1855
1853 duprintf("compat_do_replace: Translated table\n"); 1856 duprintf("compat_do_replace: Translated table\n");
1854 1857
1855 ret = __do_replace(tmp.name, tmp.valid_hooks, newinfo, 1858 ret = __do_replace(net, tmp.name, tmp.valid_hooks, newinfo,
1856 tmp.num_counters, compat_ptr(tmp.counters)); 1859 tmp.num_counters, compat_ptr(tmp.counters));
1857 if (ret) 1860 if (ret)
1858 goto free_newinfo_untrans; 1861 goto free_newinfo_untrans;
@@ -1876,11 +1879,11 @@ compat_do_ip6t_set_ctl(struct sock *sk, int cmd, void __user *user,
1876 1879
1877 switch (cmd) { 1880 switch (cmd) {
1878 case IP6T_SO_SET_REPLACE: 1881 case IP6T_SO_SET_REPLACE:
1879 ret = compat_do_replace(user, len); 1882 ret = compat_do_replace(sk->sk_net, user, len);
1880 break; 1883 break;
1881 1884
1882 case IP6T_SO_SET_ADD_COUNTERS: 1885 case IP6T_SO_SET_ADD_COUNTERS:
1883 ret = do_add_counters(user, len, 1); 1886 ret = do_add_counters(sk->sk_net, user, len, 1);
1884 break; 1887 break;
1885 1888
1886 default: 1889 default:
@@ -1929,7 +1932,8 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table,
1929} 1932}
1930 1933
1931static int 1934static int
1932compat_get_entries(struct compat_ip6t_get_entries __user *uptr, int *len) 1935compat_get_entries(struct net *net, struct compat_ip6t_get_entries __user *uptr,
1936 int *len)
1933{ 1937{
1934 int ret; 1938 int ret;
1935 struct compat_ip6t_get_entries get; 1939 struct compat_ip6t_get_entries get;
@@ -1950,7 +1954,7 @@ compat_get_entries(struct compat_ip6t_get_entries __user *uptr, int *len)
1950 } 1954 }
1951 1955
1952 xt_compat_lock(AF_INET6); 1956 xt_compat_lock(AF_INET6);
1953 t = xt_find_table_lock(AF_INET6, get.name); 1957 t = xt_find_table_lock(net, AF_INET6, get.name);
1954 if (t && !IS_ERR(t)) { 1958 if (t && !IS_ERR(t)) {
1955 struct xt_table_info *private = t->private; 1959 struct xt_table_info *private = t->private;
1956 struct xt_table_info info; 1960 struct xt_table_info info;
@@ -1986,10 +1990,10 @@ compat_do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
1986 1990
1987 switch (cmd) { 1991 switch (cmd) {
1988 case IP6T_SO_GET_INFO: 1992 case IP6T_SO_GET_INFO:
1989 ret = get_info(user, len, 1); 1993 ret = get_info(sk->sk_net, user, len, 1);
1990 break; 1994 break;
1991 case IP6T_SO_GET_ENTRIES: 1995 case IP6T_SO_GET_ENTRIES:
1992 ret = compat_get_entries(user, len); 1996 ret = compat_get_entries(sk->sk_net, user, len);
1993 break; 1997 break;
1994 default: 1998 default:
1995 ret = do_ip6t_get_ctl(sk, cmd, user, len); 1999 ret = do_ip6t_get_ctl(sk, cmd, user, len);
@@ -2008,11 +2012,11 @@ do_ip6t_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
2008 2012
2009 switch (cmd) { 2013 switch (cmd) {
2010 case IP6T_SO_SET_REPLACE: 2014 case IP6T_SO_SET_REPLACE:
2011 ret = do_replace(user, len); 2015 ret = do_replace(sk->sk_net, user, len);
2012 break; 2016 break;
2013 2017
2014 case IP6T_SO_SET_ADD_COUNTERS: 2018 case IP6T_SO_SET_ADD_COUNTERS:
2015 ret = do_add_counters(user, len, 0); 2019 ret = do_add_counters(sk->sk_net, user, len, 0);
2016 break; 2020 break;
2017 2021
2018 default: 2022 default:
@@ -2033,11 +2037,11 @@ do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
2033 2037
2034 switch (cmd) { 2038 switch (cmd) {
2035 case IP6T_SO_GET_INFO: 2039 case IP6T_SO_GET_INFO:
2036 ret = get_info(user, len, 0); 2040 ret = get_info(sk->sk_net, user, len, 0);
2037 break; 2041 break;
2038 2042
2039 case IP6T_SO_GET_ENTRIES: 2043 case IP6T_SO_GET_ENTRIES:
2040 ret = get_entries(user, len); 2044 ret = get_entries(sk->sk_net, user, len);
2041 break; 2045 break;
2042 2046
2043 case IP6T_SO_GET_REVISION_MATCH: 2047 case IP6T_SO_GET_REVISION_MATCH:
@@ -2074,17 +2078,21 @@ do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
2074 return ret; 2078 return ret;
2075} 2079}
2076 2080
2077int ip6t_register_table(struct xt_table *table, const struct ip6t_replace *repl) 2081struct xt_table *ip6t_register_table(struct net *net, struct xt_table *table,
2082 const struct ip6t_replace *repl)
2078{ 2083{
2079 int ret; 2084 int ret;
2080 struct xt_table_info *newinfo; 2085 struct xt_table_info *newinfo;
2081 struct xt_table_info bootstrap 2086 struct xt_table_info bootstrap
2082 = { 0, 0, 0, { 0 }, { 0 }, { } }; 2087 = { 0, 0, 0, { 0 }, { 0 }, { } };
2083 void *loc_cpu_entry; 2088 void *loc_cpu_entry;
2089 struct xt_table *new_table;
2084 2090
2085 newinfo = xt_alloc_table_info(repl->size); 2091 newinfo = xt_alloc_table_info(repl->size);
2086 if (!newinfo) 2092 if (!newinfo) {
2087 return -ENOMEM; 2093 ret = -ENOMEM;
2094 goto out;
2095 }
2088 2096
2089 /* choose the copy on our node/cpu, but dont care about preemption */ 2097 /* choose the copy on our node/cpu, but dont care about preemption */
2090 loc_cpu_entry = newinfo->entries[raw_smp_processor_id()]; 2098 loc_cpu_entry = newinfo->entries[raw_smp_processor_id()];
@@ -2095,30 +2103,35 @@ int ip6t_register_table(struct xt_table *table, const struct ip6t_replace *repl)
2095 repl->num_entries, 2103 repl->num_entries,
2096 repl->hook_entry, 2104 repl->hook_entry,
2097 repl->underflow); 2105 repl->underflow);
2098 if (ret != 0) { 2106 if (ret != 0)
2099 xt_free_table_info(newinfo); 2107 goto out_free;
2100 return ret;
2101 }
2102 2108
2103 ret = xt_register_table(table, &bootstrap, newinfo); 2109 new_table = xt_register_table(net, table, &bootstrap, newinfo);
2104 if (ret != 0) { 2110 if (IS_ERR(new_table)) {
2105 xt_free_table_info(newinfo); 2111 ret = PTR_ERR(new_table);
2106 return ret; 2112 goto out_free;
2107 } 2113 }
2114 return new_table;
2108 2115
2109 return 0; 2116out_free:
2117 xt_free_table_info(newinfo);
2118out:
2119 return ERR_PTR(ret);
2110} 2120}
2111 2121
2112void ip6t_unregister_table(struct xt_table *table) 2122void ip6t_unregister_table(struct xt_table *table)
2113{ 2123{
2114 struct xt_table_info *private; 2124 struct xt_table_info *private;
2115 void *loc_cpu_entry; 2125 void *loc_cpu_entry;
2126 struct module *table_owner = table->me;
2116 2127
2117 private = xt_unregister_table(table); 2128 private = xt_unregister_table(table);
2118 2129
2119 /* Decrease module usage counts and free resources */ 2130 /* Decrease module usage counts and free resources */
2120 loc_cpu_entry = private->entries[raw_smp_processor_id()]; 2131 loc_cpu_entry = private->entries[raw_smp_processor_id()];
2121 IP6T_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL); 2132 IP6T_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL);
2133 if (private->number > private->initial_entries)
2134 module_put(table_owner);
2122 xt_free_table_info(private); 2135 xt_free_table_info(private);
2123} 2136}
2124 2137
@@ -2225,11 +2238,26 @@ static struct xt_match icmp6_matchstruct __read_mostly = {
2225 .family = AF_INET6, 2238 .family = AF_INET6,
2226}; 2239};
2227 2240
2241static int __net_init ip6_tables_net_init(struct net *net)
2242{
2243 return xt_proto_init(net, AF_INET6);
2244}
2245
2246static void __net_exit ip6_tables_net_exit(struct net *net)
2247{
2248 xt_proto_fini(net, AF_INET6);
2249}
2250
2251static struct pernet_operations ip6_tables_net_ops = {
2252 .init = ip6_tables_net_init,
2253 .exit = ip6_tables_net_exit,
2254};
2255
2228static int __init ip6_tables_init(void) 2256static int __init ip6_tables_init(void)
2229{ 2257{
2230 int ret; 2258 int ret;
2231 2259
2232 ret = xt_proto_init(AF_INET6); 2260 ret = register_pernet_subsys(&ip6_tables_net_ops);
2233 if (ret < 0) 2261 if (ret < 0)
2234 goto err1; 2262 goto err1;
2235 2263
@@ -2259,7 +2287,7 @@ err4:
2259err3: 2287err3:
2260 xt_unregister_target(&ip6t_standard_target); 2288 xt_unregister_target(&ip6t_standard_target);
2261err2: 2289err2:
2262 xt_proto_fini(AF_INET6); 2290 unregister_pernet_subsys(&ip6_tables_net_ops);
2263err1: 2291err1:
2264 return ret; 2292 return ret;
2265} 2293}
@@ -2271,7 +2299,8 @@ static void __exit ip6_tables_fini(void)
2271 xt_unregister_match(&icmp6_matchstruct); 2299 xt_unregister_match(&icmp6_matchstruct);
2272 xt_unregister_target(&ip6t_error_target); 2300 xt_unregister_target(&ip6t_error_target);
2273 xt_unregister_target(&ip6t_standard_target); 2301 xt_unregister_target(&ip6t_standard_target);
2274 xt_proto_fini(AF_INET6); 2302
2303 unregister_pernet_subsys(&ip6_tables_net_ops);
2275} 2304}
2276 2305
2277/* 2306/*
diff --git a/net/ipv6/netfilter/ip6table_filter.c b/net/ipv6/netfilter/ip6table_filter.c
index 87d38d08aad0..2d9cd095a72c 100644
--- a/net/ipv6/netfilter/ip6table_filter.c
+++ b/net/ipv6/netfilter/ip6table_filter.c
@@ -26,7 +26,7 @@ static struct
26 struct ip6t_replace repl; 26 struct ip6t_replace repl;
27 struct ip6t_standard entries[3]; 27 struct ip6t_standard entries[3];
28 struct ip6t_error term; 28 struct ip6t_error term;
29} initial_table __initdata = { 29} initial_table __net_initdata = {
30 .repl = { 30 .repl = {
31 .name = "filter", 31 .name = "filter",
32 .valid_hooks = FILTER_VALID_HOOKS, 32 .valid_hooks = FILTER_VALID_HOOKS,
@@ -67,7 +67,7 @@ ip6t_hook(unsigned int hook,
67 const struct net_device *out, 67 const struct net_device *out,
68 int (*okfn)(struct sk_buff *)) 68 int (*okfn)(struct sk_buff *))
69{ 69{
70 return ip6t_do_table(skb, hook, in, out, &packet_filter); 70 return ip6t_do_table(skb, hook, in, out, init_net.ipv6.ip6table_filter);
71} 71}
72 72
73static unsigned int 73static unsigned int
@@ -87,7 +87,7 @@ ip6t_local_out_hook(unsigned int hook,
87 } 87 }
88#endif 88#endif
89 89
90 return ip6t_do_table(skb, hook, in, out, &packet_filter); 90 return ip6t_do_table(skb, hook, in, out, init_net.ipv6.ip6table_filter);
91} 91}
92 92
93static struct nf_hook_ops ip6t_ops[] __read_mostly = { 93static struct nf_hook_ops ip6t_ops[] __read_mostly = {
@@ -118,6 +118,26 @@ static struct nf_hook_ops ip6t_ops[] __read_mostly = {
118static int forward = NF_ACCEPT; 118static int forward = NF_ACCEPT;
119module_param(forward, bool, 0000); 119module_param(forward, bool, 0000);
120 120
121static int __net_init ip6table_filter_net_init(struct net *net)
122{
123 /* Register table */
124 net->ipv6.ip6table_filter =
125 ip6t_register_table(net, &packet_filter, &initial_table.repl);
126 if (IS_ERR(net->ipv6.ip6table_filter))
127 return PTR_ERR(net->ipv6.ip6table_filter);
128 return 0;
129}
130
131static void __net_exit ip6table_filter_net_exit(struct net *net)
132{
133 ip6t_unregister_table(net->ipv6.ip6table_filter);
134}
135
136static struct pernet_operations ip6table_filter_net_ops = {
137 .init = ip6table_filter_net_init,
138 .exit = ip6table_filter_net_exit,
139};
140
121static int __init ip6table_filter_init(void) 141static int __init ip6table_filter_init(void)
122{ 142{
123 int ret; 143 int ret;
@@ -130,8 +150,7 @@ static int __init ip6table_filter_init(void)
130 /* Entry 1 is the FORWARD hook */ 150 /* Entry 1 is the FORWARD hook */
131 initial_table.entries[1].target.verdict = -forward - 1; 151 initial_table.entries[1].target.verdict = -forward - 1;
132 152
133 /* Register table */ 153 ret = register_pernet_subsys(&ip6table_filter_net_ops);
134 ret = ip6t_register_table(&packet_filter, &initial_table.repl);
135 if (ret < 0) 154 if (ret < 0)
136 return ret; 155 return ret;
137 156
@@ -143,14 +162,14 @@ static int __init ip6table_filter_init(void)
143 return ret; 162 return ret;
144 163
145 cleanup_table: 164 cleanup_table:
146 ip6t_unregister_table(&packet_filter); 165 unregister_pernet_subsys(&ip6table_filter_net_ops);
147 return ret; 166 return ret;
148} 167}
149 168
150static void __exit ip6table_filter_fini(void) 169static void __exit ip6table_filter_fini(void)
151{ 170{
152 nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops)); 171 nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
153 ip6t_unregister_table(&packet_filter); 172 unregister_pernet_subsys(&ip6table_filter_net_ops);
154} 173}
155 174
156module_init(ip6table_filter_init); 175module_init(ip6table_filter_init);
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c
index d6082600bc5d..035343a90ffe 100644
--- a/net/ipv6/netfilter/ip6table_mangle.c
+++ b/net/ipv6/netfilter/ip6table_mangle.c
@@ -26,7 +26,7 @@ static struct
26 struct ip6t_replace repl; 26 struct ip6t_replace repl;
27 struct ip6t_standard entries[5]; 27 struct ip6t_standard entries[5];
28 struct ip6t_error term; 28 struct ip6t_error term;
29} initial_table __initdata = { 29} initial_table __net_initdata = {
30 .repl = { 30 .repl = {
31 .name = "mangle", 31 .name = "mangle",
32 .valid_hooks = MANGLE_VALID_HOOKS, 32 .valid_hooks = MANGLE_VALID_HOOKS,
@@ -73,7 +73,7 @@ ip6t_route_hook(unsigned int hook,
73 const struct net_device *out, 73 const struct net_device *out,
74 int (*okfn)(struct sk_buff *)) 74 int (*okfn)(struct sk_buff *))
75{ 75{
76 return ip6t_do_table(skb, hook, in, out, &packet_mangler); 76 return ip6t_do_table(skb, hook, in, out, init_net.ipv6.ip6table_mangle);
77} 77}
78 78
79static unsigned int 79static unsigned int
@@ -108,7 +108,7 @@ ip6t_local_hook(unsigned int hook,
108 /* flowlabel and prio (includes version, which shouldn't change either */ 108 /* flowlabel and prio (includes version, which shouldn't change either */
109 flowlabel = *((u_int32_t *)ipv6_hdr(skb)); 109 flowlabel = *((u_int32_t *)ipv6_hdr(skb));
110 110
111 ret = ip6t_do_table(skb, hook, in, out, &packet_mangler); 111 ret = ip6t_do_table(skb, hook, in, out, init_net.ipv6.ip6table_mangle);
112 112
113 if (ret != NF_DROP && ret != NF_STOLEN 113 if (ret != NF_DROP && ret != NF_STOLEN
114 && (memcmp(&ipv6_hdr(skb)->saddr, &saddr, sizeof(saddr)) 114 && (memcmp(&ipv6_hdr(skb)->saddr, &saddr, sizeof(saddr))
@@ -158,12 +158,31 @@ static struct nf_hook_ops ip6t_ops[] __read_mostly = {
158 }, 158 },
159}; 159};
160 160
161static int __net_init ip6table_mangle_net_init(struct net *net)
162{
163 /* Register table */
164 net->ipv6.ip6table_mangle =
165 ip6t_register_table(net, &packet_mangler, &initial_table.repl);
166 if (IS_ERR(net->ipv6.ip6table_mangle))
167 return PTR_ERR(net->ipv6.ip6table_mangle);
168 return 0;
169}
170
171static void __net_exit ip6table_mangle_net_exit(struct net *net)
172{
173 ip6t_unregister_table(net->ipv6.ip6table_mangle);
174}
175
176static struct pernet_operations ip6table_mangle_net_ops = {
177 .init = ip6table_mangle_net_init,
178 .exit = ip6table_mangle_net_exit,
179};
180
161static int __init ip6table_mangle_init(void) 181static int __init ip6table_mangle_init(void)
162{ 182{
163 int ret; 183 int ret;
164 184
165 /* Register table */ 185 ret = register_pernet_subsys(&ip6table_mangle_net_ops);
166 ret = ip6t_register_table(&packet_mangler, &initial_table.repl);
167 if (ret < 0) 186 if (ret < 0)
168 return ret; 187 return ret;
169 188
@@ -175,14 +194,14 @@ static int __init ip6table_mangle_init(void)
175 return ret; 194 return ret;
176 195
177 cleanup_table: 196 cleanup_table:
178 ip6t_unregister_table(&packet_mangler); 197 unregister_pernet_subsys(&ip6table_mangle_net_ops);
179 return ret; 198 return ret;
180} 199}
181 200
182static void __exit ip6table_mangle_fini(void) 201static void __exit ip6table_mangle_fini(void)
183{ 202{
184 nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops)); 203 nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
185 ip6t_unregister_table(&packet_mangler); 204 unregister_pernet_subsys(&ip6table_mangle_net_ops);
186} 205}
187 206
188module_init(ip6table_mangle_init); 207module_init(ip6table_mangle_init);
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c
index eccbaaa104af..5cd84203abfe 100644
--- a/net/ipv6/netfilter/ip6table_raw.c
+++ b/net/ipv6/netfilter/ip6table_raw.c
@@ -13,7 +13,7 @@ static struct
13 struct ip6t_replace repl; 13 struct ip6t_replace repl;
14 struct ip6t_standard entries[2]; 14 struct ip6t_standard entries[2];
15 struct ip6t_error term; 15 struct ip6t_error term;
16} initial_table __initdata = { 16} initial_table __net_initdata = {
17 .repl = { 17 .repl = {
18 .name = "raw", 18 .name = "raw",
19 .valid_hooks = RAW_VALID_HOOKS, 19 .valid_hooks = RAW_VALID_HOOKS,
@@ -51,7 +51,7 @@ ip6t_hook(unsigned int hook,
51 const struct net_device *out, 51 const struct net_device *out,
52 int (*okfn)(struct sk_buff *)) 52 int (*okfn)(struct sk_buff *))
53{ 53{
54 return ip6t_do_table(skb, hook, in, out, &packet_raw); 54 return ip6t_do_table(skb, hook, in, out, init_net.ipv6.ip6table_raw);
55} 55}
56 56
57static struct nf_hook_ops ip6t_ops[] __read_mostly = { 57static struct nf_hook_ops ip6t_ops[] __read_mostly = {
@@ -71,12 +71,31 @@ static struct nf_hook_ops ip6t_ops[] __read_mostly = {
71 }, 71 },
72}; 72};
73 73
74static int __net_init ip6table_raw_net_init(struct net *net)
75{
76 /* Register table */
77 net->ipv6.ip6table_raw =
78 ip6t_register_table(net, &packet_raw, &initial_table.repl);
79 if (IS_ERR(net->ipv6.ip6table_raw))
80 return PTR_ERR(net->ipv6.ip6table_raw);
81 return 0;
82}
83
84static void __net_exit ip6table_raw_net_exit(struct net *net)
85{
86 ip6t_unregister_table(net->ipv6.ip6table_raw);
87}
88
89static struct pernet_operations ip6table_raw_net_ops = {
90 .init = ip6table_raw_net_init,
91 .exit = ip6table_raw_net_exit,
92};
93
74static int __init ip6table_raw_init(void) 94static int __init ip6table_raw_init(void)
75{ 95{
76 int ret; 96 int ret;
77 97
78 /* Register table */ 98 ret = register_pernet_subsys(&ip6table_raw_net_ops);
79 ret = ip6t_register_table(&packet_raw, &initial_table.repl);
80 if (ret < 0) 99 if (ret < 0)
81 return ret; 100 return ret;
82 101
@@ -88,14 +107,14 @@ static int __init ip6table_raw_init(void)
88 return ret; 107 return ret;
89 108
90 cleanup_table: 109 cleanup_table:
91 ip6t_unregister_table(&packet_raw); 110 unregister_pernet_subsys(&ip6table_raw_net_ops);
92 return ret; 111 return ret;
93} 112}
94 113
95static void __exit ip6table_raw_fini(void) 114static void __exit ip6table_raw_fini(void)
96{ 115{
97 nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops)); 116 nf_unregister_hooks(ip6t_ops, ARRAY_SIZE(ip6t_ops));
98 ip6t_unregister_table(&packet_raw); 117 unregister_pernet_subsys(&ip6table_raw_net_ops);
99} 118}
100 119
101module_init(ip6table_raw_init); 120module_init(ip6table_raw_init);
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 2d7b0246475d..3717bdf34f6e 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -30,7 +30,8 @@
30static int ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, 30static int ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff,
31 struct nf_conntrack_tuple *tuple) 31 struct nf_conntrack_tuple *tuple)
32{ 32{
33 u_int32_t _addrs[8], *ap; 33 const u_int32_t *ap;
34 u_int32_t _addrs[8];
34 35
35 ap = skb_header_pointer(skb, nhoff + offsetof(struct ipv6hdr, saddr), 36 ap = skb_header_pointer(skb, nhoff + offsetof(struct ipv6hdr, saddr),
36 sizeof(_addrs), _addrs); 37 sizeof(_addrs), _addrs);
@@ -146,8 +147,8 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
146 int (*okfn)(struct sk_buff *)) 147 int (*okfn)(struct sk_buff *))
147{ 148{
148 struct nf_conn *ct; 149 struct nf_conn *ct;
149 struct nf_conn_help *help; 150 const struct nf_conn_help *help;
150 struct nf_conntrack_helper *helper; 151 const struct nf_conntrack_helper *helper;
151 enum ip_conntrack_info ctinfo; 152 enum ip_conntrack_info ctinfo;
152 unsigned int ret, protoff; 153 unsigned int ret, protoff;
153 unsigned int extoff = (u8 *)(ipv6_hdr(skb) + 1) - skb->data; 154 unsigned int extoff = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index da924c6b5f06..0897d0f4c4a2 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -32,7 +32,8 @@ static int icmpv6_pkt_to_tuple(const struct sk_buff *skb,
32 unsigned int dataoff, 32 unsigned int dataoff,
33 struct nf_conntrack_tuple *tuple) 33 struct nf_conntrack_tuple *tuple)
34{ 34{
35 struct icmp6hdr _hdr, *hp; 35 const struct icmp6hdr *hp;
36 struct icmp6hdr _hdr;
36 37
37 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); 38 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr);
38 if (hp == NULL) 39 if (hp == NULL)
@@ -45,7 +46,7 @@ static int icmpv6_pkt_to_tuple(const struct sk_buff *skb,
45} 46}
46 47
47/* Add 1; spaces filled with 0. */ 48/* Add 1; spaces filled with 0. */
48static u_int8_t invmap[] = { 49static const u_int8_t invmap[] = {
49 [ICMPV6_ECHO_REQUEST - 128] = ICMPV6_ECHO_REPLY + 1, 50 [ICMPV6_ECHO_REQUEST - 128] = ICMPV6_ECHO_REPLY + 1,
50 [ICMPV6_ECHO_REPLY - 128] = ICMPV6_ECHO_REQUEST + 1, 51 [ICMPV6_ECHO_REPLY - 128] = ICMPV6_ECHO_REQUEST + 1,
51 [ICMPV6_NI_QUERY - 128] = ICMPV6_NI_QUERY + 1, 52 [ICMPV6_NI_QUERY - 128] = ICMPV6_NI_QUERY + 1,
@@ -101,24 +102,24 @@ static int icmpv6_packet(struct nf_conn *ct,
101} 102}
102 103
103/* Called when a new connection for this protocol found. */ 104/* Called when a new connection for this protocol found. */
104static int icmpv6_new(struct nf_conn *conntrack, 105static int icmpv6_new(struct nf_conn *ct,
105 const struct sk_buff *skb, 106 const struct sk_buff *skb,
106 unsigned int dataoff) 107 unsigned int dataoff)
107{ 108{
108 static u_int8_t valid_new[] = { 109 static const u_int8_t valid_new[] = {
109 [ICMPV6_ECHO_REQUEST - 128] = 1, 110 [ICMPV6_ECHO_REQUEST - 128] = 1,
110 [ICMPV6_NI_QUERY - 128] = 1 111 [ICMPV6_NI_QUERY - 128] = 1
111 }; 112 };
112 int type = conntrack->tuplehash[0].tuple.dst.u.icmp.type - 128; 113 int type = ct->tuplehash[0].tuple.dst.u.icmp.type - 128;
113 114
114 if (type < 0 || type >= sizeof(valid_new) || !valid_new[type]) { 115 if (type < 0 || type >= sizeof(valid_new) || !valid_new[type]) {
115 /* Can't create a new ICMPv6 `conn' with this. */ 116 /* Can't create a new ICMPv6 `conn' with this. */
116 pr_debug("icmpv6: can't create new conn with type %u\n", 117 pr_debug("icmpv6: can't create new conn with type %u\n",
117 type + 128); 118 type + 128);
118 NF_CT_DUMP_TUPLE(&conntrack->tuplehash[0].tuple); 119 NF_CT_DUMP_TUPLE(&ct->tuplehash[0].tuple);
119 return 0; 120 return 0;
120 } 121 }
121 atomic_set(&conntrack->proto.icmp.count, 0); 122 atomic_set(&ct->proto.icmp.count, 0);
122 return 1; 123 return 1;
123} 124}
124 125
@@ -129,8 +130,8 @@ icmpv6_error_message(struct sk_buff *skb,
129 unsigned int hooknum) 130 unsigned int hooknum)
130{ 131{
131 struct nf_conntrack_tuple intuple, origtuple; 132 struct nf_conntrack_tuple intuple, origtuple;
132 struct nf_conntrack_tuple_hash *h; 133 const struct nf_conntrack_tuple_hash *h;
133 struct nf_conntrack_l4proto *inproto; 134 const struct nf_conntrack_l4proto *inproto;
134 135
135 NF_CT_ASSERT(skb->nfct == NULL); 136 NF_CT_ASSERT(skb->nfct == NULL);
136 137
@@ -176,7 +177,8 @@ static int
176icmpv6_error(struct sk_buff *skb, unsigned int dataoff, 177icmpv6_error(struct sk_buff *skb, unsigned int dataoff,
177 enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum) 178 enum ip_conntrack_info *ctinfo, int pf, unsigned int hooknum)
178{ 179{
179 struct icmp6hdr _ih, *icmp6h; 180 const struct icmp6hdr *icmp6h;
181 struct icmp6hdr _ih;
180 182
181 icmp6h = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih); 183 icmp6h = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih);
182 if (icmp6h == NULL) { 184 if (icmp6h == NULL) {
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 022da6ce4c0f..2a0d698b24d5 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -39,6 +39,7 @@
39#include <net/rawv6.h> 39#include <net/rawv6.h>
40#include <net/ndisc.h> 40#include <net/ndisc.h>
41#include <net/addrconf.h> 41#include <net/addrconf.h>
42#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
42#include <linux/sysctl.h> 43#include <linux/sysctl.h>
43#include <linux/netfilter.h> 44#include <linux/netfilter.h>
44#include <linux/netfilter_ipv6.h> 45#include <linux/netfilter_ipv6.h>
@@ -680,21 +681,6 @@ void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
680 nf_conntrack_put_reasm(skb); 681 nf_conntrack_put_reasm(skb);
681} 682}
682 683
683int nf_ct_frag6_kfree_frags(struct sk_buff *skb)
684{
685 struct sk_buff *s, *s2;
686
687 for (s = NFCT_FRAG6_CB(skb)->orig; s; s = s2) {
688
689 s2 = s->next;
690 kfree_skb(s);
691 }
692
693 kfree_skb(skb);
694
695 return 0;
696}
697
698int nf_ct_frag6_init(void) 684int nf_ct_frag6_init(void)
699{ 685{
700 nf_frags.hashfn = nf_hashfn; 686 nf_frags.hashfn = nf_hashfn;
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 4d880551fe6a..8897ccf8086a 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -641,6 +641,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
641 skb_reserve(skb, hh_len); 641 skb_reserve(skb, hh_len);
642 642
643 skb->priority = sk->sk_priority; 643 skb->priority = sk->sk_priority;
644 skb->mark = sk->sk_mark;
644 skb->dst = dst_clone(&rt->u.dst); 645 skb->dst = dst_clone(&rt->u.dst);
645 646
646 skb_put(skb, length); 647 skb_put(skb, length);
@@ -767,6 +768,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
767 */ 768 */
768 memset(&fl, 0, sizeof(fl)); 769 memset(&fl, 0, sizeof(fl));
769 770
771 fl.mark = sk->sk_mark;
772
770 if (sin6) { 773 if (sin6) {
771 if (addr_len < SIN6_LEN_RFC2133) 774 if (addr_len < SIN6_LEN_RFC2133)
772 return -EINVAL; 775 return -EINVAL;
@@ -1259,7 +1262,7 @@ static const struct seq_operations raw6_seq_ops = {
1259 1262
1260static int raw6_seq_open(struct inode *inode, struct file *file) 1263static int raw6_seq_open(struct inode *inode, struct file *file)
1261{ 1264{
1262 return raw_seq_open(inode, file, &raw_v6_hashinfo, PF_INET6); 1265 return raw_seq_open(inode, file, &raw_v6_hashinfo, &raw6_seq_ops);
1263} 1266}
1264 1267
1265static const struct file_operations raw6_seq_fops = { 1268static const struct file_operations raw6_seq_fops = {
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 4004c5f0b8d7..513f72e3db0d 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -107,6 +107,7 @@ static struct dst_ops ip6_dst_ops = {
107 .update_pmtu = ip6_rt_update_pmtu, 107 .update_pmtu = ip6_rt_update_pmtu,
108 .local_out = ip6_local_out, 108 .local_out = ip6_local_out,
109 .entry_size = sizeof(struct rt6_info), 109 .entry_size = sizeof(struct rt6_info),
110 .entries = ATOMIC_INIT(0),
110}; 111};
111 112
112static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) 113static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
@@ -120,6 +121,7 @@ static struct dst_ops ip6_dst_blackhole_ops = {
120 .check = ip6_dst_check, 121 .check = ip6_dst_check,
121 .update_pmtu = ip6_rt_blackhole_update_pmtu, 122 .update_pmtu = ip6_rt_blackhole_update_pmtu,
122 .entry_size = sizeof(struct rt6_info), 123 .entry_size = sizeof(struct rt6_info),
124 .entries = ATOMIC_INIT(0),
123}; 125};
124 126
125struct rt6_info ip6_null_entry = { 127struct rt6_info ip6_null_entry = {
@@ -1907,7 +1909,7 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void *p_arg)
1907 */ 1909 */
1908 if (rt->rt6i_dev == arg->dev && 1910 if (rt->rt6i_dev == arg->dev &&
1909 !dst_metric_locked(&rt->u.dst, RTAX_MTU) && 1911 !dst_metric_locked(&rt->u.dst, RTAX_MTU) &&
1910 (dst_mtu(&rt->u.dst) > arg->mtu || 1912 (dst_mtu(&rt->u.dst) >= arg->mtu ||
1911 (dst_mtu(&rt->u.dst) < arg->mtu && 1913 (dst_mtu(&rt->u.dst) < arg->mtu &&
1912 dst_mtu(&rt->u.dst) == idev->cnf.mtu6))) { 1914 dst_mtu(&rt->u.dst) == idev->cnf.mtu6))) {
1913 rt->u.dst.metrics[RTAX_MTU-1] = arg->mtu; 1915 rt->u.dst.metrics[RTAX_MTU-1] = arg->mtu;
@@ -1960,6 +1962,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
1960 1962
1961 cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid; 1963 cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid;
1962 cfg->fc_nlinfo.nlh = nlh; 1964 cfg->fc_nlinfo.nlh = nlh;
1965 cfg->fc_nlinfo.nl_net = skb->sk->sk_net;
1963 1966
1964 if (tb[RTA_GATEWAY]) { 1967 if (tb[RTA_GATEWAY]) {
1965 nla_memcpy(&cfg->fc_gateway, tb[RTA_GATEWAY], 16); 1968 nla_memcpy(&cfg->fc_gateway, tb[RTA_GATEWAY], 16);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 00c08399837d..59d0029e93a7 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -330,8 +330,8 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
330 struct tcp_sock *tp; 330 struct tcp_sock *tp;
331 __u32 seq; 331 __u32 seq;
332 332
333 sk = inet6_lookup(&tcp_hashinfo, &hdr->daddr, th->dest, &hdr->saddr, 333 sk = inet6_lookup(skb->dev->nd_net, &tcp_hashinfo, &hdr->daddr,
334 th->source, skb->dev->ifindex); 334 th->dest, &hdr->saddr, th->source, skb->dev->ifindex);
335 335
336 if (sk == NULL) { 336 if (sk == NULL) {
337 ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), ICMP6_MIB_INERRORS); 337 ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), ICMP6_MIB_INERRORS);
@@ -1208,9 +1208,9 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
1208 if (req) 1208 if (req)
1209 return tcp_check_req(sk, skb, req, prev); 1209 return tcp_check_req(sk, skb, req, prev);
1210 1210
1211 nsk = __inet6_lookup_established(&tcp_hashinfo, &ipv6_hdr(skb)->saddr, 1211 nsk = __inet6_lookup_established(sk->sk_net, &tcp_hashinfo,
1212 th->source, &ipv6_hdr(skb)->daddr, 1212 &ipv6_hdr(skb)->saddr, th->source,
1213 ntohs(th->dest), inet6_iif(skb)); 1213 &ipv6_hdr(skb)->daddr, ntohs(th->dest), inet6_iif(skb));
1214 1214
1215 if (nsk) { 1215 if (nsk) {
1216 if (nsk->sk_state != TCP_TIME_WAIT) { 1216 if (nsk->sk_state != TCP_TIME_WAIT) {
@@ -1710,9 +1710,10 @@ static int tcp_v6_rcv(struct sk_buff *skb)
1710 TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(ipv6_hdr(skb)); 1710 TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(ipv6_hdr(skb));
1711 TCP_SKB_CB(skb)->sacked = 0; 1711 TCP_SKB_CB(skb)->sacked = 0;
1712 1712
1713 sk = __inet6_lookup(&tcp_hashinfo, &ipv6_hdr(skb)->saddr, th->source, 1713 sk = __inet6_lookup(skb->dev->nd_net, &tcp_hashinfo,
1714 &ipv6_hdr(skb)->daddr, ntohs(th->dest), 1714 &ipv6_hdr(skb)->saddr, th->source,
1715 inet6_iif(skb)); 1715 &ipv6_hdr(skb)->daddr, ntohs(th->dest),
1716 inet6_iif(skb));
1716 1717
1717 if (!sk) 1718 if (!sk)
1718 goto no_tcp_socket; 1719 goto no_tcp_socket;
@@ -1792,7 +1793,7 @@ do_time_wait:
1792 { 1793 {
1793 struct sock *sk2; 1794 struct sock *sk2;
1794 1795
1795 sk2 = inet6_lookup_listener(&tcp_hashinfo, 1796 sk2 = inet6_lookup_listener(skb->dev->nd_net, &tcp_hashinfo,
1796 &ipv6_hdr(skb)->daddr, 1797 &ipv6_hdr(skb)->daddr,
1797 ntohs(th->dest), inet6_iif(skb)); 1798 ntohs(th->dest), inet6_iif(skb));
1798 if (sk2 != NULL) { 1799 if (sk2 != NULL) {
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index bd4b9df8f614..53739de829db 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -56,7 +56,8 @@ static inline int udp_v6_get_port(struct sock *sk, unsigned short snum)
56 return udp_get_port(sk, snum, ipv6_rcv_saddr_equal); 56 return udp_get_port(sk, snum, ipv6_rcv_saddr_equal);
57} 57}
58 58
59static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport, 59static struct sock *__udp6_lib_lookup(struct net *net,
60 struct in6_addr *saddr, __be16 sport,
60 struct in6_addr *daddr, __be16 dport, 61 struct in6_addr *daddr, __be16 dport,
61 int dif, struct hlist_head udptable[]) 62 int dif, struct hlist_head udptable[])
62{ 63{
@@ -69,7 +70,8 @@ static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport,
69 sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { 70 sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) {
70 struct inet_sock *inet = inet_sk(sk); 71 struct inet_sock *inet = inet_sk(sk);
71 72
72 if (sk->sk_hash == hnum && sk->sk_family == PF_INET6) { 73 if (sk->sk_net == net && sk->sk_hash == hnum &&
74 sk->sk_family == PF_INET6) {
73 struct ipv6_pinfo *np = inet6_sk(sk); 75 struct ipv6_pinfo *np = inet6_sk(sk);
74 int score = 0; 76 int score = 0;
75 if (inet->dport) { 77 if (inet->dport) {
@@ -233,7 +235,7 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
233 struct sock *sk; 235 struct sock *sk;
234 int err; 236 int err;
235 237
236 sk = __udp6_lib_lookup(daddr, uh->dest, 238 sk = __udp6_lib_lookup(skb->dev->nd_net, daddr, uh->dest,
237 saddr, uh->source, inet6_iif(skb), udptable); 239 saddr, uh->source, inet6_iif(skb), udptable);
238 if (sk == NULL) 240 if (sk == NULL)
239 return; 241 return;
@@ -478,7 +480,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
478 * check socket cache ... must talk to Alan about his plans 480 * check socket cache ... must talk to Alan about his plans
479 * for sock caches... i'll skip this for now. 481 * for sock caches... i'll skip this for now.
480 */ 482 */
481 sk = __udp6_lib_lookup(saddr, uh->source, 483 sk = __udp6_lib_lookup(skb->dev->nd_net, saddr, uh->source,
482 daddr, uh->dest, inet6_iif(skb), udptable); 484 daddr, uh->dest, inet6_iif(skb), udptable);
483 485
484 if (sk == NULL) { 486 if (sk == NULL) {
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index c25a6b527fc4..7d20199ee1f3 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -272,6 +272,7 @@ static struct dst_ops xfrm6_dst_ops = {
272 .local_out = __ip6_local_out, 272 .local_out = __ip6_local_out,
273 .gc_thresh = 1024, 273 .gc_thresh = 1024,
274 .entry_size = sizeof(struct xfrm_dst), 274 .entry_size = sizeof(struct xfrm_dst),
275 .entries = ATOMIC_INIT(0),
275}; 276};
276 277
277static struct xfrm_policy_afinfo xfrm6_policy_afinfo = { 278static struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index fae90ff31087..639fe8a6ff1e 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -319,7 +319,7 @@ static void xfrm6_tunnel_destroy(struct xfrm_state *x)
319 xfrm6_tunnel_free_spi((xfrm_address_t *)&x->props.saddr); 319 xfrm6_tunnel_free_spi((xfrm_address_t *)&x->props.saddr);
320} 320}
321 321
322static struct xfrm_type xfrm6_tunnel_type = { 322static const struct xfrm_type xfrm6_tunnel_type = {
323 .description = "IP6IP6", 323 .description = "IP6IP6",
324 .owner = THIS_MODULE, 324 .owner = THIS_MODULE,
325 .proto = IPPROTO_IPV6, 325 .proto = IPPROTO_IPV6,
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 89e1e3070ec1..d44c87269bcb 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -340,9 +340,42 @@ static u32 ieee80211_rx_load_stats(struct ieee80211_local *local,
340 return load; 340 return load;
341} 341}
342 342
343static ieee80211_txrx_result
344ieee80211_rx_h_verify_ip_alignment(struct ieee80211_txrx_data *rx)
345{
346 int hdrlen;
347
348 /*
349 * Drivers are required to align the payload data in a way that
350 * guarantees that the contained IP header is aligned to a four-
351 * byte boundary. In the case of regular frames, this simply means
352 * aligning the payload to a four-byte boundary (because either
353 * the IP header is directly contained, or IV/RFC1042 headers that
354 * have a length divisible by four are in front of it.
355 *
356 * With A-MSDU frames, however, the payload data address must
357 * yield two modulo four because there are 14-byte 802.3 headers
358 * within the A-MSDU frames that push the IP header further back
359 * to a multiple of four again. Thankfully, the specs were sane
360 * enough this time around to require padding each A-MSDU subframe
361 * to a length that is a multiple of four.
362 *
363 * Padding like atheros hardware adds which is inbetween the 802.11
364 * header and the payload is not supported, the driver is required
365 * to move the 802.11 header further back in that case.
366 */
367 hdrlen = ieee80211_get_hdrlen(rx->fc);
368 if (rx->flags & IEEE80211_TXRXD_RX_AMSDU)
369 hdrlen += ETH_HLEN;
370 WARN_ON_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3);
371
372 return TXRX_CONTINUE;
373}
374
343ieee80211_rx_handler ieee80211_rx_pre_handlers[] = 375ieee80211_rx_handler ieee80211_rx_pre_handlers[] =
344{ 376{
345 ieee80211_rx_h_parse_qos, 377 ieee80211_rx_h_parse_qos,
378 ieee80211_rx_h_verify_ip_alignment,
346 NULL 379 NULL
347}; 380};
348 381
@@ -1679,7 +1712,6 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1679 struct ieee80211_sub_if_data *prev = NULL; 1712 struct ieee80211_sub_if_data *prev = NULL;
1680 struct sk_buff *skb_new; 1713 struct sk_buff *skb_new;
1681 u8 *bssid; 1714 u8 *bssid;
1682 int hdrlen;
1683 1715
1684 hdr = (struct ieee80211_hdr *) skb->data; 1716 hdr = (struct ieee80211_hdr *) skb->data;
1685 memset(&rx, 0, sizeof(rx)); 1717 memset(&rx, 0, sizeof(rx));
@@ -1691,18 +1723,6 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
1691 rx.fc = le16_to_cpu(hdr->frame_control); 1723 rx.fc = le16_to_cpu(hdr->frame_control);
1692 type = rx.fc & IEEE80211_FCTL_FTYPE; 1724 type = rx.fc & IEEE80211_FCTL_FTYPE;
1693 1725
1694 /*
1695 * Drivers are required to align the payload data to a four-byte
1696 * boundary, so the last two bits of the address where it starts
1697 * may not be set. The header is required to be directly before
1698 * the payload data, padding like atheros hardware adds which is
1699 * inbetween the 802.11 header and the payload is not supported,
1700 * the driver is required to move the 802.11 header further back
1701 * in that case.
1702 */
1703 hdrlen = ieee80211_get_hdrlen(rx.fc);
1704 WARN_ON_ONCE(((unsigned long)(skb->data + hdrlen)) & 3);
1705
1706 if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT) 1726 if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT)
1707 local->dot11ReceivedFragmentCount++; 1727 local->dot11ReceivedFragmentCount++;
1708 1728
@@ -1952,7 +1972,7 @@ static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local,
1952 goto end_reorder; 1972 goto end_reorder;
1953 1973
1954 /* null data frames are excluded */ 1974 /* null data frames are excluded */
1955 if (unlikely(fc & IEEE80211_STYPE_QOS_NULLFUNC)) 1975 if (unlikely(fc & IEEE80211_STYPE_NULLFUNC))
1956 goto end_reorder; 1976 goto end_reorder;
1957 1977
1958 /* new un-ordered ampdu frame - process it */ 1978 /* new un-ordered ampdu frame - process it */
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 078fff0335ad..327e847d2702 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -40,7 +40,7 @@
40 40
41#define NF_CONNTRACK_VERSION "0.5.0" 41#define NF_CONNTRACK_VERSION "0.5.0"
42 42
43DEFINE_RWLOCK(nf_conntrack_lock); 43DEFINE_SPINLOCK(nf_conntrack_lock);
44EXPORT_SYMBOL_GPL(nf_conntrack_lock); 44EXPORT_SYMBOL_GPL(nf_conntrack_lock);
45 45
46/* nf_conntrack_standalone needs this */ 46/* nf_conntrack_standalone needs this */
@@ -73,15 +73,19 @@ static unsigned int nf_conntrack_hash_rnd;
73static u_int32_t __hash_conntrack(const struct nf_conntrack_tuple *tuple, 73static u_int32_t __hash_conntrack(const struct nf_conntrack_tuple *tuple,
74 unsigned int size, unsigned int rnd) 74 unsigned int size, unsigned int rnd)
75{ 75{
76 unsigned int a, b; 76 unsigned int n;
77 77 u_int32_t h;
78 a = jhash2(tuple->src.u3.all, ARRAY_SIZE(tuple->src.u3.all), 78
79 (tuple->src.l3num << 16) | tuple->dst.protonum); 79 /* The direction must be ignored, so we hash everything up to the
80 b = jhash2(tuple->dst.u3.all, ARRAY_SIZE(tuple->dst.u3.all), 80 * destination ports (which is a multiple of 4) and treat the last
81 ((__force __u16)tuple->src.u.all << 16) | 81 * three bytes manually.
82 (__force __u16)tuple->dst.u.all); 82 */
83 83 n = (sizeof(tuple->src) + sizeof(tuple->dst.u3)) / sizeof(u32);
84 return ((u64)jhash_2words(a, b, rnd) * size) >> 32; 84 h = jhash2((u32 *)tuple, n,
85 rnd ^ (((__force __u16)tuple->dst.u.all << 16) |
86 tuple->dst.protonum));
87
88 return ((u64)h * size) >> 32;
85} 89}
86 90
87static inline u_int32_t hash_conntrack(const struct nf_conntrack_tuple *tuple) 91static inline u_int32_t hash_conntrack(const struct nf_conntrack_tuple *tuple)
@@ -166,8 +170,8 @@ static void
166clean_from_lists(struct nf_conn *ct) 170clean_from_lists(struct nf_conn *ct)
167{ 171{
168 pr_debug("clean_from_lists(%p)\n", ct); 172 pr_debug("clean_from_lists(%p)\n", ct);
169 hlist_del(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode); 173 hlist_del_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode);
170 hlist_del(&ct->tuplehash[IP_CT_DIR_REPLY].hnode); 174 hlist_del_rcu(&ct->tuplehash[IP_CT_DIR_REPLY].hnode);
171 175
172 /* Destroy all pending expectations */ 176 /* Destroy all pending expectations */
173 nf_ct_remove_expectations(ct); 177 nf_ct_remove_expectations(ct);
@@ -199,7 +203,7 @@ destroy_conntrack(struct nf_conntrack *nfct)
199 203
200 rcu_read_unlock(); 204 rcu_read_unlock();
201 205
202 write_lock_bh(&nf_conntrack_lock); 206 spin_lock_bh(&nf_conntrack_lock);
203 /* Expectations will have been removed in clean_from_lists, 207 /* Expectations will have been removed in clean_from_lists,
204 * except TFTP can create an expectation on the first packet, 208 * except TFTP can create an expectation on the first packet,
205 * before connection is in the list, so we need to clean here, 209 * before connection is in the list, so we need to clean here,
@@ -213,7 +217,7 @@ destroy_conntrack(struct nf_conntrack *nfct)
213 } 217 }
214 218
215 NF_CT_STAT_INC(delete); 219 NF_CT_STAT_INC(delete);
216 write_unlock_bh(&nf_conntrack_lock); 220 spin_unlock_bh(&nf_conntrack_lock);
217 221
218 if (ct->master) 222 if (ct->master)
219 nf_ct_put(ct->master); 223 nf_ct_put(ct->master);
@@ -236,26 +240,24 @@ static void death_by_timeout(unsigned long ul_conntrack)
236 rcu_read_unlock(); 240 rcu_read_unlock();
237 } 241 }
238 242
239 write_lock_bh(&nf_conntrack_lock); 243 spin_lock_bh(&nf_conntrack_lock);
240 /* Inside lock so preempt is disabled on module removal path. 244 /* Inside lock so preempt is disabled on module removal path.
241 * Otherwise we can get spurious warnings. */ 245 * Otherwise we can get spurious warnings. */
242 NF_CT_STAT_INC(delete_list); 246 NF_CT_STAT_INC(delete_list);
243 clean_from_lists(ct); 247 clean_from_lists(ct);
244 write_unlock_bh(&nf_conntrack_lock); 248 spin_unlock_bh(&nf_conntrack_lock);
245 nf_ct_put(ct); 249 nf_ct_put(ct);
246} 250}
247 251
248struct nf_conntrack_tuple_hash * 252struct nf_conntrack_tuple_hash *
249__nf_conntrack_find(const struct nf_conntrack_tuple *tuple, 253__nf_conntrack_find(const struct nf_conntrack_tuple *tuple)
250 const struct nf_conn *ignored_conntrack)
251{ 254{
252 struct nf_conntrack_tuple_hash *h; 255 struct nf_conntrack_tuple_hash *h;
253 struct hlist_node *n; 256 struct hlist_node *n;
254 unsigned int hash = hash_conntrack(tuple); 257 unsigned int hash = hash_conntrack(tuple);
255 258
256 hlist_for_each_entry(h, n, &nf_conntrack_hash[hash], hnode) { 259 hlist_for_each_entry_rcu(h, n, &nf_conntrack_hash[hash], hnode) {
257 if (nf_ct_tuplehash_to_ctrack(h) != ignored_conntrack && 260 if (nf_ct_tuple_equal(tuple, &h->tuple)) {
258 nf_ct_tuple_equal(tuple, &h->tuple)) {
259 NF_CT_STAT_INC(found); 261 NF_CT_STAT_INC(found);
260 return h; 262 return h;
261 } 263 }
@@ -271,12 +273,16 @@ struct nf_conntrack_tuple_hash *
271nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple) 273nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple)
272{ 274{
273 struct nf_conntrack_tuple_hash *h; 275 struct nf_conntrack_tuple_hash *h;
276 struct nf_conn *ct;
274 277
275 read_lock_bh(&nf_conntrack_lock); 278 rcu_read_lock();
276 h = __nf_conntrack_find(tuple, NULL); 279 h = __nf_conntrack_find(tuple);
277 if (h) 280 if (h) {
278 atomic_inc(&nf_ct_tuplehash_to_ctrack(h)->ct_general.use); 281 ct = nf_ct_tuplehash_to_ctrack(h);
279 read_unlock_bh(&nf_conntrack_lock); 282 if (unlikely(!atomic_inc_not_zero(&ct->ct_general.use)))
283 h = NULL;
284 }
285 rcu_read_unlock();
280 286
281 return h; 287 return h;
282} 288}
@@ -286,10 +292,10 @@ static void __nf_conntrack_hash_insert(struct nf_conn *ct,
286 unsigned int hash, 292 unsigned int hash,
287 unsigned int repl_hash) 293 unsigned int repl_hash)
288{ 294{
289 hlist_add_head(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode, 295 hlist_add_head_rcu(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode,
290 &nf_conntrack_hash[hash]); 296 &nf_conntrack_hash[hash]);
291 hlist_add_head(&ct->tuplehash[IP_CT_DIR_REPLY].hnode, 297 hlist_add_head_rcu(&ct->tuplehash[IP_CT_DIR_REPLY].hnode,
292 &nf_conntrack_hash[repl_hash]); 298 &nf_conntrack_hash[repl_hash]);
293} 299}
294 300
295void nf_conntrack_hash_insert(struct nf_conn *ct) 301void nf_conntrack_hash_insert(struct nf_conn *ct)
@@ -299,9 +305,9 @@ void nf_conntrack_hash_insert(struct nf_conn *ct)
299 hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); 305 hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
300 repl_hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple); 306 repl_hash = hash_conntrack(&ct->tuplehash[IP_CT_DIR_REPLY].tuple);
301 307
302 write_lock_bh(&nf_conntrack_lock); 308 spin_lock_bh(&nf_conntrack_lock);
303 __nf_conntrack_hash_insert(ct, hash, repl_hash); 309 __nf_conntrack_hash_insert(ct, hash, repl_hash);
304 write_unlock_bh(&nf_conntrack_lock); 310 spin_unlock_bh(&nf_conntrack_lock);
305} 311}
306EXPORT_SYMBOL_GPL(nf_conntrack_hash_insert); 312EXPORT_SYMBOL_GPL(nf_conntrack_hash_insert);
307 313
@@ -338,7 +344,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
338 NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); 344 NF_CT_ASSERT(!nf_ct_is_confirmed(ct));
339 pr_debug("Confirming conntrack %p\n", ct); 345 pr_debug("Confirming conntrack %p\n", ct);
340 346
341 write_lock_bh(&nf_conntrack_lock); 347 spin_lock_bh(&nf_conntrack_lock);
342 348
343 /* See if there's one in the list already, including reverse: 349 /* See if there's one in the list already, including reverse:
344 NAT could have grabbed it without realizing, since we're 350 NAT could have grabbed it without realizing, since we're
@@ -364,7 +370,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
364 atomic_inc(&ct->ct_general.use); 370 atomic_inc(&ct->ct_general.use);
365 set_bit(IPS_CONFIRMED_BIT, &ct->status); 371 set_bit(IPS_CONFIRMED_BIT, &ct->status);
366 NF_CT_STAT_INC(insert); 372 NF_CT_STAT_INC(insert);
367 write_unlock_bh(&nf_conntrack_lock); 373 spin_unlock_bh(&nf_conntrack_lock);
368 help = nfct_help(ct); 374 help = nfct_help(ct);
369 if (help && help->helper) 375 if (help && help->helper)
370 nf_conntrack_event_cache(IPCT_HELPER, skb); 376 nf_conntrack_event_cache(IPCT_HELPER, skb);
@@ -379,7 +385,7 @@ __nf_conntrack_confirm(struct sk_buff *skb)
379 385
380out: 386out:
381 NF_CT_STAT_INC(insert_failed); 387 NF_CT_STAT_INC(insert_failed);
382 write_unlock_bh(&nf_conntrack_lock); 388 spin_unlock_bh(&nf_conntrack_lock);
383 return NF_DROP; 389 return NF_DROP;
384} 390}
385EXPORT_SYMBOL_GPL(__nf_conntrack_confirm); 391EXPORT_SYMBOL_GPL(__nf_conntrack_confirm);
@@ -391,12 +397,22 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
391 const struct nf_conn *ignored_conntrack) 397 const struct nf_conn *ignored_conntrack)
392{ 398{
393 struct nf_conntrack_tuple_hash *h; 399 struct nf_conntrack_tuple_hash *h;
400 struct hlist_node *n;
401 unsigned int hash = hash_conntrack(tuple);
394 402
395 read_lock_bh(&nf_conntrack_lock); 403 rcu_read_lock();
396 h = __nf_conntrack_find(tuple, ignored_conntrack); 404 hlist_for_each_entry_rcu(h, n, &nf_conntrack_hash[hash], hnode) {
397 read_unlock_bh(&nf_conntrack_lock); 405 if (nf_ct_tuplehash_to_ctrack(h) != ignored_conntrack &&
406 nf_ct_tuple_equal(tuple, &h->tuple)) {
407 NF_CT_STAT_INC(found);
408 rcu_read_unlock();
409 return 1;
410 }
411 NF_CT_STAT_INC(searched);
412 }
413 rcu_read_unlock();
398 414
399 return h != NULL; 415 return 0;
400} 416}
401EXPORT_SYMBOL_GPL(nf_conntrack_tuple_taken); 417EXPORT_SYMBOL_GPL(nf_conntrack_tuple_taken);
402 418
@@ -404,7 +420,7 @@ EXPORT_SYMBOL_GPL(nf_conntrack_tuple_taken);
404 420
405/* There's a small race here where we may free a just-assured 421/* There's a small race here where we may free a just-assured
406 connection. Too bad: we're in trouble anyway. */ 422 connection. Too bad: we're in trouble anyway. */
407static int early_drop(unsigned int hash) 423static noinline int early_drop(unsigned int hash)
408{ 424{
409 /* Use oldest entry, which is roughly LRU */ 425 /* Use oldest entry, which is roughly LRU */
410 struct nf_conntrack_tuple_hash *h; 426 struct nf_conntrack_tuple_hash *h;
@@ -413,21 +429,23 @@ static int early_drop(unsigned int hash)
413 unsigned int i, cnt = 0; 429 unsigned int i, cnt = 0;
414 int dropped = 0; 430 int dropped = 0;
415 431
416 read_lock_bh(&nf_conntrack_lock); 432 rcu_read_lock();
417 for (i = 0; i < nf_conntrack_htable_size; i++) { 433 for (i = 0; i < nf_conntrack_htable_size; i++) {
418 hlist_for_each_entry(h, n, &nf_conntrack_hash[hash], hnode) { 434 hlist_for_each_entry_rcu(h, n, &nf_conntrack_hash[hash],
435 hnode) {
419 tmp = nf_ct_tuplehash_to_ctrack(h); 436 tmp = nf_ct_tuplehash_to_ctrack(h);
420 if (!test_bit(IPS_ASSURED_BIT, &tmp->status)) 437 if (!test_bit(IPS_ASSURED_BIT, &tmp->status))
421 ct = tmp; 438 ct = tmp;
422 cnt++; 439 cnt++;
423 } 440 }
441
442 if (ct && unlikely(!atomic_inc_not_zero(&ct->ct_general.use)))
443 ct = NULL;
424 if (ct || cnt >= NF_CT_EVICTION_RANGE) 444 if (ct || cnt >= NF_CT_EVICTION_RANGE)
425 break; 445 break;
426 hash = (hash + 1) % nf_conntrack_htable_size; 446 hash = (hash + 1) % nf_conntrack_htable_size;
427 } 447 }
428 if (ct) 448 rcu_read_unlock();
429 atomic_inc(&ct->ct_general.use);
430 read_unlock_bh(&nf_conntrack_lock);
431 449
432 if (!ct) 450 if (!ct)
433 return dropped; 451 return dropped;
@@ -444,7 +462,7 @@ static int early_drop(unsigned int hash)
444struct nf_conn *nf_conntrack_alloc(const struct nf_conntrack_tuple *orig, 462struct nf_conn *nf_conntrack_alloc(const struct nf_conntrack_tuple *orig,
445 const struct nf_conntrack_tuple *repl) 463 const struct nf_conntrack_tuple *repl)
446{ 464{
447 struct nf_conn *conntrack = NULL; 465 struct nf_conn *ct = NULL;
448 466
449 if (unlikely(!nf_conntrack_hash_rnd_initted)) { 467 if (unlikely(!nf_conntrack_hash_rnd_initted)) {
450 get_random_bytes(&nf_conntrack_hash_rnd, 4); 468 get_random_bytes(&nf_conntrack_hash_rnd, 4);
@@ -454,8 +472,8 @@ struct nf_conn *nf_conntrack_alloc(const struct nf_conntrack_tuple *orig,
454 /* We don't want any race condition at early drop stage */ 472 /* We don't want any race condition at early drop stage */
455 atomic_inc(&nf_conntrack_count); 473 atomic_inc(&nf_conntrack_count);
456 474
457 if (nf_conntrack_max 475 if (nf_conntrack_max &&
458 && atomic_read(&nf_conntrack_count) > nf_conntrack_max) { 476 unlikely(atomic_read(&nf_conntrack_count) > nf_conntrack_max)) {
459 unsigned int hash = hash_conntrack(orig); 477 unsigned int hash = hash_conntrack(orig);
460 if (!early_drop(hash)) { 478 if (!early_drop(hash)) {
461 atomic_dec(&nf_conntrack_count); 479 atomic_dec(&nf_conntrack_count);
@@ -467,30 +485,37 @@ struct nf_conn *nf_conntrack_alloc(const struct nf_conntrack_tuple *orig,
467 } 485 }
468 } 486 }
469 487
470 conntrack = kmem_cache_zalloc(nf_conntrack_cachep, GFP_ATOMIC); 488 ct = kmem_cache_zalloc(nf_conntrack_cachep, GFP_ATOMIC);
471 if (conntrack == NULL) { 489 if (ct == NULL) {
472 pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n"); 490 pr_debug("nf_conntrack_alloc: Can't alloc conntrack.\n");
473 atomic_dec(&nf_conntrack_count); 491 atomic_dec(&nf_conntrack_count);
474 return ERR_PTR(-ENOMEM); 492 return ERR_PTR(-ENOMEM);
475 } 493 }
476 494
477 atomic_set(&conntrack->ct_general.use, 1); 495 atomic_set(&ct->ct_general.use, 1);
478 conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig; 496 ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig;
479 conntrack->tuplehash[IP_CT_DIR_REPLY].tuple = *repl; 497 ct->tuplehash[IP_CT_DIR_REPLY].tuple = *repl;
480 /* Don't set timer yet: wait for confirmation */ 498 /* Don't set timer yet: wait for confirmation */
481 setup_timer(&conntrack->timeout, death_by_timeout, 499 setup_timer(&ct->timeout, death_by_timeout, (unsigned long)ct);
482 (unsigned long)conntrack); 500 INIT_RCU_HEAD(&ct->rcu);
483 501
484 return conntrack; 502 return ct;
485} 503}
486EXPORT_SYMBOL_GPL(nf_conntrack_alloc); 504EXPORT_SYMBOL_GPL(nf_conntrack_alloc);
487 505
488void nf_conntrack_free(struct nf_conn *conntrack) 506static void nf_conntrack_free_rcu(struct rcu_head *head)
489{ 507{
490 nf_ct_ext_free(conntrack); 508 struct nf_conn *ct = container_of(head, struct nf_conn, rcu);
491 kmem_cache_free(nf_conntrack_cachep, conntrack); 509
510 nf_ct_ext_free(ct);
511 kmem_cache_free(nf_conntrack_cachep, ct);
492 atomic_dec(&nf_conntrack_count); 512 atomic_dec(&nf_conntrack_count);
493} 513}
514
515void nf_conntrack_free(struct nf_conn *ct)
516{
517 call_rcu(&ct->rcu, nf_conntrack_free_rcu);
518}
494EXPORT_SYMBOL_GPL(nf_conntrack_free); 519EXPORT_SYMBOL_GPL(nf_conntrack_free);
495 520
496/* Allocate a new conntrack: we return -ENOMEM if classification 521/* Allocate a new conntrack: we return -ENOMEM if classification
@@ -502,7 +527,7 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
502 struct sk_buff *skb, 527 struct sk_buff *skb,
503 unsigned int dataoff) 528 unsigned int dataoff)
504{ 529{
505 struct nf_conn *conntrack; 530 struct nf_conn *ct;
506 struct nf_conn_help *help; 531 struct nf_conn_help *help;
507 struct nf_conntrack_tuple repl_tuple; 532 struct nf_conntrack_tuple repl_tuple;
508 struct nf_conntrack_expect *exp; 533 struct nf_conntrack_expect *exp;
@@ -512,46 +537,46 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
512 return NULL; 537 return NULL;
513 } 538 }
514 539
515 conntrack = nf_conntrack_alloc(tuple, &repl_tuple); 540 ct = nf_conntrack_alloc(tuple, &repl_tuple);
516 if (conntrack == NULL || IS_ERR(conntrack)) { 541 if (ct == NULL || IS_ERR(ct)) {
517 pr_debug("Can't allocate conntrack.\n"); 542 pr_debug("Can't allocate conntrack.\n");
518 return (struct nf_conntrack_tuple_hash *)conntrack; 543 return (struct nf_conntrack_tuple_hash *)ct;
519 } 544 }
520 545
521 if (!l4proto->new(conntrack, skb, dataoff)) { 546 if (!l4proto->new(ct, skb, dataoff)) {
522 nf_conntrack_free(conntrack); 547 nf_conntrack_free(ct);
523 pr_debug("init conntrack: can't track with proto module\n"); 548 pr_debug("init conntrack: can't track with proto module\n");
524 return NULL; 549 return NULL;
525 } 550 }
526 551
527 write_lock_bh(&nf_conntrack_lock); 552 spin_lock_bh(&nf_conntrack_lock);
528 exp = nf_ct_find_expectation(tuple); 553 exp = nf_ct_find_expectation(tuple);
529 if (exp) { 554 if (exp) {
530 pr_debug("conntrack: expectation arrives ct=%p exp=%p\n", 555 pr_debug("conntrack: expectation arrives ct=%p exp=%p\n",
531 conntrack, exp); 556 ct, exp);
532 /* Welcome, Mr. Bond. We've been expecting you... */ 557 /* Welcome, Mr. Bond. We've been expecting you... */
533 __set_bit(IPS_EXPECTED_BIT, &conntrack->status); 558 __set_bit(IPS_EXPECTED_BIT, &ct->status);
534 conntrack->master = exp->master; 559 ct->master = exp->master;
535 if (exp->helper) { 560 if (exp->helper) {
536 help = nf_ct_helper_ext_add(conntrack, GFP_ATOMIC); 561 help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
537 if (help) 562 if (help)
538 rcu_assign_pointer(help->helper, exp->helper); 563 rcu_assign_pointer(help->helper, exp->helper);
539 } 564 }
540 565
541#ifdef CONFIG_NF_CONNTRACK_MARK 566#ifdef CONFIG_NF_CONNTRACK_MARK
542 conntrack->mark = exp->master->mark; 567 ct->mark = exp->master->mark;
543#endif 568#endif
544#ifdef CONFIG_NF_CONNTRACK_SECMARK 569#ifdef CONFIG_NF_CONNTRACK_SECMARK
545 conntrack->secmark = exp->master->secmark; 570 ct->secmark = exp->master->secmark;
546#endif 571#endif
547 nf_conntrack_get(&conntrack->master->ct_general); 572 nf_conntrack_get(&ct->master->ct_general);
548 NF_CT_STAT_INC(expect_new); 573 NF_CT_STAT_INC(expect_new);
549 } else { 574 } else {
550 struct nf_conntrack_helper *helper; 575 struct nf_conntrack_helper *helper;
551 576
552 helper = __nf_ct_helper_find(&repl_tuple); 577 helper = __nf_ct_helper_find(&repl_tuple);
553 if (helper) { 578 if (helper) {
554 help = nf_ct_helper_ext_add(conntrack, GFP_ATOMIC); 579 help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
555 if (help) 580 if (help)
556 rcu_assign_pointer(help->helper, helper); 581 rcu_assign_pointer(help->helper, helper);
557 } 582 }
@@ -559,18 +584,17 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
559 } 584 }
560 585
561 /* Overload tuple linked list to put us in unconfirmed list. */ 586 /* Overload tuple linked list to put us in unconfirmed list. */
562 hlist_add_head(&conntrack->tuplehash[IP_CT_DIR_ORIGINAL].hnode, 587 hlist_add_head(&ct->tuplehash[IP_CT_DIR_ORIGINAL].hnode, &unconfirmed);
563 &unconfirmed);
564 588
565 write_unlock_bh(&nf_conntrack_lock); 589 spin_unlock_bh(&nf_conntrack_lock);
566 590
567 if (exp) { 591 if (exp) {
568 if (exp->expectfn) 592 if (exp->expectfn)
569 exp->expectfn(conntrack, exp); 593 exp->expectfn(ct, exp);
570 nf_ct_expect_put(exp); 594 nf_ct_expect_put(exp);
571 } 595 }
572 596
573 return &conntrack->tuplehash[IP_CT_DIR_ORIGINAL]; 597 return &ct->tuplehash[IP_CT_DIR_ORIGINAL];
574} 598}
575 599
576/* On success, returns conntrack ptr, sets skb->nfct and ctinfo */ 600/* On success, returns conntrack ptr, sets skb->nfct and ctinfo */
@@ -729,7 +753,6 @@ void nf_conntrack_alter_reply(struct nf_conn *ct,
729 struct nf_conn_help *help = nfct_help(ct); 753 struct nf_conn_help *help = nfct_help(ct);
730 struct nf_conntrack_helper *helper; 754 struct nf_conntrack_helper *helper;
731 755
732 write_lock_bh(&nf_conntrack_lock);
733 /* Should be unconfirmed, so not in hash table yet */ 756 /* Should be unconfirmed, so not in hash table yet */
734 NF_CT_ASSERT(!nf_ct_is_confirmed(ct)); 757 NF_CT_ASSERT(!nf_ct_is_confirmed(ct));
735 758
@@ -738,8 +761,9 @@ void nf_conntrack_alter_reply(struct nf_conn *ct,
738 761
739 ct->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply; 762 ct->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply;
740 if (ct->master || (help && help->expecting != 0)) 763 if (ct->master || (help && help->expecting != 0))
741 goto out; 764 return;
742 765
766 rcu_read_lock();
743 helper = __nf_ct_helper_find(newreply); 767 helper = __nf_ct_helper_find(newreply);
744 if (helper == NULL) { 768 if (helper == NULL) {
745 if (help) 769 if (help)
@@ -757,7 +781,7 @@ void nf_conntrack_alter_reply(struct nf_conn *ct,
757 781
758 rcu_assign_pointer(help->helper, helper); 782 rcu_assign_pointer(help->helper, helper);
759out: 783out:
760 write_unlock_bh(&nf_conntrack_lock); 784 rcu_read_unlock();
761} 785}
762EXPORT_SYMBOL_GPL(nf_conntrack_alter_reply); 786EXPORT_SYMBOL_GPL(nf_conntrack_alter_reply);
763 787
@@ -773,13 +797,11 @@ void __nf_ct_refresh_acct(struct nf_conn *ct,
773 NF_CT_ASSERT(ct->timeout.data == (unsigned long)ct); 797 NF_CT_ASSERT(ct->timeout.data == (unsigned long)ct);
774 NF_CT_ASSERT(skb); 798 NF_CT_ASSERT(skb);
775 799
776 write_lock_bh(&nf_conntrack_lock); 800 spin_lock_bh(&nf_conntrack_lock);
777 801
778 /* Only update if this is not a fixed timeout */ 802 /* Only update if this is not a fixed timeout */
779 if (test_bit(IPS_FIXED_TIMEOUT_BIT, &ct->status)) { 803 if (test_bit(IPS_FIXED_TIMEOUT_BIT, &ct->status))
780 write_unlock_bh(&nf_conntrack_lock); 804 goto acct;
781 return;
782 }
783 805
784 /* If not in hash table, timer will not be active yet */ 806 /* If not in hash table, timer will not be active yet */
785 if (!nf_ct_is_confirmed(ct)) { 807 if (!nf_ct_is_confirmed(ct)) {
@@ -799,6 +821,7 @@ void __nf_ct_refresh_acct(struct nf_conn *ct,
799 } 821 }
800 } 822 }
801 823
824acct:
802#ifdef CONFIG_NF_CT_ACCT 825#ifdef CONFIG_NF_CT_ACCT
803 if (do_acct) { 826 if (do_acct) {
804 ct->counters[CTINFO2DIR(ctinfo)].packets++; 827 ct->counters[CTINFO2DIR(ctinfo)].packets++;
@@ -811,7 +834,7 @@ void __nf_ct_refresh_acct(struct nf_conn *ct,
811 } 834 }
812#endif 835#endif
813 836
814 write_unlock_bh(&nf_conntrack_lock); 837 spin_unlock_bh(&nf_conntrack_lock);
815 838
816 /* must be unlocked when calling event cache */ 839 /* must be unlocked when calling event cache */
817 if (event) 840 if (event)
@@ -879,14 +902,6 @@ static void nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb)
879 nf_conntrack_get(nskb->nfct); 902 nf_conntrack_get(nskb->nfct);
880} 903}
881 904
882static inline int
883do_iter(const struct nf_conntrack_tuple_hash *i,
884 int (*iter)(struct nf_conn *i, void *data),
885 void *data)
886{
887 return iter(nf_ct_tuplehash_to_ctrack(i), data);
888}
889
890/* Bring out ya dead! */ 905/* Bring out ya dead! */
891static struct nf_conn * 906static struct nf_conn *
892get_next_corpse(int (*iter)(struct nf_conn *i, void *data), 907get_next_corpse(int (*iter)(struct nf_conn *i, void *data),
@@ -896,7 +911,7 @@ get_next_corpse(int (*iter)(struct nf_conn *i, void *data),
896 struct nf_conn *ct; 911 struct nf_conn *ct;
897 struct hlist_node *n; 912 struct hlist_node *n;
898 913
899 write_lock_bh(&nf_conntrack_lock); 914 spin_lock_bh(&nf_conntrack_lock);
900 for (; *bucket < nf_conntrack_htable_size; (*bucket)++) { 915 for (; *bucket < nf_conntrack_htable_size; (*bucket)++) {
901 hlist_for_each_entry(h, n, &nf_conntrack_hash[*bucket], hnode) { 916 hlist_for_each_entry(h, n, &nf_conntrack_hash[*bucket], hnode) {
902 ct = nf_ct_tuplehash_to_ctrack(h); 917 ct = nf_ct_tuplehash_to_ctrack(h);
@@ -909,11 +924,11 @@ get_next_corpse(int (*iter)(struct nf_conn *i, void *data),
909 if (iter(ct, data)) 924 if (iter(ct, data))
910 set_bit(IPS_DYING_BIT, &ct->status); 925 set_bit(IPS_DYING_BIT, &ct->status);
911 } 926 }
912 write_unlock_bh(&nf_conntrack_lock); 927 spin_unlock_bh(&nf_conntrack_lock);
913 return NULL; 928 return NULL;
914found: 929found:
915 atomic_inc(&ct->ct_general.use); 930 atomic_inc(&ct->ct_general.use);
916 write_unlock_bh(&nf_conntrack_lock); 931 spin_unlock_bh(&nf_conntrack_lock);
917 return ct; 932 return ct;
918} 933}
919 934
@@ -939,7 +954,7 @@ static int kill_all(struct nf_conn *i, void *data)
939 return 1; 954 return 1;
940} 955}
941 956
942void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced, int size) 957void nf_ct_free_hashtable(struct hlist_head *hash, int vmalloced, unsigned int size)
943{ 958{
944 if (vmalloced) 959 if (vmalloced)
945 vfree(hash); 960 vfree(hash);
@@ -988,7 +1003,7 @@ void nf_conntrack_cleanup(void)
988 nf_conntrack_expect_fini(); 1003 nf_conntrack_expect_fini();
989} 1004}
990 1005
991struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced) 1006struct hlist_head *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced)
992{ 1007{
993 struct hlist_head *hash; 1008 struct hlist_head *hash;
994 unsigned int size, i; 1009 unsigned int size, i;
@@ -1015,8 +1030,8 @@ EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
1015 1030
1016int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp) 1031int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
1017{ 1032{
1018 int i, bucket, hashsize, vmalloced; 1033 int i, bucket, vmalloced, old_vmalloced;
1019 int old_vmalloced, old_size; 1034 unsigned int hashsize, old_size;
1020 int rnd; 1035 int rnd;
1021 struct hlist_head *hash, *old_hash; 1036 struct hlist_head *hash, *old_hash;
1022 struct nf_conntrack_tuple_hash *h; 1037 struct nf_conntrack_tuple_hash *h;
@@ -1025,7 +1040,7 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
1025 if (!nf_conntrack_htable_size) 1040 if (!nf_conntrack_htable_size)
1026 return param_set_uint(val, kp); 1041 return param_set_uint(val, kp);
1027 1042
1028 hashsize = simple_strtol(val, NULL, 0); 1043 hashsize = simple_strtoul(val, NULL, 0);
1029 if (!hashsize) 1044 if (!hashsize)
1030 return -EINVAL; 1045 return -EINVAL;
1031 1046
@@ -1037,12 +1052,17 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
1037 * use a newrandom seed */ 1052 * use a newrandom seed */
1038 get_random_bytes(&rnd, 4); 1053 get_random_bytes(&rnd, 4);
1039 1054
1040 write_lock_bh(&nf_conntrack_lock); 1055 /* Lookups in the old hash might happen in parallel, which means we
1056 * might get false negatives during connection lookup. New connections
1057 * created because of a false negative won't make it into the hash
1058 * though since that required taking the lock.
1059 */
1060 spin_lock_bh(&nf_conntrack_lock);
1041 for (i = 0; i < nf_conntrack_htable_size; i++) { 1061 for (i = 0; i < nf_conntrack_htable_size; i++) {
1042 while (!hlist_empty(&nf_conntrack_hash[i])) { 1062 while (!hlist_empty(&nf_conntrack_hash[i])) {
1043 h = hlist_entry(nf_conntrack_hash[i].first, 1063 h = hlist_entry(nf_conntrack_hash[i].first,
1044 struct nf_conntrack_tuple_hash, hnode); 1064 struct nf_conntrack_tuple_hash, hnode);
1045 hlist_del(&h->hnode); 1065 hlist_del_rcu(&h->hnode);
1046 bucket = __hash_conntrack(&h->tuple, hashsize, rnd); 1066 bucket = __hash_conntrack(&h->tuple, hashsize, rnd);
1047 hlist_add_head(&h->hnode, &hash[bucket]); 1067 hlist_add_head(&h->hnode, &hash[bucket]);
1048 } 1068 }
@@ -1055,7 +1075,7 @@ int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
1055 nf_conntrack_vmalloc = vmalloced; 1075 nf_conntrack_vmalloc = vmalloced;
1056 nf_conntrack_hash = hash; 1076 nf_conntrack_hash = hash;
1057 nf_conntrack_hash_rnd = rnd; 1077 nf_conntrack_hash_rnd = rnd;
1058 write_unlock_bh(&nf_conntrack_lock); 1078 spin_unlock_bh(&nf_conntrack_lock);
1059 1079
1060 nf_ct_free_hashtable(old_hash, old_vmalloced, old_size); 1080 nf_ct_free_hashtable(old_hash, old_vmalloced, old_size);
1061 return 0; 1081 return 0;
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index e0cd9d00aa61..e06bf0028bb1 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -50,7 +50,7 @@ void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)
50 NF_CT_ASSERT(master_help); 50 NF_CT_ASSERT(master_help);
51 NF_CT_ASSERT(!timer_pending(&exp->timeout)); 51 NF_CT_ASSERT(!timer_pending(&exp->timeout));
52 52
53 hlist_del(&exp->hnode); 53 hlist_del_rcu(&exp->hnode);
54 nf_ct_expect_count--; 54 nf_ct_expect_count--;
55 55
56 hlist_del(&exp->lnode); 56 hlist_del(&exp->lnode);
@@ -65,9 +65,9 @@ static void nf_ct_expectation_timed_out(unsigned long ul_expect)
65{ 65{
66 struct nf_conntrack_expect *exp = (void *)ul_expect; 66 struct nf_conntrack_expect *exp = (void *)ul_expect;
67 67
68 write_lock_bh(&nf_conntrack_lock); 68 spin_lock_bh(&nf_conntrack_lock);
69 nf_ct_unlink_expect(exp); 69 nf_ct_unlink_expect(exp);
70 write_unlock_bh(&nf_conntrack_lock); 70 spin_unlock_bh(&nf_conntrack_lock);
71 nf_ct_expect_put(exp); 71 nf_ct_expect_put(exp);
72} 72}
73 73
@@ -97,7 +97,7 @@ __nf_ct_expect_find(const struct nf_conntrack_tuple *tuple)
97 return NULL; 97 return NULL;
98 98
99 h = nf_ct_expect_dst_hash(tuple); 99 h = nf_ct_expect_dst_hash(tuple);
100 hlist_for_each_entry(i, n, &nf_ct_expect_hash[h], hnode) { 100 hlist_for_each_entry_rcu(i, n, &nf_ct_expect_hash[h], hnode) {
101 if (nf_ct_tuple_mask_cmp(tuple, &i->tuple, &i->mask)) 101 if (nf_ct_tuple_mask_cmp(tuple, &i->tuple, &i->mask))
102 return i; 102 return i;
103 } 103 }
@@ -111,11 +111,11 @@ nf_ct_expect_find_get(const struct nf_conntrack_tuple *tuple)
111{ 111{
112 struct nf_conntrack_expect *i; 112 struct nf_conntrack_expect *i;
113 113
114 read_lock_bh(&nf_conntrack_lock); 114 rcu_read_lock();
115 i = __nf_ct_expect_find(tuple); 115 i = __nf_ct_expect_find(tuple);
116 if (i) 116 if (i && !atomic_inc_not_zero(&i->use))
117 atomic_inc(&i->use); 117 i = NULL;
118 read_unlock_bh(&nf_conntrack_lock); 118 rcu_read_unlock();
119 119
120 return i; 120 return i;
121} 121}
@@ -201,12 +201,12 @@ static inline int expect_matches(const struct nf_conntrack_expect *a,
201/* Generally a bad idea to call this: could have matched already. */ 201/* Generally a bad idea to call this: could have matched already. */
202void nf_ct_unexpect_related(struct nf_conntrack_expect *exp) 202void nf_ct_unexpect_related(struct nf_conntrack_expect *exp)
203{ 203{
204 write_lock_bh(&nf_conntrack_lock); 204 spin_lock_bh(&nf_conntrack_lock);
205 if (del_timer(&exp->timeout)) { 205 if (del_timer(&exp->timeout)) {
206 nf_ct_unlink_expect(exp); 206 nf_ct_unlink_expect(exp);
207 nf_ct_expect_put(exp); 207 nf_ct_expect_put(exp);
208 } 208 }
209 write_unlock_bh(&nf_conntrack_lock); 209 spin_unlock_bh(&nf_conntrack_lock);
210} 210}
211EXPORT_SYMBOL_GPL(nf_ct_unexpect_related); 211EXPORT_SYMBOL_GPL(nf_ct_unexpect_related);
212 212
@@ -223,6 +223,7 @@ struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me)
223 223
224 new->master = me; 224 new->master = me;
225 atomic_set(&new->use, 1); 225 atomic_set(&new->use, 1);
226 INIT_RCU_HEAD(&new->rcu);
226 return new; 227 return new;
227} 228}
228EXPORT_SYMBOL_GPL(nf_ct_expect_alloc); 229EXPORT_SYMBOL_GPL(nf_ct_expect_alloc);
@@ -278,10 +279,18 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, int family,
278} 279}
279EXPORT_SYMBOL_GPL(nf_ct_expect_init); 280EXPORT_SYMBOL_GPL(nf_ct_expect_init);
280 281
282static void nf_ct_expect_free_rcu(struct rcu_head *head)
283{
284 struct nf_conntrack_expect *exp;
285
286 exp = container_of(head, struct nf_conntrack_expect, rcu);
287 kmem_cache_free(nf_ct_expect_cachep, exp);
288}
289
281void nf_ct_expect_put(struct nf_conntrack_expect *exp) 290void nf_ct_expect_put(struct nf_conntrack_expect *exp)
282{ 291{
283 if (atomic_dec_and_test(&exp->use)) 292 if (atomic_dec_and_test(&exp->use))
284 kmem_cache_free(nf_ct_expect_cachep, exp); 293 call_rcu(&exp->rcu, nf_ct_expect_free_rcu);
285} 294}
286EXPORT_SYMBOL_GPL(nf_ct_expect_put); 295EXPORT_SYMBOL_GPL(nf_ct_expect_put);
287 296
@@ -295,7 +304,7 @@ static void nf_ct_expect_insert(struct nf_conntrack_expect *exp)
295 hlist_add_head(&exp->lnode, &master_help->expectations); 304 hlist_add_head(&exp->lnode, &master_help->expectations);
296 master_help->expecting++; 305 master_help->expecting++;
297 306
298 hlist_add_head(&exp->hnode, &nf_ct_expect_hash[h]); 307 hlist_add_head_rcu(&exp->hnode, &nf_ct_expect_hash[h]);
299 nf_ct_expect_count++; 308 nf_ct_expect_count++;
300 309
301 setup_timer(&exp->timeout, nf_ct_expectation_timed_out, 310 setup_timer(&exp->timeout, nf_ct_expectation_timed_out,
@@ -346,7 +355,7 @@ int nf_ct_expect_related(struct nf_conntrack_expect *expect)
346 355
347 NF_CT_ASSERT(master_help); 356 NF_CT_ASSERT(master_help);
348 357
349 write_lock_bh(&nf_conntrack_lock); 358 spin_lock_bh(&nf_conntrack_lock);
350 if (!master_help->helper) { 359 if (!master_help->helper) {
351 ret = -ESHUTDOWN; 360 ret = -ESHUTDOWN;
352 goto out; 361 goto out;
@@ -381,7 +390,7 @@ int nf_ct_expect_related(struct nf_conntrack_expect *expect)
381 nf_ct_expect_event(IPEXP_NEW, expect); 390 nf_ct_expect_event(IPEXP_NEW, expect);
382 ret = 0; 391 ret = 0;
383out: 392out:
384 write_unlock_bh(&nf_conntrack_lock); 393 spin_unlock_bh(&nf_conntrack_lock);
385 return ret; 394 return ret;
386} 395}
387EXPORT_SYMBOL_GPL(nf_ct_expect_related); 396EXPORT_SYMBOL_GPL(nf_ct_expect_related);
@@ -394,10 +403,12 @@ struct ct_expect_iter_state {
394static struct hlist_node *ct_expect_get_first(struct seq_file *seq) 403static struct hlist_node *ct_expect_get_first(struct seq_file *seq)
395{ 404{
396 struct ct_expect_iter_state *st = seq->private; 405 struct ct_expect_iter_state *st = seq->private;
406 struct hlist_node *n;
397 407
398 for (st->bucket = 0; st->bucket < nf_ct_expect_hsize; st->bucket++) { 408 for (st->bucket = 0; st->bucket < nf_ct_expect_hsize; st->bucket++) {
399 if (!hlist_empty(&nf_ct_expect_hash[st->bucket])) 409 n = rcu_dereference(nf_ct_expect_hash[st->bucket].first);
400 return nf_ct_expect_hash[st->bucket].first; 410 if (n)
411 return n;
401 } 412 }
402 return NULL; 413 return NULL;
403} 414}
@@ -407,11 +418,11 @@ static struct hlist_node *ct_expect_get_next(struct seq_file *seq,
407{ 418{
408 struct ct_expect_iter_state *st = seq->private; 419 struct ct_expect_iter_state *st = seq->private;
409 420
410 head = head->next; 421 head = rcu_dereference(head->next);
411 while (head == NULL) { 422 while (head == NULL) {
412 if (++st->bucket >= nf_ct_expect_hsize) 423 if (++st->bucket >= nf_ct_expect_hsize)
413 return NULL; 424 return NULL;
414 head = nf_ct_expect_hash[st->bucket].first; 425 head = rcu_dereference(nf_ct_expect_hash[st->bucket].first);
415 } 426 }
416 return head; 427 return head;
417} 428}
@@ -427,8 +438,9 @@ static struct hlist_node *ct_expect_get_idx(struct seq_file *seq, loff_t pos)
427} 438}
428 439
429static void *exp_seq_start(struct seq_file *seq, loff_t *pos) 440static void *exp_seq_start(struct seq_file *seq, loff_t *pos)
441 __acquires(RCU)
430{ 442{
431 read_lock_bh(&nf_conntrack_lock); 443 rcu_read_lock();
432 return ct_expect_get_idx(seq, *pos); 444 return ct_expect_get_idx(seq, *pos);
433} 445}
434 446
@@ -439,8 +451,9 @@ static void *exp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
439} 451}
440 452
441static void exp_seq_stop(struct seq_file *seq, void *v) 453static void exp_seq_stop(struct seq_file *seq, void *v)
454 __releases(RCU)
442{ 455{
443 read_unlock_bh(&nf_conntrack_lock); 456 rcu_read_unlock();
444} 457}
445 458
446static int exp_seq_show(struct seq_file *s, void *v) 459static int exp_seq_show(struct seq_file *s, void *v)
diff --git a/net/netfilter/nf_conntrack_h323_asn1.c b/net/netfilter/nf_conntrack_h323_asn1.c
index ff66fba514fd..867882313e49 100644
--- a/net/netfilter/nf_conntrack_h323_asn1.c
+++ b/net/netfilter/nf_conntrack_h323_asn1.c
@@ -87,7 +87,7 @@ typedef struct field_t {
87 unsigned char ub; 87 unsigned char ub;
88 unsigned short attr; 88 unsigned short attr;
89 unsigned short offset; 89 unsigned short offset;
90 struct field_t *fields; 90 const struct field_t *fields;
91} field_t; 91} field_t;
92 92
93/* Bit Stream */ 93/* Bit Stream */
@@ -96,7 +96,7 @@ typedef struct {
96 unsigned char *beg; 96 unsigned char *beg;
97 unsigned char *end; 97 unsigned char *end;
98 unsigned char *cur; 98 unsigned char *cur;
99 unsigned bit; 99 unsigned int bit;
100} bitstr_t; 100} bitstr_t;
101 101
102/* Tool Functions */ 102/* Tool Functions */
@@ -104,29 +104,29 @@ typedef struct {
104#define INC_BITS(bs,b) if(((bs)->bit+=(b))>7){(bs)->cur+=(bs)->bit>>3;(bs)->bit&=7;} 104#define INC_BITS(bs,b) if(((bs)->bit+=(b))>7){(bs)->cur+=(bs)->bit>>3;(bs)->bit&=7;}
105#define BYTE_ALIGN(bs) if((bs)->bit){(bs)->cur++;(bs)->bit=0;} 105#define BYTE_ALIGN(bs) if((bs)->bit){(bs)->cur++;(bs)->bit=0;}
106#define CHECK_BOUND(bs,n) if((bs)->cur+(n)>(bs)->end)return(H323_ERROR_BOUND) 106#define CHECK_BOUND(bs,n) if((bs)->cur+(n)>(bs)->end)return(H323_ERROR_BOUND)
107static unsigned get_len(bitstr_t * bs); 107static unsigned int get_len(bitstr_t *bs);
108static unsigned get_bit(bitstr_t * bs); 108static unsigned int get_bit(bitstr_t *bs);
109static unsigned get_bits(bitstr_t * bs, unsigned b); 109static unsigned int get_bits(bitstr_t *bs, unsigned int b);
110static unsigned get_bitmap(bitstr_t * bs, unsigned b); 110static unsigned int get_bitmap(bitstr_t *bs, unsigned int b);
111static unsigned get_uint(bitstr_t * bs, int b); 111static unsigned int get_uint(bitstr_t *bs, int b);
112 112
113/* Decoder Functions */ 113/* Decoder Functions */
114static int decode_nul(bitstr_t * bs, field_t * f, char *base, int level); 114static int decode_nul(bitstr_t *bs, const struct field_t *f, char *base, int level);
115static int decode_bool(bitstr_t * bs, field_t * f, char *base, int level); 115static int decode_bool(bitstr_t *bs, const struct field_t *f, char *base, int level);
116static int decode_oid(bitstr_t * bs, field_t * f, char *base, int level); 116static int decode_oid(bitstr_t *bs, const struct field_t *f, char *base, int level);
117static int decode_int(bitstr_t * bs, field_t * f, char *base, int level); 117static int decode_int(bitstr_t *bs, const struct field_t *f, char *base, int level);
118static int decode_enum(bitstr_t * bs, field_t * f, char *base, int level); 118static int decode_enum(bitstr_t *bs, const struct field_t *f, char *base, int level);
119static int decode_bitstr(bitstr_t * bs, field_t * f, char *base, int level); 119static int decode_bitstr(bitstr_t *bs, const struct field_t *f, char *base, int level);
120static int decode_numstr(bitstr_t * bs, field_t * f, char *base, int level); 120static int decode_numstr(bitstr_t *bs, const struct field_t *f, char *base, int level);
121static int decode_octstr(bitstr_t * bs, field_t * f, char *base, int level); 121static int decode_octstr(bitstr_t *bs, const struct field_t *f, char *base, int level);
122static int decode_bmpstr(bitstr_t * bs, field_t * f, char *base, int level); 122static int decode_bmpstr(bitstr_t *bs, const struct field_t *f, char *base, int level);
123static int decode_seq(bitstr_t * bs, field_t * f, char *base, int level); 123static int decode_seq(bitstr_t *bs, const struct field_t *f, char *base, int level);
124static int decode_seqof(bitstr_t * bs, field_t * f, char *base, int level); 124static int decode_seqof(bitstr_t *bs, const struct field_t *f, char *base, int level);
125static int decode_choice(bitstr_t * bs, field_t * f, char *base, int level); 125static int decode_choice(bitstr_t *bs, const struct field_t *f, char *base, int level);
126 126
127/* Decoder Functions Vector */ 127/* Decoder Functions Vector */
128typedef int (*decoder_t) (bitstr_t *, field_t *, char *, int); 128typedef int (*decoder_t)(bitstr_t *, const struct field_t *, char *, int);
129static decoder_t Decoders[] = { 129static const decoder_t Decoders[] = {
130 decode_nul, 130 decode_nul,
131 decode_bool, 131 decode_bool,
132 decode_oid, 132 decode_oid,
@@ -150,9 +150,9 @@ static decoder_t Decoders[] = {
150 * Functions 150 * Functions
151 ****************************************************************************/ 151 ****************************************************************************/
152/* Assume bs is aligned && v < 16384 */ 152/* Assume bs is aligned && v < 16384 */
153unsigned get_len(bitstr_t * bs) 153static unsigned int get_len(bitstr_t *bs)
154{ 154{
155 unsigned v; 155 unsigned int v;
156 156
157 v = *bs->cur++; 157 v = *bs->cur++;
158 158
@@ -166,9 +166,9 @@ unsigned get_len(bitstr_t * bs)
166} 166}
167 167
168/****************************************************************************/ 168/****************************************************************************/
169unsigned get_bit(bitstr_t * bs) 169static unsigned int get_bit(bitstr_t *bs)
170{ 170{
171 unsigned b = (*bs->cur) & (0x80 >> bs->bit); 171 unsigned int b = (*bs->cur) & (0x80 >> bs->bit);
172 172
173 INC_BIT(bs); 173 INC_BIT(bs);
174 174
@@ -177,9 +177,9 @@ unsigned get_bit(bitstr_t * bs)
177 177
178/****************************************************************************/ 178/****************************************************************************/
179/* Assume b <= 8 */ 179/* Assume b <= 8 */
180unsigned get_bits(bitstr_t * bs, unsigned b) 180static unsigned int get_bits(bitstr_t *bs, unsigned int b)
181{ 181{
182 unsigned v, l; 182 unsigned int v, l;
183 183
184 v = (*bs->cur) & (0xffU >> bs->bit); 184 v = (*bs->cur) & (0xffU >> bs->bit);
185 l = b + bs->bit; 185 l = b + bs->bit;
@@ -203,9 +203,9 @@ unsigned get_bits(bitstr_t * bs, unsigned b)
203 203
204/****************************************************************************/ 204/****************************************************************************/
205/* Assume b <= 32 */ 205/* Assume b <= 32 */
206unsigned get_bitmap(bitstr_t * bs, unsigned b) 206static unsigned int get_bitmap(bitstr_t *bs, unsigned int b)
207{ 207{
208 unsigned v, l, shift, bytes; 208 unsigned int v, l, shift, bytes;
209 209
210 if (!b) 210 if (!b)
211 return 0; 211 return 0;
@@ -213,18 +213,18 @@ unsigned get_bitmap(bitstr_t * bs, unsigned b)
213 l = bs->bit + b; 213 l = bs->bit + b;
214 214
215 if (l < 8) { 215 if (l < 8) {
216 v = (unsigned) (*bs->cur) << (bs->bit + 24); 216 v = (unsigned int)(*bs->cur) << (bs->bit + 24);
217 bs->bit = l; 217 bs->bit = l;
218 } else if (l == 8) { 218 } else if (l == 8) {
219 v = (unsigned) (*bs->cur++) << (bs->bit + 24); 219 v = (unsigned int)(*bs->cur++) << (bs->bit + 24);
220 bs->bit = 0; 220 bs->bit = 0;
221 } else { 221 } else {
222 for (bytes = l >> 3, shift = 24, v = 0; bytes; 222 for (bytes = l >> 3, shift = 24, v = 0; bytes;
223 bytes--, shift -= 8) 223 bytes--, shift -= 8)
224 v |= (unsigned) (*bs->cur++) << shift; 224 v |= (unsigned int)(*bs->cur++) << shift;
225 225
226 if (l < 32) { 226 if (l < 32) {
227 v |= (unsigned) (*bs->cur) << shift; 227 v |= (unsigned int)(*bs->cur) << shift;
228 v <<= bs->bit; 228 v <<= bs->bit;
229 } else if (l > 32) { 229 } else if (l > 32) {
230 v <<= bs->bit; 230 v <<= bs->bit;
@@ -242,9 +242,9 @@ unsigned get_bitmap(bitstr_t * bs, unsigned b)
242/**************************************************************************** 242/****************************************************************************
243 * Assume bs is aligned and sizeof(unsigned int) == 4 243 * Assume bs is aligned and sizeof(unsigned int) == 4
244 ****************************************************************************/ 244 ****************************************************************************/
245unsigned get_uint(bitstr_t * bs, int b) 245static unsigned int get_uint(bitstr_t *bs, int b)
246{ 246{
247 unsigned v = 0; 247 unsigned int v = 0;
248 248
249 switch (b) { 249 switch (b) {
250 case 4: 250 case 4:
@@ -264,7 +264,8 @@ unsigned get_uint(bitstr_t * bs, int b)
264} 264}
265 265
266/****************************************************************************/ 266/****************************************************************************/
267int decode_nul(bitstr_t * bs, field_t * f, char *base, int level) 267static int decode_nul(bitstr_t *bs, const struct field_t *f,
268 char *base, int level)
268{ 269{
269 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); 270 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
270 271
@@ -272,7 +273,8 @@ int decode_nul(bitstr_t * bs, field_t * f, char *base, int level)
272} 273}
273 274
274/****************************************************************************/ 275/****************************************************************************/
275int decode_bool(bitstr_t * bs, field_t * f, char *base, int level) 276static int decode_bool(bitstr_t *bs, const struct field_t *f,
277 char *base, int level)
276{ 278{
277 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); 279 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
278 280
@@ -283,7 +285,8 @@ int decode_bool(bitstr_t * bs, field_t * f, char *base, int level)
283} 285}
284 286
285/****************************************************************************/ 287/****************************************************************************/
286int decode_oid(bitstr_t * bs, field_t * f, char *base, int level) 288static int decode_oid(bitstr_t *bs, const struct field_t *f,
289 char *base, int level)
287{ 290{
288 int len; 291 int len;
289 292
@@ -299,9 +302,10 @@ int decode_oid(bitstr_t * bs, field_t * f, char *base, int level)
299} 302}
300 303
301/****************************************************************************/ 304/****************************************************************************/
302int decode_int(bitstr_t * bs, field_t * f, char *base, int level) 305static int decode_int(bitstr_t *bs, const struct field_t *f,
306 char *base, int level)
303{ 307{
304 unsigned len; 308 unsigned int len;
305 309
306 PRINT("%*.s%s", level * TAB_SIZE, " ", f->name); 310 PRINT("%*.s%s", level * TAB_SIZE, " ", f->name);
307 311
@@ -318,9 +322,9 @@ int decode_int(bitstr_t * bs, field_t * f, char *base, int level)
318 len = get_bits(bs, 2) + 1; 322 len = get_bits(bs, 2) + 1;
319 BYTE_ALIGN(bs); 323 BYTE_ALIGN(bs);
320 if (base && (f->attr & DECODE)) { /* timeToLive */ 324 if (base && (f->attr & DECODE)) { /* timeToLive */
321 unsigned v = get_uint(bs, len) + f->lb; 325 unsigned int v = get_uint(bs, len) + f->lb;
322 PRINT(" = %u", v); 326 PRINT(" = %u", v);
323 *((unsigned *) (base + f->offset)) = v; 327 *((unsigned int *)(base + f->offset)) = v;
324 } 328 }
325 bs->cur += len; 329 bs->cur += len;
326 break; 330 break;
@@ -342,7 +346,8 @@ int decode_int(bitstr_t * bs, field_t * f, char *base, int level)
342} 346}
343 347
344/****************************************************************************/ 348/****************************************************************************/
345int decode_enum(bitstr_t * bs, field_t * f, char *base, int level) 349static int decode_enum(bitstr_t *bs, const struct field_t *f,
350 char *base, int level)
346{ 351{
347 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); 352 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
348 353
@@ -357,9 +362,10 @@ int decode_enum(bitstr_t * bs, field_t * f, char *base, int level)
357} 362}
358 363
359/****************************************************************************/ 364/****************************************************************************/
360int decode_bitstr(bitstr_t * bs, field_t * f, char *base, int level) 365static int decode_bitstr(bitstr_t *bs, const struct field_t *f,
366 char *base, int level)
361{ 367{
362 unsigned len; 368 unsigned int len;
363 369
364 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); 370 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
365 371
@@ -390,9 +396,10 @@ int decode_bitstr(bitstr_t * bs, field_t * f, char *base, int level)
390} 396}
391 397
392/****************************************************************************/ 398/****************************************************************************/
393int decode_numstr(bitstr_t * bs, field_t * f, char *base, int level) 399static int decode_numstr(bitstr_t *bs, const struct field_t *f,
400 char *base, int level)
394{ 401{
395 unsigned len; 402 unsigned int len;
396 403
397 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); 404 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
398 405
@@ -407,9 +414,10 @@ int decode_numstr(bitstr_t * bs, field_t * f, char *base, int level)
407} 414}
408 415
409/****************************************************************************/ 416/****************************************************************************/
410int decode_octstr(bitstr_t * bs, field_t * f, char *base, int level) 417static int decode_octstr(bitstr_t *bs, const struct field_t *f,
418 char *base, int level)
411{ 419{
412 unsigned len; 420 unsigned int len;
413 421
414 PRINT("%*.s%s", level * TAB_SIZE, " ", f->name); 422 PRINT("%*.s%s", level * TAB_SIZE, " ", f->name);
415 423
@@ -424,7 +432,7 @@ int decode_octstr(bitstr_t * bs, field_t * f, char *base, int level)
424 bs->cur[0], bs->cur[1], 432 bs->cur[0], bs->cur[1],
425 bs->cur[2], bs->cur[3], 433 bs->cur[2], bs->cur[3],
426 bs->cur[4] * 256 + bs->cur[5])); 434 bs->cur[4] * 256 + bs->cur[5]));
427 *((unsigned *) (base + f->offset)) = 435 *((unsigned int *)(base + f->offset)) =
428 bs->cur - bs->buf; 436 bs->cur - bs->buf;
429 } 437 }
430 } 438 }
@@ -455,9 +463,10 @@ int decode_octstr(bitstr_t * bs, field_t * f, char *base, int level)
455} 463}
456 464
457/****************************************************************************/ 465/****************************************************************************/
458int decode_bmpstr(bitstr_t * bs, field_t * f, char *base, int level) 466static int decode_bmpstr(bitstr_t *bs, const struct field_t *f,
467 char *base, int level)
459{ 468{
460 unsigned len; 469 unsigned int len;
461 470
462 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); 471 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
463 472
@@ -480,11 +489,12 @@ int decode_bmpstr(bitstr_t * bs, field_t * f, char *base, int level)
480} 489}
481 490
482/****************************************************************************/ 491/****************************************************************************/
483int decode_seq(bitstr_t * bs, field_t * f, char *base, int level) 492static int decode_seq(bitstr_t *bs, const struct field_t *f,
493 char *base, int level)
484{ 494{
485 unsigned ext, bmp, i, opt, len = 0, bmp2, bmp2_len; 495 unsigned int ext, bmp, i, opt, len = 0, bmp2, bmp2_len;
486 int err; 496 int err;
487 field_t *son; 497 const struct field_t *son;
488 unsigned char *beg = NULL; 498 unsigned char *beg = NULL;
489 499
490 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); 500 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
@@ -498,7 +508,7 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level)
498 /* Get fields bitmap */ 508 /* Get fields bitmap */
499 bmp = get_bitmap(bs, f->sz); 509 bmp = get_bitmap(bs, f->sz);
500 if (base) 510 if (base)
501 *(unsigned *) base = bmp; 511 *(unsigned int *)base = bmp;
502 512
503 /* Decode the root components */ 513 /* Decode the root components */
504 for (i = opt = 0, son = f->fields; i < f->lb; i++, son++) { 514 for (i = opt = 0, son = f->fields; i < f->lb; i++, son++) {
@@ -550,7 +560,7 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level)
550 bmp2 = get_bitmap(bs, bmp2_len); 560 bmp2 = get_bitmap(bs, bmp2_len);
551 bmp |= bmp2 >> f->sz; 561 bmp |= bmp2 >> f->sz;
552 if (base) 562 if (base)
553 *(unsigned *) base = bmp; 563 *(unsigned int *)base = bmp;
554 BYTE_ALIGN(bs); 564 BYTE_ALIGN(bs);
555 565
556 /* Decode the extension components */ 566 /* Decode the extension components */
@@ -596,11 +606,12 @@ int decode_seq(bitstr_t * bs, field_t * f, char *base, int level)
596} 606}
597 607
598/****************************************************************************/ 608/****************************************************************************/
599int decode_seqof(bitstr_t * bs, field_t * f, char *base, int level) 609static int decode_seqof(bitstr_t *bs, const struct field_t *f,
610 char *base, int level)
600{ 611{
601 unsigned count, effective_count = 0, i, len = 0; 612 unsigned int count, effective_count = 0, i, len = 0;
602 int err; 613 int err;
603 field_t *son; 614 const struct field_t *son;
604 unsigned char *beg = NULL; 615 unsigned char *beg = NULL;
605 616
606 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); 617 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
@@ -636,8 +647,8 @@ int decode_seqof(bitstr_t * bs, field_t * f, char *base, int level)
636 /* Write Count */ 647 /* Write Count */
637 if (base) { 648 if (base) {
638 effective_count = count > f->ub ? f->ub : count; 649 effective_count = count > f->ub ? f->ub : count;
639 *(unsigned *) base = effective_count; 650 *(unsigned int *)base = effective_count;
640 base += sizeof(unsigned); 651 base += sizeof(unsigned int);
641 } 652 }
642 653
643 /* Decode nested field */ 654 /* Decode nested field */
@@ -685,11 +696,12 @@ int decode_seqof(bitstr_t * bs, field_t * f, char *base, int level)
685 696
686 697
687/****************************************************************************/ 698/****************************************************************************/
688int decode_choice(bitstr_t * bs, field_t * f, char *base, int level) 699static int decode_choice(bitstr_t *bs, const struct field_t *f,
700 char *base, int level)
689{ 701{
690 unsigned type, ext, len = 0; 702 unsigned int type, ext, len = 0;
691 int err; 703 int err;
692 field_t *son; 704 const struct field_t *son;
693 unsigned char *beg = NULL; 705 unsigned char *beg = NULL;
694 706
695 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name); 707 PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
@@ -710,7 +722,7 @@ int decode_choice(bitstr_t * bs, field_t * f, char *base, int level)
710 722
711 /* Write Type */ 723 /* Write Type */
712 if (base) 724 if (base)
713 *(unsigned *) base = type; 725 *(unsigned int *)base = type;
714 726
715 /* Check Range */ 727 /* Check Range */
716 if (type >= f->ub) { /* Newer version? */ 728 if (type >= f->ub) { /* Newer version? */
@@ -754,9 +766,9 @@ int decode_choice(bitstr_t * bs, field_t * f, char *base, int level)
754} 766}
755 767
756/****************************************************************************/ 768/****************************************************************************/
757int DecodeRasMessage(unsigned char *buf, size_t sz, RasMessage * ras) 769int DecodeRasMessage(unsigned char *buf, size_t sz, RasMessage *ras)
758{ 770{
759 static field_t ras_message = { 771 static const struct field_t ras_message = {
760 FNAME("RasMessage") CHOICE, 5, 24, 32, DECODE | EXT, 772 FNAME("RasMessage") CHOICE, 5, 24, 32, DECODE | EXT,
761 0, _RasMessage 773 0, _RasMessage
762 }; 774 };
@@ -771,9 +783,9 @@ int DecodeRasMessage(unsigned char *buf, size_t sz, RasMessage * ras)
771 783
772/****************************************************************************/ 784/****************************************************************************/
773static int DecodeH323_UserInformation(unsigned char *buf, unsigned char *beg, 785static int DecodeH323_UserInformation(unsigned char *buf, unsigned char *beg,
774 size_t sz, H323_UserInformation * uuie) 786 size_t sz, H323_UserInformation *uuie)
775{ 787{
776 static field_t h323_userinformation = { 788 static const struct field_t h323_userinformation = {
777 FNAME("H323-UserInformation") SEQ, 1, 2, 2, DECODE | EXT, 789 FNAME("H323-UserInformation") SEQ, 1, 2, 2, DECODE | EXT,
778 0, _H323_UserInformation 790 0, _H323_UserInformation
779 }; 791 };
@@ -792,7 +804,7 @@ int DecodeMultimediaSystemControlMessage(unsigned char *buf, size_t sz,
792 MultimediaSystemControlMessage * 804 MultimediaSystemControlMessage *
793 mscm) 805 mscm)
794{ 806{
795 static field_t multimediasystemcontrolmessage = { 807 static const struct field_t multimediasystemcontrolmessage = {
796 FNAME("MultimediaSystemControlMessage") CHOICE, 2, 4, 4, 808 FNAME("MultimediaSystemControlMessage") CHOICE, 2, 4, 4,
797 DECODE | EXT, 0, _MultimediaSystemControlMessage 809 DECODE | EXT, 0, _MultimediaSystemControlMessage
798 }; 810 };
@@ -807,7 +819,7 @@ int DecodeMultimediaSystemControlMessage(unsigned char *buf, size_t sz,
807} 819}
808 820
809/****************************************************************************/ 821/****************************************************************************/
810int DecodeQ931(unsigned char *buf, size_t sz, Q931 * q931) 822int DecodeQ931(unsigned char *buf, size_t sz, Q931 *q931)
811{ 823{
812 unsigned char *p = buf; 824 unsigned char *p = buf;
813 int len; 825 int len;
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c
index 872c1aa3124c..62137879e6aa 100644
--- a/net/netfilter/nf_conntrack_h323_main.c
+++ b/net/netfilter/nf_conntrack_h323_main.c
@@ -114,7 +114,8 @@ static int get_tpkt_data(struct sk_buff *skb, unsigned int protoff,
114{ 114{
115 struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info; 115 struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
116 int dir = CTINFO2DIR(ctinfo); 116 int dir = CTINFO2DIR(ctinfo);
117 struct tcphdr _tcph, *th; 117 const struct tcphdr *th;
118 struct tcphdr _tcph;
118 int tcpdatalen; 119 int tcpdatalen;
119 int tcpdataoff; 120 int tcpdataoff;
120 unsigned char *tpkt; 121 unsigned char *tpkt;
@@ -212,11 +213,11 @@ static int get_tpkt_data(struct sk_buff *skb, unsigned int protoff,
212} 213}
213 214
214/****************************************************************************/ 215/****************************************************************************/
215static int get_h245_addr(struct nf_conn *ct, unsigned char *data, 216static int get_h245_addr(struct nf_conn *ct, const unsigned char *data,
216 H245_TransportAddress *taddr, 217 H245_TransportAddress *taddr,
217 union nf_inet_addr *addr, __be16 *port) 218 union nf_inet_addr *addr, __be16 *port)
218{ 219{
219 unsigned char *p; 220 const unsigned char *p;
220 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num; 221 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
221 int len; 222 int len;
222 223
@@ -625,7 +626,7 @@ int get_h225_addr(struct nf_conn *ct, unsigned char *data,
625 TransportAddress *taddr, 626 TransportAddress *taddr,
626 union nf_inet_addr *addr, __be16 *port) 627 union nf_inet_addr *addr, __be16 *port)
627{ 628{
628 unsigned char *p; 629 const unsigned char *p;
629 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num; 630 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
630 int len; 631 int len;
631 632
@@ -704,9 +705,8 @@ static int expect_h245(struct sk_buff *skb, struct nf_conn *ct,
704 705
705/* If the calling party is on the same side of the forward-to party, 706/* If the calling party is on the same side of the forward-to party,
706 * we don't need to track the second call */ 707 * we don't need to track the second call */
707static int callforward_do_filter(union nf_inet_addr *src, 708static int callforward_do_filter(const union nf_inet_addr *src,
708 union nf_inet_addr *dst, 709 const union nf_inet_addr *dst, int family)
709 int family)
710{ 710{
711 const struct nf_afinfo *afinfo; 711 const struct nf_afinfo *afinfo;
712 struct flowi fl1, fl2; 712 struct flowi fl1, fl2;
@@ -1185,7 +1185,8 @@ static struct nf_conntrack_helper nf_conntrack_helper_q931[] __read_mostly = {
1185static unsigned char *get_udp_data(struct sk_buff *skb, unsigned int protoff, 1185static unsigned char *get_udp_data(struct sk_buff *skb, unsigned int protoff,
1186 int *datalen) 1186 int *datalen)
1187{ 1187{
1188 struct udphdr _uh, *uh; 1188 const struct udphdr *uh;
1189 struct udphdr _uh;
1189 int dataoff; 1190 int dataoff;
1190 1191
1191 uh = skb_header_pointer(skb, protoff, sizeof(_uh), &_uh); 1192 uh = skb_header_pointer(skb, protoff, sizeof(_uh), &_uh);
@@ -1415,7 +1416,7 @@ static int process_rcf(struct sk_buff *skb, struct nf_conn *ct,
1415 nf_ct_refresh(ct, skb, info->timeout * HZ); 1416 nf_ct_refresh(ct, skb, info->timeout * HZ);
1416 1417
1417 /* Set expect timeout */ 1418 /* Set expect timeout */
1418 read_lock_bh(&nf_conntrack_lock); 1419 spin_lock_bh(&nf_conntrack_lock);
1419 exp = find_expect(ct, &ct->tuplehash[dir].tuple.dst.u3, 1420 exp = find_expect(ct, &ct->tuplehash[dir].tuple.dst.u3,
1420 info->sig_port[!dir]); 1421 info->sig_port[!dir]);
1421 if (exp) { 1422 if (exp) {
@@ -1425,7 +1426,7 @@ static int process_rcf(struct sk_buff *skb, struct nf_conn *ct,
1425 NF_CT_DUMP_TUPLE(&exp->tuple); 1426 NF_CT_DUMP_TUPLE(&exp->tuple);
1426 set_expect_timeout(exp, info->timeout); 1427 set_expect_timeout(exp, info->timeout);
1427 } 1428 }
1428 read_unlock_bh(&nf_conntrack_lock); 1429 spin_unlock_bh(&nf_conntrack_lock);
1429 } 1430 }
1430 1431
1431 return 0; 1432 return 0;
@@ -1468,7 +1469,7 @@ static int process_arq(struct sk_buff *skb, struct nf_conn *ct,
1468 enum ip_conntrack_info ctinfo, 1469 enum ip_conntrack_info ctinfo,
1469 unsigned char **data, AdmissionRequest *arq) 1470 unsigned char **data, AdmissionRequest *arq)
1470{ 1471{
1471 struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info; 1472 const struct nf_ct_h323_master *info = &nfct_help(ct)->help.ct_h323_info;
1472 int dir = CTINFO2DIR(ctinfo); 1473 int dir = CTINFO2DIR(ctinfo);
1473 __be16 port; 1474 __be16 port;
1474 union nf_inet_addr addr; 1475 union nf_inet_addr addr;
diff --git a/net/netfilter/nf_conntrack_h323_types.c b/net/netfilter/nf_conntrack_h323_types.c
index 3a21fdf1a265..d880f3523c1d 100644
--- a/net/netfilter/nf_conntrack_h323_types.c
+++ b/net/netfilter/nf_conntrack_h323_types.c
@@ -5,22 +5,22 @@
5 * This source code is licensed under General Public License version 2. 5 * This source code is licensed under General Public License version 2.
6 */ 6 */
7 7
8static field_t _TransportAddress_ipAddress[] = { /* SEQUENCE */ 8static const struct field_t _TransportAddress_ipAddress[] = { /* SEQUENCE */
9 {FNAME("ip") OCTSTR, FIXD, 4, 0, DECODE, 9 {FNAME("ip") OCTSTR, FIXD, 4, 0, DECODE,
10 offsetof(TransportAddress_ipAddress, ip), NULL}, 10 offsetof(TransportAddress_ipAddress, ip), NULL},
11 {FNAME("port") INT, WORD, 0, 0, SKIP, 0, NULL}, 11 {FNAME("port") INT, WORD, 0, 0, SKIP, 0, NULL},
12}; 12};
13 13
14static field_t _TransportAddress_ipSourceRoute_route[] = { /* SEQUENCE OF */ 14static const struct field_t _TransportAddress_ipSourceRoute_route[] = { /* SEQUENCE OF */
15 {FNAME("item") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL}, 15 {FNAME("item") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL},
16}; 16};
17 17
18static field_t _TransportAddress_ipSourceRoute_routing[] = { /* CHOICE */ 18static const struct field_t _TransportAddress_ipSourceRoute_routing[] = { /* CHOICE */
19 {FNAME("strict") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 19 {FNAME("strict") NUL, FIXD, 0, 0, SKIP, 0, NULL},
20 {FNAME("loose") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 20 {FNAME("loose") NUL, FIXD, 0, 0, SKIP, 0, NULL},
21}; 21};
22 22
23static field_t _TransportAddress_ipSourceRoute[] = { /* SEQUENCE */ 23static const struct field_t _TransportAddress_ipSourceRoute[] = { /* SEQUENCE */
24 {FNAME("ip") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL}, 24 {FNAME("ip") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL},
25 {FNAME("port") INT, WORD, 0, 0, SKIP, 0, NULL}, 25 {FNAME("port") INT, WORD, 0, 0, SKIP, 0, NULL},
26 {FNAME("route") SEQOF, SEMI, 0, 0, SKIP, 0, 26 {FNAME("route") SEQOF, SEMI, 0, 0, SKIP, 0,
@@ -29,37 +29,37 @@ static field_t _TransportAddress_ipSourceRoute[] = { /* SEQUENCE */
29 _TransportAddress_ipSourceRoute_routing}, 29 _TransportAddress_ipSourceRoute_routing},
30}; 30};
31 31
32static field_t _TransportAddress_ipxAddress[] = { /* SEQUENCE */ 32static const struct field_t _TransportAddress_ipxAddress[] = { /* SEQUENCE */
33 {FNAME("node") OCTSTR, FIXD, 6, 0, SKIP, 0, NULL}, 33 {FNAME("node") OCTSTR, FIXD, 6, 0, SKIP, 0, NULL},
34 {FNAME("netnum") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL}, 34 {FNAME("netnum") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL},
35 {FNAME("port") OCTSTR, FIXD, 2, 0, SKIP, 0, NULL}, 35 {FNAME("port") OCTSTR, FIXD, 2, 0, SKIP, 0, NULL},
36}; 36};
37 37
38static field_t _TransportAddress_ip6Address[] = { /* SEQUENCE */ 38static const struct field_t _TransportAddress_ip6Address[] = { /* SEQUENCE */
39 {FNAME("ip") OCTSTR, FIXD, 16, 0, DECODE, 39 {FNAME("ip") OCTSTR, FIXD, 16, 0, DECODE,
40 offsetof(TransportAddress_ip6Address, ip), NULL}, 40 offsetof(TransportAddress_ip6Address, ip), NULL},
41 {FNAME("port") INT, WORD, 0, 0, SKIP, 0, NULL}, 41 {FNAME("port") INT, WORD, 0, 0, SKIP, 0, NULL},
42}; 42};
43 43
44static field_t _H221NonStandard[] = { /* SEQUENCE */ 44static const struct field_t _H221NonStandard[] = { /* SEQUENCE */
45 {FNAME("t35CountryCode") INT, BYTE, 0, 0, SKIP, 0, NULL}, 45 {FNAME("t35CountryCode") INT, BYTE, 0, 0, SKIP, 0, NULL},
46 {FNAME("t35Extension") INT, BYTE, 0, 0, SKIP, 0, NULL}, 46 {FNAME("t35Extension") INT, BYTE, 0, 0, SKIP, 0, NULL},
47 {FNAME("manufacturerCode") INT, WORD, 0, 0, SKIP, 0, NULL}, 47 {FNAME("manufacturerCode") INT, WORD, 0, 0, SKIP, 0, NULL},
48}; 48};
49 49
50static field_t _NonStandardIdentifier[] = { /* CHOICE */ 50static const struct field_t _NonStandardIdentifier[] = { /* CHOICE */
51 {FNAME("object") OID, BYTE, 0, 0, SKIP, 0, NULL}, 51 {FNAME("object") OID, BYTE, 0, 0, SKIP, 0, NULL},
52 {FNAME("h221NonStandard") SEQ, 0, 3, 3, SKIP | EXT, 0, 52 {FNAME("h221NonStandard") SEQ, 0, 3, 3, SKIP | EXT, 0,
53 _H221NonStandard}, 53 _H221NonStandard},
54}; 54};
55 55
56static field_t _NonStandardParameter[] = { /* SEQUENCE */ 56static const struct field_t _NonStandardParameter[] = { /* SEQUENCE */
57 {FNAME("nonStandardIdentifier") CHOICE, 1, 2, 2, SKIP | EXT, 0, 57 {FNAME("nonStandardIdentifier") CHOICE, 1, 2, 2, SKIP | EXT, 0,
58 _NonStandardIdentifier}, 58 _NonStandardIdentifier},
59 {FNAME("data") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL}, 59 {FNAME("data") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL},
60}; 60};
61 61
62static field_t _TransportAddress[] = { /* CHOICE */ 62static const struct field_t _TransportAddress[] = { /* CHOICE */
63 {FNAME("ipAddress") SEQ, 0, 2, 2, DECODE, 63 {FNAME("ipAddress") SEQ, 0, 2, 2, DECODE,
64 offsetof(TransportAddress, ipAddress), _TransportAddress_ipAddress}, 64 offsetof(TransportAddress, ipAddress), _TransportAddress_ipAddress},
65 {FNAME("ipSourceRoute") SEQ, 0, 4, 4, SKIP | EXT, 0, 65 {FNAME("ipSourceRoute") SEQ, 0, 4, 4, SKIP | EXT, 0,
@@ -75,7 +75,7 @@ static field_t _TransportAddress[] = { /* CHOICE */
75 _NonStandardParameter}, 75 _NonStandardParameter},
76}; 76};
77 77
78static field_t _AliasAddress[] = { /* CHOICE */ 78static const struct field_t _AliasAddress[] = { /* CHOICE */
79 {FNAME("dialedDigits") NUMDGT, 7, 1, 0, SKIP, 0, NULL}, 79 {FNAME("dialedDigits") NUMDGT, 7, 1, 0, SKIP, 0, NULL},
80 {FNAME("h323-ID") BMPSTR, BYTE, 1, 0, SKIP, 0, NULL}, 80 {FNAME("h323-ID") BMPSTR, BYTE, 1, 0, SKIP, 0, NULL},
81 {FNAME("url-ID") IA5STR, WORD, 1, 0, SKIP, 0, NULL}, 81 {FNAME("url-ID") IA5STR, WORD, 1, 0, SKIP, 0, NULL},
@@ -85,78 +85,78 @@ static field_t _AliasAddress[] = { /* CHOICE */
85 {FNAME("mobileUIM") CHOICE, 1, 2, 2, SKIP | EXT, 0, NULL}, 85 {FNAME("mobileUIM") CHOICE, 1, 2, 2, SKIP | EXT, 0, NULL},
86}; 86};
87 87
88static field_t _Setup_UUIE_sourceAddress[] = { /* SEQUENCE OF */ 88static const struct field_t _Setup_UUIE_sourceAddress[] = { /* SEQUENCE OF */
89 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress}, 89 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress},
90}; 90};
91 91
92static field_t _VendorIdentifier[] = { /* SEQUENCE */ 92static const struct field_t _VendorIdentifier[] = { /* SEQUENCE */
93 {FNAME("vendor") SEQ, 0, 3, 3, SKIP | EXT, 0, _H221NonStandard}, 93 {FNAME("vendor") SEQ, 0, 3, 3, SKIP | EXT, 0, _H221NonStandard},
94 {FNAME("productId") OCTSTR, BYTE, 1, 0, SKIP | OPT, 0, NULL}, 94 {FNAME("productId") OCTSTR, BYTE, 1, 0, SKIP | OPT, 0, NULL},
95 {FNAME("versionId") OCTSTR, BYTE, 1, 0, SKIP | OPT, 0, NULL}, 95 {FNAME("versionId") OCTSTR, BYTE, 1, 0, SKIP | OPT, 0, NULL},
96}; 96};
97 97
98static field_t _GatekeeperInfo[] = { /* SEQUENCE */ 98static const struct field_t _GatekeeperInfo[] = { /* SEQUENCE */
99 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 99 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
100 _NonStandardParameter}, 100 _NonStandardParameter},
101}; 101};
102 102
103static field_t _H310Caps[] = { /* SEQUENCE */ 103static const struct field_t _H310Caps[] = { /* SEQUENCE */
104 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 104 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
105 _NonStandardParameter}, 105 _NonStandardParameter},
106 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 106 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
107 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL}, 107 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL},
108}; 108};
109 109
110static field_t _H320Caps[] = { /* SEQUENCE */ 110static const struct field_t _H320Caps[] = { /* SEQUENCE */
111 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 111 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
112 _NonStandardParameter}, 112 _NonStandardParameter},
113 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 113 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
114 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL}, 114 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL},
115}; 115};
116 116
117static field_t _H321Caps[] = { /* SEQUENCE */ 117static const struct field_t _H321Caps[] = { /* SEQUENCE */
118 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 118 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
119 _NonStandardParameter}, 119 _NonStandardParameter},
120 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 120 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
121 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL}, 121 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL},
122}; 122};
123 123
124static field_t _H322Caps[] = { /* SEQUENCE */ 124static const struct field_t _H322Caps[] = { /* SEQUENCE */
125 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 125 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
126 _NonStandardParameter}, 126 _NonStandardParameter},
127 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 127 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
128 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL}, 128 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL},
129}; 129};
130 130
131static field_t _H323Caps[] = { /* SEQUENCE */ 131static const struct field_t _H323Caps[] = { /* SEQUENCE */
132 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 132 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
133 _NonStandardParameter}, 133 _NonStandardParameter},
134 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 134 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
135 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL}, 135 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL},
136}; 136};
137 137
138static field_t _H324Caps[] = { /* SEQUENCE */ 138static const struct field_t _H324Caps[] = { /* SEQUENCE */
139 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 139 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
140 _NonStandardParameter}, 140 _NonStandardParameter},
141 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 141 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
142 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL}, 142 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL},
143}; 143};
144 144
145static field_t _VoiceCaps[] = { /* SEQUENCE */ 145static const struct field_t _VoiceCaps[] = { /* SEQUENCE */
146 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 146 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
147 _NonStandardParameter}, 147 _NonStandardParameter},
148 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 148 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
149 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL}, 149 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL},
150}; 150};
151 151
152static field_t _T120OnlyCaps[] = { /* SEQUENCE */ 152static const struct field_t _T120OnlyCaps[] = { /* SEQUENCE */
153 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 153 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
154 _NonStandardParameter}, 154 _NonStandardParameter},
155 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 155 {FNAME("dataRatesSupported") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
156 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL}, 156 {FNAME("supportedPrefixes") SEQOF, SEMI, 0, 0, SKIP, 0, NULL},
157}; 157};
158 158
159static field_t _SupportedProtocols[] = { /* CHOICE */ 159static const struct field_t _SupportedProtocols[] = { /* CHOICE */
160 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP, 0, 160 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP, 0,
161 _NonStandardParameter}, 161 _NonStandardParameter},
162 {FNAME("h310") SEQ, 1, 1, 3, SKIP | EXT, 0, _H310Caps}, 162 {FNAME("h310") SEQ, 1, 1, 3, SKIP | EXT, 0, _H310Caps},
@@ -171,29 +171,29 @@ static field_t _SupportedProtocols[] = { /* CHOICE */
171 {FNAME("t38FaxAnnexbOnly") SEQ, 2, 5, 5, SKIP | EXT, 0, NULL}, 171 {FNAME("t38FaxAnnexbOnly") SEQ, 2, 5, 5, SKIP | EXT, 0, NULL},
172}; 172};
173 173
174static field_t _GatewayInfo_protocol[] = { /* SEQUENCE OF */ 174static const struct field_t _GatewayInfo_protocol[] = { /* SEQUENCE OF */
175 {FNAME("item") CHOICE, 4, 9, 11, SKIP | EXT, 0, _SupportedProtocols}, 175 {FNAME("item") CHOICE, 4, 9, 11, SKIP | EXT, 0, _SupportedProtocols},
176}; 176};
177 177
178static field_t _GatewayInfo[] = { /* SEQUENCE */ 178static const struct field_t _GatewayInfo[] = { /* SEQUENCE */
179 {FNAME("protocol") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, 179 {FNAME("protocol") SEQOF, SEMI, 0, 0, SKIP | OPT, 0,
180 _GatewayInfo_protocol}, 180 _GatewayInfo_protocol},
181 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 181 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
182 _NonStandardParameter}, 182 _NonStandardParameter},
183}; 183};
184 184
185static field_t _McuInfo[] = { /* SEQUENCE */ 185static const struct field_t _McuInfo[] = { /* SEQUENCE */
186 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 186 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
187 _NonStandardParameter}, 187 _NonStandardParameter},
188 {FNAME("protocol") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 188 {FNAME("protocol") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
189}; 189};
190 190
191static field_t _TerminalInfo[] = { /* SEQUENCE */ 191static const struct field_t _TerminalInfo[] = { /* SEQUENCE */
192 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 192 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
193 _NonStandardParameter}, 193 _NonStandardParameter},
194}; 194};
195 195
196static field_t _EndpointType[] = { /* SEQUENCE */ 196static const struct field_t _EndpointType[] = { /* SEQUENCE */
197 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 197 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
198 _NonStandardParameter}, 198 _NonStandardParameter},
199 {FNAME("vendor") SEQ, 2, 3, 3, SKIP | EXT | OPT, 0, 199 {FNAME("vendor") SEQ, 2, 3, 3, SKIP | EXT | OPT, 0,
@@ -210,19 +210,19 @@ static field_t _EndpointType[] = { /* SEQUENCE */
210 0, NULL}, 210 0, NULL},
211}; 211};
212 212
213static field_t _Setup_UUIE_destinationAddress[] = { /* SEQUENCE OF */ 213static const struct field_t _Setup_UUIE_destinationAddress[] = { /* SEQUENCE OF */
214 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress}, 214 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress},
215}; 215};
216 216
217static field_t _Setup_UUIE_destExtraCallInfo[] = { /* SEQUENCE OF */ 217static const struct field_t _Setup_UUIE_destExtraCallInfo[] = { /* SEQUENCE OF */
218 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress}, 218 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress},
219}; 219};
220 220
221static field_t _Setup_UUIE_destExtraCRV[] = { /* SEQUENCE OF */ 221static const struct field_t _Setup_UUIE_destExtraCRV[] = { /* SEQUENCE OF */
222 {FNAME("item") INT, WORD, 0, 0, SKIP, 0, NULL}, 222 {FNAME("item") INT, WORD, 0, 0, SKIP, 0, NULL},
223}; 223};
224 224
225static field_t _Setup_UUIE_conferenceGoal[] = { /* CHOICE */ 225static const struct field_t _Setup_UUIE_conferenceGoal[] = { /* CHOICE */
226 {FNAME("create") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 226 {FNAME("create") NUL, FIXD, 0, 0, SKIP, 0, NULL},
227 {FNAME("join") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 227 {FNAME("join") NUL, FIXD, 0, 0, SKIP, 0, NULL},
228 {FNAME("invite") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 228 {FNAME("invite") NUL, FIXD, 0, 0, SKIP, 0, NULL},
@@ -231,12 +231,12 @@ static field_t _Setup_UUIE_conferenceGoal[] = { /* CHOICE */
231 0, NULL}, 231 0, NULL},
232}; 232};
233 233
234static field_t _Q954Details[] = { /* SEQUENCE */ 234static const struct field_t _Q954Details[] = { /* SEQUENCE */
235 {FNAME("conferenceCalling") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 235 {FNAME("conferenceCalling") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
236 {FNAME("threePartyService") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 236 {FNAME("threePartyService") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
237}; 237};
238 238
239static field_t _QseriesOptions[] = { /* SEQUENCE */ 239static const struct field_t _QseriesOptions[] = { /* SEQUENCE */
240 {FNAME("q932Full") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 240 {FNAME("q932Full") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
241 {FNAME("q951Full") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 241 {FNAME("q951Full") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
242 {FNAME("q952Full") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 242 {FNAME("q952Full") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
@@ -247,32 +247,32 @@ static field_t _QseriesOptions[] = { /* SEQUENCE */
247 {FNAME("q954Info") SEQ, 0, 2, 2, SKIP | EXT, 0, _Q954Details}, 247 {FNAME("q954Info") SEQ, 0, 2, 2, SKIP | EXT, 0, _Q954Details},
248}; 248};
249 249
250static field_t _CallType[] = { /* CHOICE */ 250static const struct field_t _CallType[] = { /* CHOICE */
251 {FNAME("pointToPoint") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 251 {FNAME("pointToPoint") NUL, FIXD, 0, 0, SKIP, 0, NULL},
252 {FNAME("oneToN") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 252 {FNAME("oneToN") NUL, FIXD, 0, 0, SKIP, 0, NULL},
253 {FNAME("nToOne") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 253 {FNAME("nToOne") NUL, FIXD, 0, 0, SKIP, 0, NULL},
254 {FNAME("nToN") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 254 {FNAME("nToN") NUL, FIXD, 0, 0, SKIP, 0, NULL},
255}; 255};
256 256
257static field_t _H245_NonStandardIdentifier_h221NonStandard[] = { /* SEQUENCE */ 257static const struct field_t _H245_NonStandardIdentifier_h221NonStandard[] = { /* SEQUENCE */
258 {FNAME("t35CountryCode") INT, BYTE, 0, 0, SKIP, 0, NULL}, 258 {FNAME("t35CountryCode") INT, BYTE, 0, 0, SKIP, 0, NULL},
259 {FNAME("t35Extension") INT, BYTE, 0, 0, SKIP, 0, NULL}, 259 {FNAME("t35Extension") INT, BYTE, 0, 0, SKIP, 0, NULL},
260 {FNAME("manufacturerCode") INT, WORD, 0, 0, SKIP, 0, NULL}, 260 {FNAME("manufacturerCode") INT, WORD, 0, 0, SKIP, 0, NULL},
261}; 261};
262 262
263static field_t _H245_NonStandardIdentifier[] = { /* CHOICE */ 263static const struct field_t _H245_NonStandardIdentifier[] = { /* CHOICE */
264 {FNAME("object") OID, BYTE, 0, 0, SKIP, 0, NULL}, 264 {FNAME("object") OID, BYTE, 0, 0, SKIP, 0, NULL},
265 {FNAME("h221NonStandard") SEQ, 0, 3, 3, SKIP, 0, 265 {FNAME("h221NonStandard") SEQ, 0, 3, 3, SKIP, 0,
266 _H245_NonStandardIdentifier_h221NonStandard}, 266 _H245_NonStandardIdentifier_h221NonStandard},
267}; 267};
268 268
269static field_t _H245_NonStandardParameter[] = { /* SEQUENCE */ 269static const struct field_t _H245_NonStandardParameter[] = { /* SEQUENCE */
270 {FNAME("nonStandardIdentifier") CHOICE, 1, 2, 2, SKIP, 0, 270 {FNAME("nonStandardIdentifier") CHOICE, 1, 2, 2, SKIP, 0,
271 _H245_NonStandardIdentifier}, 271 _H245_NonStandardIdentifier},
272 {FNAME("data") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL}, 272 {FNAME("data") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL},
273}; 273};
274 274
275static field_t _H261VideoCapability[] = { /* SEQUENCE */ 275static const struct field_t _H261VideoCapability[] = { /* SEQUENCE */
276 {FNAME("qcifMPI") INT, 2, 1, 0, SKIP | OPT, 0, NULL}, 276 {FNAME("qcifMPI") INT, 2, 1, 0, SKIP | OPT, 0, NULL},
277 {FNAME("cifMPI") INT, 2, 1, 0, SKIP | OPT, 0, NULL}, 277 {FNAME("cifMPI") INT, 2, 1, 0, SKIP | OPT, 0, NULL},
278 {FNAME("temporalSpatialTradeOffCapability") BOOL, FIXD, 0, 0, SKIP, 0, 278 {FNAME("temporalSpatialTradeOffCapability") BOOL, FIXD, 0, 0, SKIP, 0,
@@ -282,7 +282,7 @@ static field_t _H261VideoCapability[] = { /* SEQUENCE */
282 {FNAME("videoBadMBsCap") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 282 {FNAME("videoBadMBsCap") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
283}; 283};
284 284
285static field_t _H262VideoCapability[] = { /* SEQUENCE */ 285static const struct field_t _H262VideoCapability[] = { /* SEQUENCE */
286 {FNAME("profileAndLevel-SPatML") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 286 {FNAME("profileAndLevel-SPatML") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
287 {FNAME("profileAndLevel-MPatLL") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 287 {FNAME("profileAndLevel-MPatLL") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
288 {FNAME("profileAndLevel-MPatML") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 288 {FNAME("profileAndLevel-MPatML") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
@@ -304,7 +304,7 @@ static field_t _H262VideoCapability[] = { /* SEQUENCE */
304 {FNAME("videoBadMBsCap") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 304 {FNAME("videoBadMBsCap") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
305}; 305};
306 306
307static field_t _H263VideoCapability[] = { /* SEQUENCE */ 307static const struct field_t _H263VideoCapability[] = { /* SEQUENCE */
308 {FNAME("sqcifMPI") INT, 5, 1, 0, SKIP | OPT, 0, NULL}, 308 {FNAME("sqcifMPI") INT, 5, 1, 0, SKIP | OPT, 0, NULL},
309 {FNAME("qcifMPI") INT, 5, 1, 0, SKIP | OPT, 0, NULL}, 309 {FNAME("qcifMPI") INT, 5, 1, 0, SKIP | OPT, 0, NULL},
310 {FNAME("cifMPI") INT, 5, 1, 0, SKIP | OPT, 0, NULL}, 310 {FNAME("cifMPI") INT, 5, 1, 0, SKIP | OPT, 0, NULL},
@@ -330,7 +330,7 @@ static field_t _H263VideoCapability[] = { /* SEQUENCE */
330 {FNAME("h263Options") SEQ, 5, 29, 31, SKIP | EXT | OPT, 0, NULL}, 330 {FNAME("h263Options") SEQ, 5, 29, 31, SKIP | EXT | OPT, 0, NULL},
331}; 331};
332 332
333static field_t _IS11172VideoCapability[] = { /* SEQUENCE */ 333static const struct field_t _IS11172VideoCapability[] = { /* SEQUENCE */
334 {FNAME("constrainedBitstream") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 334 {FNAME("constrainedBitstream") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
335 {FNAME("videoBitRate") INT, CONS, 0, 0, SKIP | OPT, 0, NULL}, 335 {FNAME("videoBitRate") INT, CONS, 0, 0, SKIP | OPT, 0, NULL},
336 {FNAME("vbvBufferSize") INT, CONS, 0, 0, SKIP | OPT, 0, NULL}, 336 {FNAME("vbvBufferSize") INT, CONS, 0, 0, SKIP | OPT, 0, NULL},
@@ -341,7 +341,7 @@ static field_t _IS11172VideoCapability[] = { /* SEQUENCE */
341 {FNAME("videoBadMBsCap") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 341 {FNAME("videoBadMBsCap") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
342}; 342};
343 343
344static field_t _VideoCapability[] = { /* CHOICE */ 344static const struct field_t _VideoCapability[] = { /* CHOICE */
345 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0, 345 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0,
346 _H245_NonStandardParameter}, 346 _H245_NonStandardParameter},
347 {FNAME("h261VideoCapability") SEQ, 2, 5, 6, SKIP | EXT, 0, 347 {FNAME("h261VideoCapability") SEQ, 2, 5, 6, SKIP | EXT, 0,
@@ -355,12 +355,12 @@ static field_t _VideoCapability[] = { /* CHOICE */
355 {FNAME("genericVideoCapability") SEQ, 5, 6, 6, SKIP | EXT, 0, NULL}, 355 {FNAME("genericVideoCapability") SEQ, 5, 6, 6, SKIP | EXT, 0, NULL},
356}; 356};
357 357
358static field_t _AudioCapability_g7231[] = { /* SEQUENCE */ 358static const struct field_t _AudioCapability_g7231[] = { /* SEQUENCE */
359 {FNAME("maxAl-sduAudioFrames") INT, BYTE, 1, 0, SKIP, 0, NULL}, 359 {FNAME("maxAl-sduAudioFrames") INT, BYTE, 1, 0, SKIP, 0, NULL},
360 {FNAME("silenceSuppression") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 360 {FNAME("silenceSuppression") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
361}; 361};
362 362
363static field_t _IS11172AudioCapability[] = { /* SEQUENCE */ 363static const struct field_t _IS11172AudioCapability[] = { /* SEQUENCE */
364 {FNAME("audioLayer1") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 364 {FNAME("audioLayer1") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
365 {FNAME("audioLayer2") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 365 {FNAME("audioLayer2") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
366 {FNAME("audioLayer3") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 366 {FNAME("audioLayer3") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
@@ -372,7 +372,7 @@ static field_t _IS11172AudioCapability[] = { /* SEQUENCE */
372 {FNAME("bitRate") INT, WORD, 1, 0, SKIP, 0, NULL}, 372 {FNAME("bitRate") INT, WORD, 1, 0, SKIP, 0, NULL},
373}; 373};
374 374
375static field_t _IS13818AudioCapability[] = { /* SEQUENCE */ 375static const struct field_t _IS13818AudioCapability[] = { /* SEQUENCE */
376 {FNAME("audioLayer1") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 376 {FNAME("audioLayer1") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
377 {FNAME("audioLayer2") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 377 {FNAME("audioLayer2") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
378 {FNAME("audioLayer3") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 378 {FNAME("audioLayer3") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
@@ -396,7 +396,7 @@ static field_t _IS13818AudioCapability[] = { /* SEQUENCE */
396 {FNAME("bitRate") INT, WORD, 1, 0, SKIP, 0, NULL}, 396 {FNAME("bitRate") INT, WORD, 1, 0, SKIP, 0, NULL},
397}; 397};
398 398
399static field_t _AudioCapability[] = { /* CHOICE */ 399static const struct field_t _AudioCapability[] = { /* CHOICE */
400 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0, 400 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0,
401 _H245_NonStandardParameter}, 401 _H245_NonStandardParameter},
402 {FNAME("g711Alaw64k") INT, BYTE, 1, 0, SKIP, 0, NULL}, 402 {FNAME("g711Alaw64k") INT, BYTE, 1, 0, SKIP, 0, NULL},
@@ -424,7 +424,7 @@ static field_t _AudioCapability[] = { /* CHOICE */
424 {FNAME("g729Extensions") SEQ, 1, 8, 8, SKIP | EXT, 0, NULL}, 424 {FNAME("g729Extensions") SEQ, 1, 8, 8, SKIP | EXT, 0, NULL},
425}; 425};
426 426
427static field_t _DataProtocolCapability[] = { /* CHOICE */ 427static const struct field_t _DataProtocolCapability[] = { /* CHOICE */
428 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0, 428 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0,
429 _H245_NonStandardParameter}, 429 _H245_NonStandardParameter},
430 {FNAME("v14buffered") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 430 {FNAME("v14buffered") NUL, FIXD, 0, 0, SKIP, 0, NULL},
@@ -442,7 +442,7 @@ static field_t _DataProtocolCapability[] = { /* CHOICE */
442 {FNAME("udp") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 442 {FNAME("udp") NUL, FIXD, 0, 0, SKIP, 0, NULL},
443}; 443};
444 444
445static field_t _T84Profile_t84Restricted[] = { /* SEQUENCE */ 445static const struct field_t _T84Profile_t84Restricted[] = { /* SEQUENCE */
446 {FNAME("qcif") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 446 {FNAME("qcif") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
447 {FNAME("cif") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 447 {FNAME("cif") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
448 {FNAME("ccir601Seq") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 448 {FNAME("ccir601Seq") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
@@ -464,25 +464,25 @@ static field_t _T84Profile_t84Restricted[] = { /* SEQUENCE */
464 {FNAME("digPhotoHighProg") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 464 {FNAME("digPhotoHighProg") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
465}; 465};
466 466
467static field_t _T84Profile[] = { /* CHOICE */ 467static const struct field_t _T84Profile[] = { /* CHOICE */
468 {FNAME("t84Unrestricted") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 468 {FNAME("t84Unrestricted") NUL, FIXD, 0, 0, SKIP, 0, NULL},
469 {FNAME("t84Restricted") SEQ, 0, 19, 19, SKIP | EXT, 0, 469 {FNAME("t84Restricted") SEQ, 0, 19, 19, SKIP | EXT, 0,
470 _T84Profile_t84Restricted}, 470 _T84Profile_t84Restricted},
471}; 471};
472 472
473static field_t _DataApplicationCapability_application_t84[] = { /* SEQUENCE */ 473static const struct field_t _DataApplicationCapability_application_t84[] = { /* SEQUENCE */
474 {FNAME("t84Protocol") CHOICE, 3, 7, 14, SKIP | EXT, 0, 474 {FNAME("t84Protocol") CHOICE, 3, 7, 14, SKIP | EXT, 0,
475 _DataProtocolCapability}, 475 _DataProtocolCapability},
476 {FNAME("t84Profile") CHOICE, 1, 2, 2, SKIP, 0, _T84Profile}, 476 {FNAME("t84Profile") CHOICE, 1, 2, 2, SKIP, 0, _T84Profile},
477}; 477};
478 478
479static field_t _DataApplicationCapability_application_nlpid[] = { /* SEQUENCE */ 479static const struct field_t _DataApplicationCapability_application_nlpid[] = { /* SEQUENCE */
480 {FNAME("nlpidProtocol") CHOICE, 3, 7, 14, SKIP | EXT, 0, 480 {FNAME("nlpidProtocol") CHOICE, 3, 7, 14, SKIP | EXT, 0,
481 _DataProtocolCapability}, 481 _DataProtocolCapability},
482 {FNAME("nlpidData") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL}, 482 {FNAME("nlpidData") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL},
483}; 483};
484 484
485static field_t _DataApplicationCapability_application[] = { /* CHOICE */ 485static const struct field_t _DataApplicationCapability_application[] = { /* CHOICE */
486 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0, 486 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0,
487 _H245_NonStandardParameter}, 487 _H245_NonStandardParameter},
488 {FNAME("t120") CHOICE, 3, 7, 14, DECODE | EXT, 488 {FNAME("t120") CHOICE, 3, 7, 14, DECODE | EXT,
@@ -509,20 +509,20 @@ static field_t _DataApplicationCapability_application[] = { /* CHOICE */
509 {FNAME("genericDataCapability") SEQ, 5, 6, 6, SKIP | EXT, 0, NULL}, 509 {FNAME("genericDataCapability") SEQ, 5, 6, 6, SKIP | EXT, 0, NULL},
510}; 510};
511 511
512static field_t _DataApplicationCapability[] = { /* SEQUENCE */ 512static const struct field_t _DataApplicationCapability[] = { /* SEQUENCE */
513 {FNAME("application") CHOICE, 4, 10, 14, DECODE | EXT, 513 {FNAME("application") CHOICE, 4, 10, 14, DECODE | EXT,
514 offsetof(DataApplicationCapability, application), 514 offsetof(DataApplicationCapability, application),
515 _DataApplicationCapability_application}, 515 _DataApplicationCapability_application},
516 {FNAME("maxBitRate") INT, CONS, 0, 0, SKIP, 0, NULL}, 516 {FNAME("maxBitRate") INT, CONS, 0, 0, SKIP, 0, NULL},
517}; 517};
518 518
519static field_t _EncryptionMode[] = { /* CHOICE */ 519static const struct field_t _EncryptionMode[] = { /* CHOICE */
520 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0, 520 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0,
521 _H245_NonStandardParameter}, 521 _H245_NonStandardParameter},
522 {FNAME("h233Encryption") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 522 {FNAME("h233Encryption") NUL, FIXD, 0, 0, SKIP, 0, NULL},
523}; 523};
524 524
525static field_t _DataType[] = { /* CHOICE */ 525static const struct field_t _DataType[] = { /* CHOICE */
526 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0, 526 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0,
527 _H245_NonStandardParameter}, 527 _H245_NonStandardParameter},
528 {FNAME("nullData") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 528 {FNAME("nullData") NUL, FIXD, 0, 0, SKIP, 0, NULL},
@@ -538,7 +538,7 @@ static field_t _DataType[] = { /* CHOICE */
538 {FNAME("multiplexedStream") SEQ, 0, 2, 2, SKIP | EXT, 0, NULL}, 538 {FNAME("multiplexedStream") SEQ, 0, 2, 2, SKIP | EXT, 0, NULL},
539}; 539};
540 540
541static field_t _H222LogicalChannelParameters[] = { /* SEQUENCE */ 541static const struct field_t _H222LogicalChannelParameters[] = { /* SEQUENCE */
542 {FNAME("resourceID") INT, WORD, 0, 0, SKIP, 0, NULL}, 542 {FNAME("resourceID") INT, WORD, 0, 0, SKIP, 0, NULL},
543 {FNAME("subChannelID") INT, WORD, 0, 0, SKIP, 0, NULL}, 543 {FNAME("subChannelID") INT, WORD, 0, 0, SKIP, 0, NULL},
544 {FNAME("pcr-pid") INT, WORD, 0, 0, SKIP | OPT, 0, NULL}, 544 {FNAME("pcr-pid") INT, WORD, 0, 0, SKIP | OPT, 0, NULL},
@@ -546,12 +546,12 @@ static field_t _H222LogicalChannelParameters[] = { /* SEQUENCE */
546 {FNAME("streamDescriptors") OCTSTR, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 546 {FNAME("streamDescriptors") OCTSTR, SEMI, 0, 0, SKIP | OPT, 0, NULL},
547}; 547};
548 548
549static field_t _H223LogicalChannelParameters_adaptationLayerType_al3[] = { /* SEQUENCE */ 549static const struct field_t _H223LogicalChannelParameters_adaptationLayerType_al3[] = { /* SEQUENCE */
550 {FNAME("controlFieldOctets") INT, 2, 0, 0, SKIP, 0, NULL}, 550 {FNAME("controlFieldOctets") INT, 2, 0, 0, SKIP, 0, NULL},
551 {FNAME("sendBufferSize") INT, CONS, 0, 0, SKIP, 0, NULL}, 551 {FNAME("sendBufferSize") INT, CONS, 0, 0, SKIP, 0, NULL},
552}; 552};
553 553
554static field_t _H223LogicalChannelParameters_adaptationLayerType[] = { /* CHOICE */ 554static const struct field_t _H223LogicalChannelParameters_adaptationLayerType[] = { /* CHOICE */
555 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0, 555 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0,
556 _H245_NonStandardParameter}, 556 _H245_NonStandardParameter},
557 {FNAME("al1Framed") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 557 {FNAME("al1Framed") NUL, FIXD, 0, 0, SKIP, 0, NULL},
@@ -565,53 +565,53 @@ static field_t _H223LogicalChannelParameters_adaptationLayerType[] = { /* CHOICE
565 {FNAME("al3M") SEQ, 0, 5, 6, SKIP | EXT, 0, NULL}, 565 {FNAME("al3M") SEQ, 0, 5, 6, SKIP | EXT, 0, NULL},
566}; 566};
567 567
568static field_t _H223LogicalChannelParameters[] = { /* SEQUENCE */ 568static const struct field_t _H223LogicalChannelParameters[] = { /* SEQUENCE */
569 {FNAME("adaptationLayerType") CHOICE, 3, 6, 9, SKIP | EXT, 0, 569 {FNAME("adaptationLayerType") CHOICE, 3, 6, 9, SKIP | EXT, 0,
570 _H223LogicalChannelParameters_adaptationLayerType}, 570 _H223LogicalChannelParameters_adaptationLayerType},
571 {FNAME("segmentableFlag") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 571 {FNAME("segmentableFlag") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
572}; 572};
573 573
574static field_t _CRCLength[] = { /* CHOICE */ 574static const struct field_t _CRCLength[] = { /* CHOICE */
575 {FNAME("crc8bit") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 575 {FNAME("crc8bit") NUL, FIXD, 0, 0, SKIP, 0, NULL},
576 {FNAME("crc16bit") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 576 {FNAME("crc16bit") NUL, FIXD, 0, 0, SKIP, 0, NULL},
577 {FNAME("crc32bit") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 577 {FNAME("crc32bit") NUL, FIXD, 0, 0, SKIP, 0, NULL},
578}; 578};
579 579
580static field_t _V76HDLCParameters[] = { /* SEQUENCE */ 580static const struct field_t _V76HDLCParameters[] = { /* SEQUENCE */
581 {FNAME("crcLength") CHOICE, 2, 3, 3, SKIP | EXT, 0, _CRCLength}, 581 {FNAME("crcLength") CHOICE, 2, 3, 3, SKIP | EXT, 0, _CRCLength},
582 {FNAME("n401") INT, WORD, 1, 0, SKIP, 0, NULL}, 582 {FNAME("n401") INT, WORD, 1, 0, SKIP, 0, NULL},
583 {FNAME("loopbackTestProcedure") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 583 {FNAME("loopbackTestProcedure") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
584}; 584};
585 585
586static field_t _V76LogicalChannelParameters_suspendResume[] = { /* CHOICE */ 586static const struct field_t _V76LogicalChannelParameters_suspendResume[] = { /* CHOICE */
587 {FNAME("noSuspendResume") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 587 {FNAME("noSuspendResume") NUL, FIXD, 0, 0, SKIP, 0, NULL},
588 {FNAME("suspendResumewAddress") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 588 {FNAME("suspendResumewAddress") NUL, FIXD, 0, 0, SKIP, 0, NULL},
589 {FNAME("suspendResumewoAddress") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 589 {FNAME("suspendResumewoAddress") NUL, FIXD, 0, 0, SKIP, 0, NULL},
590}; 590};
591 591
592static field_t _V76LogicalChannelParameters_mode_eRM_recovery[] = { /* CHOICE */ 592static const struct field_t _V76LogicalChannelParameters_mode_eRM_recovery[] = { /* CHOICE */
593 {FNAME("rej") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 593 {FNAME("rej") NUL, FIXD, 0, 0, SKIP, 0, NULL},
594 {FNAME("sREJ") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 594 {FNAME("sREJ") NUL, FIXD, 0, 0, SKIP, 0, NULL},
595 {FNAME("mSREJ") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 595 {FNAME("mSREJ") NUL, FIXD, 0, 0, SKIP, 0, NULL},
596}; 596};
597 597
598static field_t _V76LogicalChannelParameters_mode_eRM[] = { /* SEQUENCE */ 598static const struct field_t _V76LogicalChannelParameters_mode_eRM[] = { /* SEQUENCE */
599 {FNAME("windowSize") INT, 7, 1, 0, SKIP, 0, NULL}, 599 {FNAME("windowSize") INT, 7, 1, 0, SKIP, 0, NULL},
600 {FNAME("recovery") CHOICE, 2, 3, 3, SKIP | EXT, 0, 600 {FNAME("recovery") CHOICE, 2, 3, 3, SKIP | EXT, 0,
601 _V76LogicalChannelParameters_mode_eRM_recovery}, 601 _V76LogicalChannelParameters_mode_eRM_recovery},
602}; 602};
603 603
604static field_t _V76LogicalChannelParameters_mode[] = { /* CHOICE */ 604static const struct field_t _V76LogicalChannelParameters_mode[] = { /* CHOICE */
605 {FNAME("eRM") SEQ, 0, 2, 2, SKIP | EXT, 0, 605 {FNAME("eRM") SEQ, 0, 2, 2, SKIP | EXT, 0,
606 _V76LogicalChannelParameters_mode_eRM}, 606 _V76LogicalChannelParameters_mode_eRM},
607 {FNAME("uNERM") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 607 {FNAME("uNERM") NUL, FIXD, 0, 0, SKIP, 0, NULL},
608}; 608};
609 609
610static field_t _V75Parameters[] = { /* SEQUENCE */ 610static const struct field_t _V75Parameters[] = { /* SEQUENCE */
611 {FNAME("audioHeaderPresent") BOOL, FIXD, 0, 0, SKIP, 0, NULL}, 611 {FNAME("audioHeaderPresent") BOOL, FIXD, 0, 0, SKIP, 0, NULL},
612}; 612};
613 613
614static field_t _V76LogicalChannelParameters[] = { /* SEQUENCE */ 614static const struct field_t _V76LogicalChannelParameters[] = { /* SEQUENCE */
615 {FNAME("hdlcParameters") SEQ, 0, 3, 3, SKIP | EXT, 0, 615 {FNAME("hdlcParameters") SEQ, 0, 3, 3, SKIP | EXT, 0,
616 _V76HDLCParameters}, 616 _V76HDLCParameters},
617 {FNAME("suspendResume") CHOICE, 2, 3, 3, SKIP | EXT, 0, 617 {FNAME("suspendResume") CHOICE, 2, 3, 3, SKIP | EXT, 0,
@@ -622,38 +622,38 @@ static field_t _V76LogicalChannelParameters[] = { /* SEQUENCE */
622 {FNAME("v75Parameters") SEQ, 0, 1, 1, SKIP | EXT, 0, _V75Parameters}, 622 {FNAME("v75Parameters") SEQ, 0, 1, 1, SKIP | EXT, 0, _V75Parameters},
623}; 623};
624 624
625static field_t _H2250LogicalChannelParameters_nonStandard[] = { /* SEQUENCE OF */ 625static const struct field_t _H2250LogicalChannelParameters_nonStandard[] = { /* SEQUENCE OF */
626 {FNAME("item") SEQ, 0, 2, 2, SKIP, 0, _H245_NonStandardParameter}, 626 {FNAME("item") SEQ, 0, 2, 2, SKIP, 0, _H245_NonStandardParameter},
627}; 627};
628 628
629static field_t _UnicastAddress_iPAddress[] = { /* SEQUENCE */ 629static const struct field_t _UnicastAddress_iPAddress[] = { /* SEQUENCE */
630 {FNAME("network") OCTSTR, FIXD, 4, 0, DECODE, 630 {FNAME("network") OCTSTR, FIXD, 4, 0, DECODE,
631 offsetof(UnicastAddress_iPAddress, network), NULL}, 631 offsetof(UnicastAddress_iPAddress, network), NULL},
632 {FNAME("tsapIdentifier") INT, WORD, 0, 0, SKIP, 0, NULL}, 632 {FNAME("tsapIdentifier") INT, WORD, 0, 0, SKIP, 0, NULL},
633}; 633};
634 634
635static field_t _UnicastAddress_iPXAddress[] = { /* SEQUENCE */ 635static const struct field_t _UnicastAddress_iPXAddress[] = { /* SEQUENCE */
636 {FNAME("node") OCTSTR, FIXD, 6, 0, SKIP, 0, NULL}, 636 {FNAME("node") OCTSTR, FIXD, 6, 0, SKIP, 0, NULL},
637 {FNAME("netnum") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL}, 637 {FNAME("netnum") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL},
638 {FNAME("tsapIdentifier") OCTSTR, FIXD, 2, 0, SKIP, 0, NULL}, 638 {FNAME("tsapIdentifier") OCTSTR, FIXD, 2, 0, SKIP, 0, NULL},
639}; 639};
640 640
641static field_t _UnicastAddress_iP6Address[] = { /* SEQUENCE */ 641static const struct field_t _UnicastAddress_iP6Address[] = { /* SEQUENCE */
642 {FNAME("network") OCTSTR, FIXD, 16, 0, DECODE, 642 {FNAME("network") OCTSTR, FIXD, 16, 0, DECODE,
643 offsetof(UnicastAddress_iP6Address, network), NULL}, 643 offsetof(UnicastAddress_iP6Address, network), NULL},
644 {FNAME("tsapIdentifier") INT, WORD, 0, 0, SKIP, 0, NULL}, 644 {FNAME("tsapIdentifier") INT, WORD, 0, 0, SKIP, 0, NULL},
645}; 645};
646 646
647static field_t _UnicastAddress_iPSourceRouteAddress_routing[] = { /* CHOICE */ 647static const struct field_t _UnicastAddress_iPSourceRouteAddress_routing[] = { /* CHOICE */
648 {FNAME("strict") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 648 {FNAME("strict") NUL, FIXD, 0, 0, SKIP, 0, NULL},
649 {FNAME("loose") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 649 {FNAME("loose") NUL, FIXD, 0, 0, SKIP, 0, NULL},
650}; 650};
651 651
652static field_t _UnicastAddress_iPSourceRouteAddress_route[] = { /* SEQUENCE OF */ 652static const struct field_t _UnicastAddress_iPSourceRouteAddress_route[] = { /* SEQUENCE OF */
653 {FNAME("item") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL}, 653 {FNAME("item") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL},
654}; 654};
655 655
656static field_t _UnicastAddress_iPSourceRouteAddress[] = { /* SEQUENCE */ 656static const struct field_t _UnicastAddress_iPSourceRouteAddress[] = { /* SEQUENCE */
657 {FNAME("routing") CHOICE, 1, 2, 2, SKIP, 0, 657 {FNAME("routing") CHOICE, 1, 2, 2, SKIP, 0,
658 _UnicastAddress_iPSourceRouteAddress_routing}, 658 _UnicastAddress_iPSourceRouteAddress_routing},
659 {FNAME("network") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL}, 659 {FNAME("network") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL},
@@ -662,7 +662,7 @@ static field_t _UnicastAddress_iPSourceRouteAddress[] = { /* SEQUENCE */
662 _UnicastAddress_iPSourceRouteAddress_route}, 662 _UnicastAddress_iPSourceRouteAddress_route},
663}; 663};
664 664
665static field_t _UnicastAddress[] = { /* CHOICE */ 665static const struct field_t _UnicastAddress[] = { /* CHOICE */
666 {FNAME("iPAddress") SEQ, 0, 2, 2, DECODE | EXT, 666 {FNAME("iPAddress") SEQ, 0, 2, 2, DECODE | EXT,
667 offsetof(UnicastAddress, iPAddress), _UnicastAddress_iPAddress}, 667 offsetof(UnicastAddress, iPAddress), _UnicastAddress_iPAddress},
668 {FNAME("iPXAddress") SEQ, 0, 3, 3, SKIP | EXT, 0, 668 {FNAME("iPXAddress") SEQ, 0, 3, 3, SKIP | EXT, 0,
@@ -676,17 +676,17 @@ static field_t _UnicastAddress[] = { /* CHOICE */
676 {FNAME("nonStandardAddress") SEQ, 0, 2, 2, SKIP, 0, NULL}, 676 {FNAME("nonStandardAddress") SEQ, 0, 2, 2, SKIP, 0, NULL},
677}; 677};
678 678
679static field_t _MulticastAddress_iPAddress[] = { /* SEQUENCE */ 679static const struct field_t _MulticastAddress_iPAddress[] = { /* SEQUENCE */
680 {FNAME("network") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL}, 680 {FNAME("network") OCTSTR, FIXD, 4, 0, SKIP, 0, NULL},
681 {FNAME("tsapIdentifier") INT, WORD, 0, 0, SKIP, 0, NULL}, 681 {FNAME("tsapIdentifier") INT, WORD, 0, 0, SKIP, 0, NULL},
682}; 682};
683 683
684static field_t _MulticastAddress_iP6Address[] = { /* SEQUENCE */ 684static const struct field_t _MulticastAddress_iP6Address[] = { /* SEQUENCE */
685 {FNAME("network") OCTSTR, FIXD, 16, 0, SKIP, 0, NULL}, 685 {FNAME("network") OCTSTR, FIXD, 16, 0, SKIP, 0, NULL},
686 {FNAME("tsapIdentifier") INT, WORD, 0, 0, SKIP, 0, NULL}, 686 {FNAME("tsapIdentifier") INT, WORD, 0, 0, SKIP, 0, NULL},
687}; 687};
688 688
689static field_t _MulticastAddress[] = { /* CHOICE */ 689static const struct field_t _MulticastAddress[] = { /* CHOICE */
690 {FNAME("iPAddress") SEQ, 0, 2, 2, SKIP | EXT, 0, 690 {FNAME("iPAddress") SEQ, 0, 2, 2, SKIP | EXT, 0,
691 _MulticastAddress_iPAddress}, 691 _MulticastAddress_iPAddress},
692 {FNAME("iP6Address") SEQ, 0, 2, 2, SKIP | EXT, 0, 692 {FNAME("iP6Address") SEQ, 0, 2, 2, SKIP | EXT, 0,
@@ -695,14 +695,14 @@ static field_t _MulticastAddress[] = { /* CHOICE */
695 {FNAME("nonStandardAddress") SEQ, 0, 2, 2, SKIP, 0, NULL}, 695 {FNAME("nonStandardAddress") SEQ, 0, 2, 2, SKIP, 0, NULL},
696}; 696};
697 697
698static field_t _H245_TransportAddress[] = { /* CHOICE */ 698static const struct field_t _H245_TransportAddress[] = { /* CHOICE */
699 {FNAME("unicastAddress") CHOICE, 3, 5, 7, DECODE | EXT, 699 {FNAME("unicastAddress") CHOICE, 3, 5, 7, DECODE | EXT,
700 offsetof(H245_TransportAddress, unicastAddress), _UnicastAddress}, 700 offsetof(H245_TransportAddress, unicastAddress), _UnicastAddress},
701 {FNAME("multicastAddress") CHOICE, 1, 2, 4, SKIP | EXT, 0, 701 {FNAME("multicastAddress") CHOICE, 1, 2, 4, SKIP | EXT, 0,
702 _MulticastAddress}, 702 _MulticastAddress},
703}; 703};
704 704
705static field_t _H2250LogicalChannelParameters[] = { /* SEQUENCE */ 705static const struct field_t _H2250LogicalChannelParameters[] = { /* SEQUENCE */
706 {FNAME("nonStandard") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, 706 {FNAME("nonStandard") SEQOF, SEMI, 0, 0, SKIP | OPT, 0,
707 _H2250LogicalChannelParameters_nonStandard}, 707 _H2250LogicalChannelParameters_nonStandard},
708 {FNAME("sessionID") INT, BYTE, 0, 0, SKIP, 0, NULL}, 708 {FNAME("sessionID") INT, BYTE, 0, 0, SKIP, 0, NULL},
@@ -728,7 +728,7 @@ static field_t _H2250LogicalChannelParameters[] = { /* SEQUENCE */
728 {FNAME("source") SEQ, 0, 2, 2, SKIP | EXT | OPT, 0, NULL}, 728 {FNAME("source") SEQ, 0, 2, 2, SKIP | EXT | OPT, 0, NULL},
729}; 729};
730 730
731static field_t _OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters[] = { /* CHOICE */ 731static const struct field_t _OpenLogicalChannel_forwardLogicalChannelParameters_multiplexParameters[] = { /* CHOICE */
732 {FNAME("h222LogicalChannelParameters") SEQ, 3, 5, 5, SKIP | EXT, 0, 732 {FNAME("h222LogicalChannelParameters") SEQ, 3, 5, 5, SKIP | EXT, 0,
733 _H222LogicalChannelParameters}, 733 _H222LogicalChannelParameters},
734 {FNAME("h223LogicalChannelParameters") SEQ, 0, 2, 2, SKIP | EXT, 0, 734 {FNAME("h223LogicalChannelParameters") SEQ, 0, 2, 2, SKIP | EXT, 0,
@@ -742,7 +742,7 @@ static field_t _OpenLogicalChannel_forwardLogicalChannelParameters_multiplexPara
742 {FNAME("none") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 742 {FNAME("none") NUL, FIXD, 0, 0, SKIP, 0, NULL},
743}; 743};
744 744
745static field_t _OpenLogicalChannel_forwardLogicalChannelParameters[] = { /* SEQUENCE */ 745static const struct field_t _OpenLogicalChannel_forwardLogicalChannelParameters[] = { /* SEQUENCE */
746 {FNAME("portNumber") INT, WORD, 0, 0, SKIP | OPT, 0, NULL}, 746 {FNAME("portNumber") INT, WORD, 0, 0, SKIP | OPT, 0, NULL},
747 {FNAME("dataType") CHOICE, 3, 6, 9, DECODE | EXT, 747 {FNAME("dataType") CHOICE, 3, 6, 9, DECODE | EXT,
748 offsetof(OpenLogicalChannel_forwardLogicalChannelParameters, 748 offsetof(OpenLogicalChannel_forwardLogicalChannelParameters,
@@ -756,7 +756,7 @@ static field_t _OpenLogicalChannel_forwardLogicalChannelParameters[] = { /* SEQU
756 {FNAME("replacementFor") INT, WORD, 1, 0, SKIP | OPT, 0, NULL}, 756 {FNAME("replacementFor") INT, WORD, 1, 0, SKIP | OPT, 0, NULL},
757}; 757};
758 758
759static field_t _OpenLogicalChannel_reverseLogicalChannelParameters_multiplexParameters[] = { /* CHOICE */ 759static const struct field_t _OpenLogicalChannel_reverseLogicalChannelParameters_multiplexParameters[] = { /* CHOICE */
760 {FNAME("h223LogicalChannelParameters") SEQ, 0, 2, 2, SKIP | EXT, 0, 760 {FNAME("h223LogicalChannelParameters") SEQ, 0, 2, 2, SKIP | EXT, 0,
761 _H223LogicalChannelParameters}, 761 _H223LogicalChannelParameters},
762 {FNAME("v76LogicalChannelParameters") SEQ, 0, 5, 5, SKIP | EXT, 0, 762 {FNAME("v76LogicalChannelParameters") SEQ, 0, 5, 5, SKIP | EXT, 0,
@@ -767,7 +767,7 @@ static field_t _OpenLogicalChannel_reverseLogicalChannelParameters_multiplexPara
767 h2250LogicalChannelParameters), _H2250LogicalChannelParameters}, 767 h2250LogicalChannelParameters), _H2250LogicalChannelParameters},
768}; 768};
769 769
770static field_t _OpenLogicalChannel_reverseLogicalChannelParameters[] = { /* SEQUENCE */ 770static const struct field_t _OpenLogicalChannel_reverseLogicalChannelParameters[] = { /* SEQUENCE */
771 {FNAME("dataType") CHOICE, 3, 6, 9, SKIP | EXT, 0, _DataType}, 771 {FNAME("dataType") CHOICE, 3, 6, 9, SKIP | EXT, 0, _DataType},
772 {FNAME("multiplexParameters") CHOICE, 1, 2, 3, DECODE | EXT | OPT, 772 {FNAME("multiplexParameters") CHOICE, 1, 2, 3, DECODE | EXT | OPT,
773 offsetof(OpenLogicalChannel_reverseLogicalChannelParameters, 773 offsetof(OpenLogicalChannel_reverseLogicalChannelParameters,
@@ -778,23 +778,23 @@ static field_t _OpenLogicalChannel_reverseLogicalChannelParameters[] = { /* SEQU
778 {FNAME("replacementFor") INT, WORD, 1, 0, SKIP | OPT, 0, NULL}, 778 {FNAME("replacementFor") INT, WORD, 1, 0, SKIP | OPT, 0, NULL},
779}; 779};
780 780
781static field_t _NetworkAccessParameters_distribution[] = { /* CHOICE */ 781static const struct field_t _NetworkAccessParameters_distribution[] = { /* CHOICE */
782 {FNAME("unicast") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 782 {FNAME("unicast") NUL, FIXD, 0, 0, SKIP, 0, NULL},
783 {FNAME("multicast") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 783 {FNAME("multicast") NUL, FIXD, 0, 0, SKIP, 0, NULL},
784}; 784};
785 785
786static field_t _Q2931Address_address[] = { /* CHOICE */ 786static const struct field_t _Q2931Address_address[] = { /* CHOICE */
787 {FNAME("internationalNumber") NUMSTR, 4, 1, 0, SKIP, 0, NULL}, 787 {FNAME("internationalNumber") NUMSTR, 4, 1, 0, SKIP, 0, NULL},
788 {FNAME("nsapAddress") OCTSTR, 5, 1, 0, SKIP, 0, NULL}, 788 {FNAME("nsapAddress") OCTSTR, 5, 1, 0, SKIP, 0, NULL},
789}; 789};
790 790
791static field_t _Q2931Address[] = { /* SEQUENCE */ 791static const struct field_t _Q2931Address[] = { /* SEQUENCE */
792 {FNAME("address") CHOICE, 1, 2, 2, SKIP | EXT, 0, 792 {FNAME("address") CHOICE, 1, 2, 2, SKIP | EXT, 0,
793 _Q2931Address_address}, 793 _Q2931Address_address},
794 {FNAME("subaddress") OCTSTR, 5, 1, 0, SKIP | OPT, 0, NULL}, 794 {FNAME("subaddress") OCTSTR, 5, 1, 0, SKIP | OPT, 0, NULL},
795}; 795};
796 796
797static field_t _NetworkAccessParameters_networkAddress[] = { /* CHOICE */ 797static const struct field_t _NetworkAccessParameters_networkAddress[] = { /* CHOICE */
798 {FNAME("q2931Address") SEQ, 1, 2, 2, SKIP | EXT, 0, _Q2931Address}, 798 {FNAME("q2931Address") SEQ, 1, 2, 2, SKIP | EXT, 0, _Q2931Address},
799 {FNAME("e164Address") NUMDGT, 7, 1, 0, SKIP, 0, NULL}, 799 {FNAME("e164Address") NUMDGT, 7, 1, 0, SKIP, 0, NULL},
800 {FNAME("localAreaAddress") CHOICE, 1, 2, 2, DECODE | EXT, 800 {FNAME("localAreaAddress") CHOICE, 1, 2, 2, DECODE | EXT,
@@ -802,7 +802,7 @@ static field_t _NetworkAccessParameters_networkAddress[] = { /* CHOICE */
802 _H245_TransportAddress}, 802 _H245_TransportAddress},
803}; 803};
804 804
805static field_t _NetworkAccessParameters[] = { /* SEQUENCE */ 805static const struct field_t _NetworkAccessParameters[] = { /* SEQUENCE */
806 {FNAME("distribution") CHOICE, 1, 2, 2, SKIP | EXT | OPT, 0, 806 {FNAME("distribution") CHOICE, 1, 2, 2, SKIP | EXT | OPT, 0,
807 _NetworkAccessParameters_distribution}, 807 _NetworkAccessParameters_distribution},
808 {FNAME("networkAddress") CHOICE, 2, 3, 3, DECODE | EXT, 808 {FNAME("networkAddress") CHOICE, 2, 3, 3, DECODE | EXT,
@@ -814,7 +814,7 @@ static field_t _NetworkAccessParameters[] = { /* SEQUENCE */
814 NULL}, 814 NULL},
815}; 815};
816 816
817static field_t _OpenLogicalChannel[] = { /* SEQUENCE */ 817static const struct field_t _OpenLogicalChannel[] = { /* SEQUENCE */
818 {FNAME("forwardLogicalChannelNumber") INT, WORD, 1, 0, SKIP, 0, NULL}, 818 {FNAME("forwardLogicalChannelNumber") INT, WORD, 1, 0, SKIP, 0, NULL},
819 {FNAME("forwardLogicalChannelParameters") SEQ, 1, 3, 5, DECODE | EXT, 819 {FNAME("forwardLogicalChannelParameters") SEQ, 1, 3, 5, DECODE | EXT,
820 offsetof(OpenLogicalChannel, forwardLogicalChannelParameters), 820 offsetof(OpenLogicalChannel, forwardLogicalChannelParameters),
@@ -829,13 +829,13 @@ static field_t _OpenLogicalChannel[] = { /* SEQUENCE */
829 {FNAME("encryptionSync") SEQ, 2, 4, 4, STOP | EXT | OPT, 0, NULL}, 829 {FNAME("encryptionSync") SEQ, 2, 4, 4, STOP | EXT | OPT, 0, NULL},
830}; 830};
831 831
832static field_t _Setup_UUIE_fastStart[] = { /* SEQUENCE OF */ 832static const struct field_t _Setup_UUIE_fastStart[] = { /* SEQUENCE OF */
833 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT, 833 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT,
834 sizeof(OpenLogicalChannel), _OpenLogicalChannel} 834 sizeof(OpenLogicalChannel), _OpenLogicalChannel}
835 , 835 ,
836}; 836};
837 837
838static field_t _Setup_UUIE[] = { /* SEQUENCE */ 838static const struct field_t _Setup_UUIE[] = { /* SEQUENCE */
839 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 839 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
840 {FNAME("h245Address") CHOICE, 3, 7, 7, DECODE | EXT | OPT, 840 {FNAME("h245Address") CHOICE, 3, 7, 7, DECODE | EXT | OPT,
841 offsetof(Setup_UUIE, h245Address), _TransportAddress}, 841 offsetof(Setup_UUIE, h245Address), _TransportAddress},
@@ -894,13 +894,13 @@ static field_t _Setup_UUIE[] = { /* SEQUENCE */
894 NULL}, 894 NULL},
895}; 895};
896 896
897static field_t _CallProceeding_UUIE_fastStart[] = { /* SEQUENCE OF */ 897static const struct field_t _CallProceeding_UUIE_fastStart[] = { /* SEQUENCE OF */
898 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT, 898 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT,
899 sizeof(OpenLogicalChannel), _OpenLogicalChannel} 899 sizeof(OpenLogicalChannel), _OpenLogicalChannel}
900 , 900 ,
901}; 901};
902 902
903static field_t _CallProceeding_UUIE[] = { /* SEQUENCE */ 903static const struct field_t _CallProceeding_UUIE[] = { /* SEQUENCE */
904 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 904 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
905 {FNAME("destinationInfo") SEQ, 6, 8, 10, SKIP | EXT, 0, 905 {FNAME("destinationInfo") SEQ, 6, 8, 10, SKIP | EXT, 0,
906 _EndpointType}, 906 _EndpointType},
@@ -920,13 +920,13 @@ static field_t _CallProceeding_UUIE[] = { /* SEQUENCE */
920 {FNAME("featureSet") SEQ, 3, 4, 4, SKIP | EXT | OPT, 0, NULL}, 920 {FNAME("featureSet") SEQ, 3, 4, 4, SKIP | EXT | OPT, 0, NULL},
921}; 921};
922 922
923static field_t _Connect_UUIE_fastStart[] = { /* SEQUENCE OF */ 923static const struct field_t _Connect_UUIE_fastStart[] = { /* SEQUENCE OF */
924 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT, 924 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT,
925 sizeof(OpenLogicalChannel), _OpenLogicalChannel} 925 sizeof(OpenLogicalChannel), _OpenLogicalChannel}
926 , 926 ,
927}; 927};
928 928
929static field_t _Connect_UUIE[] = { /* SEQUENCE */ 929static const struct field_t _Connect_UUIE[] = { /* SEQUENCE */
930 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 930 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
931 {FNAME("h245Address") CHOICE, 3, 7, 7, DECODE | EXT | OPT, 931 {FNAME("h245Address") CHOICE, 3, 7, 7, DECODE | EXT | OPT,
932 offsetof(Connect_UUIE, h245Address), _TransportAddress}, 932 offsetof(Connect_UUIE, h245Address), _TransportAddress},
@@ -954,13 +954,13 @@ static field_t _Connect_UUIE[] = { /* SEQUENCE */
954 {FNAME("featureSet") SEQ, 3, 4, 4, SKIP | EXT | OPT, 0, NULL}, 954 {FNAME("featureSet") SEQ, 3, 4, 4, SKIP | EXT | OPT, 0, NULL},
955}; 955};
956 956
957static field_t _Alerting_UUIE_fastStart[] = { /* SEQUENCE OF */ 957static const struct field_t _Alerting_UUIE_fastStart[] = { /* SEQUENCE OF */
958 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT, 958 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT,
959 sizeof(OpenLogicalChannel), _OpenLogicalChannel} 959 sizeof(OpenLogicalChannel), _OpenLogicalChannel}
960 , 960 ,
961}; 961};
962 962
963static field_t _Alerting_UUIE[] = { /* SEQUENCE */ 963static const struct field_t _Alerting_UUIE[] = { /* SEQUENCE */
964 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 964 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
965 {FNAME("destinationInfo") SEQ, 6, 8, 10, SKIP | EXT, 0, 965 {FNAME("destinationInfo") SEQ, 6, 8, 10, SKIP | EXT, 0,
966 _EndpointType}, 966 _EndpointType},
@@ -986,7 +986,7 @@ static field_t _Alerting_UUIE[] = { /* SEQUENCE */
986 {FNAME("featureSet") SEQ, 3, 4, 4, SKIP | EXT | OPT, 0, NULL}, 986 {FNAME("featureSet") SEQ, 3, 4, 4, SKIP | EXT | OPT, 0, NULL},
987}; 987};
988 988
989static field_t _Information_UUIE[] = { /* SEQUENCE */ 989static const struct field_t _Information_UUIE[] = { /* SEQUENCE */
990 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 990 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
991 {FNAME("callIdentifier") SEQ, 0, 1, 1, SKIP | EXT, 0, NULL}, 991 {FNAME("callIdentifier") SEQ, 0, 1, 1, SKIP | EXT, 0, NULL},
992 {FNAME("tokens") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL}, 992 {FNAME("tokens") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, NULL},
@@ -996,7 +996,7 @@ static field_t _Information_UUIE[] = { /* SEQUENCE */
996 {FNAME("circuitInfo") SEQ, 3, 3, 3, SKIP | EXT | OPT, 0, NULL}, 996 {FNAME("circuitInfo") SEQ, 3, 3, 3, SKIP | EXT | OPT, 0, NULL},
997}; 997};
998 998
999static field_t _ReleaseCompleteReason[] = { /* CHOICE */ 999static const struct field_t _ReleaseCompleteReason[] = { /* CHOICE */
1000 {FNAME("noBandwidth") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1000 {FNAME("noBandwidth") NUL, FIXD, 0, 0, SKIP, 0, NULL},
1001 {FNAME("gatekeeperResources") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1001 {FNAME("gatekeeperResources") NUL, FIXD, 0, 0, SKIP, 0, NULL},
1002 {FNAME("unreachableDestination") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1002 {FNAME("unreachableDestination") NUL, FIXD, 0, 0, SKIP, 0, NULL},
@@ -1022,7 +1022,7 @@ static field_t _ReleaseCompleteReason[] = { /* CHOICE */
1022 {FNAME("tunnelledSignallingRejected") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1022 {FNAME("tunnelledSignallingRejected") NUL, FIXD, 0, 0, SKIP, 0, NULL},
1023}; 1023};
1024 1024
1025static field_t _ReleaseComplete_UUIE[] = { /* SEQUENCE */ 1025static const struct field_t _ReleaseComplete_UUIE[] = { /* SEQUENCE */
1026 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1026 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
1027 {FNAME("reason") CHOICE, 4, 12, 22, SKIP | EXT | OPT, 0, 1027 {FNAME("reason") CHOICE, 4, 12, 22, SKIP | EXT | OPT, 0,
1028 _ReleaseCompleteReason}, 1028 _ReleaseCompleteReason},
@@ -1039,11 +1039,11 @@ static field_t _ReleaseComplete_UUIE[] = { /* SEQUENCE */
1039 {FNAME("featureSet") SEQ, 3, 4, 4, SKIP | EXT | OPT, 0, NULL}, 1039 {FNAME("featureSet") SEQ, 3, 4, 4, SKIP | EXT | OPT, 0, NULL},
1040}; 1040};
1041 1041
1042static field_t _Facility_UUIE_alternativeAliasAddress[] = { /* SEQUENCE OF */ 1042static const struct field_t _Facility_UUIE_alternativeAliasAddress[] = { /* SEQUENCE OF */
1043 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress}, 1043 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress},
1044}; 1044};
1045 1045
1046static field_t _FacilityReason[] = { /* CHOICE */ 1046static const struct field_t _FacilityReason[] = { /* CHOICE */
1047 {FNAME("routeCallToGatekeeper") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1047 {FNAME("routeCallToGatekeeper") NUL, FIXD, 0, 0, SKIP, 0, NULL},
1048 {FNAME("callForwarded") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1048 {FNAME("callForwarded") NUL, FIXD, 0, 0, SKIP, 0, NULL},
1049 {FNAME("routeCallToMC") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1049 {FNAME("routeCallToMC") NUL, FIXD, 0, 0, SKIP, 0, NULL},
@@ -1057,13 +1057,13 @@ static field_t _FacilityReason[] = { /* CHOICE */
1057 {FNAME("transportedInformation") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1057 {FNAME("transportedInformation") NUL, FIXD, 0, 0, SKIP, 0, NULL},
1058}; 1058};
1059 1059
1060static field_t _Facility_UUIE_fastStart[] = { /* SEQUENCE OF */ 1060static const struct field_t _Facility_UUIE_fastStart[] = { /* SEQUENCE OF */
1061 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT, 1061 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT,
1062 sizeof(OpenLogicalChannel), _OpenLogicalChannel} 1062 sizeof(OpenLogicalChannel), _OpenLogicalChannel}
1063 , 1063 ,
1064}; 1064};
1065 1065
1066static field_t _Facility_UUIE[] = { /* SEQUENCE */ 1066static const struct field_t _Facility_UUIE[] = { /* SEQUENCE */
1067 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1067 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
1068 {FNAME("alternativeAddress") CHOICE, 3, 7, 7, DECODE | EXT | OPT, 1068 {FNAME("alternativeAddress") CHOICE, 3, 7, 7, DECODE | EXT | OPT,
1069 offsetof(Facility_UUIE, alternativeAddress), _TransportAddress}, 1069 offsetof(Facility_UUIE, alternativeAddress), _TransportAddress},
@@ -1094,17 +1094,17 @@ static field_t _Facility_UUIE[] = { /* SEQUENCE */
1094 NULL}, 1094 NULL},
1095}; 1095};
1096 1096
1097static field_t _CallIdentifier[] = { /* SEQUENCE */ 1097static const struct field_t _CallIdentifier[] = { /* SEQUENCE */
1098 {FNAME("guid") OCTSTR, FIXD, 16, 0, SKIP, 0, NULL}, 1098 {FNAME("guid") OCTSTR, FIXD, 16, 0, SKIP, 0, NULL},
1099}; 1099};
1100 1100
1101static field_t _SecurityServiceMode[] = { /* CHOICE */ 1101static const struct field_t _SecurityServiceMode[] = { /* CHOICE */
1102 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0, _NonStandardParameter}, 1102 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0, _NonStandardParameter},
1103 {FNAME("none") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1103 {FNAME("none") NUL, FIXD, 0, 0, SKIP, 0, NULL},
1104 {FNAME("default") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1104 {FNAME("default") NUL, FIXD, 0, 0, SKIP, 0, NULL},
1105}; 1105};
1106 1106
1107static field_t _SecurityCapabilities[] = { /* SEQUENCE */ 1107static const struct field_t _SecurityCapabilities[] = { /* SEQUENCE */
1108 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP | OPT, 0, 1108 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP | OPT, 0,
1109 _NonStandardParameter}, 1109 _NonStandardParameter},
1110 {FNAME("encryption") CHOICE, 2, 3, 3, SKIP | EXT, 0, 1110 {FNAME("encryption") CHOICE, 2, 3, 3, SKIP | EXT, 0,
@@ -1115,30 +1115,30 @@ static field_t _SecurityCapabilities[] = { /* SEQUENCE */
1115 _SecurityServiceMode}, 1115 _SecurityServiceMode},
1116}; 1116};
1117 1117
1118static field_t _H245Security[] = { /* CHOICE */ 1118static const struct field_t _H245Security[] = { /* CHOICE */
1119 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0, _NonStandardParameter}, 1119 {FNAME("nonStandard") SEQ, 0, 2, 2, SKIP, 0, _NonStandardParameter},
1120 {FNAME("noSecurity") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1120 {FNAME("noSecurity") NUL, FIXD, 0, 0, SKIP, 0, NULL},
1121 {FNAME("tls") SEQ, 1, 4, 4, SKIP | EXT, 0, _SecurityCapabilities}, 1121 {FNAME("tls") SEQ, 1, 4, 4, SKIP | EXT, 0, _SecurityCapabilities},
1122 {FNAME("ipsec") SEQ, 1, 4, 4, SKIP | EXT, 0, _SecurityCapabilities}, 1122 {FNAME("ipsec") SEQ, 1, 4, 4, SKIP | EXT, 0, _SecurityCapabilities},
1123}; 1123};
1124 1124
1125static field_t _DHset[] = { /* SEQUENCE */ 1125static const struct field_t _DHset[] = { /* SEQUENCE */
1126 {FNAME("halfkey") BITSTR, WORD, 0, 0, SKIP, 0, NULL}, 1126 {FNAME("halfkey") BITSTR, WORD, 0, 0, SKIP, 0, NULL},
1127 {FNAME("modSize") BITSTR, WORD, 0, 0, SKIP, 0, NULL}, 1127 {FNAME("modSize") BITSTR, WORD, 0, 0, SKIP, 0, NULL},
1128 {FNAME("generator") BITSTR, WORD, 0, 0, SKIP, 0, NULL}, 1128 {FNAME("generator") BITSTR, WORD, 0, 0, SKIP, 0, NULL},
1129}; 1129};
1130 1130
1131static field_t _TypedCertificate[] = { /* SEQUENCE */ 1131static const struct field_t _TypedCertificate[] = { /* SEQUENCE */
1132 {FNAME("type") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1132 {FNAME("type") OID, BYTE, 0, 0, SKIP, 0, NULL},
1133 {FNAME("certificate") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1133 {FNAME("certificate") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL},
1134}; 1134};
1135 1135
1136static field_t _H235_NonStandardParameter[] = { /* SEQUENCE */ 1136static const struct field_t _H235_NonStandardParameter[] = { /* SEQUENCE */
1137 {FNAME("nonStandardIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1137 {FNAME("nonStandardIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
1138 {FNAME("data") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1138 {FNAME("data") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL},
1139}; 1139};
1140 1140
1141static field_t _ClearToken[] = { /* SEQUENCE */ 1141static const struct field_t _ClearToken[] = { /* SEQUENCE */
1142 {FNAME("tokenOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1142 {FNAME("tokenOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1143 {FNAME("timeStamp") INT, CONS, 1, 0, SKIP | OPT, 0, NULL}, 1143 {FNAME("timeStamp") INT, CONS, 1, 0, SKIP | OPT, 0, NULL},
1144 {FNAME("password") BMPSTR, 7, 1, 0, SKIP | OPT, 0, NULL}, 1144 {FNAME("password") BMPSTR, 7, 1, 0, SKIP | OPT, 0, NULL},
@@ -1154,120 +1154,120 @@ static field_t _ClearToken[] = { /* SEQUENCE */
1154 {FNAME("sendersID") BMPSTR, 7, 1, 0, SKIP | OPT, 0, NULL}, 1154 {FNAME("sendersID") BMPSTR, 7, 1, 0, SKIP | OPT, 0, NULL},
1155}; 1155};
1156 1156
1157static field_t _Progress_UUIE_tokens[] = { /* SEQUENCE OF */ 1157static const struct field_t _Progress_UUIE_tokens[] = { /* SEQUENCE OF */
1158 {FNAME("item") SEQ, 8, 9, 11, SKIP | EXT, 0, _ClearToken}, 1158 {FNAME("item") SEQ, 8, 9, 11, SKIP | EXT, 0, _ClearToken},
1159}; 1159};
1160 1160
1161static field_t _Params[] = { /* SEQUENCE */ 1161static const struct field_t _Params[] = { /* SEQUENCE */
1162 {FNAME("ranInt") INT, UNCO, 0, 0, SKIP | OPT, 0, NULL}, 1162 {FNAME("ranInt") INT, UNCO, 0, 0, SKIP | OPT, 0, NULL},
1163 {FNAME("iv8") OCTSTR, FIXD, 8, 0, SKIP | OPT, 0, NULL}, 1163 {FNAME("iv8") OCTSTR, FIXD, 8, 0, SKIP | OPT, 0, NULL},
1164 {FNAME("iv16") OCTSTR, FIXD, 16, 0, SKIP | OPT, 0, NULL}, 1164 {FNAME("iv16") OCTSTR, FIXD, 16, 0, SKIP | OPT, 0, NULL},
1165}; 1165};
1166 1166
1167static field_t _CryptoH323Token_cryptoEPPwdHash_token[] = { /* SEQUENCE */ 1167static const struct field_t _CryptoH323Token_cryptoEPPwdHash_token[] = { /* SEQUENCE */
1168 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1168 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1169 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params}, 1169 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params},
1170 {FNAME("hash") BITSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1170 {FNAME("hash") BITSTR, SEMI, 0, 0, SKIP, 0, NULL},
1171}; 1171};
1172 1172
1173static field_t _CryptoH323Token_cryptoEPPwdHash[] = { /* SEQUENCE */ 1173static const struct field_t _CryptoH323Token_cryptoEPPwdHash[] = { /* SEQUENCE */
1174 {FNAME("alias") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress}, 1174 {FNAME("alias") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress},
1175 {FNAME("timeStamp") INT, CONS, 1, 0, SKIP, 0, NULL}, 1175 {FNAME("timeStamp") INT, CONS, 1, 0, SKIP, 0, NULL},
1176 {FNAME("token") SEQ, 0, 3, 3, SKIP, 0, 1176 {FNAME("token") SEQ, 0, 3, 3, SKIP, 0,
1177 _CryptoH323Token_cryptoEPPwdHash_token}, 1177 _CryptoH323Token_cryptoEPPwdHash_token},
1178}; 1178};
1179 1179
1180static field_t _CryptoH323Token_cryptoGKPwdHash_token[] = { /* SEQUENCE */ 1180static const struct field_t _CryptoH323Token_cryptoGKPwdHash_token[] = { /* SEQUENCE */
1181 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1181 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1182 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params}, 1182 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params},
1183 {FNAME("hash") BITSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1183 {FNAME("hash") BITSTR, SEMI, 0, 0, SKIP, 0, NULL},
1184}; 1184};
1185 1185
1186static field_t _CryptoH323Token_cryptoGKPwdHash[] = { /* SEQUENCE */ 1186static const struct field_t _CryptoH323Token_cryptoGKPwdHash[] = { /* SEQUENCE */
1187 {FNAME("gatekeeperId") BMPSTR, 7, 1, 0, SKIP, 0, NULL}, 1187 {FNAME("gatekeeperId") BMPSTR, 7, 1, 0, SKIP, 0, NULL},
1188 {FNAME("timeStamp") INT, CONS, 1, 0, SKIP, 0, NULL}, 1188 {FNAME("timeStamp") INT, CONS, 1, 0, SKIP, 0, NULL},
1189 {FNAME("token") SEQ, 0, 3, 3, SKIP, 0, 1189 {FNAME("token") SEQ, 0, 3, 3, SKIP, 0,
1190 _CryptoH323Token_cryptoGKPwdHash_token}, 1190 _CryptoH323Token_cryptoGKPwdHash_token},
1191}; 1191};
1192 1192
1193static field_t _CryptoH323Token_cryptoEPPwdEncr[] = { /* SEQUENCE */ 1193static const struct field_t _CryptoH323Token_cryptoEPPwdEncr[] = { /* SEQUENCE */
1194 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1194 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1195 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params}, 1195 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params},
1196 {FNAME("encryptedData") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1196 {FNAME("encryptedData") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL},
1197}; 1197};
1198 1198
1199static field_t _CryptoH323Token_cryptoGKPwdEncr[] = { /* SEQUENCE */ 1199static const struct field_t _CryptoH323Token_cryptoGKPwdEncr[] = { /* SEQUENCE */
1200 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1200 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1201 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params}, 1201 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params},
1202 {FNAME("encryptedData") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1202 {FNAME("encryptedData") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL},
1203}; 1203};
1204 1204
1205static field_t _CryptoH323Token_cryptoEPCert[] = { /* SEQUENCE */ 1205static const struct field_t _CryptoH323Token_cryptoEPCert[] = { /* SEQUENCE */
1206 {FNAME("toBeSigned") SEQ, 8, 9, 11, SKIP | OPEN | EXT, 0, NULL}, 1206 {FNAME("toBeSigned") SEQ, 8, 9, 11, SKIP | OPEN | EXT, 0, NULL},
1207 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1207 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1208 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params}, 1208 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params},
1209 {FNAME("signature") BITSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1209 {FNAME("signature") BITSTR, SEMI, 0, 0, SKIP, 0, NULL},
1210}; 1210};
1211 1211
1212static field_t _CryptoH323Token_cryptoGKCert[] = { /* SEQUENCE */ 1212static const struct field_t _CryptoH323Token_cryptoGKCert[] = { /* SEQUENCE */
1213 {FNAME("toBeSigned") SEQ, 8, 9, 11, SKIP | OPEN | EXT, 0, NULL}, 1213 {FNAME("toBeSigned") SEQ, 8, 9, 11, SKIP | OPEN | EXT, 0, NULL},
1214 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1214 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1215 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params}, 1215 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params},
1216 {FNAME("signature") BITSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1216 {FNAME("signature") BITSTR, SEMI, 0, 0, SKIP, 0, NULL},
1217}; 1217};
1218 1218
1219static field_t _CryptoH323Token_cryptoFastStart[] = { /* SEQUENCE */ 1219static const struct field_t _CryptoH323Token_cryptoFastStart[] = { /* SEQUENCE */
1220 {FNAME("toBeSigned") SEQ, 8, 9, 11, SKIP | OPEN | EXT, 0, NULL}, 1220 {FNAME("toBeSigned") SEQ, 8, 9, 11, SKIP | OPEN | EXT, 0, NULL},
1221 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1221 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1222 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params}, 1222 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params},
1223 {FNAME("signature") BITSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1223 {FNAME("signature") BITSTR, SEMI, 0, 0, SKIP, 0, NULL},
1224}; 1224};
1225 1225
1226static field_t _CryptoToken_cryptoEncryptedToken_token[] = { /* SEQUENCE */ 1226static const struct field_t _CryptoToken_cryptoEncryptedToken_token[] = { /* SEQUENCE */
1227 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1227 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1228 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params}, 1228 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params},
1229 {FNAME("encryptedData") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1229 {FNAME("encryptedData") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL},
1230}; 1230};
1231 1231
1232static field_t _CryptoToken_cryptoEncryptedToken[] = { /* SEQUENCE */ 1232static const struct field_t _CryptoToken_cryptoEncryptedToken[] = { /* SEQUENCE */
1233 {FNAME("tokenOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1233 {FNAME("tokenOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1234 {FNAME("token") SEQ, 0, 3, 3, SKIP, 0, 1234 {FNAME("token") SEQ, 0, 3, 3, SKIP, 0,
1235 _CryptoToken_cryptoEncryptedToken_token}, 1235 _CryptoToken_cryptoEncryptedToken_token},
1236}; 1236};
1237 1237
1238static field_t _CryptoToken_cryptoSignedToken_token[] = { /* SEQUENCE */ 1238static const struct field_t _CryptoToken_cryptoSignedToken_token[] = { /* SEQUENCE */
1239 {FNAME("toBeSigned") SEQ, 8, 9, 11, SKIP | OPEN | EXT, 0, NULL}, 1239 {FNAME("toBeSigned") SEQ, 8, 9, 11, SKIP | OPEN | EXT, 0, NULL},
1240 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1240 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1241 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params}, 1241 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params},
1242 {FNAME("signature") BITSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1242 {FNAME("signature") BITSTR, SEMI, 0, 0, SKIP, 0, NULL},
1243}; 1243};
1244 1244
1245static field_t _CryptoToken_cryptoSignedToken[] = { /* SEQUENCE */ 1245static const struct field_t _CryptoToken_cryptoSignedToken[] = { /* SEQUENCE */
1246 {FNAME("tokenOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1246 {FNAME("tokenOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1247 {FNAME("token") SEQ, 0, 4, 4, SKIP, 0, 1247 {FNAME("token") SEQ, 0, 4, 4, SKIP, 0,
1248 _CryptoToken_cryptoSignedToken_token}, 1248 _CryptoToken_cryptoSignedToken_token},
1249}; 1249};
1250 1250
1251static field_t _CryptoToken_cryptoHashedToken_token[] = { /* SEQUENCE */ 1251static const struct field_t _CryptoToken_cryptoHashedToken_token[] = { /* SEQUENCE */
1252 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1252 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1253 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params}, 1253 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params},
1254 {FNAME("hash") BITSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1254 {FNAME("hash") BITSTR, SEMI, 0, 0, SKIP, 0, NULL},
1255}; 1255};
1256 1256
1257static field_t _CryptoToken_cryptoHashedToken[] = { /* SEQUENCE */ 1257static const struct field_t _CryptoToken_cryptoHashedToken[] = { /* SEQUENCE */
1258 {FNAME("tokenOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1258 {FNAME("tokenOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1259 {FNAME("hashedVals") SEQ, 8, 9, 11, SKIP | EXT, 0, _ClearToken}, 1259 {FNAME("hashedVals") SEQ, 8, 9, 11, SKIP | EXT, 0, _ClearToken},
1260 {FNAME("token") SEQ, 0, 3, 3, SKIP, 0, 1260 {FNAME("token") SEQ, 0, 3, 3, SKIP, 0,
1261 _CryptoToken_cryptoHashedToken_token}, 1261 _CryptoToken_cryptoHashedToken_token},
1262}; 1262};
1263 1263
1264static field_t _CryptoToken_cryptoPwdEncr[] = { /* SEQUENCE */ 1264static const struct field_t _CryptoToken_cryptoPwdEncr[] = { /* SEQUENCE */
1265 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1265 {FNAME("algorithmOID") OID, BYTE, 0, 0, SKIP, 0, NULL},
1266 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params}, 1266 {FNAME("paramS") SEQ, 2, 2, 3, SKIP | EXT, 0, _Params},
1267 {FNAME("encryptedData") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL}, 1267 {FNAME("encryptedData") OCTSTR, SEMI, 0, 0, SKIP, 0, NULL},
1268}; 1268};
1269 1269
1270static field_t _CryptoToken[] = { /* CHOICE */ 1270static const struct field_t _CryptoToken[] = { /* CHOICE */
1271 {FNAME("cryptoEncryptedToken") SEQ, 0, 2, 2, SKIP, 0, 1271 {FNAME("cryptoEncryptedToken") SEQ, 0, 2, 2, SKIP, 0,
1272 _CryptoToken_cryptoEncryptedToken}, 1272 _CryptoToken_cryptoEncryptedToken},
1273 {FNAME("cryptoSignedToken") SEQ, 0, 2, 2, SKIP, 0, 1273 {FNAME("cryptoSignedToken") SEQ, 0, 2, 2, SKIP, 0,
@@ -1278,7 +1278,7 @@ static field_t _CryptoToken[] = { /* CHOICE */
1278 _CryptoToken_cryptoPwdEncr}, 1278 _CryptoToken_cryptoPwdEncr},
1279}; 1279};
1280 1280
1281static field_t _CryptoH323Token[] = { /* CHOICE */ 1281static const struct field_t _CryptoH323Token[] = { /* CHOICE */
1282 {FNAME("cryptoEPPwdHash") SEQ, 0, 3, 3, SKIP, 0, 1282 {FNAME("cryptoEPPwdHash") SEQ, 0, 3, 3, SKIP, 0,
1283 _CryptoH323Token_cryptoEPPwdHash}, 1283 _CryptoH323Token_cryptoEPPwdHash},
1284 {FNAME("cryptoGKPwdHash") SEQ, 0, 3, 3, SKIP, 0, 1284 {FNAME("cryptoGKPwdHash") SEQ, 0, 3, 3, SKIP, 0,
@@ -1297,17 +1297,17 @@ static field_t _CryptoH323Token[] = { /* CHOICE */
1297 _CryptoToken}, 1297 _CryptoToken},
1298}; 1298};
1299 1299
1300static field_t _Progress_UUIE_cryptoTokens[] = { /* SEQUENCE OF */ 1300static const struct field_t _Progress_UUIE_cryptoTokens[] = { /* SEQUENCE OF */
1301 {FNAME("item") CHOICE, 3, 8, 8, SKIP | EXT, 0, _CryptoH323Token}, 1301 {FNAME("item") CHOICE, 3, 8, 8, SKIP | EXT, 0, _CryptoH323Token},
1302}; 1302};
1303 1303
1304static field_t _Progress_UUIE_fastStart[] = { /* SEQUENCE OF */ 1304static const struct field_t _Progress_UUIE_fastStart[] = { /* SEQUENCE OF */
1305 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT, 1305 {FNAME("item") SEQ, 1, 3, 5, DECODE | OPEN | EXT,
1306 sizeof(OpenLogicalChannel), _OpenLogicalChannel} 1306 sizeof(OpenLogicalChannel), _OpenLogicalChannel}
1307 , 1307 ,
1308}; 1308};
1309 1309
1310static field_t _Progress_UUIE[] = { /* SEQUENCE */ 1310static const struct field_t _Progress_UUIE[] = { /* SEQUENCE */
1311 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1311 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
1312 {FNAME("destinationInfo") SEQ, 6, 8, 10, SKIP | EXT, 0, 1312 {FNAME("destinationInfo") SEQ, 6, 8, 10, SKIP | EXT, 0,
1313 _EndpointType}, 1313 _EndpointType},
@@ -1328,7 +1328,7 @@ static field_t _Progress_UUIE[] = { /* SEQUENCE */
1328 {FNAME("fastConnectRefused") NUL, FIXD, 0, 0, SKIP | OPT, 0, NULL}, 1328 {FNAME("fastConnectRefused") NUL, FIXD, 0, 0, SKIP | OPT, 0, NULL},
1329}; 1329};
1330 1330
1331static field_t _H323_UU_PDU_h323_message_body[] = { /* CHOICE */ 1331static const struct field_t _H323_UU_PDU_h323_message_body[] = { /* CHOICE */
1332 {FNAME("setup") SEQ, 7, 13, 39, DECODE | EXT, 1332 {FNAME("setup") SEQ, 7, 13, 39, DECODE | EXT,
1333 offsetof(H323_UU_PDU_h323_message_body, setup), _Setup_UUIE}, 1333 offsetof(H323_UU_PDU_h323_message_body, setup), _Setup_UUIE},
1334 {FNAME("callProceeding") SEQ, 1, 3, 12, DECODE | EXT, 1334 {FNAME("callProceeding") SEQ, 1, 3, 12, DECODE | EXT,
@@ -1352,7 +1352,7 @@ static field_t _H323_UU_PDU_h323_message_body[] = { /* CHOICE */
1352 {FNAME("notify") SEQ, 2, 4, 4, SKIP | EXT, 0, NULL}, 1352 {FNAME("notify") SEQ, 2, 4, 4, SKIP | EXT, 0, NULL},
1353}; 1353};
1354 1354
1355static field_t _RequestMessage[] = { /* CHOICE */ 1355static const struct field_t _RequestMessage[] = { /* CHOICE */
1356 {FNAME("nonStandard") SEQ, 0, 1, 1, STOP | EXT, 0, NULL}, 1356 {FNAME("nonStandard") SEQ, 0, 1, 1, STOP | EXT, 0, NULL},
1357 {FNAME("masterSlaveDetermination") SEQ, 0, 2, 2, STOP | EXT, 0, NULL}, 1357 {FNAME("masterSlaveDetermination") SEQ, 0, 2, 2, STOP | EXT, 0, NULL},
1358 {FNAME("terminalCapabilitySet") SEQ, 3, 5, 5, STOP | EXT, 0, NULL}, 1358 {FNAME("terminalCapabilitySet") SEQ, 3, 5, 5, STOP | EXT, 0, NULL},
@@ -1372,7 +1372,7 @@ static field_t _RequestMessage[] = { /* CHOICE */
1372 NULL}, 1372 NULL},
1373}; 1373};
1374 1374
1375static field_t _OpenLogicalChannelAck_reverseLogicalChannelParameters_multiplexParameters[] = { /* CHOICE */ 1375static const struct field_t _OpenLogicalChannelAck_reverseLogicalChannelParameters_multiplexParameters[] = { /* CHOICE */
1376 {FNAME("h222LogicalChannelParameters") SEQ, 3, 5, 5, SKIP | EXT, 0, 1376 {FNAME("h222LogicalChannelParameters") SEQ, 3, 5, 5, SKIP | EXT, 0,
1377 _H222LogicalChannelParameters}, 1377 _H222LogicalChannelParameters},
1378 {FNAME("h2250LogicalChannelParameters") SEQ, 10, 11, 14, DECODE | EXT, 1378 {FNAME("h2250LogicalChannelParameters") SEQ, 10, 11, 14, DECODE | EXT,
@@ -1381,7 +1381,7 @@ static field_t _OpenLogicalChannelAck_reverseLogicalChannelParameters_multiplexP
1381 h2250LogicalChannelParameters), _H2250LogicalChannelParameters}, 1381 h2250LogicalChannelParameters), _H2250LogicalChannelParameters},
1382}; 1382};
1383 1383
1384static field_t _OpenLogicalChannelAck_reverseLogicalChannelParameters[] = { /* SEQUENCE */ 1384static const struct field_t _OpenLogicalChannelAck_reverseLogicalChannelParameters[] = { /* SEQUENCE */
1385 {FNAME("reverseLogicalChannelNumber") INT, WORD, 1, 0, SKIP, 0, NULL}, 1385 {FNAME("reverseLogicalChannelNumber") INT, WORD, 1, 0, SKIP, 0, NULL},
1386 {FNAME("portNumber") INT, WORD, 0, 0, SKIP | OPT, 0, NULL}, 1386 {FNAME("portNumber") INT, WORD, 0, 0, SKIP | OPT, 0, NULL},
1387 {FNAME("multiplexParameters") CHOICE, 0, 1, 2, DECODE | EXT | OPT, 1387 {FNAME("multiplexParameters") CHOICE, 0, 1, 2, DECODE | EXT | OPT,
@@ -1391,11 +1391,11 @@ static field_t _OpenLogicalChannelAck_reverseLogicalChannelParameters[] = { /* S
1391 {FNAME("replacementFor") INT, WORD, 1, 0, SKIP | OPT, 0, NULL}, 1391 {FNAME("replacementFor") INT, WORD, 1, 0, SKIP | OPT, 0, NULL},
1392}; 1392};
1393 1393
1394static field_t _H2250LogicalChannelAckParameters_nonStandard[] = { /* SEQUENCE OF */ 1394static const struct field_t _H2250LogicalChannelAckParameters_nonStandard[] = { /* SEQUENCE OF */
1395 {FNAME("item") SEQ, 0, 2, 2, SKIP, 0, _H245_NonStandardParameter}, 1395 {FNAME("item") SEQ, 0, 2, 2, SKIP, 0, _H245_NonStandardParameter},
1396}; 1396};
1397 1397
1398static field_t _H2250LogicalChannelAckParameters[] = { /* SEQUENCE */ 1398static const struct field_t _H2250LogicalChannelAckParameters[] = { /* SEQUENCE */
1399 {FNAME("nonStandard") SEQOF, SEMI, 0, 0, SKIP | OPT, 0, 1399 {FNAME("nonStandard") SEQOF, SEMI, 0, 0, SKIP | OPT, 0,
1400 _H2250LogicalChannelAckParameters_nonStandard}, 1400 _H2250LogicalChannelAckParameters_nonStandard},
1401 {FNAME("sessionID") INT, 8, 1, 0, SKIP | OPT, 0, NULL}, 1401 {FNAME("sessionID") INT, 8, 1, 0, SKIP | OPT, 0, NULL},
@@ -1410,14 +1410,14 @@ static field_t _H2250LogicalChannelAckParameters[] = { /* SEQUENCE */
1410 {FNAME("portNumber") INT, WORD, 0, 0, SKIP | OPT, 0, NULL}, 1410 {FNAME("portNumber") INT, WORD, 0, 0, SKIP | OPT, 0, NULL},
1411}; 1411};
1412 1412
1413static field_t _OpenLogicalChannelAck_forwardMultiplexAckParameters[] = { /* CHOICE */ 1413static const struct field_t _OpenLogicalChannelAck_forwardMultiplexAckParameters[] = { /* CHOICE */
1414 {FNAME("h2250LogicalChannelAckParameters") SEQ, 5, 5, 7, DECODE | EXT, 1414 {FNAME("h2250LogicalChannelAckParameters") SEQ, 5, 5, 7, DECODE | EXT,
1415 offsetof(OpenLogicalChannelAck_forwardMultiplexAckParameters, 1415 offsetof(OpenLogicalChannelAck_forwardMultiplexAckParameters,
1416 h2250LogicalChannelAckParameters), 1416 h2250LogicalChannelAckParameters),
1417 _H2250LogicalChannelAckParameters}, 1417 _H2250LogicalChannelAckParameters},
1418}; 1418};
1419 1419
1420static field_t _OpenLogicalChannelAck[] = { /* SEQUENCE */ 1420static const struct field_t _OpenLogicalChannelAck[] = { /* SEQUENCE */
1421 {FNAME("forwardLogicalChannelNumber") INT, WORD, 1, 0, SKIP, 0, NULL}, 1421 {FNAME("forwardLogicalChannelNumber") INT, WORD, 1, 0, SKIP, 0, NULL},
1422 {FNAME("reverseLogicalChannelParameters") SEQ, 2, 3, 4, 1422 {FNAME("reverseLogicalChannelParameters") SEQ, 2, 3, 4,
1423 DECODE | EXT | OPT, offsetof(OpenLogicalChannelAck, 1423 DECODE | EXT | OPT, offsetof(OpenLogicalChannelAck,
@@ -1433,7 +1433,7 @@ static field_t _OpenLogicalChannelAck[] = { /* SEQUENCE */
1433 {FNAME("encryptionSync") SEQ, 2, 4, 4, STOP | EXT | OPT, 0, NULL}, 1433 {FNAME("encryptionSync") SEQ, 2, 4, 4, STOP | EXT | OPT, 0, NULL},
1434}; 1434};
1435 1435
1436static field_t _ResponseMessage[] = { /* CHOICE */ 1436static const struct field_t _ResponseMessage[] = { /* CHOICE */
1437 {FNAME("nonStandard") SEQ, 0, 1, 1, STOP | EXT, 0, NULL}, 1437 {FNAME("nonStandard") SEQ, 0, 1, 1, STOP | EXT, 0, NULL},
1438 {FNAME("masterSlaveDeterminationAck") SEQ, 0, 1, 1, STOP | EXT, 0, 1438 {FNAME("masterSlaveDeterminationAck") SEQ, 0, 1, 1, STOP | EXT, 0,
1439 NULL}, 1439 NULL},
@@ -1469,7 +1469,7 @@ static field_t _ResponseMessage[] = { /* CHOICE */
1469 {FNAME("logicalChannelRateReject") SEQ, 1, 4, 4, STOP | EXT, 0, NULL}, 1469 {FNAME("logicalChannelRateReject") SEQ, 1, 4, 4, STOP | EXT, 0, NULL},
1470}; 1470};
1471 1471
1472static field_t _MultimediaSystemControlMessage[] = { /* CHOICE */ 1472static const struct field_t _MultimediaSystemControlMessage[] = { /* CHOICE */
1473 {FNAME("request") CHOICE, 4, 11, 15, DECODE | EXT, 1473 {FNAME("request") CHOICE, 4, 11, 15, DECODE | EXT,
1474 offsetof(MultimediaSystemControlMessage, request), _RequestMessage}, 1474 offsetof(MultimediaSystemControlMessage, request), _RequestMessage},
1475 {FNAME("response") CHOICE, 5, 19, 24, DECODE | EXT, 1475 {FNAME("response") CHOICE, 5, 19, 24, DECODE | EXT,
@@ -1479,14 +1479,14 @@ static field_t _MultimediaSystemControlMessage[] = { /* CHOICE */
1479 {FNAME("indication") CHOICE, 4, 14, 23, STOP | EXT, 0, NULL}, 1479 {FNAME("indication") CHOICE, 4, 14, 23, STOP | EXT, 0, NULL},
1480}; 1480};
1481 1481
1482static field_t _H323_UU_PDU_h245Control[] = { /* SEQUENCE OF */ 1482static const struct field_t _H323_UU_PDU_h245Control[] = { /* SEQUENCE OF */
1483 {FNAME("item") CHOICE, 2, 4, 4, DECODE | OPEN | EXT, 1483 {FNAME("item") CHOICE, 2, 4, 4, DECODE | OPEN | EXT,
1484 sizeof(MultimediaSystemControlMessage), 1484 sizeof(MultimediaSystemControlMessage),
1485 _MultimediaSystemControlMessage} 1485 _MultimediaSystemControlMessage}
1486 , 1486 ,
1487}; 1487};
1488 1488
1489static field_t _H323_UU_PDU[] = { /* SEQUENCE */ 1489static const struct field_t _H323_UU_PDU[] = { /* SEQUENCE */
1490 {FNAME("h323-message-body") CHOICE, 3, 7, 13, DECODE | EXT, 1490 {FNAME("h323-message-body") CHOICE, 3, 7, 13, DECODE | EXT,
1491 offsetof(H323_UU_PDU, h323_message_body), 1491 offsetof(H323_UU_PDU, h323_message_body),
1492 _H323_UU_PDU_h323_message_body}, 1492 _H323_UU_PDU_h323_message_body},
@@ -1507,13 +1507,13 @@ static field_t _H323_UU_PDU[] = { /* SEQUENCE */
1507 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL}, 1507 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL},
1508}; 1508};
1509 1509
1510static field_t _H323_UserInformation[] = { /* SEQUENCE */ 1510static const struct field_t _H323_UserInformation[] = { /* SEQUENCE */
1511 {FNAME("h323-uu-pdu") SEQ, 1, 2, 11, DECODE | EXT, 1511 {FNAME("h323-uu-pdu") SEQ, 1, 2, 11, DECODE | EXT,
1512 offsetof(H323_UserInformation, h323_uu_pdu), _H323_UU_PDU}, 1512 offsetof(H323_UserInformation, h323_uu_pdu), _H323_UU_PDU},
1513 {FNAME("user-data") SEQ, 0, 2, 2, STOP | EXT | OPT, 0, NULL}, 1513 {FNAME("user-data") SEQ, 0, 2, 2, STOP | EXT | OPT, 0, NULL},
1514}; 1514};
1515 1515
1516static field_t _GatekeeperRequest[] = { /* SEQUENCE */ 1516static const struct field_t _GatekeeperRequest[] = { /* SEQUENCE */
1517 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL}, 1517 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL},
1518 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1518 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
1519 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 1519 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
@@ -1537,7 +1537,7 @@ static field_t _GatekeeperRequest[] = { /* SEQUENCE */
1537 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL}, 1537 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL},
1538}; 1538};
1539 1539
1540static field_t _GatekeeperConfirm[] = { /* SEQUENCE */ 1540static const struct field_t _GatekeeperConfirm[] = { /* SEQUENCE */
1541 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL}, 1541 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL},
1542 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1542 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
1543 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 1543 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
@@ -1557,23 +1557,23 @@ static field_t _GatekeeperConfirm[] = { /* SEQUENCE */
1557 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL}, 1557 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL},
1558}; 1558};
1559 1559
1560static field_t _RegistrationRequest_callSignalAddress[] = { /* SEQUENCE OF */ 1560static const struct field_t _RegistrationRequest_callSignalAddress[] = { /* SEQUENCE OF */
1561 {FNAME("item") CHOICE, 3, 7, 7, DECODE | EXT, 1561 {FNAME("item") CHOICE, 3, 7, 7, DECODE | EXT,
1562 sizeof(TransportAddress), _TransportAddress} 1562 sizeof(TransportAddress), _TransportAddress}
1563 , 1563 ,
1564}; 1564};
1565 1565
1566static field_t _RegistrationRequest_rasAddress[] = { /* SEQUENCE OF */ 1566static const struct field_t _RegistrationRequest_rasAddress[] = { /* SEQUENCE OF */
1567 {FNAME("item") CHOICE, 3, 7, 7, DECODE | EXT, 1567 {FNAME("item") CHOICE, 3, 7, 7, DECODE | EXT,
1568 sizeof(TransportAddress), _TransportAddress} 1568 sizeof(TransportAddress), _TransportAddress}
1569 , 1569 ,
1570}; 1570};
1571 1571
1572static field_t _RegistrationRequest_terminalAlias[] = { /* SEQUENCE OF */ 1572static const struct field_t _RegistrationRequest_terminalAlias[] = { /* SEQUENCE OF */
1573 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress}, 1573 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress},
1574}; 1574};
1575 1575
1576static field_t _RegistrationRequest[] = { /* SEQUENCE */ 1576static const struct field_t _RegistrationRequest[] = { /* SEQUENCE */
1577 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL}, 1577 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL},
1578 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1578 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
1579 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 1579 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
@@ -1621,17 +1621,17 @@ static field_t _RegistrationRequest[] = { /* SEQUENCE */
1621 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL}, 1621 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL},
1622}; 1622};
1623 1623
1624static field_t _RegistrationConfirm_callSignalAddress[] = { /* SEQUENCE OF */ 1624static const struct field_t _RegistrationConfirm_callSignalAddress[] = { /* SEQUENCE OF */
1625 {FNAME("item") CHOICE, 3, 7, 7, DECODE | EXT, 1625 {FNAME("item") CHOICE, 3, 7, 7, DECODE | EXT,
1626 sizeof(TransportAddress), _TransportAddress} 1626 sizeof(TransportAddress), _TransportAddress}
1627 , 1627 ,
1628}; 1628};
1629 1629
1630static field_t _RegistrationConfirm_terminalAlias[] = { /* SEQUENCE OF */ 1630static const struct field_t _RegistrationConfirm_terminalAlias[] = { /* SEQUENCE OF */
1631 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress}, 1631 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress},
1632}; 1632};
1633 1633
1634static field_t _RegistrationConfirm[] = { /* SEQUENCE */ 1634static const struct field_t _RegistrationConfirm[] = { /* SEQUENCE */
1635 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL}, 1635 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL},
1636 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL}, 1636 {FNAME("protocolIdentifier") OID, BYTE, 0, 0, SKIP, 0, NULL},
1637 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 1637 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
@@ -1667,13 +1667,13 @@ static field_t _RegistrationConfirm[] = { /* SEQUENCE */
1667 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL}, 1667 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL},
1668}; 1668};
1669 1669
1670static field_t _UnregistrationRequest_callSignalAddress[] = { /* SEQUENCE OF */ 1670static const struct field_t _UnregistrationRequest_callSignalAddress[] = { /* SEQUENCE OF */
1671 {FNAME("item") CHOICE, 3, 7, 7, DECODE | EXT, 1671 {FNAME("item") CHOICE, 3, 7, 7, DECODE | EXT,
1672 sizeof(TransportAddress), _TransportAddress} 1672 sizeof(TransportAddress), _TransportAddress}
1673 , 1673 ,
1674}; 1674};
1675 1675
1676static field_t _UnregistrationRequest[] = { /* SEQUENCE */ 1676static const struct field_t _UnregistrationRequest[] = { /* SEQUENCE */
1677 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL}, 1677 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL},
1678 {FNAME("callSignalAddress") SEQOF, SEMI, 0, 10, DECODE, 1678 {FNAME("callSignalAddress") SEQOF, SEMI, 0, 10, DECODE,
1679 offsetof(UnregistrationRequest, callSignalAddress), 1679 offsetof(UnregistrationRequest, callSignalAddress),
@@ -1694,24 +1694,24 @@ static field_t _UnregistrationRequest[] = { /* SEQUENCE */
1694 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL}, 1694 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL},
1695}; 1695};
1696 1696
1697static field_t _CallModel[] = { /* CHOICE */ 1697static const struct field_t _CallModel[] = { /* CHOICE */
1698 {FNAME("direct") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1698 {FNAME("direct") NUL, FIXD, 0, 0, SKIP, 0, NULL},
1699 {FNAME("gatekeeperRouted") NUL, FIXD, 0, 0, SKIP, 0, NULL}, 1699 {FNAME("gatekeeperRouted") NUL, FIXD, 0, 0, SKIP, 0, NULL},
1700}; 1700};
1701 1701
1702static field_t _AdmissionRequest_destinationInfo[] = { /* SEQUENCE OF */ 1702static const struct field_t _AdmissionRequest_destinationInfo[] = { /* SEQUENCE OF */
1703 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress}, 1703 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress},
1704}; 1704};
1705 1705
1706static field_t _AdmissionRequest_destExtraCallInfo[] = { /* SEQUENCE OF */ 1706static const struct field_t _AdmissionRequest_destExtraCallInfo[] = { /* SEQUENCE OF */
1707 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress}, 1707 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress},
1708}; 1708};
1709 1709
1710static field_t _AdmissionRequest_srcInfo[] = { /* SEQUENCE OF */ 1710static const struct field_t _AdmissionRequest_srcInfo[] = { /* SEQUENCE OF */
1711 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress}, 1711 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress},
1712}; 1712};
1713 1713
1714static field_t _AdmissionRequest[] = { /* SEQUENCE */ 1714static const struct field_t _AdmissionRequest[] = { /* SEQUENCE */
1715 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL}, 1715 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL},
1716 {FNAME("callType") CHOICE, 2, 4, 4, SKIP | EXT, 0, _CallType}, 1716 {FNAME("callType") CHOICE, 2, 4, 4, SKIP | EXT, 0, _CallType},
1717 {FNAME("callModel") CHOICE, 1, 2, 2, SKIP | EXT | OPT, 0, _CallModel}, 1717 {FNAME("callModel") CHOICE, 1, 2, 2, SKIP | EXT | OPT, 0, _CallModel},
@@ -1755,7 +1755,7 @@ static field_t _AdmissionRequest[] = { /* SEQUENCE */
1755 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL}, 1755 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL},
1756}; 1756};
1757 1757
1758static field_t _AdmissionConfirm[] = { /* SEQUENCE */ 1758static const struct field_t _AdmissionConfirm[] = { /* SEQUENCE */
1759 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL}, 1759 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL},
1760 {FNAME("bandWidth") INT, CONS, 0, 0, SKIP, 0, NULL}, 1760 {FNAME("bandWidth") INT, CONS, 0, 0, SKIP, 0, NULL},
1761 {FNAME("callModel") CHOICE, 1, 2, 2, SKIP | EXT, 0, _CallModel}, 1761 {FNAME("callModel") CHOICE, 1, 2, 2, SKIP | EXT, 0, _CallModel},
@@ -1790,11 +1790,11 @@ static field_t _AdmissionConfirm[] = { /* SEQUENCE */
1790 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL}, 1790 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL},
1791}; 1791};
1792 1792
1793static field_t _LocationRequest_destinationInfo[] = { /* SEQUENCE OF */ 1793static const struct field_t _LocationRequest_destinationInfo[] = { /* SEQUENCE OF */
1794 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress}, 1794 {FNAME("item") CHOICE, 1, 2, 7, SKIP | EXT, 0, _AliasAddress},
1795}; 1795};
1796 1796
1797static field_t _LocationRequest[] = { /* SEQUENCE */ 1797static const struct field_t _LocationRequest[] = { /* SEQUENCE */
1798 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL}, 1798 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL},
1799 {FNAME("endpointIdentifier") BMPSTR, 7, 1, 0, SKIP | OPT, 0, NULL}, 1799 {FNAME("endpointIdentifier") BMPSTR, 7, 1, 0, SKIP | OPT, 0, NULL},
1800 {FNAME("destinationInfo") SEQOF, SEMI, 0, 0, SKIP, 0, 1800 {FNAME("destinationInfo") SEQOF, SEMI, 0, 0, SKIP, 0,
@@ -1818,7 +1818,7 @@ static field_t _LocationRequest[] = { /* SEQUENCE */
1818 {FNAME("circuitInfo") SEQ, 3, 3, 3, STOP | EXT | OPT, 0, NULL}, 1818 {FNAME("circuitInfo") SEQ, 3, 3, 3, STOP | EXT | OPT, 0, NULL},
1819}; 1819};
1820 1820
1821static field_t _LocationConfirm[] = { /* SEQUENCE */ 1821static const struct field_t _LocationConfirm[] = { /* SEQUENCE */
1822 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL}, 1822 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL},
1823 {FNAME("callSignalAddress") CHOICE, 3, 7, 7, DECODE | EXT, 1823 {FNAME("callSignalAddress") CHOICE, 3, 7, 7, DECODE | EXT,
1824 offsetof(LocationConfirm, callSignalAddress), _TransportAddress}, 1824 offsetof(LocationConfirm, callSignalAddress), _TransportAddress},
@@ -1844,13 +1844,13 @@ static field_t _LocationConfirm[] = { /* SEQUENCE */
1844 {FNAME("serviceControl") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL}, 1844 {FNAME("serviceControl") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL},
1845}; 1845};
1846 1846
1847static field_t _InfoRequestResponse_callSignalAddress[] = { /* SEQUENCE OF */ 1847static const struct field_t _InfoRequestResponse_callSignalAddress[] = { /* SEQUENCE OF */
1848 {FNAME("item") CHOICE, 3, 7, 7, DECODE | EXT, 1848 {FNAME("item") CHOICE, 3, 7, 7, DECODE | EXT,
1849 sizeof(TransportAddress), _TransportAddress} 1849 sizeof(TransportAddress), _TransportAddress}
1850 , 1850 ,
1851}; 1851};
1852 1852
1853static field_t _InfoRequestResponse[] = { /* SEQUENCE */ 1853static const struct field_t _InfoRequestResponse[] = { /* SEQUENCE */
1854 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0, 1854 {FNAME("nonStandardData") SEQ, 0, 2, 2, SKIP | OPT, 0,
1855 _NonStandardParameter}, 1855 _NonStandardParameter},
1856 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL}, 1856 {FNAME("requestSeqNum") INT, WORD, 1, 0, SKIP, 0, NULL},
@@ -1873,7 +1873,7 @@ static field_t _InfoRequestResponse[] = { /* SEQUENCE */
1873 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL}, 1873 {FNAME("genericData") SEQOF, SEMI, 0, 0, STOP | OPT, 0, NULL},
1874}; 1874};
1875 1875
1876static field_t _RasMessage[] = { /* CHOICE */ 1876static const struct field_t _RasMessage[] = { /* CHOICE */
1877 {FNAME("gatekeeperRequest") SEQ, 4, 8, 18, DECODE | EXT, 1877 {FNAME("gatekeeperRequest") SEQ, 4, 8, 18, DECODE | EXT,
1878 offsetof(RasMessage, gatekeeperRequest), _GatekeeperRequest}, 1878 offsetof(RasMessage, gatekeeperRequest), _GatekeeperRequest},
1879 {FNAME("gatekeeperConfirm") SEQ, 2, 5, 14, DECODE | EXT, 1879 {FNAME("gatekeeperConfirm") SEQ, 2, 5, 14, DECODE | EXT,
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index 96aa637c0932..b1fd21cc1dbc 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -28,6 +28,7 @@
28#include <net/netfilter/nf_conntrack_core.h> 28#include <net/netfilter/nf_conntrack_core.h>
29#include <net/netfilter/nf_conntrack_extend.h> 29#include <net/netfilter/nf_conntrack_extend.h>
30 30
31static DEFINE_MUTEX(nf_ct_helper_mutex);
31static struct hlist_head *nf_ct_helper_hash __read_mostly; 32static struct hlist_head *nf_ct_helper_hash __read_mostly;
32static unsigned int nf_ct_helper_hsize __read_mostly; 33static unsigned int nf_ct_helper_hsize __read_mostly;
33static unsigned int nf_ct_helper_count __read_mostly; 34static unsigned int nf_ct_helper_count __read_mostly;
@@ -54,42 +55,13 @@ __nf_ct_helper_find(const struct nf_conntrack_tuple *tuple)
54 return NULL; 55 return NULL;
55 56
56 h = helper_hash(tuple); 57 h = helper_hash(tuple);
57 hlist_for_each_entry(helper, n, &nf_ct_helper_hash[h], hnode) { 58 hlist_for_each_entry_rcu(helper, n, &nf_ct_helper_hash[h], hnode) {
58 if (nf_ct_tuple_src_mask_cmp(tuple, &helper->tuple, &mask)) 59 if (nf_ct_tuple_src_mask_cmp(tuple, &helper->tuple, &mask))
59 return helper; 60 return helper;
60 } 61 }
61 return NULL; 62 return NULL;
62} 63}
63 64EXPORT_SYMBOL_GPL(__nf_ct_helper_find);
64struct nf_conntrack_helper *
65nf_ct_helper_find_get(const struct nf_conntrack_tuple *tuple)
66{
67 struct nf_conntrack_helper *helper;
68
69 /* need nf_conntrack_lock to assure that helper exists until
70 * try_module_get() is called */
71 read_lock_bh(&nf_conntrack_lock);
72
73 helper = __nf_ct_helper_find(tuple);
74 if (helper) {
75 /* need to increase module usage count to assure helper will
76 * not go away while the caller is e.g. busy putting a
77 * conntrack in the hash that uses the helper */
78 if (!try_module_get(helper->me))
79 helper = NULL;
80 }
81
82 read_unlock_bh(&nf_conntrack_lock);
83
84 return helper;
85}
86EXPORT_SYMBOL_GPL(nf_ct_helper_find_get);
87
88void nf_ct_helper_put(struct nf_conntrack_helper *helper)
89{
90 module_put(helper->me);
91}
92EXPORT_SYMBOL_GPL(nf_ct_helper_put);
93 65
94struct nf_conntrack_helper * 66struct nf_conntrack_helper *
95__nf_conntrack_helper_find_byname(const char *name) 67__nf_conntrack_helper_find_byname(const char *name)
@@ -99,7 +71,7 @@ __nf_conntrack_helper_find_byname(const char *name)
99 unsigned int i; 71 unsigned int i;
100 72
101 for (i = 0; i < nf_ct_helper_hsize; i++) { 73 for (i = 0; i < nf_ct_helper_hsize; i++) {
102 hlist_for_each_entry(h, n, &nf_ct_helper_hash[i], hnode) { 74 hlist_for_each_entry_rcu(h, n, &nf_ct_helper_hash[i], hnode) {
103 if (!strcmp(h->name, name)) 75 if (!strcmp(h->name, name))
104 return h; 76 return h;
105 } 77 }
@@ -140,10 +112,10 @@ int nf_conntrack_helper_register(struct nf_conntrack_helper *me)
140 112
141 BUG_ON(me->timeout == 0); 113 BUG_ON(me->timeout == 0);
142 114
143 write_lock_bh(&nf_conntrack_lock); 115 mutex_lock(&nf_ct_helper_mutex);
144 hlist_add_head(&me->hnode, &nf_ct_helper_hash[h]); 116 hlist_add_head_rcu(&me->hnode, &nf_ct_helper_hash[h]);
145 nf_ct_helper_count++; 117 nf_ct_helper_count++;
146 write_unlock_bh(&nf_conntrack_lock); 118 mutex_unlock(&nf_ct_helper_mutex);
147 119
148 return 0; 120 return 0;
149} 121}
@@ -156,10 +128,17 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
156 struct hlist_node *n, *next; 128 struct hlist_node *n, *next;
157 unsigned int i; 129 unsigned int i;
158 130
159 /* Need write lock here, to delete helper. */ 131 mutex_lock(&nf_ct_helper_mutex);
160 write_lock_bh(&nf_conntrack_lock); 132 hlist_del_rcu(&me->hnode);
161 hlist_del(&me->hnode);
162 nf_ct_helper_count--; 133 nf_ct_helper_count--;
134 mutex_unlock(&nf_ct_helper_mutex);
135
136 /* Make sure every nothing is still using the helper unless its a
137 * connection in the hash.
138 */
139 synchronize_rcu();
140
141 spin_lock_bh(&nf_conntrack_lock);
163 142
164 /* Get rid of expectations */ 143 /* Get rid of expectations */
165 for (i = 0; i < nf_ct_expect_hsize; i++) { 144 for (i = 0; i < nf_ct_expect_hsize; i++) {
@@ -181,10 +160,7 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
181 hlist_for_each_entry(h, n, &nf_conntrack_hash[i], hnode) 160 hlist_for_each_entry(h, n, &nf_conntrack_hash[i], hnode)
182 unhelp(h, me); 161 unhelp(h, me);
183 } 162 }
184 write_unlock_bh(&nf_conntrack_lock); 163 spin_unlock_bh(&nf_conntrack_lock);
185
186 /* Someone could be still looking at the helper in a bh. */
187 synchronize_net();
188} 164}
189EXPORT_SYMBOL_GPL(nf_conntrack_helper_unregister); 165EXPORT_SYMBOL_GPL(nf_conntrack_helper_unregister);
190 166
diff --git a/net/netfilter/nf_conntrack_irc.c b/net/netfilter/nf_conntrack_irc.c
index dfaed4ba83cd..c336b07a0d4c 100644
--- a/net/netfilter/nf_conntrack_irc.c
+++ b/net/netfilter/nf_conntrack_irc.c
@@ -23,7 +23,7 @@
23 23
24#define MAX_PORTS 8 24#define MAX_PORTS 8
25static unsigned short ports[MAX_PORTS]; 25static unsigned short ports[MAX_PORTS];
26static int ports_c; 26static unsigned int ports_c;
27static unsigned int max_dcc_channels = 8; 27static unsigned int max_dcc_channels = 8;
28static unsigned int dcc_timeout __read_mostly = 300; 28static unsigned int dcc_timeout __read_mostly = 300;
29/* This is slow, but it's simple. --RR */ 29/* This is slow, but it's simple. --RR */
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 38141f104db7..4a1b42b2b7a5 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -491,11 +491,6 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
491 && ctnetlink_dump_helpinfo(skb, ct) < 0) 491 && ctnetlink_dump_helpinfo(skb, ct) < 0)
492 goto nla_put_failure; 492 goto nla_put_failure;
493 493
494#ifdef CONFIG_NF_CONNTRACK_MARK
495 if ((events & IPCT_MARK || ct->mark)
496 && ctnetlink_dump_mark(skb, ct) < 0)
497 goto nla_put_failure;
498#endif
499#ifdef CONFIG_NF_CONNTRACK_SECMARK 494#ifdef CONFIG_NF_CONNTRACK_SECMARK
500 if ((events & IPCT_SECMARK || ct->secmark) 495 if ((events & IPCT_SECMARK || ct->secmark)
501 && ctnetlink_dump_secmark(skb, ct) < 0) 496 && ctnetlink_dump_secmark(skb, ct) < 0)
@@ -516,6 +511,12 @@ static int ctnetlink_conntrack_event(struct notifier_block *this,
516 goto nla_put_failure; 511 goto nla_put_failure;
517 } 512 }
518 513
514#ifdef CONFIG_NF_CONNTRACK_MARK
515 if ((events & IPCT_MARK || ct->mark)
516 && ctnetlink_dump_mark(skb, ct) < 0)
517 goto nla_put_failure;
518#endif
519
519 nlh->nlmsg_len = skb->tail - b; 520 nlh->nlmsg_len = skb->tail - b;
520 nfnetlink_send(skb, 0, group, 0); 521 nfnetlink_send(skb, 0, group, 0);
521 return NOTIFY_DONE; 522 return NOTIFY_DONE;
@@ -545,12 +546,12 @@ ctnetlink_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
545 struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh); 546 struct nfgenmsg *nfmsg = NLMSG_DATA(cb->nlh);
546 u_int8_t l3proto = nfmsg->nfgen_family; 547 u_int8_t l3proto = nfmsg->nfgen_family;
547 548
548 read_lock_bh(&nf_conntrack_lock); 549 rcu_read_lock();
549 last = (struct nf_conn *)cb->args[1]; 550 last = (struct nf_conn *)cb->args[1];
550 for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) { 551 for (; cb->args[0] < nf_conntrack_htable_size; cb->args[0]++) {
551restart: 552restart:
552 hlist_for_each_entry(h, n, &nf_conntrack_hash[cb->args[0]], 553 hlist_for_each_entry_rcu(h, n, &nf_conntrack_hash[cb->args[0]],
553 hnode) { 554 hnode) {
554 if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL) 555 if (NF_CT_DIRECTION(h) != IP_CT_DIR_ORIGINAL)
555 continue; 556 continue;
556 ct = nf_ct_tuplehash_to_ctrack(h); 557 ct = nf_ct_tuplehash_to_ctrack(h);
@@ -568,7 +569,8 @@ restart:
568 cb->nlh->nlmsg_seq, 569 cb->nlh->nlmsg_seq,
569 IPCTNL_MSG_CT_NEW, 570 IPCTNL_MSG_CT_NEW,
570 1, ct) < 0) { 571 1, ct) < 0) {
571 nf_conntrack_get(&ct->ct_general); 572 if (!atomic_inc_not_zero(&ct->ct_general.use))
573 continue;
572 cb->args[1] = (unsigned long)ct; 574 cb->args[1] = (unsigned long)ct;
573 goto out; 575 goto out;
574 } 576 }
@@ -584,7 +586,7 @@ restart:
584 } 586 }
585 } 587 }
586out: 588out:
587 read_unlock_bh(&nf_conntrack_lock); 589 rcu_read_unlock();
588 if (last) 590 if (last)
589 nf_ct_put(last); 591 nf_ct_put(last);
590 592
@@ -1167,11 +1169,12 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
1167 ct->mark = ntohl(nla_get_be32(cda[CTA_MARK])); 1169 ct->mark = ntohl(nla_get_be32(cda[CTA_MARK]));
1168#endif 1170#endif
1169 1171
1170 helper = nf_ct_helper_find_get(rtuple); 1172 rcu_read_lock();
1173 helper = __nf_ct_helper_find(rtuple);
1171 if (helper) { 1174 if (helper) {
1172 help = nf_ct_helper_ext_add(ct, GFP_KERNEL); 1175 help = nf_ct_helper_ext_add(ct, GFP_KERNEL);
1173 if (help == NULL) { 1176 if (help == NULL) {
1174 nf_ct_helper_put(helper); 1177 rcu_read_unlock();
1175 err = -ENOMEM; 1178 err = -ENOMEM;
1176 goto err; 1179 goto err;
1177 } 1180 }
@@ -1187,9 +1190,7 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
1187 1190
1188 add_timer(&ct->timeout); 1191 add_timer(&ct->timeout);
1189 nf_conntrack_hash_insert(ct); 1192 nf_conntrack_hash_insert(ct);
1190 1193 rcu_read_unlock();
1191 if (helper)
1192 nf_ct_helper_put(helper);
1193 1194
1194 return 0; 1195 return 0;
1195 1196
@@ -1220,11 +1221,11 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1220 return err; 1221 return err;
1221 } 1222 }
1222 1223
1223 write_lock_bh(&nf_conntrack_lock); 1224 spin_lock_bh(&nf_conntrack_lock);
1224 if (cda[CTA_TUPLE_ORIG]) 1225 if (cda[CTA_TUPLE_ORIG])
1225 h = __nf_conntrack_find(&otuple, NULL); 1226 h = __nf_conntrack_find(&otuple);
1226 else if (cda[CTA_TUPLE_REPLY]) 1227 else if (cda[CTA_TUPLE_REPLY])
1227 h = __nf_conntrack_find(&rtuple, NULL); 1228 h = __nf_conntrack_find(&rtuple);
1228 1229
1229 if (h == NULL) { 1230 if (h == NULL) {
1230 struct nf_conntrack_tuple master; 1231 struct nf_conntrack_tuple master;
@@ -1237,9 +1238,9 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1237 CTA_TUPLE_MASTER, 1238 CTA_TUPLE_MASTER,
1238 u3); 1239 u3);
1239 if (err < 0) 1240 if (err < 0)
1240 return err; 1241 goto out_unlock;
1241 1242
1242 master_h = __nf_conntrack_find(&master, NULL); 1243 master_h = __nf_conntrack_find(&master);
1243 if (master_h == NULL) { 1244 if (master_h == NULL) {
1244 err = -ENOENT; 1245 err = -ENOENT;
1245 goto out_unlock; 1246 goto out_unlock;
@@ -1248,7 +1249,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1248 atomic_inc(&master_ct->ct_general.use); 1249 atomic_inc(&master_ct->ct_general.use);
1249 } 1250 }
1250 1251
1251 write_unlock_bh(&nf_conntrack_lock); 1252 spin_unlock_bh(&nf_conntrack_lock);
1252 err = -ENOENT; 1253 err = -ENOENT;
1253 if (nlh->nlmsg_flags & NLM_F_CREATE) 1254 if (nlh->nlmsg_flags & NLM_F_CREATE)
1254 err = ctnetlink_create_conntrack(cda, 1255 err = ctnetlink_create_conntrack(cda,
@@ -1281,7 +1282,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1281 } 1282 }
1282 1283
1283out_unlock: 1284out_unlock:
1284 write_unlock_bh(&nf_conntrack_lock); 1285 spin_unlock_bh(&nf_conntrack_lock);
1285 return err; 1286 return err;
1286} 1287}
1287 1288
@@ -1472,7 +1473,7 @@ ctnetlink_exp_dump_table(struct sk_buff *skb, struct netlink_callback *cb)
1472 struct hlist_node *n; 1473 struct hlist_node *n;
1473 u_int8_t l3proto = nfmsg->nfgen_family; 1474 u_int8_t l3proto = nfmsg->nfgen_family;
1474 1475
1475 read_lock_bh(&nf_conntrack_lock); 1476 rcu_read_lock();
1476 last = (struct nf_conntrack_expect *)cb->args[1]; 1477 last = (struct nf_conntrack_expect *)cb->args[1];
1477 for (; cb->args[0] < nf_ct_expect_hsize; cb->args[0]++) { 1478 for (; cb->args[0] < nf_ct_expect_hsize; cb->args[0]++) {
1478restart: 1479restart:
@@ -1489,7 +1490,8 @@ restart:
1489 cb->nlh->nlmsg_seq, 1490 cb->nlh->nlmsg_seq,
1490 IPCTNL_MSG_EXP_NEW, 1491 IPCTNL_MSG_EXP_NEW,
1491 1, exp) < 0) { 1492 1, exp) < 0) {
1492 atomic_inc(&exp->use); 1493 if (!atomic_inc_not_zero(&exp->use))
1494 continue;
1493 cb->args[1] = (unsigned long)exp; 1495 cb->args[1] = (unsigned long)exp;
1494 goto out; 1496 goto out;
1495 } 1497 }
@@ -1500,7 +1502,7 @@ restart:
1500 } 1502 }
1501 } 1503 }
1502out: 1504out:
1503 read_unlock_bh(&nf_conntrack_lock); 1505 rcu_read_unlock();
1504 if (last) 1506 if (last)
1505 nf_ct_expect_put(last); 1507 nf_ct_expect_put(last);
1506 1508
@@ -1613,10 +1615,10 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
1613 struct nf_conn_help *m_help; 1615 struct nf_conn_help *m_help;
1614 1616
1615 /* delete all expectations for this helper */ 1617 /* delete all expectations for this helper */
1616 write_lock_bh(&nf_conntrack_lock); 1618 spin_lock_bh(&nf_conntrack_lock);
1617 h = __nf_conntrack_helper_find_byname(name); 1619 h = __nf_conntrack_helper_find_byname(name);
1618 if (!h) { 1620 if (!h) {
1619 write_unlock_bh(&nf_conntrack_lock); 1621 spin_unlock_bh(&nf_conntrack_lock);
1620 return -EINVAL; 1622 return -EINVAL;
1621 } 1623 }
1622 for (i = 0; i < nf_ct_expect_hsize; i++) { 1624 for (i = 0; i < nf_ct_expect_hsize; i++) {
@@ -1631,10 +1633,10 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
1631 } 1633 }
1632 } 1634 }
1633 } 1635 }
1634 write_unlock_bh(&nf_conntrack_lock); 1636 spin_unlock_bh(&nf_conntrack_lock);
1635 } else { 1637 } else {
1636 /* This basically means we have to flush everything*/ 1638 /* This basically means we have to flush everything*/
1637 write_lock_bh(&nf_conntrack_lock); 1639 spin_lock_bh(&nf_conntrack_lock);
1638 for (i = 0; i < nf_ct_expect_hsize; i++) { 1640 for (i = 0; i < nf_ct_expect_hsize; i++) {
1639 hlist_for_each_entry_safe(exp, n, next, 1641 hlist_for_each_entry_safe(exp, n, next,
1640 &nf_ct_expect_hash[i], 1642 &nf_ct_expect_hash[i],
@@ -1645,7 +1647,7 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
1645 } 1647 }
1646 } 1648 }
1647 } 1649 }
1648 write_unlock_bh(&nf_conntrack_lock); 1650 spin_unlock_bh(&nf_conntrack_lock);
1649 } 1651 }
1650 1652
1651 return 0; 1653 return 0;
@@ -1731,11 +1733,11 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
1731 if (err < 0) 1733 if (err < 0)
1732 return err; 1734 return err;
1733 1735
1734 write_lock_bh(&nf_conntrack_lock); 1736 spin_lock_bh(&nf_conntrack_lock);
1735 exp = __nf_ct_expect_find(&tuple); 1737 exp = __nf_ct_expect_find(&tuple);
1736 1738
1737 if (!exp) { 1739 if (!exp) {
1738 write_unlock_bh(&nf_conntrack_lock); 1740 spin_unlock_bh(&nf_conntrack_lock);
1739 err = -ENOENT; 1741 err = -ENOENT;
1740 if (nlh->nlmsg_flags & NLM_F_CREATE) 1742 if (nlh->nlmsg_flags & NLM_F_CREATE)
1741 err = ctnetlink_create_expect(cda, u3); 1743 err = ctnetlink_create_expect(cda, u3);
@@ -1745,7 +1747,7 @@ ctnetlink_new_expect(struct sock *ctnl, struct sk_buff *skb,
1745 err = -EEXIST; 1747 err = -EEXIST;
1746 if (!(nlh->nlmsg_flags & NLM_F_EXCL)) 1748 if (!(nlh->nlmsg_flags & NLM_F_EXCL))
1747 err = ctnetlink_change_expect(exp, cda); 1749 err = ctnetlink_change_expect(exp, cda);
1748 write_unlock_bh(&nf_conntrack_lock); 1750 spin_unlock_bh(&nf_conntrack_lock);
1749 1751
1750 return err; 1752 return err;
1751} 1753}
diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c
index 099b6df3e2b5..b5cb8e831230 100644
--- a/net/netfilter/nf_conntrack_pptp.c
+++ b/net/netfilter/nf_conntrack_pptp.c
@@ -67,7 +67,7 @@ EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_expectfn);
67 67
68#ifdef DEBUG 68#ifdef DEBUG
69/* PptpControlMessageType names */ 69/* PptpControlMessageType names */
70const char *pptp_msg_name[] = { 70const char *const pptp_msg_name[] = {
71 "UNKNOWN_MESSAGE", 71 "UNKNOWN_MESSAGE",
72 "START_SESSION_REQUEST", 72 "START_SESSION_REQUEST",
73 "START_SESSION_REPLY", 73 "START_SESSION_REPLY",
@@ -136,7 +136,7 @@ static void pptp_expectfn(struct nf_conn *ct,
136 136
137static int destroy_sibling_or_exp(const struct nf_conntrack_tuple *t) 137static int destroy_sibling_or_exp(const struct nf_conntrack_tuple *t)
138{ 138{
139 struct nf_conntrack_tuple_hash *h; 139 const struct nf_conntrack_tuple_hash *h;
140 struct nf_conntrack_expect *exp; 140 struct nf_conntrack_expect *exp;
141 struct nf_conn *sibling; 141 struct nf_conn *sibling;
142 142
@@ -168,7 +168,7 @@ static int destroy_sibling_or_exp(const struct nf_conntrack_tuple *t)
168/* timeout GRE data connections */ 168/* timeout GRE data connections */
169static void pptp_destroy_siblings(struct nf_conn *ct) 169static void pptp_destroy_siblings(struct nf_conn *ct)
170{ 170{
171 struct nf_conn_help *help = nfct_help(ct); 171 const struct nf_conn_help *help = nfct_help(ct);
172 struct nf_conntrack_tuple t; 172 struct nf_conntrack_tuple t;
173 173
174 nf_ct_gre_keymap_destroy(ct); 174 nf_ct_gre_keymap_destroy(ct);
@@ -497,9 +497,11 @@ conntrack_pptp_help(struct sk_buff *skb, unsigned int protoff,
497 497
498{ 498{
499 int dir = CTINFO2DIR(ctinfo); 499 int dir = CTINFO2DIR(ctinfo);
500 struct nf_ct_pptp_master *info = &nfct_help(ct)->help.ct_pptp_info; 500 const struct nf_ct_pptp_master *info = &nfct_help(ct)->help.ct_pptp_info;
501 struct tcphdr _tcph, *tcph; 501 const struct tcphdr *tcph;
502 struct pptp_pkt_hdr _pptph, *pptph; 502 struct tcphdr _tcph;
503 const struct pptp_pkt_hdr *pptph;
504 struct pptp_pkt_hdr _pptph;
503 struct PptpControlHeader _ctlh, *ctlh; 505 struct PptpControlHeader _ctlh, *ctlh;
504 union pptp_ctrl_union _pptpReq, *pptpReq; 506 union pptp_ctrl_union _pptpReq, *pptpReq;
505 unsigned int tcplen = skb->len - protoff; 507 unsigned int tcplen = skb->len - protoff;
diff --git a/net/netfilter/nf_conntrack_proto_generic.c b/net/netfilter/nf_conntrack_proto_generic.c
index 22c5dcb6306a..55458915575f 100644
--- a/net/netfilter/nf_conntrack_proto_generic.c
+++ b/net/netfilter/nf_conntrack_proto_generic.c
@@ -41,19 +41,19 @@ static int generic_print_tuple(struct seq_file *s,
41} 41}
42 42
43/* Returns verdict for packet, or -1 for invalid. */ 43/* Returns verdict for packet, or -1 for invalid. */
44static int packet(struct nf_conn *conntrack, 44static int packet(struct nf_conn *ct,
45 const struct sk_buff *skb, 45 const struct sk_buff *skb,
46 unsigned int dataoff, 46 unsigned int dataoff,
47 enum ip_conntrack_info ctinfo, 47 enum ip_conntrack_info ctinfo,
48 int pf, 48 int pf,
49 unsigned int hooknum) 49 unsigned int hooknum)
50{ 50{
51 nf_ct_refresh_acct(conntrack, ctinfo, skb, nf_ct_generic_timeout); 51 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_generic_timeout);
52 return NF_ACCEPT; 52 return NF_ACCEPT;
53} 53}
54 54
55/* Called when a new connection for this protocol found. */ 55/* Called when a new connection for this protocol found. */
56static int new(struct nf_conn *conntrack, const struct sk_buff *skb, 56static int new(struct nf_conn *ct, const struct sk_buff *skb,
57 unsigned int dataoff) 57 unsigned int dataoff)
58{ 58{
59 return 1; 59 return 1;
diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c
index 4a185f6aa65a..e10024a1b666 100644
--- a/net/netfilter/nf_conntrack_proto_gre.c
+++ b/net/netfilter/nf_conntrack_proto_gre.c
@@ -161,9 +161,11 @@ static int gre_pkt_to_tuple(const struct sk_buff *skb,
161 unsigned int dataoff, 161 unsigned int dataoff,
162 struct nf_conntrack_tuple *tuple) 162 struct nf_conntrack_tuple *tuple)
163{ 163{
164 struct gre_hdr_pptp _pgrehdr, *pgrehdr; 164 const struct gre_hdr_pptp *pgrehdr;
165 struct gre_hdr_pptp _pgrehdr;
165 __be16 srckey; 166 __be16 srckey;
166 struct gre_hdr _grehdr, *grehdr; 167 const struct gre_hdr *grehdr;
168 struct gre_hdr _grehdr;
167 169
168 /* first only delinearize old RFC1701 GRE header */ 170 /* first only delinearize old RFC1701 GRE header */
169 grehdr = skb_header_pointer(skb, dataoff, sizeof(_grehdr), &_grehdr); 171 grehdr = skb_header_pointer(skb, dataoff, sizeof(_grehdr), &_grehdr);
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
index 21d29e782baf..f9a08370dbb3 100644
--- a/net/netfilter/nf_conntrack_proto_sctp.c
+++ b/net/netfilter/nf_conntrack_proto_sctp.c
@@ -25,7 +25,7 @@
25#include <net/netfilter/nf_conntrack_l4proto.h> 25#include <net/netfilter/nf_conntrack_l4proto.h>
26#include <net/netfilter/nf_conntrack_ecache.h> 26#include <net/netfilter/nf_conntrack_ecache.h>
27 27
28/* Protects conntrack->proto.sctp */ 28/* Protects ct->proto.sctp */
29static DEFINE_RWLOCK(sctp_lock); 29static DEFINE_RWLOCK(sctp_lock);
30 30
31/* FIXME: Examine ipfilter's timeouts and conntrack transitions more 31/* FIXME: Examine ipfilter's timeouts and conntrack transitions more
@@ -624,7 +624,7 @@ static struct nf_conntrack_l4proto nf_conntrack_l4proto_sctp6 __read_mostly = {
624#endif 624#endif
625}; 625};
626 626
627int __init nf_conntrack_proto_sctp_init(void) 627static int __init nf_conntrack_proto_sctp_init(void)
628{ 628{
629 int ret; 629 int ret;
630 630
@@ -647,7 +647,7 @@ int __init nf_conntrack_proto_sctp_init(void)
647 return ret; 647 return ret;
648} 648}
649 649
650void __exit nf_conntrack_proto_sctp_fini(void) 650static void __exit nf_conntrack_proto_sctp_fini(void)
651{ 651{
652 nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp6); 652 nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp6);
653 nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp4); 653 nf_conntrack_l4proto_unregister(&nf_conntrack_l4proto_sctp4);
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 64c9b910419c..3e0cccae5636 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -26,7 +26,7 @@
26#include <net/netfilter/nf_conntrack_ecache.h> 26#include <net/netfilter/nf_conntrack_ecache.h>
27#include <net/netfilter/nf_log.h> 27#include <net/netfilter/nf_log.h>
28 28
29/* Protects conntrack->proto.tcp */ 29/* Protects ct->proto.tcp */
30static DEFINE_RWLOCK(tcp_lock); 30static DEFINE_RWLOCK(tcp_lock);
31 31
32/* "Be conservative in what you do, 32/* "Be conservative in what you do,
@@ -46,7 +46,7 @@ static int nf_ct_tcp_max_retrans __read_mostly = 3;
46 /* FIXME: Examine ipfilter's timeouts and conntrack transitions more 46 /* FIXME: Examine ipfilter's timeouts and conntrack transitions more
47 closely. They're more complex. --RR */ 47 closely. They're more complex. --RR */
48 48
49static const char *tcp_conntrack_names[] = { 49static const char *const tcp_conntrack_names[] = {
50 "NONE", 50 "NONE",
51 "SYN_SENT", 51 "SYN_SENT",
52 "SYN_RECV", 52 "SYN_RECV",
@@ -261,7 +261,8 @@ static int tcp_pkt_to_tuple(const struct sk_buff *skb,
261 unsigned int dataoff, 261 unsigned int dataoff,
262 struct nf_conntrack_tuple *tuple) 262 struct nf_conntrack_tuple *tuple)
263{ 263{
264 struct tcphdr _hdr, *hp; 264 const struct tcphdr *hp;
265 struct tcphdr _hdr;
265 266
266 /* Actually only need first 8 bytes. */ 267 /* Actually only need first 8 bytes. */
267 hp = skb_header_pointer(skb, dataoff, 8, &_hdr); 268 hp = skb_header_pointer(skb, dataoff, 8, &_hdr);
@@ -292,13 +293,12 @@ static int tcp_print_tuple(struct seq_file *s,
292} 293}
293 294
294/* Print out the private part of the conntrack. */ 295/* Print out the private part of the conntrack. */
295static int tcp_print_conntrack(struct seq_file *s, 296static int tcp_print_conntrack(struct seq_file *s, const struct nf_conn *ct)
296 const struct nf_conn *conntrack)
297{ 297{
298 enum tcp_conntrack state; 298 enum tcp_conntrack state;
299 299
300 read_lock_bh(&tcp_lock); 300 read_lock_bh(&tcp_lock);
301 state = conntrack->proto.tcp.state; 301 state = ct->proto.tcp.state;
302 read_unlock_bh(&tcp_lock); 302 read_unlock_bh(&tcp_lock);
303 303
304 return seq_printf(s, "%s ", tcp_conntrack_names[state]); 304 return seq_printf(s, "%s ", tcp_conntrack_names[state]);
@@ -344,7 +344,7 @@ static unsigned int get_conntrack_index(const struct tcphdr *tcph)
344static inline __u32 segment_seq_plus_len(__u32 seq, 344static inline __u32 segment_seq_plus_len(__u32 seq,
345 size_t len, 345 size_t len,
346 unsigned int dataoff, 346 unsigned int dataoff,
347 struct tcphdr *tcph) 347 const struct tcphdr *tcph)
348{ 348{
349 /* XXX Should I use payload length field in IP/IPv6 header ? 349 /* XXX Should I use payload length field in IP/IPv6 header ?
350 * - YK */ 350 * - YK */
@@ -363,11 +363,11 @@ static inline __u32 segment_seq_plus_len(__u32 seq,
363 */ 363 */
364static void tcp_options(const struct sk_buff *skb, 364static void tcp_options(const struct sk_buff *skb,
365 unsigned int dataoff, 365 unsigned int dataoff,
366 struct tcphdr *tcph, 366 const struct tcphdr *tcph,
367 struct ip_ct_tcp_state *state) 367 struct ip_ct_tcp_state *state)
368{ 368{
369 unsigned char buff[(15 * 4) - sizeof(struct tcphdr)]; 369 unsigned char buff[(15 * 4) - sizeof(struct tcphdr)];
370 unsigned char *ptr; 370 const unsigned char *ptr;
371 int length = (tcph->doff*4) - sizeof(struct tcphdr); 371 int length = (tcph->doff*4) - sizeof(struct tcphdr);
372 372
373 if (!length) 373 if (!length)
@@ -418,10 +418,10 @@ static void tcp_options(const struct sk_buff *skb,
418} 418}
419 419
420static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff, 420static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff,
421 struct tcphdr *tcph, __u32 *sack) 421 const struct tcphdr *tcph, __u32 *sack)
422{ 422{
423 unsigned char buff[(15 * 4) - sizeof(struct tcphdr)]; 423 unsigned char buff[(15 * 4) - sizeof(struct tcphdr)];
424 unsigned char *ptr; 424 const unsigned char *ptr;
425 int length = (tcph->doff*4) - sizeof(struct tcphdr); 425 int length = (tcph->doff*4) - sizeof(struct tcphdr);
426 __u32 tmp; 426 __u32 tmp;
427 427
@@ -478,18 +478,18 @@ static void tcp_sack(const struct sk_buff *skb, unsigned int dataoff,
478 } 478 }
479} 479}
480 480
481static int tcp_in_window(struct nf_conn *ct, 481static int tcp_in_window(const struct nf_conn *ct,
482 struct ip_ct_tcp *state, 482 struct ip_ct_tcp *state,
483 enum ip_conntrack_dir dir, 483 enum ip_conntrack_dir dir,
484 unsigned int index, 484 unsigned int index,
485 const struct sk_buff *skb, 485 const struct sk_buff *skb,
486 unsigned int dataoff, 486 unsigned int dataoff,
487 struct tcphdr *tcph, 487 const struct tcphdr *tcph,
488 int pf) 488 int pf)
489{ 489{
490 struct ip_ct_tcp_state *sender = &state->seen[dir]; 490 struct ip_ct_tcp_state *sender = &state->seen[dir];
491 struct ip_ct_tcp_state *receiver = &state->seen[!dir]; 491 struct ip_ct_tcp_state *receiver = &state->seen[!dir];
492 struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple; 492 const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple;
493 __u32 seq, ack, sack, end, win, swin; 493 __u32 seq, ack, sack, end, win, swin;
494 int res; 494 int res;
495 495
@@ -687,14 +687,14 @@ static int tcp_in_window(struct nf_conn *ct,
687#ifdef CONFIG_NF_NAT_NEEDED 687#ifdef CONFIG_NF_NAT_NEEDED
688/* Update sender->td_end after NAT successfully mangled the packet */ 688/* Update sender->td_end after NAT successfully mangled the packet */
689/* Caller must linearize skb at tcp header. */ 689/* Caller must linearize skb at tcp header. */
690void nf_conntrack_tcp_update(struct sk_buff *skb, 690void nf_conntrack_tcp_update(const struct sk_buff *skb,
691 unsigned int dataoff, 691 unsigned int dataoff,
692 struct nf_conn *conntrack, 692 struct nf_conn *ct,
693 int dir) 693 int dir)
694{ 694{
695 struct tcphdr *tcph = (void *)skb->data + dataoff; 695 const struct tcphdr *tcph = (const void *)skb->data + dataoff;
696 struct ip_ct_tcp_state *sender = &conntrack->proto.tcp.seen[dir]; 696 const struct ip_ct_tcp_state *sender = &ct->proto.tcp.seen[dir];
697 struct ip_ct_tcp_state *receiver = &conntrack->proto.tcp.seen[!dir]; 697 const struct ip_ct_tcp_state *receiver = &ct->proto.tcp.seen[!dir];
698 __u32 end; 698 __u32 end;
699 699
700 end = segment_seq_plus_len(ntohl(tcph->seq), skb->len, dataoff, tcph); 700 end = segment_seq_plus_len(ntohl(tcph->seq), skb->len, dataoff, tcph);
@@ -703,9 +703,9 @@ void nf_conntrack_tcp_update(struct sk_buff *skb,
703 /* 703 /*
704 * We have to worry for the ack in the reply packet only... 704 * We have to worry for the ack in the reply packet only...
705 */ 705 */
706 if (after(end, conntrack->proto.tcp.seen[dir].td_end)) 706 if (after(end, ct->proto.tcp.seen[dir].td_end))
707 conntrack->proto.tcp.seen[dir].td_end = end; 707 ct->proto.tcp.seen[dir].td_end = end;
708 conntrack->proto.tcp.last_end = end; 708 ct->proto.tcp.last_end = end;
709 write_unlock_bh(&tcp_lock); 709 write_unlock_bh(&tcp_lock);
710 pr_debug("tcp_update: sender end=%u maxend=%u maxwin=%u scale=%i " 710 pr_debug("tcp_update: sender end=%u maxend=%u maxwin=%u scale=%i "
711 "receiver end=%u maxend=%u maxwin=%u scale=%i\n", 711 "receiver end=%u maxend=%u maxwin=%u scale=%i\n",
@@ -727,7 +727,7 @@ EXPORT_SYMBOL_GPL(nf_conntrack_tcp_update);
727#define TH_CWR 0x80 727#define TH_CWR 0x80
728 728
729/* table of valid flag combinations - PUSH, ECE and CWR are always valid */ 729/* table of valid flag combinations - PUSH, ECE and CWR are always valid */
730static u8 tcp_valid_flags[(TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG) + 1] = 730static const u8 tcp_valid_flags[(TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG) + 1] =
731{ 731{
732 [TH_SYN] = 1, 732 [TH_SYN] = 1,
733 [TH_SYN|TH_URG] = 1, 733 [TH_SYN|TH_URG] = 1,
@@ -747,7 +747,8 @@ static int tcp_error(struct sk_buff *skb,
747 int pf, 747 int pf,
748 unsigned int hooknum) 748 unsigned int hooknum)
749{ 749{
750 struct tcphdr _tcph, *th; 750 const struct tcphdr *th;
751 struct tcphdr _tcph;
751 unsigned int tcplen = skb->len - dataoff; 752 unsigned int tcplen = skb->len - dataoff;
752 u_int8_t tcpflags; 753 u_int8_t tcpflags;
753 754
@@ -794,7 +795,7 @@ static int tcp_error(struct sk_buff *skb,
794} 795}
795 796
796/* Returns verdict for packet, or -1 for invalid. */ 797/* Returns verdict for packet, or -1 for invalid. */
797static int tcp_packet(struct nf_conn *conntrack, 798static int tcp_packet(struct nf_conn *ct,
798 const struct sk_buff *skb, 799 const struct sk_buff *skb,
799 unsigned int dataoff, 800 unsigned int dataoff,
800 enum ip_conntrack_info ctinfo, 801 enum ip_conntrack_info ctinfo,
@@ -804,7 +805,8 @@ static int tcp_packet(struct nf_conn *conntrack,
804 struct nf_conntrack_tuple *tuple; 805 struct nf_conntrack_tuple *tuple;
805 enum tcp_conntrack new_state, old_state; 806 enum tcp_conntrack new_state, old_state;
806 enum ip_conntrack_dir dir; 807 enum ip_conntrack_dir dir;
807 struct tcphdr *th, _tcph; 808 const struct tcphdr *th;
809 struct tcphdr _tcph;
808 unsigned long timeout; 810 unsigned long timeout;
809 unsigned int index; 811 unsigned int index;
810 812
@@ -812,26 +814,24 @@ static int tcp_packet(struct nf_conn *conntrack,
812 BUG_ON(th == NULL); 814 BUG_ON(th == NULL);
813 815
814 write_lock_bh(&tcp_lock); 816 write_lock_bh(&tcp_lock);
815 old_state = conntrack->proto.tcp.state; 817 old_state = ct->proto.tcp.state;
816 dir = CTINFO2DIR(ctinfo); 818 dir = CTINFO2DIR(ctinfo);
817 index = get_conntrack_index(th); 819 index = get_conntrack_index(th);
818 new_state = tcp_conntracks[dir][index][old_state]; 820 new_state = tcp_conntracks[dir][index][old_state];
819 tuple = &conntrack->tuplehash[dir].tuple; 821 tuple = &ct->tuplehash[dir].tuple;
820 822
821 switch (new_state) { 823 switch (new_state) {
822 case TCP_CONNTRACK_SYN_SENT: 824 case TCP_CONNTRACK_SYN_SENT:
823 if (old_state < TCP_CONNTRACK_TIME_WAIT) 825 if (old_state < TCP_CONNTRACK_TIME_WAIT)
824 break; 826 break;
825 if ((conntrack->proto.tcp.seen[!dir].flags & 827 if ((ct->proto.tcp.seen[!dir].flags & IP_CT_TCP_FLAG_CLOSE_INIT)
826 IP_CT_TCP_FLAG_CLOSE_INIT) 828 || (ct->proto.tcp.last_dir == dir
827 || (conntrack->proto.tcp.last_dir == dir 829 && ct->proto.tcp.last_index == TCP_RST_SET)) {
828 && conntrack->proto.tcp.last_index == TCP_RST_SET)) {
829 /* Attempt to reopen a closed/aborted connection. 830 /* Attempt to reopen a closed/aborted connection.
830 * Delete this connection and look up again. */ 831 * Delete this connection and look up again. */
831 write_unlock_bh(&tcp_lock); 832 write_unlock_bh(&tcp_lock);
832 if (del_timer(&conntrack->timeout)) 833 if (del_timer(&ct->timeout))
833 conntrack->timeout.function((unsigned long) 834 ct->timeout.function((unsigned long)ct);
834 conntrack);
835 return -NF_REPEAT; 835 return -NF_REPEAT;
836 } 836 }
837 /* Fall through */ 837 /* Fall through */
@@ -843,10 +843,9 @@ static int tcp_packet(struct nf_conn *conntrack,
843 * c) ACK in reply direction after initial SYN in original. 843 * c) ACK in reply direction after initial SYN in original.
844 */ 844 */
845 if (index == TCP_SYNACK_SET 845 if (index == TCP_SYNACK_SET
846 && conntrack->proto.tcp.last_index == TCP_SYN_SET 846 && ct->proto.tcp.last_index == TCP_SYN_SET
847 && conntrack->proto.tcp.last_dir != dir 847 && ct->proto.tcp.last_dir != dir
848 && ntohl(th->ack_seq) == 848 && ntohl(th->ack_seq) == ct->proto.tcp.last_end) {
849 conntrack->proto.tcp.last_end) {
850 /* This SYN/ACK acknowledges a SYN that we earlier 849 /* This SYN/ACK acknowledges a SYN that we earlier
851 * ignored as invalid. This means that the client and 850 * ignored as invalid. This means that the client and
852 * the server are both in sync, while the firewall is 851 * the server are both in sync, while the firewall is
@@ -858,15 +857,14 @@ static int tcp_packet(struct nf_conn *conntrack,
858 if (LOG_INVALID(IPPROTO_TCP)) 857 if (LOG_INVALID(IPPROTO_TCP))
859 nf_log_packet(pf, 0, skb, NULL, NULL, NULL, 858 nf_log_packet(pf, 0, skb, NULL, NULL, NULL,
860 "nf_ct_tcp: killing out of sync session "); 859 "nf_ct_tcp: killing out of sync session ");
861 if (del_timer(&conntrack->timeout)) 860 if (del_timer(&ct->timeout))
862 conntrack->timeout.function((unsigned long) 861 ct->timeout.function((unsigned long)ct);
863 conntrack);
864 return -NF_DROP; 862 return -NF_DROP;
865 } 863 }
866 conntrack->proto.tcp.last_index = index; 864 ct->proto.tcp.last_index = index;
867 conntrack->proto.tcp.last_dir = dir; 865 ct->proto.tcp.last_dir = dir;
868 conntrack->proto.tcp.last_seq = ntohl(th->seq); 866 ct->proto.tcp.last_seq = ntohl(th->seq);
869 conntrack->proto.tcp.last_end = 867 ct->proto.tcp.last_end =
870 segment_seq_plus_len(ntohl(th->seq), skb->len, dataoff, th); 868 segment_seq_plus_len(ntohl(th->seq), skb->len, dataoff, th);
871 869
872 write_unlock_bh(&tcp_lock); 870 write_unlock_bh(&tcp_lock);
@@ -885,11 +883,11 @@ static int tcp_packet(struct nf_conn *conntrack,
885 return -NF_ACCEPT; 883 return -NF_ACCEPT;
886 case TCP_CONNTRACK_CLOSE: 884 case TCP_CONNTRACK_CLOSE:
887 if (index == TCP_RST_SET 885 if (index == TCP_RST_SET
888 && ((test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status) 886 && ((test_bit(IPS_SEEN_REPLY_BIT, &ct->status)
889 && conntrack->proto.tcp.last_index == TCP_SYN_SET) 887 && ct->proto.tcp.last_index == TCP_SYN_SET)
890 || (!test_bit(IPS_ASSURED_BIT, &conntrack->status) 888 || (!test_bit(IPS_ASSURED_BIT, &ct->status)
891 && conntrack->proto.tcp.last_index == TCP_ACK_SET)) 889 && ct->proto.tcp.last_index == TCP_ACK_SET))
892 && ntohl(th->ack_seq) == conntrack->proto.tcp.last_end) { 890 && ntohl(th->ack_seq) == ct->proto.tcp.last_end) {
893 /* RST sent to invalid SYN or ACK we had let through 891 /* RST sent to invalid SYN or ACK we had let through
894 * at a) and c) above: 892 * at a) and c) above:
895 * 893 *
@@ -907,15 +905,15 @@ static int tcp_packet(struct nf_conn *conntrack,
907 break; 905 break;
908 } 906 }
909 907
910 if (!tcp_in_window(conntrack, &conntrack->proto.tcp, dir, index, 908 if (!tcp_in_window(ct, &ct->proto.tcp, dir, index,
911 skb, dataoff, th, pf)) { 909 skb, dataoff, th, pf)) {
912 write_unlock_bh(&tcp_lock); 910 write_unlock_bh(&tcp_lock);
913 return -NF_ACCEPT; 911 return -NF_ACCEPT;
914 } 912 }
915 in_window: 913 in_window:
916 /* From now on we have got in-window packets */ 914 /* From now on we have got in-window packets */
917 conntrack->proto.tcp.last_index = index; 915 ct->proto.tcp.last_index = index;
918 conntrack->proto.tcp.last_dir = dir; 916 ct->proto.tcp.last_dir = dir;
919 917
920 pr_debug("tcp_conntracks: "); 918 pr_debug("tcp_conntracks: ");
921 NF_CT_DUMP_TUPLE(tuple); 919 NF_CT_DUMP_TUPLE(tuple);
@@ -924,12 +922,12 @@ static int tcp_packet(struct nf_conn *conntrack,
924 (th->fin ? 1 : 0), (th->rst ? 1 : 0), 922 (th->fin ? 1 : 0), (th->rst ? 1 : 0),
925 old_state, new_state); 923 old_state, new_state);
926 924
927 conntrack->proto.tcp.state = new_state; 925 ct->proto.tcp.state = new_state;
928 if (old_state != new_state 926 if (old_state != new_state
929 && (new_state == TCP_CONNTRACK_FIN_WAIT 927 && (new_state == TCP_CONNTRACK_FIN_WAIT
930 || new_state == TCP_CONNTRACK_CLOSE)) 928 || new_state == TCP_CONNTRACK_CLOSE))
931 conntrack->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT; 929 ct->proto.tcp.seen[dir].flags |= IP_CT_TCP_FLAG_CLOSE_INIT;
932 timeout = conntrack->proto.tcp.retrans >= nf_ct_tcp_max_retrans 930 timeout = ct->proto.tcp.retrans >= nf_ct_tcp_max_retrans
933 && tcp_timeouts[new_state] > nf_ct_tcp_timeout_max_retrans 931 && tcp_timeouts[new_state] > nf_ct_tcp_timeout_max_retrans
934 ? nf_ct_tcp_timeout_max_retrans : tcp_timeouts[new_state]; 932 ? nf_ct_tcp_timeout_max_retrans : tcp_timeouts[new_state];
935 write_unlock_bh(&tcp_lock); 933 write_unlock_bh(&tcp_lock);
@@ -938,41 +936,41 @@ static int tcp_packet(struct nf_conn *conntrack,
938 if (new_state != old_state) 936 if (new_state != old_state)
939 nf_conntrack_event_cache(IPCT_PROTOINFO, skb); 937 nf_conntrack_event_cache(IPCT_PROTOINFO, skb);
940 938
941 if (!test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)) { 939 if (!test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
942 /* If only reply is a RST, we can consider ourselves not to 940 /* If only reply is a RST, we can consider ourselves not to
943 have an established connection: this is a fairly common 941 have an established connection: this is a fairly common
944 problem case, so we can delete the conntrack 942 problem case, so we can delete the conntrack
945 immediately. --RR */ 943 immediately. --RR */
946 if (th->rst) { 944 if (th->rst) {
947 if (del_timer(&conntrack->timeout)) 945 if (del_timer(&ct->timeout))
948 conntrack->timeout.function((unsigned long) 946 ct->timeout.function((unsigned long)ct);
949 conntrack);
950 return NF_ACCEPT; 947 return NF_ACCEPT;
951 } 948 }
952 } else if (!test_bit(IPS_ASSURED_BIT, &conntrack->status) 949 } else if (!test_bit(IPS_ASSURED_BIT, &ct->status)
953 && (old_state == TCP_CONNTRACK_SYN_RECV 950 && (old_state == TCP_CONNTRACK_SYN_RECV
954 || old_state == TCP_CONNTRACK_ESTABLISHED) 951 || old_state == TCP_CONNTRACK_ESTABLISHED)
955 && new_state == TCP_CONNTRACK_ESTABLISHED) { 952 && new_state == TCP_CONNTRACK_ESTABLISHED) {
956 /* Set ASSURED if we see see valid ack in ESTABLISHED 953 /* Set ASSURED if we see see valid ack in ESTABLISHED
957 after SYN_RECV or a valid answer for a picked up 954 after SYN_RECV or a valid answer for a picked up
958 connection. */ 955 connection. */
959 set_bit(IPS_ASSURED_BIT, &conntrack->status); 956 set_bit(IPS_ASSURED_BIT, &ct->status);
960 nf_conntrack_event_cache(IPCT_STATUS, skb); 957 nf_conntrack_event_cache(IPCT_STATUS, skb);
961 } 958 }
962 nf_ct_refresh_acct(conntrack, ctinfo, skb, timeout); 959 nf_ct_refresh_acct(ct, ctinfo, skb, timeout);
963 960
964 return NF_ACCEPT; 961 return NF_ACCEPT;
965} 962}
966 963
967/* Called when a new connection for this protocol found. */ 964/* Called when a new connection for this protocol found. */
968static int tcp_new(struct nf_conn *conntrack, 965static int tcp_new(struct nf_conn *ct,
969 const struct sk_buff *skb, 966 const struct sk_buff *skb,
970 unsigned int dataoff) 967 unsigned int dataoff)
971{ 968{
972 enum tcp_conntrack new_state; 969 enum tcp_conntrack new_state;
973 struct tcphdr *th, _tcph; 970 const struct tcphdr *th;
974 struct ip_ct_tcp_state *sender = &conntrack->proto.tcp.seen[0]; 971 struct tcphdr _tcph;
975 struct ip_ct_tcp_state *receiver = &conntrack->proto.tcp.seen[1]; 972 const struct ip_ct_tcp_state *sender = &ct->proto.tcp.seen[0];
973 const struct ip_ct_tcp_state *receiver = &ct->proto.tcp.seen[1];
976 974
977 th = skb_header_pointer(skb, dataoff, sizeof(_tcph), &_tcph); 975 th = skb_header_pointer(skb, dataoff, sizeof(_tcph), &_tcph);
978 BUG_ON(th == NULL); 976 BUG_ON(th == NULL);
@@ -990,17 +988,17 @@ static int tcp_new(struct nf_conn *conntrack,
990 988
991 if (new_state == TCP_CONNTRACK_SYN_SENT) { 989 if (new_state == TCP_CONNTRACK_SYN_SENT) {
992 /* SYN packet */ 990 /* SYN packet */
993 conntrack->proto.tcp.seen[0].td_end = 991 ct->proto.tcp.seen[0].td_end =
994 segment_seq_plus_len(ntohl(th->seq), skb->len, 992 segment_seq_plus_len(ntohl(th->seq), skb->len,
995 dataoff, th); 993 dataoff, th);
996 conntrack->proto.tcp.seen[0].td_maxwin = ntohs(th->window); 994 ct->proto.tcp.seen[0].td_maxwin = ntohs(th->window);
997 if (conntrack->proto.tcp.seen[0].td_maxwin == 0) 995 if (ct->proto.tcp.seen[0].td_maxwin == 0)
998 conntrack->proto.tcp.seen[0].td_maxwin = 1; 996 ct->proto.tcp.seen[0].td_maxwin = 1;
999 conntrack->proto.tcp.seen[0].td_maxend = 997 ct->proto.tcp.seen[0].td_maxend =
1000 conntrack->proto.tcp.seen[0].td_end; 998 ct->proto.tcp.seen[0].td_end;
1001 999
1002 tcp_options(skb, dataoff, th, &conntrack->proto.tcp.seen[0]); 1000 tcp_options(skb, dataoff, th, &ct->proto.tcp.seen[0]);
1003 conntrack->proto.tcp.seen[1].flags = 0; 1001 ct->proto.tcp.seen[1].flags = 0;
1004 } else if (nf_ct_tcp_loose == 0) { 1002 } else if (nf_ct_tcp_loose == 0) {
1005 /* Don't try to pick up connections. */ 1003 /* Don't try to pick up connections. */
1006 return 0; 1004 return 0;
@@ -1010,32 +1008,32 @@ static int tcp_new(struct nf_conn *conntrack,
1010 * its history is lost for us. 1008 * its history is lost for us.
1011 * Let's try to use the data from the packet. 1009 * Let's try to use the data from the packet.
1012 */ 1010 */
1013 conntrack->proto.tcp.seen[0].td_end = 1011 ct->proto.tcp.seen[0].td_end =
1014 segment_seq_plus_len(ntohl(th->seq), skb->len, 1012 segment_seq_plus_len(ntohl(th->seq), skb->len,
1015 dataoff, th); 1013 dataoff, th);
1016 conntrack->proto.tcp.seen[0].td_maxwin = ntohs(th->window); 1014 ct->proto.tcp.seen[0].td_maxwin = ntohs(th->window);
1017 if (conntrack->proto.tcp.seen[0].td_maxwin == 0) 1015 if (ct->proto.tcp.seen[0].td_maxwin == 0)
1018 conntrack->proto.tcp.seen[0].td_maxwin = 1; 1016 ct->proto.tcp.seen[0].td_maxwin = 1;
1019 conntrack->proto.tcp.seen[0].td_maxend = 1017 ct->proto.tcp.seen[0].td_maxend =
1020 conntrack->proto.tcp.seen[0].td_end + 1018 ct->proto.tcp.seen[0].td_end +
1021 conntrack->proto.tcp.seen[0].td_maxwin; 1019 ct->proto.tcp.seen[0].td_maxwin;
1022 conntrack->proto.tcp.seen[0].td_scale = 0; 1020 ct->proto.tcp.seen[0].td_scale = 0;
1023 1021
1024 /* We assume SACK and liberal window checking to handle 1022 /* We assume SACK and liberal window checking to handle
1025 * window scaling */ 1023 * window scaling */
1026 conntrack->proto.tcp.seen[0].flags = 1024 ct->proto.tcp.seen[0].flags =
1027 conntrack->proto.tcp.seen[1].flags = IP_CT_TCP_FLAG_SACK_PERM | 1025 ct->proto.tcp.seen[1].flags = IP_CT_TCP_FLAG_SACK_PERM |
1028 IP_CT_TCP_FLAG_BE_LIBERAL; 1026 IP_CT_TCP_FLAG_BE_LIBERAL;
1029 } 1027 }
1030 1028
1031 conntrack->proto.tcp.seen[1].td_end = 0; 1029 ct->proto.tcp.seen[1].td_end = 0;
1032 conntrack->proto.tcp.seen[1].td_maxend = 0; 1030 ct->proto.tcp.seen[1].td_maxend = 0;
1033 conntrack->proto.tcp.seen[1].td_maxwin = 1; 1031 ct->proto.tcp.seen[1].td_maxwin = 1;
1034 conntrack->proto.tcp.seen[1].td_scale = 0; 1032 ct->proto.tcp.seen[1].td_scale = 0;
1035 1033
1036 /* tcp_packet will set them */ 1034 /* tcp_packet will set them */
1037 conntrack->proto.tcp.state = TCP_CONNTRACK_NONE; 1035 ct->proto.tcp.state = TCP_CONNTRACK_NONE;
1038 conntrack->proto.tcp.last_index = TCP_NONE_SET; 1036 ct->proto.tcp.last_index = TCP_NONE_SET;
1039 1037
1040 pr_debug("tcp_new: sender end=%u maxend=%u maxwin=%u scale=%i " 1038 pr_debug("tcp_new: sender end=%u maxend=%u maxwin=%u scale=%i "
1041 "receiver end=%u maxend=%u maxwin=%u scale=%i\n", 1039 "receiver end=%u maxend=%u maxwin=%u scale=%i\n",
@@ -1098,16 +1096,16 @@ static const struct nla_policy tcp_nla_policy[CTA_PROTOINFO_TCP_MAX+1] = {
1098 1096
1099static int nlattr_to_tcp(struct nlattr *cda[], struct nf_conn *ct) 1097static int nlattr_to_tcp(struct nlattr *cda[], struct nf_conn *ct)
1100{ 1098{
1101 struct nlattr *attr = cda[CTA_PROTOINFO_TCP]; 1099 struct nlattr *pattr = cda[CTA_PROTOINFO_TCP];
1102 struct nlattr *tb[CTA_PROTOINFO_TCP_MAX+1]; 1100 struct nlattr *tb[CTA_PROTOINFO_TCP_MAX+1];
1103 int err; 1101 int err;
1104 1102
1105 /* updates could not contain anything about the private 1103 /* updates could not contain anything about the private
1106 * protocol info, in that case skip the parsing */ 1104 * protocol info, in that case skip the parsing */
1107 if (!attr) 1105 if (!pattr)
1108 return 0; 1106 return 0;
1109 1107
1110 err = nla_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, attr, tcp_nla_policy); 1108 err = nla_parse_nested(tb, CTA_PROTOINFO_TCP_MAX, pattr, tcp_nla_policy);
1111 if (err < 0) 1109 if (err < 0)
1112 return err; 1110 return err;
1113 1111
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
index 384875411082..b8a35cc06416 100644
--- a/net/netfilter/nf_conntrack_proto_udp.c
+++ b/net/netfilter/nf_conntrack_proto_udp.c
@@ -30,7 +30,8 @@ static int udp_pkt_to_tuple(const struct sk_buff *skb,
30 unsigned int dataoff, 30 unsigned int dataoff,
31 struct nf_conntrack_tuple *tuple) 31 struct nf_conntrack_tuple *tuple)
32{ 32{
33 struct udphdr _hdr, *hp; 33 const struct udphdr *hp;
34 struct udphdr _hdr;
34 35
35 /* Actually only need first 8 bytes. */ 36 /* Actually only need first 8 bytes. */
36 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); 37 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr);
@@ -61,7 +62,7 @@ static int udp_print_tuple(struct seq_file *s,
61} 62}
62 63
63/* Returns verdict for packet, and may modify conntracktype */ 64/* Returns verdict for packet, and may modify conntracktype */
64static int udp_packet(struct nf_conn *conntrack, 65static int udp_packet(struct nf_conn *ct,
65 const struct sk_buff *skb, 66 const struct sk_buff *skb,
66 unsigned int dataoff, 67 unsigned int dataoff,
67 enum ip_conntrack_info ctinfo, 68 enum ip_conntrack_info ctinfo,
@@ -70,20 +71,19 @@ static int udp_packet(struct nf_conn *conntrack,
70{ 71{
71 /* If we've seen traffic both ways, this is some kind of UDP 72 /* If we've seen traffic both ways, this is some kind of UDP
72 stream. Extend timeout. */ 73 stream. Extend timeout. */
73 if (test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)) { 74 if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
74 nf_ct_refresh_acct(conntrack, ctinfo, skb, 75 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_udp_timeout_stream);
75 nf_ct_udp_timeout_stream);
76 /* Also, more likely to be important, and not a probe */ 76 /* Also, more likely to be important, and not a probe */
77 if (!test_and_set_bit(IPS_ASSURED_BIT, &conntrack->status)) 77 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
78 nf_conntrack_event_cache(IPCT_STATUS, skb); 78 nf_conntrack_event_cache(IPCT_STATUS, skb);
79 } else 79 } else
80 nf_ct_refresh_acct(conntrack, ctinfo, skb, nf_ct_udp_timeout); 80 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_udp_timeout);
81 81
82 return NF_ACCEPT; 82 return NF_ACCEPT;
83} 83}
84 84
85/* Called when a new connection for this protocol found. */ 85/* Called when a new connection for this protocol found. */
86static int udp_new(struct nf_conn *conntrack, const struct sk_buff *skb, 86static int udp_new(struct nf_conn *ct, const struct sk_buff *skb,
87 unsigned int dataoff) 87 unsigned int dataoff)
88{ 88{
89 return 1; 89 return 1;
@@ -95,7 +95,8 @@ static int udp_error(struct sk_buff *skb, unsigned int dataoff,
95 unsigned int hooknum) 95 unsigned int hooknum)
96{ 96{
97 unsigned int udplen = skb->len - dataoff; 97 unsigned int udplen = skb->len - dataoff;
98 struct udphdr _hdr, *hdr; 98 const struct udphdr *hdr;
99 struct udphdr _hdr;
99 100
100 /* Header is too small? */ 101 /* Header is too small? */
101 hdr = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); 102 hdr = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr);
diff --git a/net/netfilter/nf_conntrack_proto_udplite.c b/net/netfilter/nf_conntrack_proto_udplite.c
index 070056d9bcd6..9dd03c7aeac6 100644
--- a/net/netfilter/nf_conntrack_proto_udplite.c
+++ b/net/netfilter/nf_conntrack_proto_udplite.c
@@ -31,7 +31,8 @@ static int udplite_pkt_to_tuple(const struct sk_buff *skb,
31 unsigned int dataoff, 31 unsigned int dataoff,
32 struct nf_conntrack_tuple *tuple) 32 struct nf_conntrack_tuple *tuple)
33{ 33{
34 struct udphdr _hdr, *hp; 34 const struct udphdr *hp;
35 struct udphdr _hdr;
35 36
36 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); 37 hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr);
37 if (hp == NULL) 38 if (hp == NULL)
@@ -60,7 +61,7 @@ static int udplite_print_tuple(struct seq_file *s,
60} 61}
61 62
62/* Returns verdict for packet, and may modify conntracktype */ 63/* Returns verdict for packet, and may modify conntracktype */
63static int udplite_packet(struct nf_conn *conntrack, 64static int udplite_packet(struct nf_conn *ct,
64 const struct sk_buff *skb, 65 const struct sk_buff *skb,
65 unsigned int dataoff, 66 unsigned int dataoff,
66 enum ip_conntrack_info ctinfo, 67 enum ip_conntrack_info ctinfo,
@@ -69,21 +70,20 @@ static int udplite_packet(struct nf_conn *conntrack,
69{ 70{
70 /* If we've seen traffic both ways, this is some kind of UDP 71 /* If we've seen traffic both ways, this is some kind of UDP
71 stream. Extend timeout. */ 72 stream. Extend timeout. */
72 if (test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status)) { 73 if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) {
73 nf_ct_refresh_acct(conntrack, ctinfo, skb, 74 nf_ct_refresh_acct(ct, ctinfo, skb,
74 nf_ct_udplite_timeout_stream); 75 nf_ct_udplite_timeout_stream);
75 /* Also, more likely to be important, and not a probe */ 76 /* Also, more likely to be important, and not a probe */
76 if (!test_and_set_bit(IPS_ASSURED_BIT, &conntrack->status)) 77 if (!test_and_set_bit(IPS_ASSURED_BIT, &ct->status))
77 nf_conntrack_event_cache(IPCT_STATUS, skb); 78 nf_conntrack_event_cache(IPCT_STATUS, skb);
78 } else 79 } else
79 nf_ct_refresh_acct(conntrack, ctinfo, skb, 80 nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_udplite_timeout);
80 nf_ct_udplite_timeout);
81 81
82 return NF_ACCEPT; 82 return NF_ACCEPT;
83} 83}
84 84
85/* Called when a new connection for this protocol found. */ 85/* Called when a new connection for this protocol found. */
86static int udplite_new(struct nf_conn *conntrack, const struct sk_buff *skb, 86static int udplite_new(struct nf_conn *ct, const struct sk_buff *skb,
87 unsigned int dataoff) 87 unsigned int dataoff)
88{ 88{
89 return 1; 89 return 1;
@@ -95,7 +95,8 @@ static int udplite_error(struct sk_buff *skb, unsigned int dataoff,
95 unsigned int hooknum) 95 unsigned int hooknum)
96{ 96{
97 unsigned int udplen = skb->len - dataoff; 97 unsigned int udplen = skb->len - dataoff;
98 struct udphdr _hdr, *hdr; 98 const struct udphdr *hdr;
99 struct udphdr _hdr;
99 unsigned int cscov; 100 unsigned int cscov;
100 101
101 /* Header is too small? */ 102 /* Header is too small? */
diff --git a/net/netfilter/nf_conntrack_sane.c b/net/netfilter/nf_conntrack_sane.c
index b5a16c6e21c2..a70051d741a7 100644
--- a/net/netfilter/nf_conntrack_sane.c
+++ b/net/netfilter/nf_conntrack_sane.c
@@ -62,8 +62,9 @@ static int help(struct sk_buff *skb,
62 enum ip_conntrack_info ctinfo) 62 enum ip_conntrack_info ctinfo)
63{ 63{
64 unsigned int dataoff, datalen; 64 unsigned int dataoff, datalen;
65 struct tcphdr _tcph, *th; 65 const struct tcphdr *th;
66 char *sb_ptr; 66 struct tcphdr _tcph;
67 void *sb_ptr;
67 int ret = NF_ACCEPT; 68 int ret = NF_ACCEPT;
68 int dir = CTINFO2DIR(ctinfo); 69 int dir = CTINFO2DIR(ctinfo);
69 struct nf_ct_sane_master *ct_sane_info; 70 struct nf_ct_sane_master *ct_sane_info;
@@ -99,7 +100,7 @@ static int help(struct sk_buff *skb,
99 if (datalen != sizeof(struct sane_request)) 100 if (datalen != sizeof(struct sane_request))
100 goto out; 101 goto out;
101 102
102 req = (struct sane_request *)sb_ptr; 103 req = sb_ptr;
103 if (req->RPC_code != htonl(SANE_NET_START)) { 104 if (req->RPC_code != htonl(SANE_NET_START)) {
104 /* Not an interesting command */ 105 /* Not an interesting command */
105 ct_sane_info->state = SANE_STATE_NORMAL; 106 ct_sane_info->state = SANE_STATE_NORMAL;
@@ -123,7 +124,7 @@ static int help(struct sk_buff *skb,
123 goto out; 124 goto out;
124 } 125 }
125 126
126 reply = (struct sane_reply_net_start *)sb_ptr; 127 reply = sb_ptr;
127 if (reply->status != htonl(SANE_STATUS_SUCCESS)) { 128 if (reply->status != htonl(SANE_STATUS_SUCCESS)) {
128 /* saned refused the command */ 129 /* saned refused the command */
129 pr_debug("nf_ct_sane: unsuccessful SANE_STATUS = %u\n", 130 pr_debug("nf_ct_sane: unsuccessful SANE_STATUS = %u\n",
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 47d8947cf263..c521c891d351 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -28,7 +28,7 @@ MODULE_ALIAS("ip_conntrack_sip");
28 28
29#define MAX_PORTS 8 29#define MAX_PORTS 8
30static unsigned short ports[MAX_PORTS]; 30static unsigned short ports[MAX_PORTS];
31static int ports_c; 31static unsigned int ports_c;
32module_param_array(ports, ushort, &ports_c, 0400); 32module_param_array(ports, ushort, &ports_c, 0400);
33MODULE_PARM_DESC(ports, "port numbers of SIP servers"); 33MODULE_PARM_DESC(ports, "port numbers of SIP servers");
34 34
@@ -48,10 +48,10 @@ unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb,
48 const char *dptr) __read_mostly; 48 const char *dptr) __read_mostly;
49EXPORT_SYMBOL_GPL(nf_nat_sdp_hook); 49EXPORT_SYMBOL_GPL(nf_nat_sdp_hook);
50 50
51static int digits_len(struct nf_conn *, const char *, const char *, int *); 51static int digits_len(const struct nf_conn *, const char *, const char *, int *);
52static int epaddr_len(struct nf_conn *, const char *, const char *, int *); 52static int epaddr_len(const struct nf_conn *, const char *, const char *, int *);
53static int skp_digits_len(struct nf_conn *, const char *, const char *, int *); 53static int skp_digits_len(const struct nf_conn *, const char *, const char *, int *);
54static int skp_epaddr_len(struct nf_conn *, const char *, const char *, int *); 54static int skp_epaddr_len(const struct nf_conn *, const char *, const char *, int *);
55 55
56struct sip_header_nfo { 56struct sip_header_nfo {
57 const char *lname; 57 const char *lname;
@@ -61,7 +61,7 @@ struct sip_header_nfo {
61 size_t snlen; 61 size_t snlen;
62 size_t ln_strlen; 62 size_t ln_strlen;
63 int case_sensitive; 63 int case_sensitive;
64 int (*match_len)(struct nf_conn *, const char *, 64 int (*match_len)(const struct nf_conn *, const char *,
65 const char *, int *); 65 const char *, int *);
66}; 66};
67 67
@@ -225,7 +225,7 @@ const char *ct_sip_search(const char *needle, const char *haystack,
225} 225}
226EXPORT_SYMBOL_GPL(ct_sip_search); 226EXPORT_SYMBOL_GPL(ct_sip_search);
227 227
228static int digits_len(struct nf_conn *ct, const char *dptr, 228static int digits_len(const struct nf_conn *ct, const char *dptr,
229 const char *limit, int *shift) 229 const char *limit, int *shift)
230{ 230{
231 int len = 0; 231 int len = 0;
@@ -237,7 +237,7 @@ static int digits_len(struct nf_conn *ct, const char *dptr,
237} 237}
238 238
239/* get digits length, skipping blank spaces. */ 239/* get digits length, skipping blank spaces. */
240static int skp_digits_len(struct nf_conn *ct, const char *dptr, 240static int skp_digits_len(const struct nf_conn *ct, const char *dptr,
241 const char *limit, int *shift) 241 const char *limit, int *shift)
242{ 242{
243 for (; dptr <= limit && *dptr == ' '; dptr++) 243 for (; dptr <= limit && *dptr == ' '; dptr++)
@@ -246,8 +246,9 @@ static int skp_digits_len(struct nf_conn *ct, const char *dptr,
246 return digits_len(ct, dptr, limit, shift); 246 return digits_len(ct, dptr, limit, shift);
247} 247}
248 248
249static int parse_addr(struct nf_conn *ct, const char *cp, const char **endp, 249static int parse_addr(const struct nf_conn *ct, const char *cp,
250 union nf_inet_addr *addr, const char *limit) 250 const char **endp, union nf_inet_addr *addr,
251 const char *limit)
251{ 252{
252 const char *end; 253 const char *end;
253 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num; 254 int family = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
@@ -272,7 +273,7 @@ static int parse_addr(struct nf_conn *ct, const char *cp, const char **endp,
272} 273}
273 274
274/* skip ip address. returns its length. */ 275/* skip ip address. returns its length. */
275static int epaddr_len(struct nf_conn *ct, const char *dptr, 276static int epaddr_len(const struct nf_conn *ct, const char *dptr,
276 const char *limit, int *shift) 277 const char *limit, int *shift)
277{ 278{
278 union nf_inet_addr addr; 279 union nf_inet_addr addr;
@@ -292,7 +293,7 @@ static int epaddr_len(struct nf_conn *ct, const char *dptr,
292} 293}
293 294
294/* get address length, skiping user info. */ 295/* get address length, skiping user info. */
295static int skp_epaddr_len(struct nf_conn *ct, const char *dptr, 296static int skp_epaddr_len(const struct nf_conn *ct, const char *dptr,
296 const char *limit, int *shift) 297 const char *limit, int *shift)
297{ 298{
298 const char *start = dptr; 299 const char *start = dptr;
@@ -319,7 +320,7 @@ static int skp_epaddr_len(struct nf_conn *ct, const char *dptr,
319} 320}
320 321
321/* Returns 0 if not found, -1 error parsing. */ 322/* Returns 0 if not found, -1 error parsing. */
322int ct_sip_get_info(struct nf_conn *ct, 323int ct_sip_get_info(const struct nf_conn *ct,
323 const char *dptr, size_t dlen, 324 const char *dptr, size_t dlen,
324 unsigned int *matchoff, 325 unsigned int *matchoff,
325 unsigned int *matchlen, 326 unsigned int *matchlen,
@@ -407,7 +408,7 @@ static int sip_help(struct sk_buff *skb,
407 unsigned int dataoff, datalen; 408 unsigned int dataoff, datalen;
408 const char *dptr; 409 const char *dptr;
409 int ret = NF_ACCEPT; 410 int ret = NF_ACCEPT;
410 int matchoff, matchlen; 411 unsigned int matchoff, matchlen;
411 u_int16_t port; 412 u_int16_t port;
412 enum sip_header_pos pos; 413 enum sip_header_pos pos;
413 typeof(nf_nat_sip_hook) nf_nat_sip; 414 typeof(nf_nat_sip_hook) nf_nat_sip;
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 696074a037c1..e88e96af613d 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -31,8 +31,8 @@ MODULE_LICENSE("GPL");
31#ifdef CONFIG_PROC_FS 31#ifdef CONFIG_PROC_FS
32int 32int
33print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, 33print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
34 struct nf_conntrack_l3proto *l3proto, 34 const struct nf_conntrack_l3proto *l3proto,
35 struct nf_conntrack_l4proto *l4proto) 35 const struct nf_conntrack_l4proto *l4proto)
36{ 36{
37 return l3proto->print_tuple(s, tuple) || l4proto->print_tuple(s, tuple); 37 return l3proto->print_tuple(s, tuple) || l4proto->print_tuple(s, tuple);
38} 38}
@@ -58,12 +58,14 @@ struct ct_iter_state {
58static struct hlist_node *ct_get_first(struct seq_file *seq) 58static struct hlist_node *ct_get_first(struct seq_file *seq)
59{ 59{
60 struct ct_iter_state *st = seq->private; 60 struct ct_iter_state *st = seq->private;
61 struct hlist_node *n;
61 62
62 for (st->bucket = 0; 63 for (st->bucket = 0;
63 st->bucket < nf_conntrack_htable_size; 64 st->bucket < nf_conntrack_htable_size;
64 st->bucket++) { 65 st->bucket++) {
65 if (!hlist_empty(&nf_conntrack_hash[st->bucket])) 66 n = rcu_dereference(nf_conntrack_hash[st->bucket].first);
66 return nf_conntrack_hash[st->bucket].first; 67 if (n)
68 return n;
67 } 69 }
68 return NULL; 70 return NULL;
69} 71}
@@ -73,11 +75,11 @@ static struct hlist_node *ct_get_next(struct seq_file *seq,
73{ 75{
74 struct ct_iter_state *st = seq->private; 76 struct ct_iter_state *st = seq->private;
75 77
76 head = head->next; 78 head = rcu_dereference(head->next);
77 while (head == NULL) { 79 while (head == NULL) {
78 if (++st->bucket >= nf_conntrack_htable_size) 80 if (++st->bucket >= nf_conntrack_htable_size)
79 return NULL; 81 return NULL;
80 head = nf_conntrack_hash[st->bucket].first; 82 head = rcu_dereference(nf_conntrack_hash[st->bucket].first);
81 } 83 }
82 return head; 84 return head;
83} 85}
@@ -93,8 +95,9 @@ static struct hlist_node *ct_get_idx(struct seq_file *seq, loff_t pos)
93} 95}
94 96
95static void *ct_seq_start(struct seq_file *seq, loff_t *pos) 97static void *ct_seq_start(struct seq_file *seq, loff_t *pos)
98 __acquires(RCU)
96{ 99{
97 read_lock_bh(&nf_conntrack_lock); 100 rcu_read_lock();
98 return ct_get_idx(seq, *pos); 101 return ct_get_idx(seq, *pos);
99} 102}
100 103
@@ -105,79 +108,80 @@ static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos)
105} 108}
106 109
107static void ct_seq_stop(struct seq_file *s, void *v) 110static void ct_seq_stop(struct seq_file *s, void *v)
111 __releases(RCU)
108{ 112{
109 read_unlock_bh(&nf_conntrack_lock); 113 rcu_read_unlock();
110} 114}
111 115
112/* return 0 on success, 1 in case of error */ 116/* return 0 on success, 1 in case of error */
113static int ct_seq_show(struct seq_file *s, void *v) 117static int ct_seq_show(struct seq_file *s, void *v)
114{ 118{
115 const struct nf_conntrack_tuple_hash *hash = v; 119 const struct nf_conntrack_tuple_hash *hash = v;
116 const struct nf_conn *conntrack = nf_ct_tuplehash_to_ctrack(hash); 120 const struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(hash);
117 struct nf_conntrack_l3proto *l3proto; 121 const struct nf_conntrack_l3proto *l3proto;
118 struct nf_conntrack_l4proto *l4proto; 122 const struct nf_conntrack_l4proto *l4proto;
119 123
120 NF_CT_ASSERT(conntrack); 124 NF_CT_ASSERT(ct);
121 125
122 /* we only want to print DIR_ORIGINAL */ 126 /* we only want to print DIR_ORIGINAL */
123 if (NF_CT_DIRECTION(hash)) 127 if (NF_CT_DIRECTION(hash))
124 return 0; 128 return 0;
125 129
126 l3proto = __nf_ct_l3proto_find(conntrack->tuplehash[IP_CT_DIR_ORIGINAL] 130 l3proto = __nf_ct_l3proto_find(ct->tuplehash[IP_CT_DIR_ORIGINAL]
127 .tuple.src.l3num); 131 .tuple.src.l3num);
128 132
129 NF_CT_ASSERT(l3proto); 133 NF_CT_ASSERT(l3proto);
130 l4proto = __nf_ct_l4proto_find(conntrack->tuplehash[IP_CT_DIR_ORIGINAL] 134 l4proto = __nf_ct_l4proto_find(ct->tuplehash[IP_CT_DIR_ORIGINAL]
131 .tuple.src.l3num, 135 .tuple.src.l3num,
132 conntrack->tuplehash[IP_CT_DIR_ORIGINAL] 136 ct->tuplehash[IP_CT_DIR_ORIGINAL]
133 .tuple.dst.protonum); 137 .tuple.dst.protonum);
134 NF_CT_ASSERT(l4proto); 138 NF_CT_ASSERT(l4proto);
135 139
136 if (seq_printf(s, "%-8s %u %-8s %u %ld ", 140 if (seq_printf(s, "%-8s %u %-8s %u %ld ",
137 l3proto->name, 141 l3proto->name,
138 conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num, 142 ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num,
139 l4proto->name, 143 l4proto->name,
140 conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum, 144 ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum,
141 timer_pending(&conntrack->timeout) 145 timer_pending(&ct->timeout)
142 ? (long)(conntrack->timeout.expires - jiffies)/HZ : 0) != 0) 146 ? (long)(ct->timeout.expires - jiffies)/HZ : 0) != 0)
143 return -ENOSPC; 147 return -ENOSPC;
144 148
145 if (l4proto->print_conntrack && l4proto->print_conntrack(s, conntrack)) 149 if (l4proto->print_conntrack && l4proto->print_conntrack(s, ct))
146 return -ENOSPC; 150 return -ENOSPC;
147 151
148 if (print_tuple(s, &conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple, 152 if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
149 l3proto, l4proto)) 153 l3proto, l4proto))
150 return -ENOSPC; 154 return -ENOSPC;
151 155
152 if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_ORIGINAL])) 156 if (seq_print_counters(s, &ct->counters[IP_CT_DIR_ORIGINAL]))
153 return -ENOSPC; 157 return -ENOSPC;
154 158
155 if (!(test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status))) 159 if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status)))
156 if (seq_printf(s, "[UNREPLIED] ")) 160 if (seq_printf(s, "[UNREPLIED] "))
157 return -ENOSPC; 161 return -ENOSPC;
158 162
159 if (print_tuple(s, &conntrack->tuplehash[IP_CT_DIR_REPLY].tuple, 163 if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple,
160 l3proto, l4proto)) 164 l3proto, l4proto))
161 return -ENOSPC; 165 return -ENOSPC;
162 166
163 if (seq_print_counters(s, &conntrack->counters[IP_CT_DIR_REPLY])) 167 if (seq_print_counters(s, &ct->counters[IP_CT_DIR_REPLY]))
164 return -ENOSPC; 168 return -ENOSPC;
165 169
166 if (test_bit(IPS_ASSURED_BIT, &conntrack->status)) 170 if (test_bit(IPS_ASSURED_BIT, &ct->status))
167 if (seq_printf(s, "[ASSURED] ")) 171 if (seq_printf(s, "[ASSURED] "))
168 return -ENOSPC; 172 return -ENOSPC;
169 173
170#if defined(CONFIG_NF_CONNTRACK_MARK) 174#if defined(CONFIG_NF_CONNTRACK_MARK)
171 if (seq_printf(s, "mark=%u ", conntrack->mark)) 175 if (seq_printf(s, "mark=%u ", ct->mark))
172 return -ENOSPC; 176 return -ENOSPC;
173#endif 177#endif
174 178
175#ifdef CONFIG_NF_CONNTRACK_SECMARK 179#ifdef CONFIG_NF_CONNTRACK_SECMARK
176 if (seq_printf(s, "secmark=%u ", conntrack->secmark)) 180 if (seq_printf(s, "secmark=%u ", ct->secmark))
177 return -ENOSPC; 181 return -ENOSPC;
178#endif 182#endif
179 183
180 if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use))) 184 if (seq_printf(s, "use=%u\n", atomic_read(&ct->ct_general.use)))
181 return -ENOSPC; 185 return -ENOSPC;
182 186
183 return 0; 187 return 0;
@@ -242,7 +246,7 @@ static void ct_cpu_seq_stop(struct seq_file *seq, void *v)
242static int ct_cpu_seq_show(struct seq_file *seq, void *v) 246static int ct_cpu_seq_show(struct seq_file *seq, void *v)
243{ 247{
244 unsigned int nr_conntracks = atomic_read(&nf_conntrack_count); 248 unsigned int nr_conntracks = atomic_read(&nf_conntrack_count);
245 struct ip_conntrack_stat *st = v; 249 const struct ip_conntrack_stat *st = v;
246 250
247 if (v == SEQ_START_TOKEN) { 251 if (v == SEQ_START_TOKEN) {
248 seq_printf(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete\n"); 252 seq_printf(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete\n");
@@ -380,7 +384,7 @@ static ctl_table nf_ct_netfilter_table[] = {
380 { .ctl_name = 0 } 384 { .ctl_name = 0 }
381}; 385};
382 386
383struct ctl_path nf_ct_path[] = { 387static struct ctl_path nf_ct_path[] = {
384 { .procname = "net", .ctl_name = CTL_NET, }, 388 { .procname = "net", .ctl_name = CTL_NET, },
385 { } 389 { }
386}; 390};
diff --git a/net/netfilter/nf_conntrack_tftp.c b/net/netfilter/nf_conntrack_tftp.c
index e894aa1ff3ad..bd2e800f23cc 100644
--- a/net/netfilter/nf_conntrack_tftp.c
+++ b/net/netfilter/nf_conntrack_tftp.c
@@ -25,7 +25,7 @@ MODULE_ALIAS("ip_conntrack_tftp");
25 25
26#define MAX_PORTS 8 26#define MAX_PORTS 8
27static unsigned short ports[MAX_PORTS]; 27static unsigned short ports[MAX_PORTS];
28static int ports_c; 28static unsigned int ports_c;
29module_param_array(ports, ushort, &ports_c, 0400); 29module_param_array(ports, ushort, &ports_c, 0400);
30MODULE_PARM_DESC(ports, "Port numbers of TFTP servers"); 30MODULE_PARM_DESC(ports, "Port numbers of TFTP servers");
31 31
@@ -39,7 +39,8 @@ static int tftp_help(struct sk_buff *skb,
39 struct nf_conn *ct, 39 struct nf_conn *ct,
40 enum ip_conntrack_info ctinfo) 40 enum ip_conntrack_info ctinfo)
41{ 41{
42 struct tftphdr _tftph, *tfh; 42 const struct tftphdr *tfh;
43 struct tftphdr _tftph;
43 struct nf_conntrack_expect *exp; 44 struct nf_conntrack_expect *exp;
44 struct nf_conntrack_tuple *tuple; 45 struct nf_conntrack_tuple *tuple;
45 unsigned int ret = NF_ACCEPT; 46 unsigned int ret = NF_ACCEPT;
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 4f5f2885fcac..cec9976aecbf 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -103,6 +103,7 @@ EXPORT_SYMBOL(nf_log_packet);
103 103
104#ifdef CONFIG_PROC_FS 104#ifdef CONFIG_PROC_FS
105static void *seq_start(struct seq_file *seq, loff_t *pos) 105static void *seq_start(struct seq_file *seq, loff_t *pos)
106 __acquires(RCU)
106{ 107{
107 rcu_read_lock(); 108 rcu_read_lock();
108 109
@@ -123,6 +124,7 @@ static void *seq_next(struct seq_file *s, void *v, loff_t *pos)
123} 124}
124 125
125static void seq_stop(struct seq_file *s, void *v) 126static void seq_stop(struct seq_file *s, void *v)
127 __releases(RCU)
126{ 128{
127 rcu_read_unlock(); 129 rcu_read_unlock();
128} 130}
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 5013cb97ce2b..7efa40d47393 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -467,7 +467,7 @@ __build_packet_message(struct nfulnl_instance *inst,
467 read_lock_bh(&skb->sk->sk_callback_lock); 467 read_lock_bh(&skb->sk->sk_callback_lock);
468 if (skb->sk->sk_socket && skb->sk->sk_socket->file) { 468 if (skb->sk->sk_socket && skb->sk->sk_socket->file) {
469 __be32 uid = htonl(skb->sk->sk_socket->file->f_uid); 469 __be32 uid = htonl(skb->sk->sk_socket->file->f_uid);
470 __be32 gid = htons(skb->sk->sk_socket->file->f_gid); 470 __be32 gid = htonl(skb->sk->sk_socket->file->f_gid);
471 /* need to unlock here since NLA_PUT may goto */ 471 /* need to unlock here since NLA_PUT may goto */
472 read_unlock_bh(&skb->sk->sk_callback_lock); 472 read_unlock_bh(&skb->sk->sk_callback_lock);
473 NLA_PUT_BE32(inst->skb, NFULA_UID, uid); 473 NLA_PUT_BE32(inst->skb, NFULA_UID, uid);
@@ -866,6 +866,7 @@ static struct hlist_node *get_idx(struct iter_state *st, loff_t pos)
866} 866}
867 867
868static void *seq_start(struct seq_file *seq, loff_t *pos) 868static void *seq_start(struct seq_file *seq, loff_t *pos)
869 __acquires(instances_lock)
869{ 870{
870 read_lock_bh(&instances_lock); 871 read_lock_bh(&instances_lock);
871 return get_idx(seq->private, *pos); 872 return get_idx(seq->private, *pos);
@@ -878,6 +879,7 @@ static void *seq_next(struct seq_file *s, void *v, loff_t *pos)
878} 879}
879 880
880static void seq_stop(struct seq_file *s, void *v) 881static void seq_stop(struct seq_file *s, void *v)
882 __releases(instances_lock)
881{ 883{
882 read_unlock_bh(&instances_lock); 884 read_unlock_bh(&instances_lock);
883} 885}
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 51476f82bb54..a48b20fe9cd6 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -360,7 +360,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
360 360
361 if (data_len) { 361 if (data_len) {
362 struct nlattr *nla; 362 struct nlattr *nla;
363 int size = nla_attr_size(data_len); 363 int sz = nla_attr_size(data_len);
364 364
365 if (skb_tailroom(skb) < nla_total_size(data_len)) { 365 if (skb_tailroom(skb) < nla_total_size(data_len)) {
366 printk(KERN_WARNING "nf_queue: no tailroom!\n"); 366 printk(KERN_WARNING "nf_queue: no tailroom!\n");
@@ -369,7 +369,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
369 369
370 nla = (struct nlattr *)skb_put(skb, nla_total_size(data_len)); 370 nla = (struct nlattr *)skb_put(skb, nla_total_size(data_len));
371 nla->nla_type = NFQA_PAYLOAD; 371 nla->nla_type = NFQA_PAYLOAD;
372 nla->nla_len = size; 372 nla->nla_len = sz;
373 373
374 if (skb_copy_bits(entskb, 0, nla_data(nla), data_len)) 374 if (skb_copy_bits(entskb, 0, nla_data(nla), data_len))
375 BUG(); 375 BUG();
@@ -845,6 +845,7 @@ static struct hlist_node *get_idx(struct seq_file *seq, loff_t pos)
845} 845}
846 846
847static void *seq_start(struct seq_file *seq, loff_t *pos) 847static void *seq_start(struct seq_file *seq, loff_t *pos)
848 __acquires(instances_lock)
848{ 849{
849 spin_lock(&instances_lock); 850 spin_lock(&instances_lock);
850 return get_idx(seq, *pos); 851 return get_idx(seq, *pos);
@@ -857,6 +858,7 @@ static void *seq_next(struct seq_file *s, void *v, loff_t *pos)
857} 858}
858 859
859static void seq_stop(struct seq_file *s, void *v) 860static void seq_stop(struct seq_file *s, void *v)
861 __releases(instances_lock)
860{ 862{
861 spin_unlock(&instances_lock); 863 spin_unlock(&instances_lock);
862} 864}
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 8d4fca96a4a7..a6792089fcf9 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -44,7 +44,6 @@ struct xt_af {
44 struct mutex mutex; 44 struct mutex mutex;
45 struct list_head match; 45 struct list_head match;
46 struct list_head target; 46 struct list_head target;
47 struct list_head tables;
48#ifdef CONFIG_COMPAT 47#ifdef CONFIG_COMPAT
49 struct mutex compat_mutex; 48 struct mutex compat_mutex;
50 struct compat_delta *compat_offsets; 49 struct compat_delta *compat_offsets;
@@ -59,12 +58,6 @@ static struct xt_af *xt;
59#define duprintf(format, args...) 58#define duprintf(format, args...)
60#endif 59#endif
61 60
62enum {
63 TABLE,
64 TARGET,
65 MATCH,
66};
67
68static const char *xt_prefix[NPROTO] = { 61static const char *xt_prefix[NPROTO] = {
69 [AF_INET] = "ip", 62 [AF_INET] = "ip",
70 [AF_INET6] = "ip6", 63 [AF_INET6] = "ip6",
@@ -400,7 +393,7 @@ int xt_compat_match_offset(struct xt_match *match)
400EXPORT_SYMBOL_GPL(xt_compat_match_offset); 393EXPORT_SYMBOL_GPL(xt_compat_match_offset);
401 394
402int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr, 395int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
403 int *size) 396 unsigned int *size)
404{ 397{
405 struct xt_match *match = m->u.kernel.match; 398 struct xt_match *match = m->u.kernel.match;
406 struct compat_xt_entry_match *cm = (struct compat_xt_entry_match *)m; 399 struct compat_xt_entry_match *cm = (struct compat_xt_entry_match *)m;
@@ -427,7 +420,7 @@ int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
427EXPORT_SYMBOL_GPL(xt_compat_match_from_user); 420EXPORT_SYMBOL_GPL(xt_compat_match_from_user);
428 421
429int xt_compat_match_to_user(struct xt_entry_match *m, void __user **dstptr, 422int xt_compat_match_to_user(struct xt_entry_match *m, void __user **dstptr,
430 int *size) 423 unsigned int *size)
431{ 424{
432 struct xt_match *match = m->u.kernel.match; 425 struct xt_match *match = m->u.kernel.match;
433 struct compat_xt_entry_match __user *cm = *dstptr; 426 struct compat_xt_entry_match __user *cm = *dstptr;
@@ -494,7 +487,7 @@ int xt_compat_target_offset(struct xt_target *target)
494EXPORT_SYMBOL_GPL(xt_compat_target_offset); 487EXPORT_SYMBOL_GPL(xt_compat_target_offset);
495 488
496void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr, 489void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
497 int *size) 490 unsigned int *size)
498{ 491{
499 struct xt_target *target = t->u.kernel.target; 492 struct xt_target *target = t->u.kernel.target;
500 struct compat_xt_entry_target *ct = (struct compat_xt_entry_target *)t; 493 struct compat_xt_entry_target *ct = (struct compat_xt_entry_target *)t;
@@ -520,7 +513,7 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
520EXPORT_SYMBOL_GPL(xt_compat_target_from_user); 513EXPORT_SYMBOL_GPL(xt_compat_target_from_user);
521 514
522int xt_compat_target_to_user(struct xt_entry_target *t, void __user **dstptr, 515int xt_compat_target_to_user(struct xt_entry_target *t, void __user **dstptr,
523 int *size) 516 unsigned int *size)
524{ 517{
525 struct xt_target *target = t->u.kernel.target; 518 struct xt_target *target = t->u.kernel.target;
526 struct compat_xt_entry_target __user *ct = *dstptr; 519 struct compat_xt_entry_target __user *ct = *dstptr;
@@ -597,14 +590,14 @@ void xt_free_table_info(struct xt_table_info *info)
597EXPORT_SYMBOL(xt_free_table_info); 590EXPORT_SYMBOL(xt_free_table_info);
598 591
599/* Find table by name, grabs mutex & ref. Returns ERR_PTR() on error. */ 592/* Find table by name, grabs mutex & ref. Returns ERR_PTR() on error. */
600struct xt_table *xt_find_table_lock(int af, const char *name) 593struct xt_table *xt_find_table_lock(struct net *net, int af, const char *name)
601{ 594{
602 struct xt_table *t; 595 struct xt_table *t;
603 596
604 if (mutex_lock_interruptible(&xt[af].mutex) != 0) 597 if (mutex_lock_interruptible(&xt[af].mutex) != 0)
605 return ERR_PTR(-EINTR); 598 return ERR_PTR(-EINTR);
606 599
607 list_for_each_entry(t, &xt[af].tables, list) 600 list_for_each_entry(t, &net->xt.tables[af], list)
608 if (strcmp(t->name, name) == 0 && try_module_get(t->me)) 601 if (strcmp(t->name, name) == 0 && try_module_get(t->me))
609 return t; 602 return t;
610 mutex_unlock(&xt[af].mutex); 603 mutex_unlock(&xt[af].mutex);
@@ -660,20 +653,27 @@ xt_replace_table(struct xt_table *table,
660} 653}
661EXPORT_SYMBOL_GPL(xt_replace_table); 654EXPORT_SYMBOL_GPL(xt_replace_table);
662 655
663int xt_register_table(struct xt_table *table, 656struct xt_table *xt_register_table(struct net *net, struct xt_table *table,
664 struct xt_table_info *bootstrap, 657 struct xt_table_info *bootstrap,
665 struct xt_table_info *newinfo) 658 struct xt_table_info *newinfo)
666{ 659{
667 int ret; 660 int ret;
668 struct xt_table_info *private; 661 struct xt_table_info *private;
669 struct xt_table *t; 662 struct xt_table *t;
670 663
664 /* Don't add one object to multiple lists. */
665 table = kmemdup(table, sizeof(struct xt_table), GFP_KERNEL);
666 if (!table) {
667 ret = -ENOMEM;
668 goto out;
669 }
670
671 ret = mutex_lock_interruptible(&xt[table->af].mutex); 671 ret = mutex_lock_interruptible(&xt[table->af].mutex);
672 if (ret != 0) 672 if (ret != 0)
673 return ret; 673 goto out_free;
674 674
675 /* Don't autoload: we'd eat our tail... */ 675 /* Don't autoload: we'd eat our tail... */
676 list_for_each_entry(t, &xt[table->af].tables, list) { 676 list_for_each_entry(t, &net->xt.tables[table->af], list) {
677 if (strcmp(t->name, table->name) == 0) { 677 if (strcmp(t->name, table->name) == 0) {
678 ret = -EEXIST; 678 ret = -EEXIST;
679 goto unlock; 679 goto unlock;
@@ -692,12 +692,16 @@ int xt_register_table(struct xt_table *table,
692 /* save number of initial entries */ 692 /* save number of initial entries */
693 private->initial_entries = private->number; 693 private->initial_entries = private->number;
694 694
695 list_add(&table->list, &xt[table->af].tables); 695 list_add(&table->list, &net->xt.tables[table->af]);
696 mutex_unlock(&xt[table->af].mutex);
697 return table;
696 698
697 ret = 0;
698 unlock: 699 unlock:
699 mutex_unlock(&xt[table->af].mutex); 700 mutex_unlock(&xt[table->af].mutex);
700 return ret; 701out_free:
702 kfree(table);
703out:
704 return ERR_PTR(ret);
701} 705}
702EXPORT_SYMBOL_GPL(xt_register_table); 706EXPORT_SYMBOL_GPL(xt_register_table);
703 707
@@ -709,130 +713,204 @@ void *xt_unregister_table(struct xt_table *table)
709 private = table->private; 713 private = table->private;
710 list_del(&table->list); 714 list_del(&table->list);
711 mutex_unlock(&xt[table->af].mutex); 715 mutex_unlock(&xt[table->af].mutex);
716 kfree(table);
712 717
713 return private; 718 return private;
714} 719}
715EXPORT_SYMBOL_GPL(xt_unregister_table); 720EXPORT_SYMBOL_GPL(xt_unregister_table);
716 721
717#ifdef CONFIG_PROC_FS 722#ifdef CONFIG_PROC_FS
718static struct list_head *xt_get_idx(struct list_head *list, struct seq_file *seq, loff_t pos) 723struct xt_names_priv {
724 struct seq_net_private p;
725 int af;
726};
727static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos)
719{ 728{
720 struct list_head *head = list->next; 729 struct xt_names_priv *priv = seq->private;
730 struct net *net = priv->p.net;
731 int af = priv->af;
721 732
722 if (!head || list_empty(list)) 733 mutex_lock(&xt[af].mutex);
723 return NULL; 734 return seq_list_start(&net->xt.tables[af], *pos);
735}
724 736
725 while (pos && (head = head->next)) { 737static void *xt_table_seq_next(struct seq_file *seq, void *v, loff_t *pos)
726 if (head == list) 738{
727 return NULL; 739 struct xt_names_priv *priv = seq->private;
728 pos--; 740 struct net *net = priv->p.net;
729 } 741 int af = priv->af;
730 return pos ? NULL : head;
731}
732
733static struct list_head *type2list(u_int16_t af, u_int16_t type)
734{
735 struct list_head *list;
736
737 switch (type) {
738 case TARGET:
739 list = &xt[af].target;
740 break;
741 case MATCH:
742 list = &xt[af].match;
743 break;
744 case TABLE:
745 list = &xt[af].tables;
746 break;
747 default:
748 list = NULL;
749 break;
750 }
751 742
752 return list; 743 return seq_list_next(v, &net->xt.tables[af], pos);
753} 744}
754 745
755static void *xt_tgt_seq_start(struct seq_file *seq, loff_t *pos) 746static void xt_table_seq_stop(struct seq_file *seq, void *v)
756{ 747{
757 struct proc_dir_entry *pde = (struct proc_dir_entry *) seq->private; 748 struct xt_names_priv *priv = seq->private;
758 u_int16_t af = (unsigned long)pde->data & 0xffff; 749 int af = priv->af;
759 u_int16_t type = (unsigned long)pde->data >> 16;
760 struct list_head *list;
761 750
762 if (af >= NPROTO) 751 mutex_unlock(&xt[af].mutex);
763 return NULL; 752}
764 753
765 list = type2list(af, type); 754static int xt_table_seq_show(struct seq_file *seq, void *v)
766 if (!list) 755{
767 return NULL; 756 struct xt_table *table = list_entry(v, struct xt_table, list);
768 757
769 if (mutex_lock_interruptible(&xt[af].mutex) != 0) 758 if (strlen(table->name))
770 return NULL; 759 return seq_printf(seq, "%s\n", table->name);
760 else
761 return 0;
762}
763
764static const struct seq_operations xt_table_seq_ops = {
765 .start = xt_table_seq_start,
766 .next = xt_table_seq_next,
767 .stop = xt_table_seq_stop,
768 .show = xt_table_seq_show,
769};
771 770
772 return xt_get_idx(list, seq, *pos); 771static int xt_table_open(struct inode *inode, struct file *file)
772{
773 int ret;
774 struct xt_names_priv *priv;
775
776 ret = seq_open_net(inode, file, &xt_table_seq_ops,
777 sizeof(struct xt_names_priv));
778 if (!ret) {
779 priv = ((struct seq_file *)file->private_data)->private;
780 priv->af = (unsigned long)PDE(inode)->data;
781 }
782 return ret;
773} 783}
774 784
775static void *xt_tgt_seq_next(struct seq_file *seq, void *v, loff_t *pos) 785static const struct file_operations xt_table_ops = {
786 .owner = THIS_MODULE,
787 .open = xt_table_open,
788 .read = seq_read,
789 .llseek = seq_lseek,
790 .release = seq_release,
791};
792
793static void *xt_match_seq_start(struct seq_file *seq, loff_t *pos)
776{ 794{
777 struct proc_dir_entry *pde = seq->private; 795 struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
778 u_int16_t af = (unsigned long)pde->data & 0xffff; 796 u_int16_t af = (unsigned long)pde->data;
779 u_int16_t type = (unsigned long)pde->data >> 16;
780 struct list_head *list;
781 797
782 if (af >= NPROTO) 798 mutex_lock(&xt[af].mutex);
783 return NULL; 799 return seq_list_start(&xt[af].match, *pos);
800}
784 801
785 list = type2list(af, type); 802static void *xt_match_seq_next(struct seq_file *seq, void *v, loff_t *pos)
786 if (!list) 803{
787 return NULL; 804 struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
805 u_int16_t af = (unsigned long)pde->data;
788 806
789 (*pos)++; 807 return seq_list_next(v, &xt[af].match, pos);
790 return xt_get_idx(list, seq, *pos);
791} 808}
792 809
793static void xt_tgt_seq_stop(struct seq_file *seq, void *v) 810static void xt_match_seq_stop(struct seq_file *seq, void *v)
794{ 811{
795 struct proc_dir_entry *pde = seq->private; 812 struct proc_dir_entry *pde = seq->private;
796 u_int16_t af = (unsigned long)pde->data & 0xffff; 813 u_int16_t af = (unsigned long)pde->data;
797 814
798 mutex_unlock(&xt[af].mutex); 815 mutex_unlock(&xt[af].mutex);
799} 816}
800 817
801static int xt_name_seq_show(struct seq_file *seq, void *v) 818static int xt_match_seq_show(struct seq_file *seq, void *v)
802{ 819{
803 char *name = (char *)v + sizeof(struct list_head); 820 struct xt_match *match = list_entry(v, struct xt_match, list);
804 821
805 if (strlen(name)) 822 if (strlen(match->name))
806 return seq_printf(seq, "%s\n", name); 823 return seq_printf(seq, "%s\n", match->name);
807 else 824 else
808 return 0; 825 return 0;
809} 826}
810 827
811static const struct seq_operations xt_tgt_seq_ops = { 828static const struct seq_operations xt_match_seq_ops = {
812 .start = xt_tgt_seq_start, 829 .start = xt_match_seq_start,
813 .next = xt_tgt_seq_next, 830 .next = xt_match_seq_next,
814 .stop = xt_tgt_seq_stop, 831 .stop = xt_match_seq_stop,
815 .show = xt_name_seq_show, 832 .show = xt_match_seq_show,
816}; 833};
817 834
818static int xt_tgt_open(struct inode *inode, struct file *file) 835static int xt_match_open(struct inode *inode, struct file *file)
819{ 836{
820 int ret; 837 int ret;
821 838
822 ret = seq_open(file, &xt_tgt_seq_ops); 839 ret = seq_open(file, &xt_match_seq_ops);
823 if (!ret) { 840 if (!ret) {
824 struct seq_file *seq = file->private_data; 841 struct seq_file *seq = file->private_data;
825 struct proc_dir_entry *pde = PDE(inode);
826 842
827 seq->private = pde; 843 seq->private = PDE(inode);
828 } 844 }
845 return ret;
846}
847
848static const struct file_operations xt_match_ops = {
849 .owner = THIS_MODULE,
850 .open = xt_match_open,
851 .read = seq_read,
852 .llseek = seq_lseek,
853 .release = seq_release,
854};
855
856static void *xt_target_seq_start(struct seq_file *seq, loff_t *pos)
857{
858 struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
859 u_int16_t af = (unsigned long)pde->data;
860
861 mutex_lock(&xt[af].mutex);
862 return seq_list_start(&xt[af].target, *pos);
863}
864
865static void *xt_target_seq_next(struct seq_file *seq, void *v, loff_t *pos)
866{
867 struct proc_dir_entry *pde = (struct proc_dir_entry *)seq->private;
868 u_int16_t af = (unsigned long)pde->data;
869
870 return seq_list_next(v, &xt[af].target, pos);
871}
872
873static void xt_target_seq_stop(struct seq_file *seq, void *v)
874{
875 struct proc_dir_entry *pde = seq->private;
876 u_int16_t af = (unsigned long)pde->data;
877
878 mutex_unlock(&xt[af].mutex);
879}
829 880
881static int xt_target_seq_show(struct seq_file *seq, void *v)
882{
883 struct xt_target *target = list_entry(v, struct xt_target, list);
884
885 if (strlen(target->name))
886 return seq_printf(seq, "%s\n", target->name);
887 else
888 return 0;
889}
890
891static const struct seq_operations xt_target_seq_ops = {
892 .start = xt_target_seq_start,
893 .next = xt_target_seq_next,
894 .stop = xt_target_seq_stop,
895 .show = xt_target_seq_show,
896};
897
898static int xt_target_open(struct inode *inode, struct file *file)
899{
900 int ret;
901
902 ret = seq_open(file, &xt_target_seq_ops);
903 if (!ret) {
904 struct seq_file *seq = file->private_data;
905
906 seq->private = PDE(inode);
907 }
830 return ret; 908 return ret;
831} 909}
832 910
833static const struct file_operations xt_file_ops = { 911static const struct file_operations xt_target_ops = {
834 .owner = THIS_MODULE, 912 .owner = THIS_MODULE,
835 .open = xt_tgt_open, 913 .open = xt_target_open,
836 .read = seq_read, 914 .read = seq_read,
837 .llseek = seq_lseek, 915 .llseek = seq_lseek,
838 .release = seq_release, 916 .release = seq_release,
@@ -844,7 +922,7 @@ static const struct file_operations xt_file_ops = {
844 922
845#endif /* CONFIG_PROC_FS */ 923#endif /* CONFIG_PROC_FS */
846 924
847int xt_proto_init(int af) 925int xt_proto_init(struct net *net, int af)
848{ 926{
849#ifdef CONFIG_PROC_FS 927#ifdef CONFIG_PROC_FS
850 char buf[XT_FUNCTION_MAXNAMELEN]; 928 char buf[XT_FUNCTION_MAXNAMELEN];
@@ -858,25 +936,25 @@ int xt_proto_init(int af)
858#ifdef CONFIG_PROC_FS 936#ifdef CONFIG_PROC_FS
859 strlcpy(buf, xt_prefix[af], sizeof(buf)); 937 strlcpy(buf, xt_prefix[af], sizeof(buf));
860 strlcat(buf, FORMAT_TABLES, sizeof(buf)); 938 strlcat(buf, FORMAT_TABLES, sizeof(buf));
861 proc = proc_net_fops_create(&init_net, buf, 0440, &xt_file_ops); 939 proc = proc_net_fops_create(net, buf, 0440, &xt_table_ops);
862 if (!proc) 940 if (!proc)
863 goto out; 941 goto out;
864 proc->data = (void *) ((unsigned long) af | (TABLE << 16)); 942 proc->data = (void *)(unsigned long)af;
865 943
866 944
867 strlcpy(buf, xt_prefix[af], sizeof(buf)); 945 strlcpy(buf, xt_prefix[af], sizeof(buf));
868 strlcat(buf, FORMAT_MATCHES, sizeof(buf)); 946 strlcat(buf, FORMAT_MATCHES, sizeof(buf));
869 proc = proc_net_fops_create(&init_net, buf, 0440, &xt_file_ops); 947 proc = proc_net_fops_create(net, buf, 0440, &xt_match_ops);
870 if (!proc) 948 if (!proc)
871 goto out_remove_tables; 949 goto out_remove_tables;
872 proc->data = (void *) ((unsigned long) af | (MATCH << 16)); 950 proc->data = (void *)(unsigned long)af;
873 951
874 strlcpy(buf, xt_prefix[af], sizeof(buf)); 952 strlcpy(buf, xt_prefix[af], sizeof(buf));
875 strlcat(buf, FORMAT_TARGETS, sizeof(buf)); 953 strlcat(buf, FORMAT_TARGETS, sizeof(buf));
876 proc = proc_net_fops_create(&init_net, buf, 0440, &xt_file_ops); 954 proc = proc_net_fops_create(net, buf, 0440, &xt_target_ops);
877 if (!proc) 955 if (!proc)
878 goto out_remove_matches; 956 goto out_remove_matches;
879 proc->data = (void *) ((unsigned long) af | (TARGET << 16)); 957 proc->data = (void *)(unsigned long)af;
880#endif 958#endif
881 959
882 return 0; 960 return 0;
@@ -885,42 +963,54 @@ int xt_proto_init(int af)
885out_remove_matches: 963out_remove_matches:
886 strlcpy(buf, xt_prefix[af], sizeof(buf)); 964 strlcpy(buf, xt_prefix[af], sizeof(buf));
887 strlcat(buf, FORMAT_MATCHES, sizeof(buf)); 965 strlcat(buf, FORMAT_MATCHES, sizeof(buf));
888 proc_net_remove(&init_net, buf); 966 proc_net_remove(net, buf);
889 967
890out_remove_tables: 968out_remove_tables:
891 strlcpy(buf, xt_prefix[af], sizeof(buf)); 969 strlcpy(buf, xt_prefix[af], sizeof(buf));
892 strlcat(buf, FORMAT_TABLES, sizeof(buf)); 970 strlcat(buf, FORMAT_TABLES, sizeof(buf));
893 proc_net_remove(&init_net, buf); 971 proc_net_remove(net, buf);
894out: 972out:
895 return -1; 973 return -1;
896#endif 974#endif
897} 975}
898EXPORT_SYMBOL_GPL(xt_proto_init); 976EXPORT_SYMBOL_GPL(xt_proto_init);
899 977
900void xt_proto_fini(int af) 978void xt_proto_fini(struct net *net, int af)
901{ 979{
902#ifdef CONFIG_PROC_FS 980#ifdef CONFIG_PROC_FS
903 char buf[XT_FUNCTION_MAXNAMELEN]; 981 char buf[XT_FUNCTION_MAXNAMELEN];
904 982
905 strlcpy(buf, xt_prefix[af], sizeof(buf)); 983 strlcpy(buf, xt_prefix[af], sizeof(buf));
906 strlcat(buf, FORMAT_TABLES, sizeof(buf)); 984 strlcat(buf, FORMAT_TABLES, sizeof(buf));
907 proc_net_remove(&init_net, buf); 985 proc_net_remove(net, buf);
908 986
909 strlcpy(buf, xt_prefix[af], sizeof(buf)); 987 strlcpy(buf, xt_prefix[af], sizeof(buf));
910 strlcat(buf, FORMAT_TARGETS, sizeof(buf)); 988 strlcat(buf, FORMAT_TARGETS, sizeof(buf));
911 proc_net_remove(&init_net, buf); 989 proc_net_remove(net, buf);
912 990
913 strlcpy(buf, xt_prefix[af], sizeof(buf)); 991 strlcpy(buf, xt_prefix[af], sizeof(buf));
914 strlcat(buf, FORMAT_MATCHES, sizeof(buf)); 992 strlcat(buf, FORMAT_MATCHES, sizeof(buf));
915 proc_net_remove(&init_net, buf); 993 proc_net_remove(net, buf);
916#endif /*CONFIG_PROC_FS*/ 994#endif /*CONFIG_PROC_FS*/
917} 995}
918EXPORT_SYMBOL_GPL(xt_proto_fini); 996EXPORT_SYMBOL_GPL(xt_proto_fini);
919 997
998static int __net_init xt_net_init(struct net *net)
999{
1000 int i;
1001
1002 for (i = 0; i < NPROTO; i++)
1003 INIT_LIST_HEAD(&net->xt.tables[i]);
1004 return 0;
1005}
1006
1007static struct pernet_operations xt_net_ops = {
1008 .init = xt_net_init,
1009};
920 1010
921static int __init xt_init(void) 1011static int __init xt_init(void)
922{ 1012{
923 int i; 1013 int i, rv;
924 1014
925 xt = kmalloc(sizeof(struct xt_af) * NPROTO, GFP_KERNEL); 1015 xt = kmalloc(sizeof(struct xt_af) * NPROTO, GFP_KERNEL);
926 if (!xt) 1016 if (!xt)
@@ -934,13 +1024,16 @@ static int __init xt_init(void)
934#endif 1024#endif
935 INIT_LIST_HEAD(&xt[i].target); 1025 INIT_LIST_HEAD(&xt[i].target);
936 INIT_LIST_HEAD(&xt[i].match); 1026 INIT_LIST_HEAD(&xt[i].match);
937 INIT_LIST_HEAD(&xt[i].tables);
938 } 1027 }
939 return 0; 1028 rv = register_pernet_subsys(&xt_net_ops);
1029 if (rv < 0)
1030 kfree(xt);
1031 return rv;
940} 1032}
941 1033
942static void __exit xt_fini(void) 1034static void __exit xt_fini(void)
943{ 1035{
1036 unregister_pernet_subsys(&xt_net_ops);
944 kfree(xt); 1037 kfree(xt);
945} 1038}
946 1039
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index 60e3767cc71d..217e2b686322 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -13,7 +13,10 @@
13#include <linux/ip.h> 13#include <linux/ip.h>
14#include <linux/ipv6.h> 14#include <linux/ipv6.h>
15#include <linux/tcp.h> 15#include <linux/tcp.h>
16#include <net/dst.h>
17#include <net/flow.h>
16#include <net/ipv6.h> 18#include <net/ipv6.h>
19#include <net/route.h>
17#include <net/tcp.h> 20#include <net/tcp.h>
18 21
19#include <linux/netfilter_ipv4/ip_tables.h> 22#include <linux/netfilter_ipv4/ip_tables.h>
@@ -41,6 +44,7 @@ optlen(const u_int8_t *opt, unsigned int offset)
41static int 44static int
42tcpmss_mangle_packet(struct sk_buff *skb, 45tcpmss_mangle_packet(struct sk_buff *skb,
43 const struct xt_tcpmss_info *info, 46 const struct xt_tcpmss_info *info,
47 unsigned int in_mtu,
44 unsigned int tcphoff, 48 unsigned int tcphoff,
45 unsigned int minlen) 49 unsigned int minlen)
46{ 50{
@@ -76,7 +80,13 @@ tcpmss_mangle_packet(struct sk_buff *skb,
76 dst_mtu(skb->dst)); 80 dst_mtu(skb->dst));
77 return -1; 81 return -1;
78 } 82 }
79 newmss = dst_mtu(skb->dst) - minlen; 83 if (in_mtu <= minlen) {
84 if (net_ratelimit())
85 printk(KERN_ERR "xt_TCPMSS: unknown or "
86 "invalid path-MTU (%u)\n", in_mtu);
87 return -1;
88 }
89 newmss = min(dst_mtu(skb->dst), in_mtu) - minlen;
80 } else 90 } else
81 newmss = info->mss; 91 newmss = info->mss;
82 92
@@ -137,6 +147,28 @@ tcpmss_mangle_packet(struct sk_buff *skb,
137 return TCPOLEN_MSS; 147 return TCPOLEN_MSS;
138} 148}
139 149
150static u_int32_t tcpmss_reverse_mtu4(const struct iphdr *iph)
151{
152 struct flowi fl = {
153 .fl4_dst = iph->saddr,
154 };
155 const struct nf_afinfo *ai;
156 struct rtable *rt = NULL;
157 u_int32_t mtu = ~0U;
158
159 rcu_read_lock();
160 ai = nf_get_afinfo(AF_INET);
161 if (ai != NULL)
162 ai->route((struct dst_entry **)&rt, &fl);
163 rcu_read_unlock();
164
165 if (rt != NULL) {
166 mtu = dst_mtu(&rt->u.dst);
167 dst_release(&rt->u.dst);
168 }
169 return mtu;
170}
171
140static unsigned int 172static unsigned int
141tcpmss_tg4(struct sk_buff *skb, const struct net_device *in, 173tcpmss_tg4(struct sk_buff *skb, const struct net_device *in,
142 const struct net_device *out, unsigned int hooknum, 174 const struct net_device *out, unsigned int hooknum,
@@ -146,7 +178,8 @@ tcpmss_tg4(struct sk_buff *skb, const struct net_device *in,
146 __be16 newlen; 178 __be16 newlen;
147 int ret; 179 int ret;
148 180
149 ret = tcpmss_mangle_packet(skb, targinfo, iph->ihl * 4, 181 ret = tcpmss_mangle_packet(skb, targinfo, tcpmss_reverse_mtu4(iph),
182 iph->ihl * 4,
150 sizeof(*iph) + sizeof(struct tcphdr)); 183 sizeof(*iph) + sizeof(struct tcphdr));
151 if (ret < 0) 184 if (ret < 0)
152 return NF_DROP; 185 return NF_DROP;
@@ -160,6 +193,28 @@ tcpmss_tg4(struct sk_buff *skb, const struct net_device *in,
160} 193}
161 194
162#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) 195#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
196static u_int32_t tcpmss_reverse_mtu6(const struct ipv6hdr *iph)
197{
198 struct flowi fl = {
199 .fl6_dst = iph->saddr,
200 };
201 const struct nf_afinfo *ai;
202 struct rtable *rt = NULL;
203 u_int32_t mtu = ~0U;
204
205 rcu_read_lock();
206 ai = nf_get_afinfo(AF_INET6);
207 if (ai != NULL)
208 ai->route((struct dst_entry **)&rt, &fl);
209 rcu_read_unlock();
210
211 if (rt != NULL) {
212 mtu = dst_mtu(&rt->u.dst);
213 dst_release(&rt->u.dst);
214 }
215 return mtu;
216}
217
163static unsigned int 218static unsigned int
164tcpmss_tg6(struct sk_buff *skb, const struct net_device *in, 219tcpmss_tg6(struct sk_buff *skb, const struct net_device *in,
165 const struct net_device *out, unsigned int hooknum, 220 const struct net_device *out, unsigned int hooknum,
@@ -174,7 +229,8 @@ tcpmss_tg6(struct sk_buff *skb, const struct net_device *in,
174 tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr); 229 tcphoff = ipv6_skip_exthdr(skb, sizeof(*ipv6h), &nexthdr);
175 if (tcphoff < 0) 230 if (tcphoff < 0)
176 return NF_DROP; 231 return NF_DROP;
177 ret = tcpmss_mangle_packet(skb, targinfo, tcphoff, 232 ret = tcpmss_mangle_packet(skb, targinfo, tcpmss_reverse_mtu6(ipv6h),
233 tcphoff,
178 sizeof(*ipv6h) + sizeof(struct tcphdr)); 234 sizeof(*ipv6h) + sizeof(struct tcphdr));
179 if (ret < 0) 235 if (ret < 0)
180 return NF_DROP; 236 return NF_DROP;
diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c
index e00ecd974fa3..3b0111933f60 100644
--- a/net/netfilter/xt_connlimit.c
+++ b/net/netfilter/xt_connlimit.c
@@ -120,11 +120,11 @@ static int count_them(struct xt_connlimit_data *data,
120 else 120 else
121 hash = &data->iphash[connlimit_iphash(addr->ip & mask->ip)]; 121 hash = &data->iphash[connlimit_iphash(addr->ip & mask->ip)];
122 122
123 read_lock_bh(&nf_conntrack_lock); 123 rcu_read_lock();
124 124
125 /* check the saved connections */ 125 /* check the saved connections */
126 list_for_each_entry_safe(conn, tmp, hash, list) { 126 list_for_each_entry_safe(conn, tmp, hash, list) {
127 found = __nf_conntrack_find(&conn->tuple, NULL); 127 found = __nf_conntrack_find(&conn->tuple);
128 found_ct = NULL; 128 found_ct = NULL;
129 129
130 if (found != NULL) 130 if (found != NULL)
@@ -163,7 +163,7 @@ static int count_them(struct xt_connlimit_data *data,
163 ++matches; 163 ++matches;
164 } 164 }
165 165
166 read_unlock_bh(&nf_conntrack_lock); 166 rcu_read_unlock();
167 167
168 if (addit) { 168 if (addit) {
169 /* save the new connection in our list */ 169 /* save the new connection in our list */
diff --git a/net/netfilter/xt_conntrack.c b/net/netfilter/xt_conntrack.c
index e92190eafcc5..85330856a29c 100644
--- a/net/netfilter/xt_conntrack.c
+++ b/net/netfilter/xt_conntrack.c
@@ -4,7 +4,6 @@
4 * 4 *
5 * (C) 2001 Marc Boucher (marc@mbsi.ca). 5 * (C) 2001 Marc Boucher (marc@mbsi.ca).
6 * Copyright © CC Computer Consultants GmbH, 2007 - 2008 6 * Copyright © CC Computer Consultants GmbH, 2007 - 2008
7 * Jan Engelhardt <jengelh@computergmbh.de>
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -20,6 +19,7 @@
20 19
21MODULE_LICENSE("GPL"); 20MODULE_LICENSE("GPL");
22MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>"); 21MODULE_AUTHOR("Marc Boucher <marc@mbsi.ca>");
22MODULE_AUTHOR("Jan Engelhardt <jengelh@computergmbh.de>");
23MODULE_DESCRIPTION("Xtables: connection tracking state match"); 23MODULE_DESCRIPTION("Xtables: connection tracking state match");
24MODULE_ALIAS("ipt_conntrack"); 24MODULE_ALIAS("ipt_conntrack");
25MODULE_ALIAS("ip6t_conntrack"); 25MODULE_ALIAS("ip6t_conntrack");
@@ -166,6 +166,44 @@ conntrack_mt_repldst(const struct nf_conn *ct,
166 &info->repldst_addr, &info->repldst_mask, family); 166 &info->repldst_addr, &info->repldst_mask, family);
167} 167}
168 168
169static inline bool
170ct_proto_port_check(const struct xt_conntrack_mtinfo1 *info,
171 const struct nf_conn *ct)
172{
173 const struct nf_conntrack_tuple *tuple;
174
175 tuple = &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple;
176 if ((info->match_flags & XT_CONNTRACK_PROTO) &&
177 (tuple->dst.protonum == info->l4proto) ^
178 !(info->invert_flags & XT_CONNTRACK_PROTO))
179 return false;
180
181 /* Shortcut to match all recognized protocols by using ->src.all. */
182 if ((info->match_flags & XT_CONNTRACK_ORIGSRC_PORT) &&
183 (tuple->src.u.all == info->origsrc_port) ^
184 !(info->invert_flags & XT_CONNTRACK_ORIGSRC_PORT))
185 return false;
186
187 if ((info->match_flags & XT_CONNTRACK_ORIGDST_PORT) &&
188 (tuple->dst.u.all == info->origdst_port) ^
189 !(info->invert_flags & XT_CONNTRACK_ORIGDST_PORT))
190 return false;
191
192 tuple = &ct->tuplehash[IP_CT_DIR_REPLY].tuple;
193
194 if ((info->match_flags & XT_CONNTRACK_REPLSRC_PORT) &&
195 (tuple->src.u.all == info->replsrc_port) ^
196 !(info->invert_flags & XT_CONNTRACK_REPLSRC_PORT))
197 return false;
198
199 if ((info->match_flags & XT_CONNTRACK_REPLDST_PORT) &&
200 (tuple->dst.u.all == info->repldst_port) ^
201 !(info->invert_flags & XT_CONNTRACK_REPLDST_PORT))
202 return false;
203
204 return true;
205}
206
169static bool 207static bool
170conntrack_mt(const struct sk_buff *skb, const struct net_device *in, 208conntrack_mt(const struct sk_buff *skb, const struct net_device *in,
171 const struct net_device *out, const struct xt_match *match, 209 const struct net_device *out, const struct xt_match *match,
@@ -200,10 +238,9 @@ conntrack_mt(const struct sk_buff *skb, const struct net_device *in,
200 238
201 if (ct == NULL) 239 if (ct == NULL)
202 return info->match_flags & XT_CONNTRACK_STATE; 240 return info->match_flags & XT_CONNTRACK_STATE;
203 241 if ((info->match_flags & XT_CONNTRACK_DIRECTION) &&
204 if ((info->match_flags & XT_CONNTRACK_PROTO) && 242 (CTINFO2DIR(ctinfo) == IP_CT_DIR_ORIGINAL) ^
205 ((ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum == 243 !!(info->invert_flags & XT_CONNTRACK_DIRECTION))
206 info->l4proto) ^ !(info->invert_flags & XT_CONNTRACK_PROTO)))
207 return false; 244 return false;
208 245
209 if (info->match_flags & XT_CONNTRACK_ORIGSRC) 246 if (info->match_flags & XT_CONNTRACK_ORIGSRC)
@@ -226,6 +263,9 @@ conntrack_mt(const struct sk_buff *skb, const struct net_device *in,
226 !(info->invert_flags & XT_CONNTRACK_REPLDST)) 263 !(info->invert_flags & XT_CONNTRACK_REPLDST))
227 return false; 264 return false;
228 265
266 if (!ct_proto_port_check(info, ct))
267 return false;
268
229 if ((info->match_flags & XT_CONNTRACK_STATUS) && 269 if ((info->match_flags & XT_CONNTRACK_STATUS) &&
230 (!!(info->status_mask & ct->status) ^ 270 (!!(info->status_mask & ct->status) ^
231 !(info->invert_flags & XT_CONNTRACK_STATUS))) 271 !(info->invert_flags & XT_CONNTRACK_STATUS)))
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index d479ca980115..744c7f2ab0b1 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -1,9 +1,9 @@
1/* iptables match extension to limit the number of packets per second 1/*
2 * seperately for each hashbucket (sourceip/sourceport/dstip/dstport) 2 * xt_hashlimit - Netfilter module to limit the number of packets per time
3 * seperately for each hashbucket (sourceip/sourceport/dstip/dstport)
3 * 4 *
4 * (C) 2003-2004 by Harald Welte <laforge@netfilter.org> 5 * (C) 2003-2004 by Harald Welte <laforge@netfilter.org>
5 * 6 * Copyright © CC Computer Consultants GmbH, 2007 - 2008
6 * $Id: ipt_hashlimit.c 3244 2004-10-20 16:24:29Z laforge@netfilter.org $
7 * 7 *
8 * Development of this code was funded by Astaro AG, http://www.astaro.com/ 8 * Development of this code was funded by Astaro AG, http://www.astaro.com/
9 */ 9 */
@@ -35,6 +35,7 @@
35 35
36MODULE_LICENSE("GPL"); 36MODULE_LICENSE("GPL");
37MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); 37MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
38MODULE_AUTHOR("Jan Engelhardt <jengelh@computergmbh.de>");
38MODULE_DESCRIPTION("Xtables: per hash-bucket rate-limit match"); 39MODULE_DESCRIPTION("Xtables: per hash-bucket rate-limit match");
39MODULE_ALIAS("ipt_hashlimit"); 40MODULE_ALIAS("ipt_hashlimit");
40MODULE_ALIAS("ip6t_hashlimit"); 41MODULE_ALIAS("ip6t_hashlimit");
@@ -57,7 +58,7 @@ struct dsthash_dst {
57 __be32 dst[4]; 58 __be32 dst[4];
58 } ip6; 59 } ip6;
59#endif 60#endif
60 } addr; 61 };
61 __be16 src_port; 62 __be16 src_port;
62 __be16 dst_port; 63 __be16 dst_port;
63}; 64};
@@ -81,7 +82,7 @@ struct xt_hashlimit_htable {
81 atomic_t use; 82 atomic_t use;
82 int family; 83 int family;
83 84
84 struct hashlimit_cfg cfg; /* config */ 85 struct hashlimit_cfg1 cfg; /* config */
85 86
86 /* used internally */ 87 /* used internally */
87 spinlock_t lock; /* lock for list_head */ 88 spinlock_t lock; /* lock for list_head */
@@ -184,7 +185,7 @@ dsthash_free(struct xt_hashlimit_htable *ht, struct dsthash_ent *ent)
184} 185}
185static void htable_gc(unsigned long htlong); 186static void htable_gc(unsigned long htlong);
186 187
187static int htable_create(struct xt_hashlimit_info *minfo, int family) 188static int htable_create_v0(struct xt_hashlimit_info *minfo, int family)
188{ 189{
189 struct xt_hashlimit_htable *hinfo; 190 struct xt_hashlimit_htable *hinfo;
190 unsigned int size; 191 unsigned int size;
@@ -210,7 +211,18 @@ static int htable_create(struct xt_hashlimit_info *minfo, int family)
210 minfo->hinfo = hinfo; 211 minfo->hinfo = hinfo;
211 212
212 /* copy match config into hashtable config */ 213 /* copy match config into hashtable config */
213 memcpy(&hinfo->cfg, &minfo->cfg, sizeof(hinfo->cfg)); 214 hinfo->cfg.mode = minfo->cfg.mode;
215 hinfo->cfg.avg = minfo->cfg.avg;
216 hinfo->cfg.burst = minfo->cfg.burst;
217 hinfo->cfg.max = minfo->cfg.max;
218 hinfo->cfg.gc_interval = minfo->cfg.gc_interval;
219 hinfo->cfg.expire = minfo->cfg.expire;
220
221 if (family == AF_INET)
222 hinfo->cfg.srcmask = hinfo->cfg.dstmask = 32;
223 else
224 hinfo->cfg.srcmask = hinfo->cfg.dstmask = 128;
225
214 hinfo->cfg.size = size; 226 hinfo->cfg.size = size;
215 if (!hinfo->cfg.max) 227 if (!hinfo->cfg.max)
216 hinfo->cfg.max = 8 * hinfo->cfg.size; 228 hinfo->cfg.max = 8 * hinfo->cfg.size;
@@ -246,6 +258,70 @@ static int htable_create(struct xt_hashlimit_info *minfo, int family)
246 return 0; 258 return 0;
247} 259}
248 260
261static int htable_create(struct xt_hashlimit_mtinfo1 *minfo,
262 unsigned int family)
263{
264 struct xt_hashlimit_htable *hinfo;
265 unsigned int size;
266 unsigned int i;
267
268 if (minfo->cfg.size) {
269 size = minfo->cfg.size;
270 } else {
271 size = (num_physpages << PAGE_SHIFT) / 16384 /
272 sizeof(struct list_head);
273 if (num_physpages > 1024 * 1024 * 1024 / PAGE_SIZE)
274 size = 8192;
275 if (size < 16)
276 size = 16;
277 }
278 /* FIXME: don't use vmalloc() here or anywhere else -HW */
279 hinfo = vmalloc(sizeof(struct xt_hashlimit_htable) +
280 sizeof(struct list_head) * size);
281 if (hinfo == NULL) {
282 printk(KERN_ERR "xt_hashlimit: unable to create hashtable\n");
283 return -1;
284 }
285 minfo->hinfo = hinfo;
286
287 /* copy match config into hashtable config */
288 memcpy(&hinfo->cfg, &minfo->cfg, sizeof(hinfo->cfg));
289 hinfo->cfg.size = size;
290 if (hinfo->cfg.max == 0)
291 hinfo->cfg.max = 8 * hinfo->cfg.size;
292 else if (hinfo->cfg.max < hinfo->cfg.size)
293 hinfo->cfg.max = hinfo->cfg.size;
294
295 for (i = 0; i < hinfo->cfg.size; i++)
296 INIT_HLIST_HEAD(&hinfo->hash[i]);
297
298 atomic_set(&hinfo->use, 1);
299 hinfo->count = 0;
300 hinfo->family = family;
301 hinfo->rnd_initialized = 0;
302 spin_lock_init(&hinfo->lock);
303
304 hinfo->pde = create_proc_entry(minfo->name, 0,
305 family == AF_INET ? hashlimit_procdir4 :
306 hashlimit_procdir6);
307 if (hinfo->pde == NULL) {
308 vfree(hinfo);
309 return -1;
310 }
311 hinfo->pde->proc_fops = &dl_file_ops;
312 hinfo->pde->data = hinfo;
313
314 setup_timer(&hinfo->timer, htable_gc, (unsigned long)hinfo);
315 hinfo->timer.expires = jiffies + msecs_to_jiffies(hinfo->cfg.gc_interval);
316 add_timer(&hinfo->timer);
317
318 spin_lock_bh(&hashlimit_lock);
319 hlist_add_head(&hinfo->node, &hashlimit_htables);
320 spin_unlock_bh(&hashlimit_lock);
321
322 return 0;
323}
324
249static bool select_all(const struct xt_hashlimit_htable *ht, 325static bool select_all(const struct xt_hashlimit_htable *ht,
250 const struct dsthash_ent *he) 326 const struct dsthash_ent *he)
251{ 327{
@@ -388,6 +464,48 @@ static inline void rateinfo_recalc(struct dsthash_ent *dh, unsigned long now)
388 dh->rateinfo.prev = now; 464 dh->rateinfo.prev = now;
389} 465}
390 466
467static inline __be32 maskl(__be32 a, unsigned int l)
468{
469 return htonl(ntohl(a) & ~(~(u_int32_t)0 >> l));
470}
471
472#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
473static void hashlimit_ipv6_mask(__be32 *i, unsigned int p)
474{
475 switch (p) {
476 case 0:
477 i[0] = i[1] = 0;
478 i[2] = i[3] = 0;
479 break;
480 case 1 ... 31:
481 i[0] = maskl(i[0], p);
482 i[1] = i[2] = i[3] = 0;
483 break;
484 case 32:
485 i[1] = i[2] = i[3] = 0;
486 break;
487 case 33 ... 63:
488 i[1] = maskl(i[1], p - 32);
489 i[2] = i[3] = 0;
490 break;
491 case 64:
492 i[2] = i[3] = 0;
493 break;
494 case 65 ... 95:
495 i[2] = maskl(i[2], p - 64);
496 i[3] = 0;
497 case 96:
498 i[3] = 0;
499 break;
500 case 97 ... 127:
501 i[3] = maskl(i[3], p - 96);
502 break;
503 case 128:
504 break;
505 }
506}
507#endif
508
391static int 509static int
392hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo, 510hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
393 struct dsthash_dst *dst, 511 struct dsthash_dst *dst,
@@ -401,9 +519,11 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
401 switch (hinfo->family) { 519 switch (hinfo->family) {
402 case AF_INET: 520 case AF_INET:
403 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP) 521 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP)
404 dst->addr.ip.dst = ip_hdr(skb)->daddr; 522 dst->ip.dst = maskl(ip_hdr(skb)->daddr,
523 hinfo->cfg.dstmask);
405 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP) 524 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP)
406 dst->addr.ip.src = ip_hdr(skb)->saddr; 525 dst->ip.src = maskl(ip_hdr(skb)->saddr,
526 hinfo->cfg.srcmask);
407 527
408 if (!(hinfo->cfg.mode & 528 if (!(hinfo->cfg.mode &
409 (XT_HASHLIMIT_HASH_DPT | XT_HASHLIMIT_HASH_SPT))) 529 (XT_HASHLIMIT_HASH_DPT | XT_HASHLIMIT_HASH_SPT)))
@@ -412,12 +532,16 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
412 break; 532 break;
413#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) 533#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
414 case AF_INET6: 534 case AF_INET6:
415 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP) 535 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP) {
416 memcpy(&dst->addr.ip6.dst, &ipv6_hdr(skb)->daddr, 536 memcpy(&dst->ip6.dst, &ipv6_hdr(skb)->daddr,
417 sizeof(dst->addr.ip6.dst)); 537 sizeof(dst->ip6.dst));
418 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP) 538 hashlimit_ipv6_mask(dst->ip6.dst, hinfo->cfg.dstmask);
419 memcpy(&dst->addr.ip6.src, &ipv6_hdr(skb)->saddr, 539 }
420 sizeof(dst->addr.ip6.src)); 540 if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP) {
541 memcpy(&dst->ip6.src, &ipv6_hdr(skb)->saddr,
542 sizeof(dst->ip6.src));
543 hashlimit_ipv6_mask(dst->ip6.src, hinfo->cfg.srcmask);
544 }
421 545
422 if (!(hinfo->cfg.mode & 546 if (!(hinfo->cfg.mode &
423 (XT_HASHLIMIT_HASH_DPT | XT_HASHLIMIT_HASH_SPT))) 547 (XT_HASHLIMIT_HASH_DPT | XT_HASHLIMIT_HASH_SPT)))
@@ -457,10 +581,10 @@ hashlimit_init_dst(const struct xt_hashlimit_htable *hinfo,
457} 581}
458 582
459static bool 583static bool
460hashlimit_mt(const struct sk_buff *skb, const struct net_device *in, 584hashlimit_mt_v0(const struct sk_buff *skb, const struct net_device *in,
461 const struct net_device *out, const struct xt_match *match, 585 const struct net_device *out, const struct xt_match *match,
462 const void *matchinfo, int offset, unsigned int protoff, 586 const void *matchinfo, int offset, unsigned int protoff,
463 bool *hotdrop) 587 bool *hotdrop)
464{ 588{
465 const struct xt_hashlimit_info *r = 589 const struct xt_hashlimit_info *r =
466 ((const struct xt_hashlimit_info *)matchinfo)->u.master; 590 ((const struct xt_hashlimit_info *)matchinfo)->u.master;
@@ -512,9 +636,62 @@ hotdrop:
512} 636}
513 637
514static bool 638static bool
515hashlimit_mt_check(const char *tablename, const void *inf, 639hashlimit_mt(const struct sk_buff *skb, const struct net_device *in,
516 const struct xt_match *match, void *matchinfo, 640 const struct net_device *out, const struct xt_match *match,
517 unsigned int hook_mask) 641 const void *matchinfo, int offset, unsigned int protoff,
642 bool *hotdrop)
643{
644 const struct xt_hashlimit_mtinfo1 *info = matchinfo;
645 struct xt_hashlimit_htable *hinfo = info->hinfo;
646 unsigned long now = jiffies;
647 struct dsthash_ent *dh;
648 struct dsthash_dst dst;
649
650 if (hashlimit_init_dst(hinfo, &dst, skb, protoff) < 0)
651 goto hotdrop;
652
653 spin_lock_bh(&hinfo->lock);
654 dh = dsthash_find(hinfo, &dst);
655 if (dh == NULL) {
656 dh = dsthash_alloc_init(hinfo, &dst);
657 if (dh == NULL) {
658 spin_unlock_bh(&hinfo->lock);
659 goto hotdrop;
660 }
661
662 dh->expires = jiffies + msecs_to_jiffies(hinfo->cfg.expire);
663 dh->rateinfo.prev = jiffies;
664 dh->rateinfo.credit = user2credits(hinfo->cfg.avg *
665 hinfo->cfg.burst);
666 dh->rateinfo.credit_cap = user2credits(hinfo->cfg.avg *
667 hinfo->cfg.burst);
668 dh->rateinfo.cost = user2credits(hinfo->cfg.avg);
669 } else {
670 /* update expiration timeout */
671 dh->expires = now + msecs_to_jiffies(hinfo->cfg.expire);
672 rateinfo_recalc(dh, now);
673 }
674
675 if (dh->rateinfo.credit >= dh->rateinfo.cost) {
676 /* below the limit */
677 dh->rateinfo.credit -= dh->rateinfo.cost;
678 spin_unlock_bh(&hinfo->lock);
679 return !(info->cfg.mode & XT_HASHLIMIT_INVERT);
680 }
681
682 spin_unlock_bh(&hinfo->lock);
683 /* default match is underlimit - so over the limit, we need to invert */
684 return info->cfg.mode & XT_HASHLIMIT_INVERT;
685
686 hotdrop:
687 *hotdrop = true;
688 return false;
689}
690
691static bool
692hashlimit_mt_check_v0(const char *tablename, const void *inf,
693 const struct xt_match *match, void *matchinfo,
694 unsigned int hook_mask)
518{ 695{
519 struct xt_hashlimit_info *r = matchinfo; 696 struct xt_hashlimit_info *r = matchinfo;
520 697
@@ -546,7 +723,7 @@ hashlimit_mt_check(const char *tablename, const void *inf,
546 * create duplicate proc files. -HW */ 723 * create duplicate proc files. -HW */
547 mutex_lock(&hlimit_mutex); 724 mutex_lock(&hlimit_mutex);
548 r->hinfo = htable_find_get(r->name, match->family); 725 r->hinfo = htable_find_get(r->name, match->family);
549 if (!r->hinfo && htable_create(r, match->family) != 0) { 726 if (!r->hinfo && htable_create_v0(r, match->family) != 0) {
550 mutex_unlock(&hlimit_mutex); 727 mutex_unlock(&hlimit_mutex);
551 return false; 728 return false;
552 } 729 }
@@ -557,14 +734,68 @@ hashlimit_mt_check(const char *tablename, const void *inf,
557 return true; 734 return true;
558} 735}
559 736
737static bool
738hashlimit_mt_check(const char *tablename, const void *inf,
739 const struct xt_match *match, void *matchinfo,
740 unsigned int hook_mask)
741{
742 struct xt_hashlimit_mtinfo1 *info = matchinfo;
743
744 /* Check for overflow. */
745 if (info->cfg.burst == 0 ||
746 user2credits(info->cfg.avg * info->cfg.burst) <
747 user2credits(info->cfg.avg)) {
748 printk(KERN_ERR "xt_hashlimit: overflow, try lower: %u/%u\n",
749 info->cfg.avg, info->cfg.burst);
750 return false;
751 }
752 if (info->cfg.gc_interval == 0 || info->cfg.expire == 0)
753 return false;
754 if (info->name[sizeof(info->name)-1] != '\0')
755 return false;
756 if (match->family == AF_INET) {
757 if (info->cfg.srcmask > 32 || info->cfg.dstmask > 32)
758 return false;
759 } else {
760 if (info->cfg.srcmask > 128 || info->cfg.dstmask > 128)
761 return false;
762 }
763
764 /* This is the best we've got: We cannot release and re-grab lock,
765 * since checkentry() is called before x_tables.c grabs xt_mutex.
766 * We also cannot grab the hashtable spinlock, since htable_create will
767 * call vmalloc, and that can sleep. And we cannot just re-search
768 * the list of htable's in htable_create(), since then we would
769 * create duplicate proc files. -HW */
770 mutex_lock(&hlimit_mutex);
771 info->hinfo = htable_find_get(info->name, match->family);
772 if (!info->hinfo && htable_create(info, match->family) != 0) {
773 mutex_unlock(&hlimit_mutex);
774 return false;
775 }
776 mutex_unlock(&hlimit_mutex);
777
778 /* Ugly hack: For SMP, we only want to use one set */
779 info->master = info;
780 return true;
781}
782
560static void 783static void
561hashlimit_mt_destroy(const struct xt_match *match, void *matchinfo) 784hashlimit_mt_destroy_v0(const struct xt_match *match, void *matchinfo)
562{ 785{
563 const struct xt_hashlimit_info *r = matchinfo; 786 const struct xt_hashlimit_info *r = matchinfo;
564 787
565 htable_put(r->hinfo); 788 htable_put(r->hinfo);
566} 789}
567 790
791static void
792hashlimit_mt_destroy(const struct xt_match *match, void *matchinfo)
793{
794 const struct xt_hashlimit_mtinfo1 *info = matchinfo;
795
796 htable_put(info->hinfo);
797}
798
568#ifdef CONFIG_COMPAT 799#ifdef CONFIG_COMPAT
569struct compat_xt_hashlimit_info { 800struct compat_xt_hashlimit_info {
570 char name[IFNAMSIZ]; 801 char name[IFNAMSIZ];
@@ -592,38 +823,60 @@ static int hashlimit_mt_compat_to_user(void __user *dst, void *src)
592static struct xt_match hashlimit_mt_reg[] __read_mostly = { 823static struct xt_match hashlimit_mt_reg[] __read_mostly = {
593 { 824 {
594 .name = "hashlimit", 825 .name = "hashlimit",
826 .revision = 0,
595 .family = AF_INET, 827 .family = AF_INET,
596 .match = hashlimit_mt, 828 .match = hashlimit_mt_v0,
597 .matchsize = sizeof(struct xt_hashlimit_info), 829 .matchsize = sizeof(struct xt_hashlimit_info),
598#ifdef CONFIG_COMPAT 830#ifdef CONFIG_COMPAT
599 .compatsize = sizeof(struct compat_xt_hashlimit_info), 831 .compatsize = sizeof(struct compat_xt_hashlimit_info),
600 .compat_from_user = hashlimit_mt_compat_from_user, 832 .compat_from_user = hashlimit_mt_compat_from_user,
601 .compat_to_user = hashlimit_mt_compat_to_user, 833 .compat_to_user = hashlimit_mt_compat_to_user,
602#endif 834#endif
603 .checkentry = hashlimit_mt_check, 835 .checkentry = hashlimit_mt_check_v0,
604 .destroy = hashlimit_mt_destroy, 836 .destroy = hashlimit_mt_destroy_v0,
605 .me = THIS_MODULE 837 .me = THIS_MODULE
606 }, 838 },
839 {
840 .name = "hashlimit",
841 .revision = 1,
842 .family = AF_INET,
843 .match = hashlimit_mt,
844 .matchsize = sizeof(struct xt_hashlimit_mtinfo1),
845 .checkentry = hashlimit_mt_check,
846 .destroy = hashlimit_mt_destroy,
847 .me = THIS_MODULE,
848 },
607#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) 849#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
608 { 850 {
609 .name = "hashlimit", 851 .name = "hashlimit",
610 .family = AF_INET6, 852 .family = AF_INET6,
611 .match = hashlimit_mt, 853 .match = hashlimit_mt_v0,
612 .matchsize = sizeof(struct xt_hashlimit_info), 854 .matchsize = sizeof(struct xt_hashlimit_info),
613#ifdef CONFIG_COMPAT 855#ifdef CONFIG_COMPAT
614 .compatsize = sizeof(struct compat_xt_hashlimit_info), 856 .compatsize = sizeof(struct compat_xt_hashlimit_info),
615 .compat_from_user = hashlimit_mt_compat_from_user, 857 .compat_from_user = hashlimit_mt_compat_from_user,
616 .compat_to_user = hashlimit_mt_compat_to_user, 858 .compat_to_user = hashlimit_mt_compat_to_user,
617#endif 859#endif
618 .checkentry = hashlimit_mt_check, 860 .checkentry = hashlimit_mt_check_v0,
619 .destroy = hashlimit_mt_destroy, 861 .destroy = hashlimit_mt_destroy_v0,
620 .me = THIS_MODULE 862 .me = THIS_MODULE
621 }, 863 },
864 {
865 .name = "hashlimit",
866 .revision = 1,
867 .family = AF_INET6,
868 .match = hashlimit_mt,
869 .matchsize = sizeof(struct xt_hashlimit_mtinfo1),
870 .checkentry = hashlimit_mt_check,
871 .destroy = hashlimit_mt_destroy,
872 .me = THIS_MODULE,
873 },
622#endif 874#endif
623}; 875};
624 876
625/* PROC stuff */ 877/* PROC stuff */
626static void *dl_seq_start(struct seq_file *s, loff_t *pos) 878static void *dl_seq_start(struct seq_file *s, loff_t *pos)
879 __acquires(htable->lock)
627{ 880{
628 struct proc_dir_entry *pde = s->private; 881 struct proc_dir_entry *pde = s->private;
629 struct xt_hashlimit_htable *htable = pde->data; 882 struct xt_hashlimit_htable *htable = pde->data;
@@ -656,6 +909,7 @@ static void *dl_seq_next(struct seq_file *s, void *v, loff_t *pos)
656} 909}
657 910
658static void dl_seq_stop(struct seq_file *s, void *v) 911static void dl_seq_stop(struct seq_file *s, void *v)
912 __releases(htable->lock)
659{ 913{
660 struct proc_dir_entry *pde = s->private; 914 struct proc_dir_entry *pde = s->private;
661 struct xt_hashlimit_htable *htable = pde->data; 915 struct xt_hashlimit_htable *htable = pde->data;
@@ -676,9 +930,9 @@ static int dl_seq_real_show(struct dsthash_ent *ent, int family,
676 return seq_printf(s, "%ld %u.%u.%u.%u:%u->" 930 return seq_printf(s, "%ld %u.%u.%u.%u:%u->"
677 "%u.%u.%u.%u:%u %u %u %u\n", 931 "%u.%u.%u.%u:%u %u %u %u\n",
678 (long)(ent->expires - jiffies)/HZ, 932 (long)(ent->expires - jiffies)/HZ,
679 NIPQUAD(ent->dst.addr.ip.src), 933 NIPQUAD(ent->dst.ip.src),
680 ntohs(ent->dst.src_port), 934 ntohs(ent->dst.src_port),
681 NIPQUAD(ent->dst.addr.ip.dst), 935 NIPQUAD(ent->dst.ip.dst),
682 ntohs(ent->dst.dst_port), 936 ntohs(ent->dst.dst_port),
683 ent->rateinfo.credit, ent->rateinfo.credit_cap, 937 ent->rateinfo.credit, ent->rateinfo.credit_cap,
684 ent->rateinfo.cost); 938 ent->rateinfo.cost);
@@ -687,9 +941,9 @@ static int dl_seq_real_show(struct dsthash_ent *ent, int family,
687 return seq_printf(s, "%ld " NIP6_FMT ":%u->" 941 return seq_printf(s, "%ld " NIP6_FMT ":%u->"
688 NIP6_FMT ":%u %u %u %u\n", 942 NIP6_FMT ":%u %u %u %u\n",
689 (long)(ent->expires - jiffies)/HZ, 943 (long)(ent->expires - jiffies)/HZ,
690 NIP6(*(struct in6_addr *)&ent->dst.addr.ip6.src), 944 NIP6(*(struct in6_addr *)&ent->dst.ip6.src),
691 ntohs(ent->dst.src_port), 945 ntohs(ent->dst.src_port),
692 NIP6(*(struct in6_addr *)&ent->dst.addr.ip6.dst), 946 NIP6(*(struct in6_addr *)&ent->dst.ip6.dst),
693 ntohs(ent->dst.dst_port), 947 ntohs(ent->dst.dst_port),
694 ent->rateinfo.credit, ent->rateinfo.credit_cap, 948 ent->rateinfo.credit, ent->rateinfo.credit_cap,
695 ent->rateinfo.cost); 949 ent->rateinfo.cost);
diff --git a/net/netfilter/xt_iprange.c b/net/netfilter/xt_iprange.c
index dbea0e0893f3..01035fc0e140 100644
--- a/net/netfilter/xt_iprange.c
+++ b/net/netfilter/xt_iprange.c
@@ -101,7 +101,7 @@ iprange_ipv6_sub(const struct in6_addr *a, const struct in6_addr *b)
101 int r; 101 int r;
102 102
103 for (i = 0; i < 4; ++i) { 103 for (i = 0; i < 4; ++i) {
104 r = a->s6_addr32[i] - b->s6_addr32[i]; 104 r = (__force u32)a->s6_addr32[i] - (__force u32)b->s6_addr32[i];
105 if (r != 0) 105 if (r != 0)
106 return r; 106 return r;
107 } 107 }
diff --git a/net/netfilter/xt_owner.c b/net/netfilter/xt_owner.c
index d382f9cc38b0..9059c16144c3 100644
--- a/net/netfilter/xt_owner.c
+++ b/net/netfilter/xt_owner.c
@@ -4,8 +4,8 @@
4 * 4 *
5 * (C) 2000 Marc Boucher <marc@mbsi.ca> 5 * (C) 2000 Marc Boucher <marc@mbsi.ca>
6 * 6 *
7 * Copyright © CC Computer Consultants GmbH, 2007 7 * Copyright © CC Computer Consultants GmbH, 2007 - 2008
8 * Contact: <jengelh@computergmbh.de> 8 * <jengelh@computergmbh.de>
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -102,13 +102,15 @@ owner_mt(const struct sk_buff *skb, const struct net_device *in,
102 (XT_OWNER_UID | XT_OWNER_GID)) == 0; 102 (XT_OWNER_UID | XT_OWNER_GID)) == 0;
103 103
104 if (info->match & XT_OWNER_UID) 104 if (info->match & XT_OWNER_UID)
105 if ((filp->f_uid != info->uid) ^ 105 if ((filp->f_uid >= info->uid_min &&
106 !!(info->invert & XT_OWNER_UID)) 106 filp->f_uid <= info->uid_max) ^
107 !(info->invert & XT_OWNER_UID))
107 return false; 108 return false;
108 109
109 if (info->match & XT_OWNER_GID) 110 if (info->match & XT_OWNER_GID)
110 if ((filp->f_gid != info->gid) ^ 111 if ((filp->f_gid >= info->gid_min &&
111 !!(info->invert & XT_OWNER_GID)) 112 filp->f_gid <= info->gid_max) ^
113 !(info->invert & XT_OWNER_GID))
112 return false; 114 return false;
113 115
114 return true; 116 return true;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 6b178e1247b5..ff9fb6ba0c5c 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1344,6 +1344,22 @@ static void netlink_data_ready(struct sock *sk, int len)
1344 * queueing. 1344 * queueing.
1345 */ 1345 */
1346 1346
1347static void __netlink_release(struct sock *sk)
1348{
1349 /*
1350 * Last sock_put should drop referrence to sk->sk_net. It has already
1351 * been dropped in netlink_kernel_create. Taking referrence to stopping
1352 * namespace is not an option.
1353 * Take referrence to a socket to remove it from netlink lookup table
1354 * _alive_ and after that destroy it in the context of init_net.
1355 */
1356
1357 sock_hold(sk);
1358 sock_release(sk->sk_socket);
1359 sk->sk_net = get_net(&init_net);
1360 sock_put(sk);
1361}
1362
1347struct sock * 1363struct sock *
1348netlink_kernel_create(struct net *net, int unit, unsigned int groups, 1364netlink_kernel_create(struct net *net, int unit, unsigned int groups,
1349 void (*input)(struct sk_buff *skb), 1365 void (*input)(struct sk_buff *skb),
@@ -1362,8 +1378,18 @@ netlink_kernel_create(struct net *net, int unit, unsigned int groups,
1362 if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock)) 1378 if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock))
1363 return NULL; 1379 return NULL;
1364 1380
1365 if (__netlink_create(net, sock, cb_mutex, unit) < 0) 1381 /*
1366 goto out_sock_release; 1382 * We have to just have a reference on the net from sk, but don't
1383 * get_net it. Besides, we cannot get and then put the net here.
1384 * So we create one inside init_net and the move it to net.
1385 */
1386
1387 if (__netlink_create(&init_net, sock, cb_mutex, unit) < 0)
1388 goto out_sock_release_nosk;
1389
1390 sk = sock->sk;
1391 put_net(sk->sk_net);
1392 sk->sk_net = net;
1367 1393
1368 if (groups < 32) 1394 if (groups < 32)
1369 groups = 32; 1395 groups = 32;
@@ -1372,7 +1398,6 @@ netlink_kernel_create(struct net *net, int unit, unsigned int groups,
1372 if (!listeners) 1398 if (!listeners)
1373 goto out_sock_release; 1399 goto out_sock_release;
1374 1400
1375 sk = sock->sk;
1376 sk->sk_data_ready = netlink_data_ready; 1401 sk->sk_data_ready = netlink_data_ready;
1377 if (input) 1402 if (input)
1378 nlk_sk(sk)->netlink_rcv = input; 1403 nlk_sk(sk)->netlink_rcv = input;
@@ -1395,14 +1420,14 @@ netlink_kernel_create(struct net *net, int unit, unsigned int groups,
1395 nl_table[unit].registered++; 1420 nl_table[unit].registered++;
1396 } 1421 }
1397 netlink_table_ungrab(); 1422 netlink_table_ungrab();
1398
1399 /* Do not hold an extra referrence to a namespace as this socket is
1400 * internal to a namespace and does not prevent it to stop. */
1401 put_net(net);
1402 return sk; 1423 return sk;
1403 1424
1404out_sock_release: 1425out_sock_release:
1405 kfree(listeners); 1426 kfree(listeners);
1427 __netlink_release(sk);
1428 return NULL;
1429
1430out_sock_release_nosk:
1406 sock_release(sock); 1431 sock_release(sock);
1407 return NULL; 1432 return NULL;
1408} 1433}
@@ -1415,18 +1440,7 @@ netlink_kernel_release(struct sock *sk)
1415 if (sk == NULL || sk->sk_socket == NULL) 1440 if (sk == NULL || sk->sk_socket == NULL)
1416 return; 1441 return;
1417 1442
1418 /* 1443 __netlink_release(sk);
1419 * Last sock_put should drop referrence to sk->sk_net. It has already
1420 * been dropped in netlink_kernel_create. Taking referrence to stopping
1421 * namespace is not an option.
1422 * Take referrence to a socket to remove it from netlink lookup table
1423 * _alive_ and after that destroy it in the context of init_net.
1424 */
1425 sock_hold(sk);
1426 sock_release(sk->sk_socket);
1427
1428 sk->sk_net = get_net(&init_net);
1429 sock_put(sk);
1430} 1444}
1431EXPORT_SYMBOL(netlink_kernel_release); 1445EXPORT_SYMBOL(netlink_kernel_release);
1432 1446
diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
index d1e9d68f8ba0..e4b051dbed61 100644
--- a/net/rfkill/rfkill-input.c
+++ b/net/rfkill/rfkill-input.c
@@ -84,6 +84,7 @@ static void rfkill_schedule_toggle(struct rfkill_task *task)
84static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN); 84static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN);
85static DEFINE_RFKILL_TASK(rfkill_bt, RFKILL_TYPE_BLUETOOTH); 85static DEFINE_RFKILL_TASK(rfkill_bt, RFKILL_TYPE_BLUETOOTH);
86static DEFINE_RFKILL_TASK(rfkill_uwb, RFKILL_TYPE_UWB); 86static DEFINE_RFKILL_TASK(rfkill_uwb, RFKILL_TYPE_UWB);
87static DEFINE_RFKILL_TASK(rfkill_wimax, RFKILL_TYPE_WIMAX);
87 88
88static void rfkill_event(struct input_handle *handle, unsigned int type, 89static void rfkill_event(struct input_handle *handle, unsigned int type,
89 unsigned int code, int down) 90 unsigned int code, int down)
@@ -99,6 +100,9 @@ static void rfkill_event(struct input_handle *handle, unsigned int type,
99 case KEY_UWB: 100 case KEY_UWB:
100 rfkill_schedule_toggle(&rfkill_uwb); 101 rfkill_schedule_toggle(&rfkill_uwb);
101 break; 102 break;
103 case KEY_WIMAX:
104 rfkill_schedule_toggle(&rfkill_wimax);
105 break;
102 default: 106 default:
103 break; 107 break;
104 } 108 }
@@ -159,6 +163,11 @@ static const struct input_device_id rfkill_ids[] = {
159 .evbit = { BIT_MASK(EV_KEY) }, 163 .evbit = { BIT_MASK(EV_KEY) },
160 .keybit = { [BIT_WORD(KEY_UWB)] = BIT_MASK(KEY_UWB) }, 164 .keybit = { [BIT_WORD(KEY_UWB)] = BIT_MASK(KEY_UWB) },
161 }, 165 },
166 {
167 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
168 .evbit = { BIT_MASK(EV_KEY) },
169 .keybit = { [BIT_WORD(KEY_WIMAX)] = BIT_MASK(KEY_WIMAX) },
170 },
162 { } 171 { }
163}; 172};
164 173
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index d06d338812e9..6562f868e82f 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -126,6 +126,9 @@ static ssize_t rfkill_type_show(struct device *dev,
126 case RFKILL_TYPE_UWB: 126 case RFKILL_TYPE_UWB:
127 type = "ultrawideband"; 127 type = "ultrawideband";
128 break; 128 break;
129 case RFKILL_TYPE_WIMAX:
130 type = "wimax";
131 break;
129 default: 132 default:
130 BUG(); 133 BUG();
131 } 134 }
diff --git a/net/rxrpc/ar-call.c b/net/rxrpc/ar-call.c
index 3c04b00dab74..d9231245a79a 100644
--- a/net/rxrpc/ar-call.c
+++ b/net/rxrpc/ar-call.c
@@ -15,7 +15,7 @@
15#include <net/af_rxrpc.h> 15#include <net/af_rxrpc.h>
16#include "ar-internal.h" 16#include "ar-internal.h"
17 17
18const char *rxrpc_call_states[] = { 18const char *const rxrpc_call_states[] = {
19 [RXRPC_CALL_CLIENT_SEND_REQUEST] = "ClSndReq", 19 [RXRPC_CALL_CLIENT_SEND_REQUEST] = "ClSndReq",
20 [RXRPC_CALL_CLIENT_AWAIT_REPLY] = "ClAwtRpl", 20 [RXRPC_CALL_CLIENT_AWAIT_REPLY] = "ClAwtRpl",
21 [RXRPC_CALL_CLIENT_RECV_REPLY] = "ClRcvRpl", 21 [RXRPC_CALL_CLIENT_RECV_REPLY] = "ClRcvRpl",
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 58aaf892238e..1aaa2e804b0d 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -565,9 +565,9 @@ extern void __exit rxrpc_destroy_all_peers(void);
565/* 565/*
566 * ar-proc.c 566 * ar-proc.c
567 */ 567 */
568extern const char *rxrpc_call_states[]; 568extern const char *const rxrpc_call_states[];
569extern struct file_operations rxrpc_call_seq_fops; 569extern const struct file_operations rxrpc_call_seq_fops;
570extern struct file_operations rxrpc_connection_seq_fops; 570extern const struct file_operations rxrpc_connection_seq_fops;
571 571
572/* 572/*
573 * ar-recvmsg.c 573 * ar-recvmsg.c
diff --git a/net/rxrpc/ar-proc.c b/net/rxrpc/ar-proc.c
index 2e83ce325d15..83eda247fe48 100644
--- a/net/rxrpc/ar-proc.c
+++ b/net/rxrpc/ar-proc.c
@@ -14,7 +14,7 @@
14#include <net/af_rxrpc.h> 14#include <net/af_rxrpc.h>
15#include "ar-internal.h" 15#include "ar-internal.h"
16 16
17static const char *rxrpc_conn_states[] = { 17static const char *const rxrpc_conn_states[] = {
18 [RXRPC_CONN_UNUSED] = "Unused ", 18 [RXRPC_CONN_UNUSED] = "Unused ",
19 [RXRPC_CONN_CLIENT] = "Client ", 19 [RXRPC_CONN_CLIENT] = "Client ",
20 [RXRPC_CONN_SERVER_UNSECURED] = "SvUnsec ", 20 [RXRPC_CONN_SERVER_UNSECURED] = "SvUnsec ",
@@ -98,7 +98,7 @@ static int rxrpc_call_seq_open(struct inode *inode, struct file *file)
98 return seq_open(file, &rxrpc_call_seq_ops); 98 return seq_open(file, &rxrpc_call_seq_ops);
99} 99}
100 100
101struct file_operations rxrpc_call_seq_fops = { 101const struct file_operations rxrpc_call_seq_fops = {
102 .owner = THIS_MODULE, 102 .owner = THIS_MODULE,
103 .open = rxrpc_call_seq_open, 103 .open = rxrpc_call_seq_open,
104 .read = seq_read, 104 .read = seq_read,
@@ -183,7 +183,7 @@ static int rxrpc_connection_seq_open(struct inode *inode, struct file *file)
183 return seq_open(file, &rxrpc_connection_seq_ops); 183 return seq_open(file, &rxrpc_connection_seq_ops);
184} 184}
185 185
186struct file_operations rxrpc_connection_seq_fops = { 186const struct file_operations rxrpc_connection_seq_fops = {
187 .owner = THIS_MODULE, 187 .owner = THIS_MODULE,
188 .open = rxrpc_connection_seq_open, 188 .open = rxrpc_connection_seq_open,
189 .read = seq_read, 189 .read = seq_read,
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 87af7c913d81..82adfe6447d7 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -198,7 +198,7 @@ config NET_SCH_NETEM
198 198
199config NET_SCH_INGRESS 199config NET_SCH_INGRESS
200 tristate "Ingress Qdisc" 200 tristate "Ingress Qdisc"
201 depends on NET_CLS_ACT || NETFILTER 201 depends on NET_CLS_ACT
202 ---help--- 202 ---help---
203 Say Y here if you want to use classifiers for incoming packets. 203 Say Y here if you want to use classifiers for incoming packets.
204 If unsure, say Y. 204 If unsure, say Y.
@@ -307,6 +307,17 @@ config NET_CLS_RSVP6
307 To compile this code as a module, choose M here: the 307 To compile this code as a module, choose M here: the
308 module will be called cls_rsvp6. 308 module will be called cls_rsvp6.
309 309
310config NET_CLS_FLOW
311 tristate "Flow classifier"
312 select NET_CLS
313 ---help---
314 If you say Y here, you will be able to classify packets based on
315 a configurable combination of packet keys. This is mostly useful
316 in combination with SFQ.
317
318 To compile this code as a module, choose M here: the
319 module will be called cls_flow.
320
310config NET_EMATCH 321config NET_EMATCH
311 bool "Extended Matches" 322 bool "Extended Matches"
312 select NET_CLS 323 select NET_CLS
diff --git a/net/sched/Makefile b/net/sched/Makefile
index 81ecbe8e7dce..1d2b0f7df848 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_NET_CLS_RSVP) += cls_rsvp.o
35obj-$(CONFIG_NET_CLS_TCINDEX) += cls_tcindex.o 35obj-$(CONFIG_NET_CLS_TCINDEX) += cls_tcindex.o
36obj-$(CONFIG_NET_CLS_RSVP6) += cls_rsvp6.o 36obj-$(CONFIG_NET_CLS_RSVP6) += cls_rsvp6.o
37obj-$(CONFIG_NET_CLS_BASIC) += cls_basic.o 37obj-$(CONFIG_NET_CLS_BASIC) += cls_basic.o
38obj-$(CONFIG_NET_CLS_FLOW) += cls_flow.o
38obj-$(CONFIG_NET_EMATCH) += ematch.o 39obj-$(CONFIG_NET_EMATCH) += ematch.o
39obj-$(CONFIG_NET_EMATCH_CMP) += em_cmp.o 40obj-$(CONFIG_NET_EMATCH_CMP) += em_cmp.o
40obj-$(CONFIG_NET_EMATCH_NBYTE) += em_nbyte.o 41obj-$(CONFIG_NET_EMATCH_NBYTE) += em_nbyte.o
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 3377ca0d0a0c..0fbedcabf111 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -482,7 +482,7 @@ EXPORT_SYMBOL(tcf_exts_destroy);
482 482
483int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb, 483int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb,
484 struct nlattr *rate_tlv, struct tcf_exts *exts, 484 struct nlattr *rate_tlv, struct tcf_exts *exts,
485 struct tcf_ext_map *map) 485 const struct tcf_ext_map *map)
486{ 486{
487 memset(exts, 0, sizeof(*exts)); 487 memset(exts, 0, sizeof(*exts));
488 488
@@ -535,7 +535,7 @@ void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
535EXPORT_SYMBOL(tcf_exts_change); 535EXPORT_SYMBOL(tcf_exts_change);
536 536
537int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts, 537int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts,
538 struct tcf_ext_map *map) 538 const struct tcf_ext_map *map)
539{ 539{
540#ifdef CONFIG_NET_CLS_ACT 540#ifdef CONFIG_NET_CLS_ACT
541 if (map->action && exts->action) { 541 if (map->action && exts->action) {
@@ -571,7 +571,7 @@ EXPORT_SYMBOL(tcf_exts_dump);
571 571
572 572
573int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts, 573int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts,
574 struct tcf_ext_map *map) 574 const struct tcf_ext_map *map)
575{ 575{
576#ifdef CONFIG_NET_CLS_ACT 576#ifdef CONFIG_NET_CLS_ACT
577 if (exts->action) 577 if (exts->action)
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index bfb4342ea88c..956915c217d6 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -35,7 +35,7 @@ struct basic_filter
35 struct list_head link; 35 struct list_head link;
36}; 36};
37 37
38static struct tcf_ext_map basic_ext_map = { 38static const struct tcf_ext_map basic_ext_map = {
39 .action = TCA_BASIC_ACT, 39 .action = TCA_BASIC_ACT,
40 .police = TCA_BASIC_POLICE 40 .police = TCA_BASIC_POLICE
41}; 41};
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
new file mode 100644
index 000000000000..5a7f6a3060fc
--- /dev/null
+++ b/net/sched/cls_flow.c
@@ -0,0 +1,660 @@
1/*
2 * net/sched/cls_flow.c Generic flow classifier
3 *
4 * Copyright (c) 2007, 2008 Patrick McHardy <kaber@trash.net>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/list.h>
15#include <linux/jhash.h>
16#include <linux/random.h>
17#include <linux/pkt_cls.h>
18#include <linux/skbuff.h>
19#include <linux/in.h>
20#include <linux/ip.h>
21#include <linux/ipv6.h>
22
23#include <net/pkt_cls.h>
24#include <net/ip.h>
25#include <net/route.h>
26#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
27#include <net/netfilter/nf_conntrack.h>
28#endif
29
30struct flow_head {
31 struct list_head filters;
32};
33
34struct flow_filter {
35 struct list_head list;
36 struct tcf_exts exts;
37 struct tcf_ematch_tree ematches;
38 u32 handle;
39
40 u32 nkeys;
41 u32 keymask;
42 u32 mode;
43 u32 mask;
44 u32 xor;
45 u32 rshift;
46 u32 addend;
47 u32 divisor;
48 u32 baseclass;
49};
50
51static u32 flow_hashrnd __read_mostly;
52static int flow_hashrnd_initted __read_mostly;
53
54static const struct tcf_ext_map flow_ext_map = {
55 .action = TCA_FLOW_ACT,
56 .police = TCA_FLOW_POLICE,
57};
58
59static inline u32 addr_fold(void *addr)
60{
61 unsigned long a = (unsigned long)addr;
62
63 return (a & 0xFFFFFFFF) ^ (BITS_PER_LONG > 32 ? a >> 32 : 0);
64}
65
66static u32 flow_get_src(const struct sk_buff *skb)
67{
68 switch (skb->protocol) {
69 case __constant_htons(ETH_P_IP):
70 return ntohl(ip_hdr(skb)->saddr);
71 case __constant_htons(ETH_P_IPV6):
72 return ntohl(ipv6_hdr(skb)->saddr.s6_addr32[3]);
73 default:
74 return addr_fold(skb->sk);
75 }
76}
77
78static u32 flow_get_dst(const struct sk_buff *skb)
79{
80 switch (skb->protocol) {
81 case __constant_htons(ETH_P_IP):
82 return ntohl(ip_hdr(skb)->daddr);
83 case __constant_htons(ETH_P_IPV6):
84 return ntohl(ipv6_hdr(skb)->daddr.s6_addr32[3]);
85 default:
86 return addr_fold(skb->dst) ^ (__force u16)skb->protocol;
87 }
88}
89
90static u32 flow_get_proto(const struct sk_buff *skb)
91{
92 switch (skb->protocol) {
93 case __constant_htons(ETH_P_IP):
94 return ip_hdr(skb)->protocol;
95 case __constant_htons(ETH_P_IPV6):
96 return ipv6_hdr(skb)->nexthdr;
97 default:
98 return 0;
99 }
100}
101
102static int has_ports(u8 protocol)
103{
104 switch (protocol) {
105 case IPPROTO_TCP:
106 case IPPROTO_UDP:
107 case IPPROTO_UDPLITE:
108 case IPPROTO_SCTP:
109 case IPPROTO_DCCP:
110 case IPPROTO_ESP:
111 return 1;
112 default:
113 return 0;
114 }
115}
116
117static u32 flow_get_proto_src(const struct sk_buff *skb)
118{
119 u32 res = 0;
120
121 switch (skb->protocol) {
122 case __constant_htons(ETH_P_IP): {
123 struct iphdr *iph = ip_hdr(skb);
124
125 if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
126 has_ports(iph->protocol))
127 res = ntohs(*(__be16 *)((void *)iph + iph->ihl * 4));
128 break;
129 }
130 case __constant_htons(ETH_P_IPV6): {
131 struct ipv6hdr *iph = ipv6_hdr(skb);
132
133 if (has_ports(iph->nexthdr))
134 res = ntohs(*(__be16 *)&iph[1]);
135 break;
136 }
137 default:
138 res = addr_fold(skb->sk);
139 }
140
141 return res;
142}
143
144static u32 flow_get_proto_dst(const struct sk_buff *skb)
145{
146 u32 res = 0;
147
148 switch (skb->protocol) {
149 case __constant_htons(ETH_P_IP): {
150 struct iphdr *iph = ip_hdr(skb);
151
152 if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
153 has_ports(iph->protocol))
154 res = ntohs(*(__be16 *)((void *)iph + iph->ihl * 4 + 2));
155 break;
156 }
157 case __constant_htons(ETH_P_IPV6): {
158 struct ipv6hdr *iph = ipv6_hdr(skb);
159
160 if (has_ports(iph->nexthdr))
161 res = ntohs(*(__be16 *)((void *)&iph[1] + 2));
162 break;
163 }
164 default:
165 res = addr_fold(skb->dst) ^ (__force u16)skb->protocol;
166 }
167
168 return res;
169}
170
171static u32 flow_get_iif(const struct sk_buff *skb)
172{
173 return skb->iif;
174}
175
176static u32 flow_get_priority(const struct sk_buff *skb)
177{
178 return skb->priority;
179}
180
181static u32 flow_get_mark(const struct sk_buff *skb)
182{
183 return skb->mark;
184}
185
186static u32 flow_get_nfct(const struct sk_buff *skb)
187{
188#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
189 return addr_fold(skb->nfct);
190#else
191 return 0;
192#endif
193}
194
195#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
196#define CTTUPLE(skb, member) \
197({ \
198 enum ip_conntrack_info ctinfo; \
199 struct nf_conn *ct = nf_ct_get(skb, &ctinfo); \
200 if (ct == NULL) \
201 goto fallback; \
202 ct->tuplehash[CTINFO2DIR(ctinfo)].tuple.member; \
203})
204#else
205#define CTTUPLE(skb, member) \
206({ \
207 goto fallback; \
208 0; \
209})
210#endif
211
212static u32 flow_get_nfct_src(const struct sk_buff *skb)
213{
214 switch (skb->protocol) {
215 case __constant_htons(ETH_P_IP):
216 return ntohl(CTTUPLE(skb, src.u3.ip));
217 case __constant_htons(ETH_P_IPV6):
218 return ntohl(CTTUPLE(skb, src.u3.ip6[3]));
219 }
220fallback:
221 return flow_get_src(skb);
222}
223
224static u32 flow_get_nfct_dst(const struct sk_buff *skb)
225{
226 switch (skb->protocol) {
227 case __constant_htons(ETH_P_IP):
228 return ntohl(CTTUPLE(skb, dst.u3.ip));
229 case __constant_htons(ETH_P_IPV6):
230 return ntohl(CTTUPLE(skb, dst.u3.ip6[3]));
231 }
232fallback:
233 return flow_get_dst(skb);
234}
235
236static u32 flow_get_nfct_proto_src(const struct sk_buff *skb)
237{
238 return ntohs(CTTUPLE(skb, src.u.all));
239fallback:
240 return flow_get_proto_src(skb);
241}
242
243static u32 flow_get_nfct_proto_dst(const struct sk_buff *skb)
244{
245 return ntohs(CTTUPLE(skb, dst.u.all));
246fallback:
247 return flow_get_proto_dst(skb);
248}
249
250static u32 flow_get_rtclassid(const struct sk_buff *skb)
251{
252#ifdef CONFIG_NET_CLS_ROUTE
253 if (skb->dst)
254 return skb->dst->tclassid;
255#endif
256 return 0;
257}
258
259static u32 flow_get_skuid(const struct sk_buff *skb)
260{
261 if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file)
262 return skb->sk->sk_socket->file->f_uid;
263 return 0;
264}
265
266static u32 flow_get_skgid(const struct sk_buff *skb)
267{
268 if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file)
269 return skb->sk->sk_socket->file->f_gid;
270 return 0;
271}
272
273static u32 flow_key_get(const struct sk_buff *skb, int key)
274{
275 switch (key) {
276 case FLOW_KEY_SRC:
277 return flow_get_src(skb);
278 case FLOW_KEY_DST:
279 return flow_get_dst(skb);
280 case FLOW_KEY_PROTO:
281 return flow_get_proto(skb);
282 case FLOW_KEY_PROTO_SRC:
283 return flow_get_proto_src(skb);
284 case FLOW_KEY_PROTO_DST:
285 return flow_get_proto_dst(skb);
286 case FLOW_KEY_IIF:
287 return flow_get_iif(skb);
288 case FLOW_KEY_PRIORITY:
289 return flow_get_priority(skb);
290 case FLOW_KEY_MARK:
291 return flow_get_mark(skb);
292 case FLOW_KEY_NFCT:
293 return flow_get_nfct(skb);
294 case FLOW_KEY_NFCT_SRC:
295 return flow_get_nfct_src(skb);
296 case FLOW_KEY_NFCT_DST:
297 return flow_get_nfct_dst(skb);
298 case FLOW_KEY_NFCT_PROTO_SRC:
299 return flow_get_nfct_proto_src(skb);
300 case FLOW_KEY_NFCT_PROTO_DST:
301 return flow_get_nfct_proto_dst(skb);
302 case FLOW_KEY_RTCLASSID:
303 return flow_get_rtclassid(skb);
304 case FLOW_KEY_SKUID:
305 return flow_get_skuid(skb);
306 case FLOW_KEY_SKGID:
307 return flow_get_skgid(skb);
308 default:
309 WARN_ON(1);
310 return 0;
311 }
312}
313
314static int flow_classify(struct sk_buff *skb, struct tcf_proto *tp,
315 struct tcf_result *res)
316{
317 struct flow_head *head = tp->root;
318 struct flow_filter *f;
319 u32 keymask;
320 u32 classid;
321 unsigned int n, key;
322 int r;
323
324 list_for_each_entry(f, &head->filters, list) {
325 u32 keys[f->nkeys];
326
327 if (!tcf_em_tree_match(skb, &f->ematches, NULL))
328 continue;
329
330 keymask = f->keymask;
331
332 for (n = 0; n < f->nkeys; n++) {
333 key = ffs(keymask) - 1;
334 keymask &= ~(1 << key);
335 keys[n] = flow_key_get(skb, key);
336 }
337
338 if (f->mode == FLOW_MODE_HASH)
339 classid = jhash2(keys, f->nkeys, flow_hashrnd);
340 else {
341 classid = keys[0];
342 classid = (classid & f->mask) ^ f->xor;
343 classid = (classid >> f->rshift) + f->addend;
344 }
345
346 if (f->divisor)
347 classid %= f->divisor;
348
349 res->class = 0;
350 res->classid = TC_H_MAKE(f->baseclass, f->baseclass + classid);
351
352 r = tcf_exts_exec(skb, &f->exts, res);
353 if (r < 0)
354 continue;
355 return r;
356 }
357 return -1;
358}
359
360static const struct nla_policy flow_policy[TCA_FLOW_MAX + 1] = {
361 [TCA_FLOW_KEYS] = { .type = NLA_U32 },
362 [TCA_FLOW_MODE] = { .type = NLA_U32 },
363 [TCA_FLOW_BASECLASS] = { .type = NLA_U32 },
364 [TCA_FLOW_RSHIFT] = { .type = NLA_U32 },
365 [TCA_FLOW_ADDEND] = { .type = NLA_U32 },
366 [TCA_FLOW_MASK] = { .type = NLA_U32 },
367 [TCA_FLOW_XOR] = { .type = NLA_U32 },
368 [TCA_FLOW_DIVISOR] = { .type = NLA_U32 },
369 [TCA_FLOW_ACT] = { .type = NLA_NESTED },
370 [TCA_FLOW_POLICE] = { .type = NLA_NESTED },
371 [TCA_FLOW_EMATCHES] = { .type = NLA_NESTED },
372};
373
374static int flow_change(struct tcf_proto *tp, unsigned long base,
375 u32 handle, struct nlattr **tca,
376 unsigned long *arg)
377{
378 struct flow_head *head = tp->root;
379 struct flow_filter *f;
380 struct nlattr *opt = tca[TCA_OPTIONS];
381 struct nlattr *tb[TCA_FLOW_MAX + 1];
382 struct tcf_exts e;
383 struct tcf_ematch_tree t;
384 unsigned int nkeys = 0;
385 u32 baseclass = 0;
386 u32 keymask = 0;
387 u32 mode;
388 int err;
389
390 if (opt == NULL)
391 return -EINVAL;
392
393 err = nla_parse_nested(tb, TCA_FLOW_MAX, opt, flow_policy);
394 if (err < 0)
395 return err;
396
397 if (tb[TCA_FLOW_BASECLASS]) {
398 baseclass = nla_get_u32(tb[TCA_FLOW_BASECLASS]);
399 if (TC_H_MIN(baseclass) == 0)
400 return -EINVAL;
401 }
402
403 if (tb[TCA_FLOW_KEYS]) {
404 keymask = nla_get_u32(tb[TCA_FLOW_KEYS]);
405 if (fls(keymask) - 1 > FLOW_KEY_MAX)
406 return -EOPNOTSUPP;
407
408 nkeys = hweight32(keymask);
409 if (nkeys == 0)
410 return -EINVAL;
411 }
412
413 err = tcf_exts_validate(tp, tb, tca[TCA_RATE], &e, &flow_ext_map);
414 if (err < 0)
415 return err;
416
417 err = tcf_em_tree_validate(tp, tb[TCA_FLOW_EMATCHES], &t);
418 if (err < 0)
419 goto err1;
420
421 f = (struct flow_filter *)*arg;
422 if (f != NULL) {
423 err = -EINVAL;
424 if (f->handle != handle && handle)
425 goto err2;
426
427 mode = f->mode;
428 if (tb[TCA_FLOW_MODE])
429 mode = nla_get_u32(tb[TCA_FLOW_MODE]);
430 if (mode != FLOW_MODE_HASH && nkeys > 1)
431 goto err2;
432 } else {
433 err = -EINVAL;
434 if (!handle)
435 goto err2;
436 if (!tb[TCA_FLOW_KEYS])
437 goto err2;
438
439 mode = FLOW_MODE_MAP;
440 if (tb[TCA_FLOW_MODE])
441 mode = nla_get_u32(tb[TCA_FLOW_MODE]);
442 if (mode != FLOW_MODE_HASH && nkeys > 1)
443 goto err2;
444
445 if (TC_H_MAJ(baseclass) == 0)
446 baseclass = TC_H_MAKE(tp->q->handle, baseclass);
447 if (TC_H_MIN(baseclass) == 0)
448 baseclass = TC_H_MAKE(baseclass, 1);
449
450 err = -ENOBUFS;
451 f = kzalloc(sizeof(*f), GFP_KERNEL);
452 if (f == NULL)
453 goto err2;
454
455 f->handle = handle;
456 f->mask = ~0U;
457 }
458
459 tcf_exts_change(tp, &f->exts, &e);
460 tcf_em_tree_change(tp, &f->ematches, &t);
461
462 tcf_tree_lock(tp);
463
464 if (tb[TCA_FLOW_KEYS]) {
465 f->keymask = keymask;
466 f->nkeys = nkeys;
467 }
468
469 f->mode = mode;
470
471 if (tb[TCA_FLOW_MASK])
472 f->mask = nla_get_u32(tb[TCA_FLOW_MASK]);
473 if (tb[TCA_FLOW_XOR])
474 f->xor = nla_get_u32(tb[TCA_FLOW_XOR]);
475 if (tb[TCA_FLOW_RSHIFT])
476 f->rshift = nla_get_u32(tb[TCA_FLOW_RSHIFT]);
477 if (tb[TCA_FLOW_ADDEND])
478 f->addend = nla_get_u32(tb[TCA_FLOW_ADDEND]);
479
480 if (tb[TCA_FLOW_DIVISOR])
481 f->divisor = nla_get_u32(tb[TCA_FLOW_DIVISOR]);
482 if (baseclass)
483 f->baseclass = baseclass;
484
485 if (*arg == 0)
486 list_add_tail(&f->list, &head->filters);
487
488 tcf_tree_unlock(tp);
489
490 *arg = (unsigned long)f;
491 return 0;
492
493err2:
494 tcf_em_tree_destroy(tp, &t);
495err1:
496 tcf_exts_destroy(tp, &e);
497 return err;
498}
499
500static void flow_destroy_filter(struct tcf_proto *tp, struct flow_filter *f)
501{
502 tcf_exts_destroy(tp, &f->exts);
503 tcf_em_tree_destroy(tp, &f->ematches);
504 kfree(f);
505}
506
507static int flow_delete(struct tcf_proto *tp, unsigned long arg)
508{
509 struct flow_filter *f = (struct flow_filter *)arg;
510
511 tcf_tree_lock(tp);
512 list_del(&f->list);
513 tcf_tree_unlock(tp);
514 flow_destroy_filter(tp, f);
515 return 0;
516}
517
518static int flow_init(struct tcf_proto *tp)
519{
520 struct flow_head *head;
521
522 if (!flow_hashrnd_initted) {
523 get_random_bytes(&flow_hashrnd, 4);
524 flow_hashrnd_initted = 1;
525 }
526
527 head = kzalloc(sizeof(*head), GFP_KERNEL);
528 if (head == NULL)
529 return -ENOBUFS;
530 INIT_LIST_HEAD(&head->filters);
531 tp->root = head;
532 return 0;
533}
534
535static void flow_destroy(struct tcf_proto *tp)
536{
537 struct flow_head *head = tp->root;
538 struct flow_filter *f, *next;
539
540 list_for_each_entry_safe(f, next, &head->filters, list) {
541 list_del(&f->list);
542 flow_destroy_filter(tp, f);
543 }
544 kfree(head);
545}
546
547static unsigned long flow_get(struct tcf_proto *tp, u32 handle)
548{
549 struct flow_head *head = tp->root;
550 struct flow_filter *f;
551
552 list_for_each_entry(f, &head->filters, list)
553 if (f->handle == handle)
554 return (unsigned long)f;
555 return 0;
556}
557
558static void flow_put(struct tcf_proto *tp, unsigned long f)
559{
560 return;
561}
562
563static int flow_dump(struct tcf_proto *tp, unsigned long fh,
564 struct sk_buff *skb, struct tcmsg *t)
565{
566 struct flow_filter *f = (struct flow_filter *)fh;
567 struct nlattr *nest;
568
569 if (f == NULL)
570 return skb->len;
571
572 t->tcm_handle = f->handle;
573
574 nest = nla_nest_start(skb, TCA_OPTIONS);
575 if (nest == NULL)
576 goto nla_put_failure;
577
578 NLA_PUT_U32(skb, TCA_FLOW_KEYS, f->keymask);
579 NLA_PUT_U32(skb, TCA_FLOW_MODE, f->mode);
580
581 if (f->mask != ~0 || f->xor != 0) {
582 NLA_PUT_U32(skb, TCA_FLOW_MASK, f->mask);
583 NLA_PUT_U32(skb, TCA_FLOW_XOR, f->xor);
584 }
585 if (f->rshift)
586 NLA_PUT_U32(skb, TCA_FLOW_RSHIFT, f->rshift);
587 if (f->addend)
588 NLA_PUT_U32(skb, TCA_FLOW_ADDEND, f->addend);
589
590 if (f->divisor)
591 NLA_PUT_U32(skb, TCA_FLOW_DIVISOR, f->divisor);
592 if (f->baseclass)
593 NLA_PUT_U32(skb, TCA_FLOW_BASECLASS, f->baseclass);
594
595 if (tcf_exts_dump(skb, &f->exts, &flow_ext_map) < 0)
596 goto nla_put_failure;
597
598 if (f->ematches.hdr.nmatches &&
599 tcf_em_tree_dump(skb, &f->ematches, TCA_FLOW_EMATCHES) < 0)
600 goto nla_put_failure;
601
602 nla_nest_end(skb, nest);
603
604 if (tcf_exts_dump_stats(skb, &f->exts, &flow_ext_map) < 0)
605 goto nla_put_failure;
606
607 return skb->len;
608
609nla_put_failure:
610 nlmsg_trim(skb, nest);
611 return -1;
612}
613
614static void flow_walk(struct tcf_proto *tp, struct tcf_walker *arg)
615{
616 struct flow_head *head = tp->root;
617 struct flow_filter *f;
618
619 list_for_each_entry(f, &head->filters, list) {
620 if (arg->count < arg->skip)
621 goto skip;
622 if (arg->fn(tp, (unsigned long)f, arg) < 0) {
623 arg->stop = 1;
624 break;
625 }
626skip:
627 arg->count++;
628 }
629}
630
631static struct tcf_proto_ops cls_flow_ops __read_mostly = {
632 .kind = "flow",
633 .classify = flow_classify,
634 .init = flow_init,
635 .destroy = flow_destroy,
636 .change = flow_change,
637 .delete = flow_delete,
638 .get = flow_get,
639 .put = flow_put,
640 .dump = flow_dump,
641 .walk = flow_walk,
642 .owner = THIS_MODULE,
643};
644
645static int __init cls_flow_init(void)
646{
647 return register_tcf_proto_ops(&cls_flow_ops);
648}
649
650static void __exit cls_flow_exit(void)
651{
652 unregister_tcf_proto_ops(&cls_flow_ops);
653}
654
655module_init(cls_flow_init);
656module_exit(cls_flow_exit);
657
658MODULE_LICENSE("GPL");
659MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");
660MODULE_DESCRIPTION("TC flow classifier");
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index 436a6e7c438e..b0f90e593af0 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -47,7 +47,7 @@ struct fw_filter
47 struct tcf_exts exts; 47 struct tcf_exts exts;
48}; 48};
49 49
50static struct tcf_ext_map fw_ext_map = { 50static const struct tcf_ext_map fw_ext_map = {
51 .action = TCA_FW_ACT, 51 .action = TCA_FW_ACT,
52 .police = TCA_FW_POLICE 52 .police = TCA_FW_POLICE
53}; 53};
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index f7e7d3955d28..784dcb870b98 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -62,7 +62,7 @@ struct route4_filter
62 62
63#define ROUTE4_FAILURE ((struct route4_filter*)(-1L)) 63#define ROUTE4_FAILURE ((struct route4_filter*)(-1L))
64 64
65static struct tcf_ext_map route_ext_map = { 65static const struct tcf_ext_map route_ext_map = {
66 .police = TCA_ROUTE4_POLICE, 66 .police = TCA_ROUTE4_POLICE,
67 .action = TCA_ROUTE4_ACT 67 .action = TCA_ROUTE4_ACT
68}; 68};
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index ee60b2d1705d..7a7bff5ded24 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -55,7 +55,7 @@ struct tcindex_data {
55 int fall_through; /* 0: only classify if explicit match */ 55 int fall_through; /* 0: only classify if explicit match */
56}; 56};
57 57
58static struct tcf_ext_map tcindex_ext_map = { 58static const struct tcf_ext_map tcindex_ext_map = {
59 .police = TCA_TCINDEX_POLICE, 59 .police = TCA_TCINDEX_POLICE,
60 .action = TCA_TCINDEX_ACT 60 .action = TCA_TCINDEX_ACT
61}; 61};
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index e8a775689123..b18fa95ef248 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -82,7 +82,7 @@ struct tc_u_common
82 u32 hgenerator; 82 u32 hgenerator;
83}; 83};
84 84
85static struct tcf_ext_map u32_ext_map = { 85static const struct tcf_ext_map u32_ext_map = {
86 .action = TCA_U32_ACT, 86 .action = TCA_U32_ACT,
87 .police = TCA_U32_POLICE 87 .police = TCA_U32_POLICE
88}; 88};
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 3f72d528273c..274b1ddb160c 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -12,18 +12,10 @@
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/skbuff.h> 13#include <linux/skbuff.h>
14#include <linux/rtnetlink.h> 14#include <linux/rtnetlink.h>
15#include <linux/netfilter_ipv4.h>
16#include <linux/netfilter_ipv6.h>
17#include <linux/netfilter.h>
18#include <net/netlink.h> 15#include <net/netlink.h>
19#include <net/pkt_sched.h> 16#include <net/pkt_sched.h>
20 17
21 18
22/* Thanks to Doron Oz for this hack */
23#if !defined(CONFIG_NET_CLS_ACT) && defined(CONFIG_NETFILTER)
24static int nf_registered;
25#endif
26
27struct ingress_qdisc_data { 19struct ingress_qdisc_data {
28 struct tcf_proto *filter_list; 20 struct tcf_proto *filter_list;
29}; 21};
@@ -84,11 +76,6 @@ static int ingress_enqueue(struct sk_buff *skb, struct Qdisc *sch)
84 76
85 result = tc_classify(skb, p->filter_list, &res); 77 result = tc_classify(skb, p->filter_list, &res);
86 78
87 /*
88 * Unlike normal "enqueue" functions, ingress_enqueue returns a
89 * firewall FW_* code.
90 */
91#ifdef CONFIG_NET_CLS_ACT
92 sch->bstats.packets++; 79 sch->bstats.packets++;
93 sch->bstats.bytes += skb->len; 80 sch->bstats.bytes += skb->len;
94 switch (result) { 81 switch (result) {
@@ -107,71 +94,10 @@ static int ingress_enqueue(struct sk_buff *skb, struct Qdisc *sch)
107 result = TC_ACT_OK; 94 result = TC_ACT_OK;
108 break; 95 break;
109 } 96 }
110#else
111 result = NF_ACCEPT;
112 sch->bstats.packets++;
113 sch->bstats.bytes += skb->len;
114#endif
115 97
116 return result; 98 return result;
117} 99}
118 100
119#if !defined(CONFIG_NET_CLS_ACT) && defined(CONFIG_NETFILTER)
120static unsigned int ing_hook(unsigned int hook, struct sk_buff *skb,
121 const struct net_device *indev,
122 const struct net_device *outdev,
123 int (*okfn)(struct sk_buff *))
124{
125
126 struct Qdisc *q;
127 struct net_device *dev = skb->dev;
128 int fwres = NF_ACCEPT;
129
130 if (dev->qdisc_ingress) {
131 spin_lock(&dev->ingress_lock);
132 if ((q = dev->qdisc_ingress) != NULL)
133 fwres = q->enqueue(skb, q);
134 spin_unlock(&dev->ingress_lock);
135 }
136
137 return fwres;
138}
139
140/* after ipt_filter */
141static struct nf_hook_ops ing_ops[] __read_mostly = {
142 {
143 .hook = ing_hook,
144 .owner = THIS_MODULE,
145 .pf = PF_INET,
146 .hooknum = NF_INET_PRE_ROUTING,
147 .priority = NF_IP_PRI_FILTER + 1,
148 },
149 {
150 .hook = ing_hook,
151 .owner = THIS_MODULE,
152 .pf = PF_INET6,
153 .hooknum = NF_INET_PRE_ROUTING,
154 .priority = NF_IP6_PRI_FILTER + 1,
155 },
156};
157#endif
158
159static int ingress_init(struct Qdisc *sch, struct nlattr *opt)
160{
161#if !defined(CONFIG_NET_CLS_ACT) && defined(CONFIG_NETFILTER)
162 printk("Ingress scheduler: Classifier actions prefered over netfilter\n");
163
164 if (!nf_registered) {
165 if (nf_register_hooks(ing_ops, ARRAY_SIZE(ing_ops)) < 0) {
166 printk("ingress qdisc registration error \n");
167 return -EINVAL;
168 }
169 nf_registered++;
170 }
171#endif
172 return 0;
173}
174
175/* ------------------------------------------------------------- */ 101/* ------------------------------------------------------------- */
176 102
177static void ingress_destroy(struct Qdisc *sch) 103static void ingress_destroy(struct Qdisc *sch)
@@ -213,7 +139,6 @@ static struct Qdisc_ops ingress_qdisc_ops __read_mostly = {
213 .id = "ingress", 139 .id = "ingress",
214 .priv_size = sizeof(struct ingress_qdisc_data), 140 .priv_size = sizeof(struct ingress_qdisc_data),
215 .enqueue = ingress_enqueue, 141 .enqueue = ingress_enqueue,
216 .init = ingress_init,
217 .destroy = ingress_destroy, 142 .destroy = ingress_destroy,
218 .dump = ingress_dump, 143 .dump = ingress_dump,
219 .owner = THIS_MODULE, 144 .owner = THIS_MODULE,
@@ -227,10 +152,6 @@ static int __init ingress_module_init(void)
227static void __exit ingress_module_exit(void) 152static void __exit ingress_module_exit(void)
228{ 153{
229 unregister_qdisc(&ingress_qdisc_ops); 154 unregister_qdisc(&ingress_qdisc_ops);
230#if !defined(CONFIG_NET_CLS_ACT) && defined(CONFIG_NETFILTER)
231 if (nf_registered)
232 nf_unregister_hooks(ing_ops, ARRAY_SIZE(ing_ops));
233#endif
234} 155}
235 156
236module_init(ingress_module_init) 157module_init(ingress_module_init)
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 91af539ab6e6..a20e2ef7704b 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -95,6 +95,7 @@ struct sfq_sched_data
95 int limit; 95 int limit;
96 96
97/* Variables */ 97/* Variables */
98 struct tcf_proto *filter_list;
98 struct timer_list perturb_timer; 99 struct timer_list perturb_timer;
99 u32 perturbation; 100 u32 perturbation;
100 sfq_index tail; /* Index of current slot in round */ 101 sfq_index tail; /* Index of current slot in round */
@@ -155,6 +156,39 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
155 return sfq_fold_hash(q, h, h2); 156 return sfq_fold_hash(q, h, h2);
156} 157}
157 158
159static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch,
160 int *qerr)
161{
162 struct sfq_sched_data *q = qdisc_priv(sch);
163 struct tcf_result res;
164 int result;
165
166 if (TC_H_MAJ(skb->priority) == sch->handle &&
167 TC_H_MIN(skb->priority) > 0 &&
168 TC_H_MIN(skb->priority) <= SFQ_HASH_DIVISOR)
169 return TC_H_MIN(skb->priority);
170
171 if (!q->filter_list)
172 return sfq_hash(q, skb) + 1;
173
174 *qerr = NET_XMIT_BYPASS;
175 result = tc_classify(skb, q->filter_list, &res);
176 if (result >= 0) {
177#ifdef CONFIG_NET_CLS_ACT
178 switch (result) {
179 case TC_ACT_STOLEN:
180 case TC_ACT_QUEUED:
181 *qerr = NET_XMIT_SUCCESS;
182 case TC_ACT_SHOT:
183 return 0;
184 }
185#endif
186 if (TC_H_MIN(res.classid) <= SFQ_HASH_DIVISOR)
187 return TC_H_MIN(res.classid);
188 }
189 return 0;
190}
191
158static inline void sfq_link(struct sfq_sched_data *q, sfq_index x) 192static inline void sfq_link(struct sfq_sched_data *q, sfq_index x)
159{ 193{
160 sfq_index p, n; 194 sfq_index p, n;
@@ -245,8 +279,18 @@ static int
245sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) 279sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
246{ 280{
247 struct sfq_sched_data *q = qdisc_priv(sch); 281 struct sfq_sched_data *q = qdisc_priv(sch);
248 unsigned hash = sfq_hash(q, skb); 282 unsigned int hash;
249 sfq_index x; 283 sfq_index x;
284 int ret;
285
286 hash = sfq_classify(skb, sch, &ret);
287 if (hash == 0) {
288 if (ret == NET_XMIT_BYPASS)
289 sch->qstats.drops++;
290 kfree_skb(skb);
291 return ret;
292 }
293 hash--;
250 294
251 x = q->ht[hash]; 295 x = q->ht[hash];
252 if (x == SFQ_DEPTH) { 296 if (x == SFQ_DEPTH) {
@@ -289,8 +333,18 @@ static int
289sfq_requeue(struct sk_buff *skb, struct Qdisc *sch) 333sfq_requeue(struct sk_buff *skb, struct Qdisc *sch)
290{ 334{
291 struct sfq_sched_data *q = qdisc_priv(sch); 335 struct sfq_sched_data *q = qdisc_priv(sch);
292 unsigned hash = sfq_hash(q, skb); 336 unsigned int hash;
293 sfq_index x; 337 sfq_index x;
338 int ret;
339
340 hash = sfq_classify(skb, sch, &ret);
341 if (hash == 0) {
342 if (ret == NET_XMIT_BYPASS)
343 sch->qstats.drops++;
344 kfree_skb(skb);
345 return ret;
346 }
347 hash--;
294 348
295 x = q->ht[hash]; 349 x = q->ht[hash];
296 if (x == SFQ_DEPTH) { 350 if (x == SFQ_DEPTH) {
@@ -465,6 +519,8 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt)
465static void sfq_destroy(struct Qdisc *sch) 519static void sfq_destroy(struct Qdisc *sch)
466{ 520{
467 struct sfq_sched_data *q = qdisc_priv(sch); 521 struct sfq_sched_data *q = qdisc_priv(sch);
522
523 tcf_destroy_chain(q->filter_list);
468 del_timer(&q->perturb_timer); 524 del_timer(&q->perturb_timer);
469} 525}
470 526
@@ -490,9 +546,79 @@ nla_put_failure:
490 return -1; 546 return -1;
491} 547}
492 548
549static int sfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
550 struct nlattr **tca, unsigned long *arg)
551{
552 return -EOPNOTSUPP;
553}
554
555static unsigned long sfq_get(struct Qdisc *sch, u32 classid)
556{
557 return 0;
558}
559
560static struct tcf_proto **sfq_find_tcf(struct Qdisc *sch, unsigned long cl)
561{
562 struct sfq_sched_data *q = qdisc_priv(sch);
563
564 if (cl)
565 return NULL;
566 return &q->filter_list;
567}
568
569static int sfq_dump_class(struct Qdisc *sch, unsigned long cl,
570 struct sk_buff *skb, struct tcmsg *tcm)
571{
572 tcm->tcm_handle |= TC_H_MIN(cl);
573 return 0;
574}
575
576static int sfq_dump_class_stats(struct Qdisc *sch, unsigned long cl,
577 struct gnet_dump *d)
578{
579 struct sfq_sched_data *q = qdisc_priv(sch);
580 sfq_index idx = q->ht[cl-1];
581 struct gnet_stats_queue qs = { .qlen = q->qs[idx].qlen };
582 struct tc_sfq_xstats xstats = { .allot = q->allot[idx] };
583
584 if (gnet_stats_copy_queue(d, &qs) < 0)
585 return -1;
586 return gnet_stats_copy_app(d, &xstats, sizeof(xstats));
587}
588
589static void sfq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
590{
591 struct sfq_sched_data *q = qdisc_priv(sch);
592 unsigned int i;
593
594 if (arg->stop)
595 return;
596
597 for (i = 0; i < SFQ_HASH_DIVISOR; i++) {
598 if (q->ht[i] == SFQ_DEPTH ||
599 arg->count < arg->skip) {
600 arg->count++;
601 continue;
602 }
603 if (arg->fn(sch, i + 1, arg) < 0) {
604 arg->stop = 1;
605 break;
606 }
607 arg->count++;
608 }
609}
610
611static const struct Qdisc_class_ops sfq_class_ops = {
612 .get = sfq_get,
613 .change = sfq_change_class,
614 .tcf_chain = sfq_find_tcf,
615 .dump = sfq_dump_class,
616 .dump_stats = sfq_dump_class_stats,
617 .walk = sfq_walk,
618};
619
493static struct Qdisc_ops sfq_qdisc_ops __read_mostly = { 620static struct Qdisc_ops sfq_qdisc_ops __read_mostly = {
494 .next = NULL, 621 .cl_ops = &sfq_class_ops,
495 .cl_ops = NULL,
496 .id = "sfq", 622 .id = "sfq",
497 .priv_size = sizeof(struct sfq_sched_data), 623 .priv_size = sizeof(struct sfq_sched_data),
498 .enqueue = sfq_enqueue, 624 .enqueue = sfq_enqueue,
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 1411c7b1fbdc..0444fd0f0d22 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -71,7 +71,7 @@ struct teql_sched_data
71 71
72#define NEXT_SLAVE(q) (((struct teql_sched_data*)qdisc_priv(q))->next) 72#define NEXT_SLAVE(q) (((struct teql_sched_data*)qdisc_priv(q))->next)
73 73
74#define FMASK (IFF_BROADCAST|IFF_POINTOPOINT|IFF_BROADCAST) 74#define FMASK (IFF_BROADCAST|IFF_POINTOPOINT)
75 75
76/* "teql*" qdisc routines */ 76/* "teql*" qdisc routines */
77 77
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index dd98763c8b00..77383e9b3988 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2056,7 +2056,7 @@ static sctp_ierror_t sctp_verify_param(const struct sctp_association *asoc,
2056 break; 2056 break;
2057 2057
2058 case SCTP_PARAM_HMAC_ALGO: 2058 case SCTP_PARAM_HMAC_ALGO:
2059 if (!sctp_auth_enable) 2059 if (sctp_auth_enable)
2060 break; 2060 break;
2061 /* Fall Through */ 2061 /* Fall Through */
2062fallthrough: 2062fallthrough:
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index 07fad7ccf832..339ca4a8e89e 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -1652,7 +1652,7 @@ static int __init x25_init(void)
1652 1652
1653 register_netdevice_notifier(&x25_dev_notifier); 1653 register_netdevice_notifier(&x25_dev_notifier);
1654 1654
1655 printk(KERN_INFO "X.25 for Linux. Version 0.2 for Linux 2.1.15\n"); 1655 printk(KERN_INFO "X.25 for Linux Version 0.2\n");
1656 1656
1657#ifdef CONFIG_SYSCTL 1657#ifdef CONFIG_SYSCTL
1658 x25_register_sysctl(); 1658 x25_register_sysctl();
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index b5c5347aed66..6cc15250de69 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -28,6 +28,105 @@
28 * that instantiated crypto transforms have correct parameters for IPsec 28 * that instantiated crypto transforms have correct parameters for IPsec
29 * purposes. 29 * purposes.
30 */ 30 */
31static struct xfrm_algo_desc aead_list[] = {
32{
33 .name = "rfc4106(gcm(aes))",
34
35 .uinfo = {
36 .aead = {
37 .icv_truncbits = 64,
38 }
39 },
40
41 .desc = {
42 .sadb_alg_id = SADB_X_EALG_AES_GCM_ICV8,
43 .sadb_alg_ivlen = 8,
44 .sadb_alg_minbits = 128,
45 .sadb_alg_maxbits = 256
46 }
47},
48{
49 .name = "rfc4106(gcm(aes))",
50
51 .uinfo = {
52 .aead = {
53 .icv_truncbits = 96,
54 }
55 },
56
57 .desc = {
58 .sadb_alg_id = SADB_X_EALG_AES_GCM_ICV12,
59 .sadb_alg_ivlen = 8,
60 .sadb_alg_minbits = 128,
61 .sadb_alg_maxbits = 256
62 }
63},
64{
65 .name = "rfc4106(gcm(aes))",
66
67 .uinfo = {
68 .aead = {
69 .icv_truncbits = 128,
70 }
71 },
72
73 .desc = {
74 .sadb_alg_id = SADB_X_EALG_AES_GCM_ICV16,
75 .sadb_alg_ivlen = 8,
76 .sadb_alg_minbits = 128,
77 .sadb_alg_maxbits = 256
78 }
79},
80{
81 .name = "rfc4309(ccm(aes))",
82
83 .uinfo = {
84 .aead = {
85 .icv_truncbits = 64,
86 }
87 },
88
89 .desc = {
90 .sadb_alg_id = SADB_X_EALG_AES_CCM_ICV8,
91 .sadb_alg_ivlen = 8,
92 .sadb_alg_minbits = 128,
93 .sadb_alg_maxbits = 256
94 }
95},
96{
97 .name = "rfc4309(ccm(aes))",
98
99 .uinfo = {
100 .aead = {
101 .icv_truncbits = 96,
102 }
103 },
104
105 .desc = {
106 .sadb_alg_id = SADB_X_EALG_AES_CCM_ICV12,
107 .sadb_alg_ivlen = 8,
108 .sadb_alg_minbits = 128,
109 .sadb_alg_maxbits = 256
110 }
111},
112{
113 .name = "rfc4309(ccm(aes))",
114
115 .uinfo = {
116 .aead = {
117 .icv_truncbits = 128,
118 }
119 },
120
121 .desc = {
122 .sadb_alg_id = SADB_X_EALG_AES_CCM_ICV16,
123 .sadb_alg_ivlen = 8,
124 .sadb_alg_minbits = 128,
125 .sadb_alg_maxbits = 256
126 }
127},
128};
129
31static struct xfrm_algo_desc aalg_list[] = { 130static struct xfrm_algo_desc aalg_list[] = {
32{ 131{
33 .name = "hmac(digest_null)", 132 .name = "hmac(digest_null)",
@@ -332,6 +431,11 @@ static struct xfrm_algo_desc calg_list[] = {
332}, 431},
333}; 432};
334 433
434static inline int aead_entries(void)
435{
436 return ARRAY_SIZE(aead_list);
437}
438
335static inline int aalg_entries(void) 439static inline int aalg_entries(void)
336{ 440{
337 return ARRAY_SIZE(aalg_list); 441 return ARRAY_SIZE(aalg_list);
@@ -354,25 +458,32 @@ struct xfrm_algo_list {
354 u32 mask; 458 u32 mask;
355}; 459};
356 460
461static const struct xfrm_algo_list xfrm_aead_list = {
462 .algs = aead_list,
463 .entries = ARRAY_SIZE(aead_list),
464 .type = CRYPTO_ALG_TYPE_AEAD,
465 .mask = CRYPTO_ALG_TYPE_MASK,
466};
467
357static const struct xfrm_algo_list xfrm_aalg_list = { 468static const struct xfrm_algo_list xfrm_aalg_list = {
358 .algs = aalg_list, 469 .algs = aalg_list,
359 .entries = ARRAY_SIZE(aalg_list), 470 .entries = ARRAY_SIZE(aalg_list),
360 .type = CRYPTO_ALG_TYPE_HASH, 471 .type = CRYPTO_ALG_TYPE_HASH,
361 .mask = CRYPTO_ALG_TYPE_HASH_MASK | CRYPTO_ALG_ASYNC, 472 .mask = CRYPTO_ALG_TYPE_HASH_MASK,
362}; 473};
363 474
364static const struct xfrm_algo_list xfrm_ealg_list = { 475static const struct xfrm_algo_list xfrm_ealg_list = {
365 .algs = ealg_list, 476 .algs = ealg_list,
366 .entries = ARRAY_SIZE(ealg_list), 477 .entries = ARRAY_SIZE(ealg_list),
367 .type = CRYPTO_ALG_TYPE_BLKCIPHER, 478 .type = CRYPTO_ALG_TYPE_BLKCIPHER,
368 .mask = CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC, 479 .mask = CRYPTO_ALG_TYPE_BLKCIPHER_MASK,
369}; 480};
370 481
371static const struct xfrm_algo_list xfrm_calg_list = { 482static const struct xfrm_algo_list xfrm_calg_list = {
372 .algs = calg_list, 483 .algs = calg_list,
373 .entries = ARRAY_SIZE(calg_list), 484 .entries = ARRAY_SIZE(calg_list),
374 .type = CRYPTO_ALG_TYPE_COMPRESS, 485 .type = CRYPTO_ALG_TYPE_COMPRESS,
375 .mask = CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC, 486 .mask = CRYPTO_ALG_TYPE_MASK,
376}; 487};
377 488
378static struct xfrm_algo_desc *xfrm_find_algo( 489static struct xfrm_algo_desc *xfrm_find_algo(
@@ -461,6 +572,33 @@ struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe)
461} 572}
462EXPORT_SYMBOL_GPL(xfrm_calg_get_byname); 573EXPORT_SYMBOL_GPL(xfrm_calg_get_byname);
463 574
575struct xfrm_aead_name {
576 const char *name;
577 int icvbits;
578};
579
580static int xfrm_aead_name_match(const struct xfrm_algo_desc *entry,
581 const void *data)
582{
583 const struct xfrm_aead_name *aead = data;
584 const char *name = aead->name;
585
586 return aead->icvbits == entry->uinfo.aead.icv_truncbits && name &&
587 !strcmp(name, entry->name);
588}
589
590struct xfrm_algo_desc *xfrm_aead_get_byname(char *name, int icv_len, int probe)
591{
592 struct xfrm_aead_name data = {
593 .name = name,
594 .icvbits = icv_len,
595 };
596
597 return xfrm_find_algo(&xfrm_aead_list, xfrm_aead_name_match, &data,
598 probe);
599}
600EXPORT_SYMBOL_GPL(xfrm_aead_get_byname);
601
464struct xfrm_algo_desc *xfrm_aalg_get_byidx(unsigned int idx) 602struct xfrm_algo_desc *xfrm_aalg_get_byidx(unsigned int idx)
465{ 603{
466 if (idx >= aalg_entries()) 604 if (idx >= aalg_entries())
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 039e7019c48a..4d6ebc633a94 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -81,7 +81,6 @@ int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq)
81 *seq = *(__be32*)(skb_transport_header(skb) + offset_seq); 81 *seq = *(__be32*)(skb_transport_header(skb) + offset_seq);
82 return 0; 82 return 0;
83} 83}
84EXPORT_SYMBOL(xfrm_parse_spi);
85 84
86int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb) 85int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb)
87{ 86{
@@ -160,12 +159,12 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
160 } 159 }
161 160
162 if ((x->encap ? x->encap->encap_type : 0) != encap_type) { 161 if ((x->encap ? x->encap->encap_type : 0) != encap_type) {
163 XFRM_INC_STATS(LINUX_MIB_XFRMINSTATEINVALID); 162 XFRM_INC_STATS(LINUX_MIB_XFRMINSTATEMISMATCH);
164 goto drop_unlock; 163 goto drop_unlock;
165 } 164 }
166 165
167 if (x->props.replay_window && xfrm_replay_check(x, skb, seq)) { 166 if (x->props.replay_window && xfrm_replay_check(x, skb, seq)) {
168 XFRM_INC_STATS(LINUX_MIB_XFRMINSEQOUTOFWINDOW); 167 XFRM_INC_STATS(LINUX_MIB_XFRMINSTATESEQERROR);
169 goto drop_unlock; 168 goto drop_unlock;
170 } 169 }
171 170
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index f4a1047a5573..fc690368325f 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -64,6 +64,7 @@ static int xfrm_output_one(struct sk_buff *skb, int err)
64 if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { 64 if (x->type->flags & XFRM_TYPE_REPLAY_PROT) {
65 XFRM_SKB_CB(skb)->seq = ++x->replay.oseq; 65 XFRM_SKB_CB(skb)->seq = ++x->replay.oseq;
66 if (unlikely(x->replay.oseq == 0)) { 66 if (unlikely(x->replay.oseq == 0)) {
67 XFRM_INC_STATS(LINUX_MIB_XFRMOUTSTATESEQERROR);
67 x->replay.oseq--; 68 x->replay.oseq--;
68 xfrm_audit_state_replay_overflow(x, skb); 69 xfrm_audit_state_replay_overflow(x, skb);
69 err = -EOVERFLOW; 70 err = -EOVERFLOW;
diff --git a/net/xfrm/xfrm_proc.c b/net/xfrm/xfrm_proc.c
index 31d035415ecd..2b0db13f0cda 100644
--- a/net/xfrm/xfrm_proc.c
+++ b/net/xfrm/xfrm_proc.c
@@ -22,7 +22,7 @@ static struct snmp_mib xfrm_mib_list[] = {
22 SNMP_MIB_ITEM("XfrmInNoStates", LINUX_MIB_XFRMINNOSTATES), 22 SNMP_MIB_ITEM("XfrmInNoStates", LINUX_MIB_XFRMINNOSTATES),
23 SNMP_MIB_ITEM("XfrmInStateProtoError", LINUX_MIB_XFRMINSTATEPROTOERROR), 23 SNMP_MIB_ITEM("XfrmInStateProtoError", LINUX_MIB_XFRMINSTATEPROTOERROR),
24 SNMP_MIB_ITEM("XfrmInStateModeError", LINUX_MIB_XFRMINSTATEMODEERROR), 24 SNMP_MIB_ITEM("XfrmInStateModeError", LINUX_MIB_XFRMINSTATEMODEERROR),
25 SNMP_MIB_ITEM("XfrmInSeqOutOfWindow", LINUX_MIB_XFRMINSEQOUTOFWINDOW), 25 SNMP_MIB_ITEM("XfrmInStateSeqError", LINUX_MIB_XFRMINSTATESEQERROR),
26 SNMP_MIB_ITEM("XfrmInStateExpired", LINUX_MIB_XFRMINSTATEEXPIRED), 26 SNMP_MIB_ITEM("XfrmInStateExpired", LINUX_MIB_XFRMINSTATEEXPIRED),
27 SNMP_MIB_ITEM("XfrmInStateMismatch", LINUX_MIB_XFRMINSTATEMISMATCH), 27 SNMP_MIB_ITEM("XfrmInStateMismatch", LINUX_MIB_XFRMINSTATEMISMATCH),
28 SNMP_MIB_ITEM("XfrmInStateInvalid", LINUX_MIB_XFRMINSTATEINVALID), 28 SNMP_MIB_ITEM("XfrmInStateInvalid", LINUX_MIB_XFRMINSTATEINVALID),
@@ -36,6 +36,7 @@ static struct snmp_mib xfrm_mib_list[] = {
36 SNMP_MIB_ITEM("XfrmOutNoStates", LINUX_MIB_XFRMOUTNOSTATES), 36 SNMP_MIB_ITEM("XfrmOutNoStates", LINUX_MIB_XFRMOUTNOSTATES),
37 SNMP_MIB_ITEM("XfrmOutStateProtoError", LINUX_MIB_XFRMOUTSTATEPROTOERROR), 37 SNMP_MIB_ITEM("XfrmOutStateProtoError", LINUX_MIB_XFRMOUTSTATEPROTOERROR),
38 SNMP_MIB_ITEM("XfrmOutStateModeError", LINUX_MIB_XFRMOUTSTATEMODEERROR), 38 SNMP_MIB_ITEM("XfrmOutStateModeError", LINUX_MIB_XFRMOUTSTATEMODEERROR),
39 SNMP_MIB_ITEM("XfrmOutStateSeqError", LINUX_MIB_XFRMOUTSTATESEQERROR),
39 SNMP_MIB_ITEM("XfrmOutStateExpired", LINUX_MIB_XFRMOUTSTATEEXPIRED), 40 SNMP_MIB_ITEM("XfrmOutStateExpired", LINUX_MIB_XFRMOUTSTATEEXPIRED),
40 SNMP_MIB_ITEM("XfrmOutPolBlock", LINUX_MIB_XFRMOUTPOLBLOCK), 41 SNMP_MIB_ITEM("XfrmOutPolBlock", LINUX_MIB_XFRMOUTPOLBLOCK),
41 SNMP_MIB_ITEM("XfrmOutPolDead", LINUX_MIB_XFRMOUTPOLDEAD), 42 SNMP_MIB_ITEM("XfrmOutPolDead", LINUX_MIB_XFRMOUTPOLDEAD),
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 3003503d0c94..3ff76e84d548 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -216,10 +216,10 @@ static void xfrm_state_unlock_afinfo(struct xfrm_state_afinfo *afinfo)
216 write_unlock_bh(&xfrm_state_afinfo_lock); 216 write_unlock_bh(&xfrm_state_afinfo_lock);
217} 217}
218 218
219int xfrm_register_type(struct xfrm_type *type, unsigned short family) 219int xfrm_register_type(const struct xfrm_type *type, unsigned short family)
220{ 220{
221 struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family); 221 struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family);
222 struct xfrm_type **typemap; 222 const struct xfrm_type **typemap;
223 int err = 0; 223 int err = 0;
224 224
225 if (unlikely(afinfo == NULL)) 225 if (unlikely(afinfo == NULL))
@@ -235,10 +235,10 @@ int xfrm_register_type(struct xfrm_type *type, unsigned short family)
235} 235}
236EXPORT_SYMBOL(xfrm_register_type); 236EXPORT_SYMBOL(xfrm_register_type);
237 237
238int xfrm_unregister_type(struct xfrm_type *type, unsigned short family) 238int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family)
239{ 239{
240 struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family); 240 struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family);
241 struct xfrm_type **typemap; 241 const struct xfrm_type **typemap;
242 int err = 0; 242 int err = 0;
243 243
244 if (unlikely(afinfo == NULL)) 244 if (unlikely(afinfo == NULL))
@@ -254,11 +254,11 @@ int xfrm_unregister_type(struct xfrm_type *type, unsigned short family)
254} 254}
255EXPORT_SYMBOL(xfrm_unregister_type); 255EXPORT_SYMBOL(xfrm_unregister_type);
256 256
257static struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family) 257static const struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family)
258{ 258{
259 struct xfrm_state_afinfo *afinfo; 259 struct xfrm_state_afinfo *afinfo;
260 struct xfrm_type **typemap; 260 const struct xfrm_type **typemap;
261 struct xfrm_type *type; 261 const struct xfrm_type *type;
262 int modload_attempted = 0; 262 int modload_attempted = 0;
263 263
264retry: 264retry:
@@ -281,7 +281,7 @@ retry:
281 return type; 281 return type;
282} 282}
283 283
284static void xfrm_put_type(struct xfrm_type *type) 284static void xfrm_put_type(const struct xfrm_type *type)
285{ 285{
286 module_put(type->owner); 286 module_put(type->owner);
287} 287}
@@ -1645,7 +1645,6 @@ err:
1645 xfrm_audit_state_replay(x, skb, net_seq); 1645 xfrm_audit_state_replay(x, skb, net_seq);
1646 return -EINVAL; 1646 return -EINVAL;
1647} 1647}
1648EXPORT_SYMBOL(xfrm_replay_check);
1649 1648
1650void xfrm_replay_advance(struct xfrm_state *x, __be32 net_seq) 1649void xfrm_replay_advance(struct xfrm_state *x, __be32 net_seq)
1651{ 1650{
@@ -1667,7 +1666,6 @@ void xfrm_replay_advance(struct xfrm_state *x, __be32 net_seq)
1667 if (xfrm_aevent_is_on()) 1666 if (xfrm_aevent_is_on())
1668 xfrm_replay_notify(x, XFRM_REPLAY_UPDATE); 1667 xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
1669} 1668}
1670EXPORT_SYMBOL(xfrm_replay_advance);
1671 1669
1672static LIST_HEAD(xfrm_km_list); 1670static LIST_HEAD(xfrm_km_list);
1673static DEFINE_RWLOCK(xfrm_km_lock); 1671static DEFINE_RWLOCK(xfrm_km_lock);
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index e0ccdf267813..78338079b7f5 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -31,6 +31,11 @@
31#include <linux/in6.h> 31#include <linux/in6.h>
32#endif 32#endif
33 33
34static inline int aead_len(struct xfrm_algo_aead *alg)
35{
36 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
37}
38
34static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type) 39static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type)
35{ 40{
36 struct nlattr *rt = attrs[type]; 41 struct nlattr *rt = attrs[type];
@@ -68,6 +73,22 @@ static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type)
68 return 0; 73 return 0;
69} 74}
70 75
76static int verify_aead(struct nlattr **attrs)
77{
78 struct nlattr *rt = attrs[XFRMA_ALG_AEAD];
79 struct xfrm_algo_aead *algp;
80
81 if (!rt)
82 return 0;
83
84 algp = nla_data(rt);
85 if (nla_len(rt) < aead_len(algp))
86 return -EINVAL;
87
88 algp->alg_name[CRYPTO_MAX_ALG_NAME - 1] = '\0';
89 return 0;
90}
91
71static void verify_one_addr(struct nlattr **attrs, enum xfrm_attr_type_t type, 92static void verify_one_addr(struct nlattr **attrs, enum xfrm_attr_type_t type,
72 xfrm_address_t **addrp) 93 xfrm_address_t **addrp)
73{ 94{
@@ -119,20 +140,28 @@ static int verify_newsa_info(struct xfrm_usersa_info *p,
119 switch (p->id.proto) { 140 switch (p->id.proto) {
120 case IPPROTO_AH: 141 case IPPROTO_AH:
121 if (!attrs[XFRMA_ALG_AUTH] || 142 if (!attrs[XFRMA_ALG_AUTH] ||
143 attrs[XFRMA_ALG_AEAD] ||
122 attrs[XFRMA_ALG_CRYPT] || 144 attrs[XFRMA_ALG_CRYPT] ||
123 attrs[XFRMA_ALG_COMP]) 145 attrs[XFRMA_ALG_COMP])
124 goto out; 146 goto out;
125 break; 147 break;
126 148
127 case IPPROTO_ESP: 149 case IPPROTO_ESP:
128 if ((!attrs[XFRMA_ALG_AUTH] && 150 if (attrs[XFRMA_ALG_COMP])
129 !attrs[XFRMA_ALG_CRYPT]) || 151 goto out;
130 attrs[XFRMA_ALG_COMP]) 152 if (!attrs[XFRMA_ALG_AUTH] &&
153 !attrs[XFRMA_ALG_CRYPT] &&
154 !attrs[XFRMA_ALG_AEAD])
155 goto out;
156 if ((attrs[XFRMA_ALG_AUTH] ||
157 attrs[XFRMA_ALG_CRYPT]) &&
158 attrs[XFRMA_ALG_AEAD])
131 goto out; 159 goto out;
132 break; 160 break;
133 161
134 case IPPROTO_COMP: 162 case IPPROTO_COMP:
135 if (!attrs[XFRMA_ALG_COMP] || 163 if (!attrs[XFRMA_ALG_COMP] ||
164 attrs[XFRMA_ALG_AEAD] ||
136 attrs[XFRMA_ALG_AUTH] || 165 attrs[XFRMA_ALG_AUTH] ||
137 attrs[XFRMA_ALG_CRYPT]) 166 attrs[XFRMA_ALG_CRYPT])
138 goto out; 167 goto out;
@@ -143,6 +172,7 @@ static int verify_newsa_info(struct xfrm_usersa_info *p,
143 case IPPROTO_ROUTING: 172 case IPPROTO_ROUTING:
144 if (attrs[XFRMA_ALG_COMP] || 173 if (attrs[XFRMA_ALG_COMP] ||
145 attrs[XFRMA_ALG_AUTH] || 174 attrs[XFRMA_ALG_AUTH] ||
175 attrs[XFRMA_ALG_AEAD] ||
146 attrs[XFRMA_ALG_CRYPT] || 176 attrs[XFRMA_ALG_CRYPT] ||
147 attrs[XFRMA_ENCAP] || 177 attrs[XFRMA_ENCAP] ||
148 attrs[XFRMA_SEC_CTX] || 178 attrs[XFRMA_SEC_CTX] ||
@@ -155,6 +185,8 @@ static int verify_newsa_info(struct xfrm_usersa_info *p,
155 goto out; 185 goto out;
156 } 186 }
157 187
188 if ((err = verify_aead(attrs)))
189 goto out;
158 if ((err = verify_one_alg(attrs, XFRMA_ALG_AUTH))) 190 if ((err = verify_one_alg(attrs, XFRMA_ALG_AUTH)))
159 goto out; 191 goto out;
160 if ((err = verify_one_alg(attrs, XFRMA_ALG_CRYPT))) 192 if ((err = verify_one_alg(attrs, XFRMA_ALG_CRYPT)))
@@ -208,6 +240,31 @@ static int attach_one_algo(struct xfrm_algo **algpp, u8 *props,
208 return 0; 240 return 0;
209} 241}
210 242
243static int attach_aead(struct xfrm_algo_aead **algpp, u8 *props,
244 struct nlattr *rta)
245{
246 struct xfrm_algo_aead *p, *ualg;
247 struct xfrm_algo_desc *algo;
248
249 if (!rta)
250 return 0;
251
252 ualg = nla_data(rta);
253
254 algo = xfrm_aead_get_byname(ualg->alg_name, ualg->alg_icv_len, 1);
255 if (!algo)
256 return -ENOSYS;
257 *props = algo->desc.sadb_alg_id;
258
259 p = kmemdup(ualg, aead_len(ualg), GFP_KERNEL);
260 if (!p)
261 return -ENOMEM;
262
263 strcpy(p->alg_name, algo->name);
264 *algpp = p;
265 return 0;
266}
267
211static inline int xfrm_user_sec_ctx_size(struct xfrm_sec_ctx *xfrm_ctx) 268static inline int xfrm_user_sec_ctx_size(struct xfrm_sec_ctx *xfrm_ctx)
212{ 269{
213 int len = 0; 270 int len = 0;
@@ -286,6 +343,9 @@ static struct xfrm_state *xfrm_state_construct(struct xfrm_usersa_info *p,
286 343
287 copy_from_user_state(x, p); 344 copy_from_user_state(x, p);
288 345
346 if ((err = attach_aead(&x->aead, &x->props.ealgo,
347 attrs[XFRMA_ALG_AEAD])))
348 goto error;
289 if ((err = attach_one_algo(&x->aalg, &x->props.aalgo, 349 if ((err = attach_one_algo(&x->aalg, &x->props.aalgo,
290 xfrm_aalg_get_byname, 350 xfrm_aalg_get_byname,
291 attrs[XFRMA_ALG_AUTH]))) 351 attrs[XFRMA_ALG_AUTH])))
@@ -510,6 +570,8 @@ static int copy_to_user_state_extra(struct xfrm_state *x,
510 if (x->lastused) 570 if (x->lastused)
511 NLA_PUT_U64(skb, XFRMA_LASTUSED, x->lastused); 571 NLA_PUT_U64(skb, XFRMA_LASTUSED, x->lastused);
512 572
573 if (x->aead)
574 NLA_PUT(skb, XFRMA_ALG_AEAD, aead_len(x->aead), x->aead);
513 if (x->aalg) 575 if (x->aalg)
514 NLA_PUT(skb, XFRMA_ALG_AUTH, xfrm_alg_len(x->aalg), x->aalg); 576 NLA_PUT(skb, XFRMA_ALG_AUTH, xfrm_alg_len(x->aalg), x->aalg);
515 if (x->ealg) 577 if (x->ealg)
@@ -1808,6 +1870,7 @@ static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = {
1808#undef XMSGSIZE 1870#undef XMSGSIZE
1809 1871
1810static const struct nla_policy xfrma_policy[XFRMA_MAX+1] = { 1872static const struct nla_policy xfrma_policy[XFRMA_MAX+1] = {
1873 [XFRMA_ALG_AEAD] = { .len = sizeof(struct xfrm_algo_aead) },
1811 [XFRMA_ALG_AUTH] = { .len = sizeof(struct xfrm_algo) }, 1874 [XFRMA_ALG_AUTH] = { .len = sizeof(struct xfrm_algo) },
1812 [XFRMA_ALG_CRYPT] = { .len = sizeof(struct xfrm_algo) }, 1875 [XFRMA_ALG_CRYPT] = { .len = sizeof(struct xfrm_algo) },
1813 [XFRMA_ALG_COMP] = { .len = sizeof(struct xfrm_algo) }, 1876 [XFRMA_ALG_COMP] = { .len = sizeof(struct xfrm_algo) },
@@ -1972,6 +2035,8 @@ static int xfrm_notify_sa_flush(struct km_event *c)
1972static inline size_t xfrm_sa_len(struct xfrm_state *x) 2035static inline size_t xfrm_sa_len(struct xfrm_state *x)
1973{ 2036{
1974 size_t l = 0; 2037 size_t l = 0;
2038 if (x->aead)
2039 l += nla_total_size(aead_len(x->aead));
1975 if (x->aalg) 2040 if (x->aalg)
1976 l += nla_total_size(xfrm_alg_len(x->aalg)); 2041 l += nla_total_size(xfrm_alg_len(x->aalg));
1977 if (x->ealg) 2042 if (x->ealg)
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index f96dec1f9258..880d455aa659 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2692,7 +2692,6 @@ int security_netlbl_sid_to_secattr(u32 sid, struct netlbl_lsm_secattr *secattr)
2692 2692
2693netlbl_sid_to_secattr_failure: 2693netlbl_sid_to_secattr_failure:
2694 POLICY_RDUNLOCK; 2694 POLICY_RDUNLOCK;
2695 netlbl_secattr_destroy(secattr);
2696 return rc; 2695 return rc;
2697} 2696}
2698#endif /* CONFIG_NETLABEL */ 2697#endif /* CONFIG_NETLABEL */