aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild7
-rw-r--r--include/linux/atalk.h4
-rw-r--r--include/linux/dccp.h46
-rw-r--r--include/linux/fib_rules.h15
-rw-r--r--include/linux/hdlc.h4
-rw-r--r--include/linux/icmp.h9
-rw-r--r--include/linux/icmpv6.h9
-rw-r--r--include/linux/if_addr.h1
-rw-r--r--include/linux/if_arp.h9
-rw-r--r--include/linux/if_bridge.h3
-rw-r--r--include/linux/if_ether.h3
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_packet.h1
-rw-r--r--include/linux/if_pppox.h10
-rw-r--r--include/linux/if_tr.h2
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/if_wanpipe_common.h58
-rw-r--r--include/linux/igmp.h21
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/in6.h3
-rw-r--r--include/linux/ip.h14
-rw-r--r--include/linux/ipv6.h14
-rw-r--r--include/linux/jhash.h2
-rw-r--r--include/linux/key.h2
-rw-r--r--include/linux/ktime.h6
-rw-r--r--include/linux/net.h2
-rw-r--r--include/linux/netdevice.h9
-rw-r--r--include/linux/netfilter.h12
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h5
-rw-r--r--include/linux/netfilter/nfnetlink.h19
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h4
-rw-r--r--include/linux/netfilter_bridge.h11
-rw-r--r--include/linux/netfilter_bridge/ebt_802_3.h2
-rw-r--r--include/linux/netfilter_bridge/ebt_arp.h4
-rw-r--r--include/linux/netfilter_ipv4/Kbuild14
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack.h402
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_amanda.h11
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_core.h61
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_ftp.h44
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_h323.h89
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper.h46
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_icmp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_irc.h32
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_pptp.h326
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h114
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_protocol.h98
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sctp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_sip.h40
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tcp.h6
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tftp.h20
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_tuple.h146
-rw-r--r--include/linux/netfilter_ipv4/ip_nat.h79
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_core.h18
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_helper.h33
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_pptp.h11
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_protocol.h74
-rw-r--r--include/linux/netfilter_ipv4/ip_nat_rule.h28
-rw-r--r--include/linux/netfilter_ipv4/ipt_SAME.h2
-rw-r--r--include/linux/netlink.h33
-rw-r--r--include/linux/nl80211.h38
-rw-r--r--include/linux/rtnetlink.h13
-rw-r--r--include/linux/rxrpc.h62
-rw-r--r--include/linux/sctp.h9
-rw-r--r--include/linux/sdla_fr.h638
-rw-r--r--include/linux/skbuff.h392
-rw-r--r--include/linux/socket.h5
-rw-r--r--include/linux/sysctl.h4
-rw-r--r--include/linux/tcp.h21
-rw-r--r--include/linux/udp.h9
-rw-r--r--include/linux/workqueue.h7
-rw-r--r--include/linux/xfrm.h25
71 files changed, 698 insertions, 2583 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index e81e301a4d71..4ff0f57d0add 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -69,9 +69,7 @@ header-y += hdsmart.h
69header-y += hysdn_if.h 69header-y += hysdn_if.h
70header-y += i2c-dev.h 70header-y += i2c-dev.h
71header-y += i8k.h 71header-y += i8k.h
72header-y += icmp.h
73header-y += if_arcnet.h 72header-y += if_arcnet.h
74header-y += if_arp.h
75header-y += if_bonding.h 73header-y += if_bonding.h
76header-y += if_cablemodem.h 74header-y += if_cablemodem.h
77header-y += if_fc.h 75header-y += if_fc.h
@@ -88,7 +86,6 @@ header-y += if_tunnel.h
88header-y += in6.h 86header-y += in6.h
89header-y += in_route.h 87header-y += in_route.h
90header-y += ioctl.h 88header-y += ioctl.h
91header-y += ip.h
92header-y += ipmi_msgdefs.h 89header-y += ipmi_msgdefs.h
93header-y += ip_mp_alg.h 90header-y += ip_mp_alg.h
94header-y += ipsec.h 91header-y += ipsec.h
@@ -116,6 +113,7 @@ header-y += netrom.h
116header-y += nfs2.h 113header-y += nfs2.h
117header-y += nfs4_mount.h 114header-y += nfs4_mount.h
118header-y += nfs_mount.h 115header-y += nfs_mount.h
116header-y += nl80211.h
119header-y += oom.h 117header-y += oom.h
120header-y += param.h 118header-y += param.h
121header-y += pci_regs.h 119header-y += pci_regs.h
@@ -210,8 +208,10 @@ unifdef-y += hiddev.h
210unifdef-y += hpet.h 208unifdef-y += hpet.h
211unifdef-y += i2c.h 209unifdef-y += i2c.h
212unifdef-y += i2o-dev.h 210unifdef-y += i2o-dev.h
211unifdef-y += icmp.h
213unifdef-y += icmpv6.h 212unifdef-y += icmpv6.h
214unifdef-y += if_addr.h 213unifdef-y += if_addr.h
214unifdef-y += if_arp.h
215unifdef-y += if_bridge.h 215unifdef-y += if_bridge.h
216unifdef-y += if_ec.h 216unifdef-y += if_ec.h
217unifdef-y += if_eql.h 217unifdef-y += if_eql.h
@@ -231,6 +231,7 @@ unifdef-y += inet_diag.h
231unifdef-y += in.h 231unifdef-y += in.h
232unifdef-y += inotify.h 232unifdef-y += inotify.h
233unifdef-y += input.h 233unifdef-y += input.h
234unifdef-y += ip.h
234unifdef-y += ipc.h 235unifdef-y += ipc.h
235unifdef-y += ipmi.h 236unifdef-y += ipmi.h
236unifdef-y += ipv6.h 237unifdef-y += ipv6.h
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index d12984ddaa9f..ced8a1ed080c 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -101,7 +101,7 @@ struct ddpehdr {
101 101
102static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb) 102static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
103{ 103{
104 return (struct ddpehdr *)skb->h.raw; 104 return (struct ddpehdr *)skb_transport_header(skb);
105} 105}
106 106
107/* AppleTalk AARP headers */ 107/* AppleTalk AARP headers */
@@ -129,7 +129,7 @@ struct elapaarp {
129 129
130static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb) 130static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
131{ 131{
132 return (struct elapaarp *)skb->h.raw; 132 return (struct elapaarp *)skb_transport_header(skb);
133} 133}
134 134
135/* Not specified - how long till we drop a resolved entry */ 135/* Not specified - how long till we drop a resolved entry */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 1cb054bd93f2..fda2148d8c85 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -260,19 +260,20 @@ enum {
260 260
261static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) 261static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
262{ 262{
263 return (struct dccp_hdr *)skb->h.raw; 263 return (struct dccp_hdr *)skb_transport_header(skb);
264} 264}
265 265
266static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen) 266static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
267{ 267{
268 skb->h.raw = skb_push(skb, headlen); 268 skb_push(skb, headlen);
269 memset(skb->h.raw, 0, headlen); 269 skb_reset_transport_header(skb);
270 return dccp_hdr(skb); 270 return memset(skb_transport_header(skb), 0, headlen);
271} 271}
272 272
273static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb) 273static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb)
274{ 274{
275 return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr)); 275 return (struct dccp_hdr_ext *)(skb_transport_header(skb) +
276 sizeof(struct dccp_hdr));
276} 277}
277 278
278static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh) 279static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh)
@@ -301,12 +302,14 @@ static inline __u64 dccp_hdr_seq(const struct sk_buff *skb)
301 302
302static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb) 303static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb)
303{ 304{
304 return (struct dccp_hdr_request *)(skb->h.raw + dccp_basic_hdr_len(skb)); 305 return (struct dccp_hdr_request *)(skb_transport_header(skb) +
306 dccp_basic_hdr_len(skb));
305} 307}
306 308
307static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb) 309static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb)
308{ 310{
309 return (struct dccp_hdr_ack_bits *)(skb->h.raw + dccp_basic_hdr_len(skb)); 311 return (struct dccp_hdr_ack_bits *)(skb_transport_header(skb) +
312 dccp_basic_hdr_len(skb));
310} 313}
311 314
312static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb) 315static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
@@ -317,12 +320,14 @@ static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
317 320
318static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb) 321static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb)
319{ 322{
320 return (struct dccp_hdr_response *)(skb->h.raw + dccp_basic_hdr_len(skb)); 323 return (struct dccp_hdr_response *)(skb_transport_header(skb) +
324 dccp_basic_hdr_len(skb));
321} 325}
322 326
323static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb) 327static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb)
324{ 328{
325 return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb)); 329 return (struct dccp_hdr_reset *)(skb_transport_header(skb) +
330 dccp_basic_hdr_len(skb));
326} 331}
327 332
328static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh) 333static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh)
@@ -460,26 +465,27 @@ struct dccp_ackvec;
460 * @dccps_service_list - second .. last service code on passive socket 465 * @dccps_service_list - second .. last service code on passive socket
461 * @dccps_timestamp_time - time of latest TIMESTAMP option 466 * @dccps_timestamp_time - time of latest TIMESTAMP option
462 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 467 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
463 * @dccps_l_ack_ratio - 468 * @dccps_l_ack_ratio - feature-local Ack Ratio
464 * @dccps_r_ack_ratio - 469 * @dccps_r_ack_ratio - feature-remote Ack Ratio
465 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 470 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
466 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) 471 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
467 * @dccps_ndp_count - number of Non Data Packets since last data packet 472 * @dccps_ndp_count - number of Non Data Packets since last data packet
468 * @dccps_mss_cache - 473 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
469 * @dccps_minisock - 474 * @dccps_minisock - associated minisock (accessed via dccp_msk)
470 * @dccps_hc_rx_ackvec - rx half connection ack vector 475 * @dccps_hc_rx_ackvec - rx half connection ack vector
471 * @dccps_hc_rx_ccid - 476 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
472 * @dccps_hc_tx_ccid - 477 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection)
473 * @dccps_options_received - 478 * @dccps_options_received - parsed set of retrieved options
474 * @dccps_epoch - 479 * @dccps_role - role of this sock, one of %dccp_role
475 * @dccps_role - Role of this sock, one of %dccp_role 480 * @dccps_hc_rx_insert_options - receiver wants to add options when acking
476 * @dccps_hc_rx_insert_options - 481 * @dccps_hc_tx_insert_options - sender wants to add options when sending
477 * @dccps_hc_tx_insert_options -
478 * @dccps_xmit_timer - timer for when CCID is not ready to send 482 * @dccps_xmit_timer - timer for when CCID is not ready to send
483 * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs)
479 */ 484 */
480struct dccp_sock { 485struct dccp_sock {
481 /* inet_connection_sock has to be the first member of dccp_sock */ 486 /* inet_connection_sock has to be the first member of dccp_sock */
482 struct inet_connection_sock dccps_inet_connection; 487 struct inet_connection_sock dccps_inet_connection;
488#define dccps_syn_rtt dccps_inet_connection.icsk_ack.lrcvtime
483 __u64 dccps_swl; 489 __u64 dccps_swl;
484 __u64 dccps_swh; 490 __u64 dccps_swh;
485 __u64 dccps_awl; 491 __u64 dccps_awl;
diff --git a/include/linux/fib_rules.h b/include/linux/fib_rules.h
index 8270aac2aa5d..87b606b63f1e 100644
--- a/include/linux/fib_rules.h
+++ b/include/linux/fib_rules.h
@@ -5,8 +5,13 @@
5#include <linux/rtnetlink.h> 5#include <linux/rtnetlink.h>
6 6
7/* rule is permanent, and cannot be deleted */ 7/* rule is permanent, and cannot be deleted */
8#define FIB_RULE_PERMANENT 1 8#define FIB_RULE_PERMANENT 0x00000001
9#define FIB_RULE_INVERT 2 9#define FIB_RULE_INVERT 0x00000002
10#define FIB_RULE_UNRESOLVED 0x00000004
11#define FIB_RULE_DEV_DETACHED 0x00000008
12
13/* try to find source address in routing lookups */
14#define FIB_RULE_FIND_SADDR 0x00010000
10 15
11struct fib_rule_hdr 16struct fib_rule_hdr
12{ 17{
@@ -29,7 +34,7 @@ enum
29 FRA_DST, /* destination address */ 34 FRA_DST, /* destination address */
30 FRA_SRC, /* source address */ 35 FRA_SRC, /* source address */
31 FRA_IFNAME, /* interface name */ 36 FRA_IFNAME, /* interface name */
32 FRA_UNUSED1, 37 FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
33 FRA_UNUSED2, 38 FRA_UNUSED2,
34 FRA_PRIORITY, /* priority/preference */ 39 FRA_PRIORITY, /* priority/preference */
35 FRA_UNUSED3, 40 FRA_UNUSED3,
@@ -51,8 +56,8 @@ enum
51{ 56{
52 FR_ACT_UNSPEC, 57 FR_ACT_UNSPEC,
53 FR_ACT_TO_TBL, /* Pass to fixed table */ 58 FR_ACT_TO_TBL, /* Pass to fixed table */
54 FR_ACT_RES1, 59 FR_ACT_GOTO, /* Jump to another rule */
55 FR_ACT_RES2, 60 FR_ACT_NOP, /* No operation */
56 FR_ACT_RES3, 61 FR_ACT_RES3,
57 FR_ACT_RES4, 62 FR_ACT_RES4,
58 FR_ACT_BLACKHOLE, /* Drop without notification */ 63 FR_ACT_BLACKHOLE, /* Drop without notification */
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index d4b333938f73..0fe562af9c8c 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -132,8 +132,8 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
132{ 132{
133 hdlc_device *hdlc = dev_to_hdlc(dev); 133 hdlc_device *hdlc = dev_to_hdlc(dev);
134 134
135 skb->mac.raw = skb->data; 135 skb->dev = dev;
136 skb->dev = dev; 136 skb_reset_mac_header(skb);
137 137
138 if (hdlc->proto->type_trans) 138 if (hdlc->proto->type_trans)
139 return hdlc->proto->type_trans(skb, dev); 139 return hdlc->proto->type_trans(skb, dev);
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index 24da4fbc1a2f..474f2a51cf0a 100644
--- a/include/linux/icmp.h
+++ b/include/linux/icmp.h
@@ -82,6 +82,15 @@ struct icmphdr {
82 } un; 82 } un;
83}; 83};
84 84
85#ifdef __KERNEL__
86#include <linux/skbuff.h>
87
88static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb)
89{
90 return (struct icmphdr *)skb_transport_header(skb);
91}
92#endif
93
85/* 94/*
86 * constants for (set|get)sockopt 95 * constants for (set|get)sockopt
87 */ 96 */
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 68d3526c3a05..7c5e9817e998 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -75,6 +75,15 @@ struct icmp6hdr {
75#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref 75#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
76}; 76};
77 77
78#ifdef __KERNEL__
79#include <linux/skbuff.h>
80
81static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
82{
83 return (struct icmp6hdr *)skb_transport_header(skb);
84}
85#endif
86
78#define ICMPV6_ROUTER_PREF_LOW 0x3 87#define ICMPV6_ROUTER_PREF_LOW 0x3
79#define ICMPV6_ROUTER_PREF_MEDIUM 0x0 88#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
80#define ICMPV6_ROUTER_PREF_HIGH 0x1 89#define ICMPV6_ROUTER_PREF_HIGH 0x1
diff --git a/include/linux/if_addr.h b/include/linux/if_addr.h
index d557e4ce9b6b..43f3bedaafd3 100644
--- a/include/linux/if_addr.h
+++ b/include/linux/if_addr.h
@@ -39,6 +39,7 @@ enum
39#define IFA_F_TEMPORARY IFA_F_SECONDARY 39#define IFA_F_TEMPORARY IFA_F_SECONDARY
40 40
41#define IFA_F_NODAD 0x02 41#define IFA_F_NODAD 0x02
42#define IFA_F_OPTIMISTIC 0x04
42#define IFA_F_HOMEADDRESS 0x10 43#define IFA_F_HOMEADDRESS 0x10
43#define IFA_F_DEPRECATED 0x20 44#define IFA_F_DEPRECATED 0x20
44#define IFA_F_TENTATIVE 0x40 45#define IFA_F_TENTATIVE 0x40
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 7f5714214ee3..ed7b93c3083a 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -148,4 +148,13 @@ struct arphdr
148 148
149}; 149};
150 150
151#ifdef __KERNEL__
152#include <linux/skbuff.h>
153
154static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
155{
156 return (struct arphdr *)skb_network_header(skb);
157}
158#endif
159
151#endif /* _LINUX_IF_ARP_H */ 160#endif /* _LINUX_IF_ARP_H */
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index fd1b6eb94a5f..4ff211d98769 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -105,7 +105,8 @@ struct __fdb_entry
105#include <linux/netdevice.h> 105#include <linux/netdevice.h>
106 106
107extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *)); 107extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *));
108extern int (*br_handle_frame_hook)(struct net_bridge_port *p, struct sk_buff **pskb); 108extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
109 struct sk_buff *skb);
109extern int (*br_should_route_hook)(struct sk_buff **pskb); 110extern int (*br_should_route_hook)(struct sk_buff **pskb);
110 111
111#endif 112#endif
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index ab08f35cbc35..1db774cf9dc2 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -61,6 +61,7 @@
61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ 61#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
62#define ETH_P_IPX 0x8137 /* IPX over DIX */ 62#define ETH_P_IPX 0x8137 /* IPX over DIX */
63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ 63#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
64#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */
64#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ 65#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
65#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol 66#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
66 * defined in draft-wilson-wrec-wccp-v2-00.txt */ 67 * defined in draft-wilson-wrec-wccp-v2-00.txt */
@@ -112,7 +113,7 @@ struct ethhdr {
112 113
113static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) 114static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
114{ 115{
115 return (struct ethhdr *)skb->mac.raw; 116 return (struct ethhdr *)skb_mac_header(skb);
116} 117}
117 118
118#ifdef CONFIG_SYSCTL 119#ifdef CONFIG_SYSCTL
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 35ed3b5467f3..604c2434f71c 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -126,6 +126,7 @@ enum
126 IFLA_INET6_STATS, /* statistics */ 126 IFLA_INET6_STATS, /* statistics */
127 IFLA_INET6_MCAST, /* MC things. What of them? */ 127 IFLA_INET6_MCAST, /* MC things. What of them? */
128 IFLA_INET6_CACHEINFO, /* time values and max reasm size */ 128 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
129 IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
129 __IFLA_INET6_MAX 130 __IFLA_INET6_MAX
130}; 131};
131 132
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index f3de05c30678..ad09609227ff 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -42,6 +42,7 @@ struct sockaddr_ll
42#define PACKET_STATISTICS 6 42#define PACKET_STATISTICS 6
43#define PACKET_COPY_THRESH 7 43#define PACKET_COPY_THRESH 7
44#define PACKET_AUXDATA 8 44#define PACKET_AUXDATA 8
45#define PACKET_ORIGDEV 9
45 46
46struct tpacket_stats 47struct tpacket_stats
47{ 48{
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index e33ee763c052..6f987be60fe2 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -111,7 +111,17 @@ struct pppoe_hdr {
111 struct pppoe_tag tag[0]; 111 struct pppoe_tag tag[0];
112} __attribute__ ((packed)); 112} __attribute__ ((packed));
113 113
114/* Length of entire PPPoE + PPP header */
115#define PPPOE_SES_HLEN 8
116
114#ifdef __KERNEL__ 117#ifdef __KERNEL__
118#include <linux/skbuff.h>
119
120static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
121{
122 return (struct pppoe_hdr *)skb_network_header(skb);
123}
124
115struct pppoe_opt { 125struct pppoe_opt {
116 struct net_device *dev; /* device associated with socket*/ 126 struct net_device *dev; /* device associated with socket*/
117 int ifindex; /* ifindex of device associated with socket */ 127 int ifindex; /* ifindex of device associated with socket */
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h
index 2f94cf2c7abb..046e9d95ba9a 100644
--- a/include/linux/if_tr.h
+++ b/include/linux/if_tr.h
@@ -47,7 +47,7 @@ struct trh_hdr {
47 47
48static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) 48static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
49{ 49{
50 return (struct trh_hdr *)skb->mac.raw; 50 return (struct trh_hdr *)skb_mac_header(skb);
51} 51}
52#ifdef CONFIG_SYSCTL 52#ifdef CONFIG_SYSCTL
53extern struct ctl_table tr_table[]; 53extern struct ctl_table tr_table[];
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index d103580c72d2..81e9bc93569b 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -51,7 +51,7 @@ struct vlan_ethhdr {
51 51
52static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) 52static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
53{ 53{
54 return (struct vlan_ethhdr *)skb->mac.raw; 54 return (struct vlan_ethhdr *)skb_mac_header(skb);
55} 55}
56 56
57struct vlan_hdr { 57struct vlan_hdr {
@@ -275,8 +275,8 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
275 veth->h_vlan_TCI = htons(tag); 275 veth->h_vlan_TCI = htons(tag);
276 276
277 skb->protocol = __constant_htons(ETH_P_8021Q); 277 skb->protocol = __constant_htons(ETH_P_8021Q);
278 skb->mac.raw -= VLAN_HLEN; 278 skb->mac_header -= VLAN_HLEN;
279 skb->nh.raw -= VLAN_HLEN; 279 skb->network_header -= VLAN_HLEN;
280 280
281 return skb; 281 return skb;
282} 282}
diff --git a/include/linux/if_wanpipe_common.h b/include/linux/if_wanpipe_common.h
deleted file mode 100644
index 6e5461d69fdd..000000000000
--- a/include/linux/if_wanpipe_common.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/*****************************************************************************
2* if_wanipe_common.h Sangoma Driver/Socket common area definitions.
3*
4* Author: Nenad Corbic <ncorbic@sangoma.com>
5*
6* Copyright: (c) 2000 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13* Jan 13, 2000 Nenad Corbic Initial version
14*****************************************************************************/
15
16
17#ifndef _WANPIPE_SOCK_DRIVER_COMMON_H
18#define _WANPIPE_SOCK_DRIVER_COMMON_H
19
20typedef struct {
21 struct net_device *slave;
22 atomic_t packet_sent;
23 atomic_t receive_block;
24 atomic_t command;
25 atomic_t disconnect;
26 atomic_t driver_busy;
27 long common_critical;
28 struct timer_list *tx_timer;
29 struct sock *sk; /* Wanpipe Sock bind's here */
30 int (*func)(struct sk_buff *skb, struct net_device *dev,
31 struct sock *sk);
32
33 struct work_struct wanpipe_work; /* deferred keventd work */
34 unsigned char rw_bind; /* Sock bind state */
35 unsigned char usedby;
36 unsigned char state;
37 unsigned char svc;
38 unsigned short lcn;
39 void *mbox;
40} wanpipe_common_t;
41
42
43enum {
44 WANSOCK_UNCONFIGURED, /* link/channel is not configured */
45 WANSOCK_DISCONNECTED, /* link/channel is disconnected */
46 WANSOCK_CONNECTING, /* connection is in progress */
47 WANSOCK_CONNECTED, /* link/channel is operational */
48 WANSOCK_LIMIT, /* for verification only */
49 WANSOCK_DUALPORT, /* for Dual Port cards */
50 WANSOCK_DISCONNECTING,
51 WANSOCK_BINDED,
52 WANSOCK_BIND_LISTEN,
53 WANSOCK_LISTEN
54};
55
56#endif
57
58
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index a113fe68d8a1..f510e7e382a8 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -80,6 +80,27 @@ struct igmpv3_query {
80 __be32 srcs[0]; 80 __be32 srcs[0];
81}; 81};
82 82
83#ifdef __KERNEL__
84#include <linux/skbuff.h>
85
86static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
87{
88 return (struct igmphdr *)skb_transport_header(skb);
89}
90
91static inline struct igmpv3_report *
92 igmpv3_report_hdr(const struct sk_buff *skb)
93{
94 return (struct igmpv3_report *)skb_transport_header(skb);
95}
96
97static inline struct igmpv3_query *
98 igmpv3_query_hdr(const struct sk_buff *skb)
99{
100 return (struct igmpv3_query *)skb_transport_header(skb);
101}
102#endif
103
83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ 104#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
84#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ 105#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
85#define IGMP_DVMRP 0x13 /* DVMRP routing */ 106#define IGMP_DVMRP 0x13 /* DVMRP routing */
diff --git a/include/linux/in.h b/include/linux/in.h
index 1912e7c0bc26..3975cbf52f20 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -83,6 +83,7 @@ struct in_addr {
83#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ 83#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
84#define IP_PMTUDISC_WANT 1 /* Use per route hints */ 84#define IP_PMTUDISC_WANT 1 /* Use per route hints */
85#define IP_PMTUDISC_DO 2 /* Always DF */ 85#define IP_PMTUDISC_DO 2 /* Always DF */
86#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */
86 87
87#define IP_MULTICAST_IF 32 88#define IP_MULTICAST_IF 32
88#define IP_MULTICAST_TTL 33 89#define IP_MULTICAST_TTL 33
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 4e8350ae8869..2a61c82af115 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -44,10 +44,8 @@ struct in6_addr
44 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined 44 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
45 * in network byte order, not in host byte order as are the IPv4 equivalents 45 * in network byte order, not in host byte order as are the IPv4 equivalents
46 */ 46 */
47#if 0
48extern const struct in6_addr in6addr_any; 47extern const struct in6_addr in6addr_any;
49#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } 48#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
50#endif
51extern const struct in6_addr in6addr_loopback; 49extern const struct in6_addr in6addr_loopback;
52#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } 50#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
53 51
@@ -179,6 +177,7 @@ struct in6_flowlabel_req
179#define IPV6_PMTUDISC_DONT 0 177#define IPV6_PMTUDISC_DONT 0
180#define IPV6_PMTUDISC_WANT 1 178#define IPV6_PMTUDISC_WANT 1
181#define IPV6_PMTUDISC_DO 2 179#define IPV6_PMTUDISC_DO 2
180#define IPV6_PMTUDISC_PROBE 3
182 181
183/* Flowlabel */ 182/* Flowlabel */
184#define IPV6_FLOWLABEL_MGR 32 183#define IPV6_FLOWLABEL_MGR 32
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 1d36b971a8b5..bd0a2a8631c6 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -104,6 +104,20 @@ struct iphdr {
104 /*The options start here. */ 104 /*The options start here. */
105}; 105};
106 106
107#ifdef __KERNEL__
108#include <linux/skbuff.h>
109
110static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
111{
112 return (struct iphdr *)skb_network_header(skb);
113}
114
115static inline struct iphdr *ipip_hdr(const struct sk_buff *skb)
116{
117 return (struct iphdr *)skb_transport_header(skb);
118}
119#endif
120
107struct ip_auth_hdr { 121struct ip_auth_hdr {
108 __u8 nexthdr; 122 __u8 nexthdr;
109 __u8 hdrlen; /* This one is measured in 32 bit units! */ 123 __u8 hdrlen; /* This one is measured in 32 bit units! */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 713eb5eaa81f..09ea01a8a99c 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -178,6 +178,9 @@ struct ipv6_devconf {
178#endif 178#endif
179 __s32 proxy_ndp; 179 __s32 proxy_ndp;
180 __s32 accept_source_route; 180 __s32 accept_source_route;
181#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
182 __s32 optimistic_dad;
183#endif
181 void *sysctl; 184 void *sysctl;
182}; 185};
183 186
@@ -208,6 +211,7 @@ enum {
208 DEVCONF_PROXY_NDP, 211 DEVCONF_PROXY_NDP,
209 __DEVCONF_OPTIMISTIC_DAD, 212 __DEVCONF_OPTIMISTIC_DAD,
210 DEVCONF_ACCEPT_SOURCE_ROUTE, 213 DEVCONF_ACCEPT_SOURCE_ROUTE,
214 DEVCONF_OPTIMISTIC_DAD,
211 DEVCONF_MAX 215 DEVCONF_MAX
212}; 216};
213 217
@@ -219,6 +223,16 @@ enum {
219#include <net/if_inet6.h> /* struct ipv6_mc_socklist */ 223#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
220#include <net/inet_sock.h> 224#include <net/inet_sock.h>
221 225
226static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
227{
228 return (struct ipv6hdr *)skb_network_header(skb);
229}
230
231static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
232{
233 return (struct ipv6hdr *)skb_transport_header(skb);
234}
235
222/* 236/*
223 This structure contains results of exthdrs parsing 237 This structure contains results of exthdrs parsing
224 as offsets from skb->nh. 238 as offsets from skb->nh.
diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 82c7ae412eec..2a2f99fbcb16 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -84,7 +84,7 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
84/* A special optimized version that handles 1 or more of u32s. 84/* A special optimized version that handles 1 or more of u32s.
85 * The length parameter here is the number of u32s in the key. 85 * The length parameter here is the number of u32s in the key.
86 */ 86 */
87static inline u32 jhash2(u32 *k, u32 length, u32 initval) 87static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
88{ 88{
89 u32 a, b, c, len; 89 u32 a, b, c, len;
90 90
diff --git a/include/linux/key.h b/include/linux/key.h
index 169f05e4863e..a9220e75782e 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -160,6 +160,8 @@ struct key {
160 */ 160 */
161 union { 161 union {
162 struct list_head link; 162 struct list_head link;
163 unsigned long x[2];
164 void *p[2];
163 } type_data; 165 } type_data;
164 166
165 /* key data 167 /* key data
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 248305bb9a18..81bb9c7a4eb3 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -259,6 +259,12 @@ static inline s64 ktime_to_ns(const ktime_t kt)
259 259
260#endif 260#endif
261 261
262static inline s64 ktime_to_us(const ktime_t kt)
263{
264 struct timeval tv = ktime_to_timeval(kt);
265 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
266}
267
262/* 268/*
263 * The resolution of the clocks. The resolution value is returned in 269 * The resolution of the clocks. The resolution value is returned in
264 * the clock_getres() system call to give application programmers an 270 * the clock_getres() system call to give application programmers an
diff --git a/include/linux/net.h b/include/linux/net.h
index 4db21e63d8d2..efc45177b503 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -24,7 +24,7 @@
24struct poll_table_struct; 24struct poll_table_struct;
25struct inode; 25struct inode;
26 26
27#define NPROTO 33 /* should be enough for now.. */ 27#define NPROTO 34 /* should be enough for now.. */
28 28
29#define SYS_SOCKET 1 /* sys_socket(2) */ 29#define SYS_SOCKET 1 /* sys_socket(2) */
30#define SYS_BIND 2 /* sys_bind(2) */ 30#define SYS_BIND 2 /* sys_bind(2) */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1a528548cd1d..e027a3750a77 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -42,6 +42,8 @@
42struct vlan_group; 42struct vlan_group;
43struct ethtool_ops; 43struct ethtool_ops;
44struct netpoll_info; 44struct netpoll_info;
45/* 802.11 specific */
46struct wireless_dev;
45 /* source back-compat hooks */ 47 /* source back-compat hooks */
46#define SET_ETHTOOL_OPS(netdev,ops) \ 48#define SET_ETHTOOL_OPS(netdev,ops) \
47 ( (netdev)->ethtool_ops = (ops) ) 49 ( (netdev)->ethtool_ops = (ops) )
@@ -323,6 +325,7 @@ struct net_device
323#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ 325#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
324#define NETIF_F_GSO 2048 /* Enable software GSO. */ 326#define NETIF_F_GSO 2048 /* Enable software GSO. */
325#define NETIF_F_LLTX 4096 /* LockLess TX */ 327#define NETIF_F_LLTX 4096 /* LockLess TX */
328#define NETIF_F_INTERNAL_STATS 8192 /* Use stats structure in net_device */
326 329
327 /* Segmentation offload features */ 330 /* Segmentation offload features */
328#define NETIF_F_GSO_SHIFT 16 331#define NETIF_F_GSO_SHIFT 16
@@ -347,13 +350,15 @@ struct net_device
347 350
348 351
349 struct net_device_stats* (*get_stats)(struct net_device *dev); 352 struct net_device_stats* (*get_stats)(struct net_device *dev);
353 struct net_device_stats stats;
350 354
355#ifdef CONFIG_WIRELESS_EXT
351 /* List of functions to handle Wireless Extensions (instead of ioctl). 356 /* List of functions to handle Wireless Extensions (instead of ioctl).
352 * See <net/iw_handler.h> for details. Jean II */ 357 * See <net/iw_handler.h> for details. Jean II */
353 const struct iw_handler_def * wireless_handlers; 358 const struct iw_handler_def * wireless_handlers;
354 /* Instance data managed by the core of Wireless Extensions. */ 359 /* Instance data managed by the core of Wireless Extensions. */
355 struct iw_public_data * wireless_data; 360 struct iw_public_data * wireless_data;
356 361#endif
357 const struct ethtool_ops *ethtool_ops; 362 const struct ethtool_ops *ethtool_ops;
358 363
359 /* 364 /*
@@ -398,6 +403,8 @@ struct net_device
398 void *ip6_ptr; /* IPv6 specific data */ 403 void *ip6_ptr; /* IPv6 specific data */
399 void *ec_ptr; /* Econet specific data */ 404 void *ec_ptr; /* Econet specific data */
400 void *ax25_ptr; /* AX.25 specific data */ 405 void *ax25_ptr; /* AX.25 specific data */
406 struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
407 assign before registering */
401 408
402/* 409/*
403 * Cache line mostly used on receive path (including eth_type_trans()) 410 * Cache line mostly used on receive path (including eth_type_trans())
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 70d3b4f1e48d..10b5c6275706 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -281,9 +281,6 @@ extern void nf_reinject(struct sk_buff *skb,
281 struct nf_info *info, 281 struct nf_info *info,
282 unsigned int verdict); 282 unsigned int verdict);
283 283
284extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
285extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
286
287/* FIXME: Before cache is ever used, this must be implemented for real. */ 284/* FIXME: Before cache is ever used, this must be implemented for real. */
288extern void nf_invalidate_cache(int pf); 285extern void nf_invalidate_cache(int pf);
289 286
@@ -388,11 +385,18 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
388{ 385{
389 return 1; 386 return 1;
390} 387}
391static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
392struct flowi; 388struct flowi;
393static inline void 389static inline void
394nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} 390nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {}
395#endif /*CONFIG_NETFILTER*/ 391#endif /*CONFIG_NETFILTER*/
396 392
393#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
394extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
395extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
396extern void (*nf_ct_destroy)(struct nf_conntrack *);
397#else
398static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
399#endif
400
397#endif /*__KERNEL__*/ 401#endif /*__KERNEL__*/
398#endif /*__LINUX_NETFILTER_H*/ 402#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index 007af4c2770b..22ce29995f13 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -30,6 +30,11 @@ enum tcp_conntrack {
30/* Be liberal in window checking */ 30/* Be liberal in window checking */
31#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 31#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08
32 32
33struct nf_ct_tcp_flags {
34 u_int8_t flags;
35 u_int8_t mask;
36};
37
33#ifdef __KERNEL__ 38#ifdef __KERNEL__
34 39
35struct ip_ct_tcp_state { 40struct ip_ct_tcp_state {
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 1e9c821f152d..0f9311df1559 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -62,11 +62,11 @@ struct nfattr
62#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0))) 62#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0)))
63#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0)) 63#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0))
64#define NFA_NEST(skb, type) \ 64#define NFA_NEST(skb, type) \
65({ struct nfattr *__start = (struct nfattr *) (skb)->tail; \ 65({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \
66 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \ 66 NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \
67 __start; }) 67 __start; })
68#define NFA_NEST_END(skb, start) \ 68#define NFA_NEST_END(skb, start) \
69({ (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \ 69({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
70 (skb)->len; }) 70 (skb)->len; })
71#define NFA_NEST_CANCEL(skb, start) \ 71#define NFA_NEST_CANCEL(skb, start) \
72({ if (start) \ 72({ if (start) \
@@ -111,7 +111,7 @@ struct nfgenmsg {
111struct nfnl_callback 111struct nfnl_callback
112{ 112{
113 int (*call)(struct sock *nl, struct sk_buff *skb, 113 int (*call)(struct sock *nl, struct sk_buff *skb,
114 struct nlmsghdr *nlh, struct nfattr *cda[], int *errp); 114 struct nlmsghdr *nlh, struct nfattr *cda[]);
115 u_int16_t attr_count; /* number of nfattr's */ 115 u_int16_t attr_count; /* number of nfattr's */
116}; 116};
117 117
@@ -129,19 +129,6 @@ extern void __nfa_fill(struct sk_buff *skb, int attrtype,
129({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \ 129({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \
130 __nfa_fill(skb, attrtype, attrlen, data); }) 130 __nfa_fill(skb, attrtype, attrlen, data); })
131 131
132extern struct semaphore nfnl_sem;
133
134#define nfnl_shlock() down(&nfnl_sem)
135#define nfnl_shlock_nowait() down_trylock(&nfnl_sem)
136
137#define nfnl_shunlock() do { up(&nfnl_sem); \
138 if(nfnl && nfnl->sk_receive_queue.qlen) \
139 nfnl->sk_data_ready(nfnl, 0); \
140 } while(0)
141
142extern void nfnl_lock(void);
143extern void nfnl_unlock(void);
144
145extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n); 132extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n);
146extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n); 133extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n);
147 134
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index b5883ccee295..d7c35039721e 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -83,6 +83,10 @@ enum ctattr_protoinfo {
83enum ctattr_protoinfo_tcp { 83enum ctattr_protoinfo_tcp {
84 CTA_PROTOINFO_TCP_UNSPEC, 84 CTA_PROTOINFO_TCP_UNSPEC,
85 CTA_PROTOINFO_TCP_STATE, 85 CTA_PROTOINFO_TCP_STATE,
86 CTA_PROTOINFO_TCP_WSCALE_ORIGINAL,
87 CTA_PROTOINFO_TCP_WSCALE_REPLY,
88 CTA_PROTOINFO_TCP_FLAGS_ORIGINAL,
89 CTA_PROTOINFO_TCP_FLAGS_REPLY,
86 __CTA_PROTOINFO_TCP_MAX 90 __CTA_PROTOINFO_TCP_MAX
87}; 91};
88#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) 92#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 55689f39f77a..19060030bac9 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -7,6 +7,7 @@
7#include <linux/netfilter.h> 7#include <linux/netfilter.h>
8#include <linux/if_ether.h> 8#include <linux/if_ether.h>
9#include <linux/if_vlan.h> 9#include <linux/if_vlan.h>
10#include <linux/if_pppox.h>
10 11
11/* Bridge Hooks */ 12/* Bridge Hooks */
12/* After promisc drops, checksum checks. */ 13/* After promisc drops, checksum checks. */
@@ -58,8 +59,14 @@ static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
58 * enough room for the encapsulating header (if there is one). */ 59 * enough room for the encapsulating header (if there is one). */
59static inline int nf_bridge_pad(const struct sk_buff *skb) 60static inline int nf_bridge_pad(const struct sk_buff *skb)
60{ 61{
61 return (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q)) 62 int padding = 0;
62 ? VLAN_HLEN : 0; 63
64 if (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q))
65 padding = VLAN_HLEN;
66 else if (skb->nf_bridge && skb->protocol == htons(ETH_P_PPP_SES))
67 padding = PPPOE_SES_HLEN;
68
69 return padding;
63} 70}
64 71
65struct bridge_skb_cb { 72struct bridge_skb_cb {
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
index 07f044ff1a6b..a11b0c2017fd 100644
--- a/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
@@ -54,7 +54,7 @@ struct ebt_802_3_hdr {
54 54
55static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) 55static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
56{ 56{
57 return (struct ebt_802_3_hdr *)skb->mac.raw; 57 return (struct ebt_802_3_hdr *)skb_mac_header(skb);
58} 58}
59#endif 59#endif
60 60
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h
index 97e4dbde1f89..cbf4843b6b0f 100644
--- a/include/linux/netfilter_bridge/ebt_arp.h
+++ b/include/linux/netfilter_bridge/ebt_arp.h
@@ -8,8 +8,10 @@
8#define EBT_ARP_DST_IP 0x10 8#define EBT_ARP_DST_IP 0x10
9#define EBT_ARP_SRC_MAC 0x20 9#define EBT_ARP_SRC_MAC 0x20
10#define EBT_ARP_DST_MAC 0x40 10#define EBT_ARP_DST_MAC 0x40
11#define EBT_ARP_GRAT 0x80
11#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \ 12#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \
12 EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC) 13 EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC | \
14 EBT_ARP_GRAT)
13#define EBT_ARP_MATCH "arp" 15#define EBT_ARP_MATCH "arp"
14 16
15struct ebt_arp_info 17struct ebt_arp_info
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 180337801a86..7185792b900f 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,9 +1,3 @@
1header-y += ip_conntrack_helper.h
2header-y += ip_conntrack_protocol.h
3header-y += ip_conntrack_sctp.h
4header-y += ip_conntrack_tcp.h
5header-y += ip_conntrack_tftp.h
6header-y += ip_nat_pptp.h
7header-y += ipt_addrtype.h 1header-y += ipt_addrtype.h
8header-y += ipt_ah.h 2header-y += ipt_ah.h
9header-y += ipt_CLASSIFY.h 3header-y += ipt_CLASSIFY.h
@@ -49,13 +43,5 @@ header-y += ipt_ttl.h
49header-y += ipt_TTL.h 43header-y += ipt_TTL.h
50header-y += ipt_ULOG.h 44header-y += ipt_ULOG.h
51 45
52unifdef-y += ip_conntrack.h
53unifdef-y += ip_conntrack_h323.h
54unifdef-y += ip_conntrack_irc.h
55unifdef-y += ip_conntrack_pptp.h
56unifdef-y += ip_conntrack_proto_gre.h
57unifdef-y += ip_conntrack_tuple.h
58unifdef-y += ip_nat.h
59unifdef-y += ip_nat_rule.h
60unifdef-y += ip_queue.h 46unifdef-y += ip_queue.h
61unifdef-y += ip_tables.h 47unifdef-y += ip_tables.h
diff --git a/include/linux/netfilter_ipv4/ip_conntrack.h b/include/linux/netfilter_ipv4/ip_conntrack.h
deleted file mode 100644
index da9274e6bf12..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack.h
+++ /dev/null
@@ -1,402 +0,0 @@
1#ifndef _IP_CONNTRACK_H
2#define _IP_CONNTRACK_H
3
4#include <linux/netfilter/nf_conntrack_common.h>
5
6#ifdef __KERNEL__
7#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
8#include <linux/bitops.h>
9#include <linux/compiler.h>
10#include <asm/atomic.h>
11
12#include <linux/timer.h>
13#include <linux/netfilter_ipv4/ip_conntrack_tcp.h>
14#include <linux/netfilter_ipv4/ip_conntrack_icmp.h>
15#include <linux/netfilter_ipv4/ip_conntrack_proto_gre.h>
16#include <linux/netfilter_ipv4/ip_conntrack_sctp.h>
17
18/* per conntrack: protocol private data */
19union ip_conntrack_proto {
20 /* insert conntrack proto private data here */
21 struct ip_ct_gre gre;
22 struct ip_ct_sctp sctp;
23 struct ip_ct_tcp tcp;
24 struct ip_ct_icmp icmp;
25};
26
27union ip_conntrack_expect_proto {
28 /* insert expect proto private data here */
29};
30
31/* Add protocol helper include file here */
32#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
33#include <linux/netfilter_ipv4/ip_conntrack_pptp.h>
34#include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
35#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
36#include <linux/netfilter_ipv4/ip_conntrack_irc.h>
37
38/* per conntrack: application helper private data */
39union ip_conntrack_help {
40 /* insert conntrack helper private data (master) here */
41 struct ip_ct_h323_master ct_h323_info;
42 struct ip_ct_pptp_master ct_pptp_info;
43 struct ip_ct_ftp_master ct_ftp_info;
44 struct ip_ct_irc_master ct_irc_info;
45};
46
47#ifdef CONFIG_IP_NF_NAT_NEEDED
48#include <linux/netfilter_ipv4/ip_nat.h>
49#include <linux/netfilter_ipv4/ip_nat_pptp.h>
50
51/* per conntrack: nat application helper private data */
52union ip_conntrack_nat_help {
53 /* insert nat helper private data here */
54 struct ip_nat_pptp nat_pptp_info;
55};
56#endif
57
58#include <linux/types.h>
59#include <linux/skbuff.h>
60
61#ifdef CONFIG_NETFILTER_DEBUG
62#define IP_NF_ASSERT(x) \
63do { \
64 if (!(x)) \
65 /* Wooah! I'm tripping my conntrack in a frenzy of \
66 netplay... */ \
67 printk("NF_IP_ASSERT: %s:%i(%s)\n", \
68 __FILE__, __LINE__, __FUNCTION__); \
69} while(0)
70#else
71#define IP_NF_ASSERT(x)
72#endif
73
74struct ip_conntrack_helper;
75
76struct ip_conntrack
77{
78 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
79 plus 1 for any connection(s) we are `master' for */
80 struct nf_conntrack ct_general;
81
82 /* Have we seen traffic both ways yet? (bitset) */
83 unsigned long status;
84
85 /* Timer function; drops refcnt when it goes off. */
86 struct timer_list timeout;
87
88#ifdef CONFIG_IP_NF_CT_ACCT
89 /* Accounting Information (same cache line as other written members) */
90 struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
91#endif
92 /* If we were expected by an expectation, this will be it */
93 struct ip_conntrack *master;
94
95 /* Current number of expected connections */
96 unsigned int expecting;
97
98 /* Unique ID that identifies this conntrack*/
99 unsigned int id;
100
101 /* Helper, if any. */
102 struct ip_conntrack_helper *helper;
103
104 /* Storage reserved for other modules: */
105 union ip_conntrack_proto proto;
106
107 union ip_conntrack_help help;
108
109#ifdef CONFIG_IP_NF_NAT_NEEDED
110 struct {
111 struct ip_nat_info info;
112 union ip_conntrack_nat_help help;
113#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
114 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
115 int masq_index;
116#endif
117 } nat;
118#endif /* CONFIG_IP_NF_NAT_NEEDED */
119
120#if defined(CONFIG_IP_NF_CONNTRACK_MARK)
121 u_int32_t mark;
122#endif
123
124#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
125 u_int32_t secmark;
126#endif
127
128 /* Traversed often, so hopefully in different cacheline to top */
129 /* These are my tuples; original and reply */
130 struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
131};
132
133struct ip_conntrack_expect
134{
135 /* Internal linked list (global expectation list) */
136 struct list_head list;
137
138 /* We expect this tuple, with the following mask */
139 struct ip_conntrack_tuple tuple, mask;
140
141 /* Function to call after setup and insertion */
142 void (*expectfn)(struct ip_conntrack *new,
143 struct ip_conntrack_expect *this);
144
145 /* The conntrack of the master connection */
146 struct ip_conntrack *master;
147
148 /* Timer function; deletes the expectation. */
149 struct timer_list timeout;
150
151 /* Usage count. */
152 atomic_t use;
153
154 /* Unique ID */
155 unsigned int id;
156
157 /* Flags */
158 unsigned int flags;
159
160#ifdef CONFIG_IP_NF_NAT_NEEDED
161 __be32 saved_ip;
162 /* This is the original per-proto part, used to map the
163 * expected connection the way the recipient expects. */
164 union ip_conntrack_manip_proto saved_proto;
165 /* Direction relative to the master connection. */
166 enum ip_conntrack_dir dir;
167#endif
168};
169
170#define IP_CT_EXPECT_PERMANENT 0x1
171
172static inline struct ip_conntrack *
173tuplehash_to_ctrack(const struct ip_conntrack_tuple_hash *hash)
174{
175 return container_of(hash, struct ip_conntrack,
176 tuplehash[hash->tuple.dst.dir]);
177}
178
179/* get master conntrack via master expectation */
180#define master_ct(conntr) (conntr->master)
181
182/* Alter reply tuple (maybe alter helper). */
183extern void
184ip_conntrack_alter_reply(struct ip_conntrack *conntrack,
185 const struct ip_conntrack_tuple *newreply);
186
187/* Is this tuple taken? (ignoring any belonging to the given
188 conntrack). */
189extern int
190ip_conntrack_tuple_taken(const struct ip_conntrack_tuple *tuple,
191 const struct ip_conntrack *ignored_conntrack);
192
193/* Return conntrack_info and tuple hash for given skb. */
194static inline struct ip_conntrack *
195ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo)
196{
197 *ctinfo = skb->nfctinfo;
198 return (struct ip_conntrack *)skb->nfct;
199}
200
201/* decrement reference count on a conntrack */
202static inline void
203ip_conntrack_put(struct ip_conntrack *ct)
204{
205 IP_NF_ASSERT(ct);
206 nf_conntrack_put(&ct->ct_general);
207}
208
209extern int invert_tuplepr(struct ip_conntrack_tuple *inverse,
210 const struct ip_conntrack_tuple *orig);
211
212extern void __ip_ct_refresh_acct(struct ip_conntrack *ct,
213 enum ip_conntrack_info ctinfo,
214 const struct sk_buff *skb,
215 unsigned long extra_jiffies,
216 int do_acct);
217
218/* Refresh conntrack for this many jiffies and do accounting */
219static inline void ip_ct_refresh_acct(struct ip_conntrack *ct,
220 enum ip_conntrack_info ctinfo,
221 const struct sk_buff *skb,
222 unsigned long extra_jiffies)
223{
224 __ip_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1);
225}
226
227/* Refresh conntrack for this many jiffies */
228static inline void ip_ct_refresh(struct ip_conntrack *ct,
229 const struct sk_buff *skb,
230 unsigned long extra_jiffies)
231{
232 __ip_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
233}
234
235/* These are for NAT. Icky. */
236/* Update TCP window tracking data when NAT mangles the packet */
237extern void ip_conntrack_tcp_update(struct sk_buff *skb,
238 struct ip_conntrack *conntrack,
239 enum ip_conntrack_dir dir);
240
241/* Call me when a conntrack is destroyed. */
242extern void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack);
243
244/* Fake conntrack entry for untracked connections */
245extern struct ip_conntrack ip_conntrack_untracked;
246
247/* Returns new sk_buff, or NULL */
248struct sk_buff *
249ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user);
250
251/* Iterate over all conntracks: if iter returns true, it's deleted. */
252extern void
253ip_ct_iterate_cleanup(int (*iter)(struct ip_conntrack *i, void *data),
254 void *data);
255
256extern struct ip_conntrack_helper *
257__ip_conntrack_helper_find_byname(const char *);
258extern struct ip_conntrack_helper *
259ip_conntrack_helper_find_get(const struct ip_conntrack_tuple *tuple);
260extern void ip_conntrack_helper_put(struct ip_conntrack_helper *helper);
261
262extern struct ip_conntrack_protocol *
263__ip_conntrack_proto_find(u_int8_t protocol);
264extern struct ip_conntrack_protocol *
265ip_conntrack_proto_find_get(u_int8_t protocol);
266extern void ip_conntrack_proto_put(struct ip_conntrack_protocol *proto);
267
268extern void ip_ct_remove_expectations(struct ip_conntrack *ct);
269
270extern struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *,
271 struct ip_conntrack_tuple *);
272
273extern void ip_conntrack_free(struct ip_conntrack *ct);
274
275extern void ip_conntrack_hash_insert(struct ip_conntrack *ct);
276
277extern struct ip_conntrack_expect *
278__ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple);
279
280extern struct ip_conntrack_expect *
281ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple);
282
283extern struct ip_conntrack_tuple_hash *
284__ip_conntrack_find(const struct ip_conntrack_tuple *tuple,
285 const struct ip_conntrack *ignored_conntrack);
286
287extern void ip_conntrack_flush(void);
288
289/* It's confirmed if it is, or has been in the hash table. */
290static inline int is_confirmed(struct ip_conntrack *ct)
291{
292 return test_bit(IPS_CONFIRMED_BIT, &ct->status);
293}
294
295static inline int is_dying(struct ip_conntrack *ct)
296{
297 return test_bit(IPS_DYING_BIT, &ct->status);
298}
299
300extern unsigned int ip_conntrack_htable_size;
301extern int ip_conntrack_checksum;
302
303#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++)
304#define CONNTRACK_STAT_INC_ATOMIC(count) \
305do { \
306 local_bh_disable(); \
307 __get_cpu_var(ip_conntrack_stat).count++; \
308 local_bh_enable(); \
309} while (0)
310
311#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
312#include <linux/notifier.h>
313#include <linux/interrupt.h>
314
315struct ip_conntrack_ecache {
316 struct ip_conntrack *ct;
317 unsigned int events;
318};
319DECLARE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache);
320
321#define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x)
322
323extern struct atomic_notifier_head ip_conntrack_chain;
324extern struct atomic_notifier_head ip_conntrack_expect_chain;
325
326static inline int ip_conntrack_register_notifier(struct notifier_block *nb)
327{
328 return atomic_notifier_chain_register(&ip_conntrack_chain, nb);
329}
330
331static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb)
332{
333 return atomic_notifier_chain_unregister(&ip_conntrack_chain, nb);
334}
335
336static inline int
337ip_conntrack_expect_register_notifier(struct notifier_block *nb)
338{
339 return atomic_notifier_chain_register(&ip_conntrack_expect_chain, nb);
340}
341
342static inline int
343ip_conntrack_expect_unregister_notifier(struct notifier_block *nb)
344{
345 return atomic_notifier_chain_unregister(&ip_conntrack_expect_chain,
346 nb);
347}
348
349extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct);
350extern void __ip_ct_event_cache_init(struct ip_conntrack *ct);
351
352static inline void
353ip_conntrack_event_cache(enum ip_conntrack_events event,
354 const struct sk_buff *skb)
355{
356 struct ip_conntrack *ct = (struct ip_conntrack *)skb->nfct;
357 struct ip_conntrack_ecache *ecache;
358
359 local_bh_disable();
360 ecache = &__get_cpu_var(ip_conntrack_ecache);
361 if (ct != ecache->ct)
362 __ip_ct_event_cache_init(ct);
363 ecache->events |= event;
364 local_bh_enable();
365}
366
367static inline void ip_conntrack_event(enum ip_conntrack_events event,
368 struct ip_conntrack *ct)
369{
370 if (is_confirmed(ct) && !is_dying(ct))
371 atomic_notifier_call_chain(&ip_conntrack_chain, event, ct);
372}
373
374static inline void
375ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
376 struct ip_conntrack_expect *exp)
377{
378 atomic_notifier_call_chain(&ip_conntrack_expect_chain, event, exp);
379}
380#else /* CONFIG_IP_NF_CONNTRACK_EVENTS */
381static inline void ip_conntrack_event_cache(enum ip_conntrack_events event,
382 const struct sk_buff *skb) {}
383static inline void ip_conntrack_event(enum ip_conntrack_events event,
384 struct ip_conntrack *ct) {}
385static inline void ip_ct_deliver_cached_events(const struct ip_conntrack *ct) {}
386static inline void
387ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
388 struct ip_conntrack_expect *exp) {}
389#endif /* CONFIG_IP_NF_CONNTRACK_EVENTS */
390
391#ifdef CONFIG_IP_NF_NAT_NEEDED
392static inline int ip_nat_initialized(struct ip_conntrack *conntrack,
393 enum ip_nat_manip_type manip)
394{
395 if (manip == IP_NAT_MANIP_SRC)
396 return test_bit(IPS_SRC_NAT_DONE_BIT, &conntrack->status);
397 return test_bit(IPS_DST_NAT_DONE_BIT, &conntrack->status);
398}
399#endif /* CONFIG_IP_NF_NAT_NEEDED */
400
401#endif /* __KERNEL__ */
402#endif /* _IP_CONNTRACK_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_amanda.h b/include/linux/netfilter_ipv4/ip_conntrack_amanda.h
deleted file mode 100644
index de3e41f51aec..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_amanda.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _IP_CONNTRACK_AMANDA_H
2#define _IP_CONNTRACK_AMANDA_H
3/* AMANDA tracking. */
4
5struct ip_conntrack_expect;
6extern unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb,
7 enum ip_conntrack_info ctinfo,
8 unsigned int matchoff,
9 unsigned int matchlen,
10 struct ip_conntrack_expect *exp);
11#endif /* _IP_CONNTRACK_AMANDA_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h
deleted file mode 100644
index e3a6df07aa4b..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_core.h
+++ /dev/null
@@ -1,61 +0,0 @@
1#ifndef _IP_CONNTRACK_CORE_H
2#define _IP_CONNTRACK_CORE_H
3#include <linux/netfilter.h>
4
5#define MAX_IP_CT_PROTO 256
6extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO];
7
8/* This header is used to share core functionality between the
9 standalone connection tracking module, and the compatibility layer's use
10 of connection tracking. */
11extern unsigned int ip_conntrack_in(unsigned int hooknum,
12 struct sk_buff **pskb,
13 const struct net_device *in,
14 const struct net_device *out,
15 int (*okfn)(struct sk_buff *));
16
17extern int ip_conntrack_init(void);
18extern void ip_conntrack_cleanup(void);
19
20struct ip_conntrack_protocol;
21
22extern int
23ip_ct_get_tuple(const struct iphdr *iph,
24 const struct sk_buff *skb,
25 unsigned int dataoff,
26 struct ip_conntrack_tuple *tuple,
27 const struct ip_conntrack_protocol *protocol);
28
29extern int
30ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse,
31 const struct ip_conntrack_tuple *orig,
32 const struct ip_conntrack_protocol *protocol);
33
34/* Find a connection corresponding to a tuple. */
35struct ip_conntrack_tuple_hash *
36ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple,
37 const struct ip_conntrack *ignored_conntrack);
38
39extern int __ip_conntrack_confirm(struct sk_buff **pskb);
40
41/* Confirm a connection: returns NF_DROP if packet must be dropped. */
42static inline int ip_conntrack_confirm(struct sk_buff **pskb)
43{
44 struct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct;
45 int ret = NF_ACCEPT;
46
47 if (ct) {
48 if (!is_confirmed(ct) && !is_dying(ct))
49 ret = __ip_conntrack_confirm(pskb);
50 ip_ct_deliver_cached_events(ct);
51 }
52 return ret;
53}
54
55extern void ip_ct_unlink_expect(struct ip_conntrack_expect *exp);
56
57extern struct list_head *ip_conntrack_hash;
58extern struct list_head ip_conntrack_expect_list;
59extern rwlock_t ip_conntrack_lock;
60#endif /* _IP_CONNTRACK_CORE_H */
61
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h b/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
deleted file mode 100644
index 2129fc3972ac..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_ftp.h
+++ /dev/null
@@ -1,44 +0,0 @@
1#ifndef _IP_CONNTRACK_FTP_H
2#define _IP_CONNTRACK_FTP_H
3/* FTP tracking. */
4
5/* This enum is exposed to userspace */
6enum ip_ct_ftp_type
7{
8 /* PORT command from client */
9 IP_CT_FTP_PORT,
10 /* PASV response from server */
11 IP_CT_FTP_PASV,
12 /* EPRT command from client */
13 IP_CT_FTP_EPRT,
14 /* EPSV response from server */
15 IP_CT_FTP_EPSV,
16};
17
18#ifdef __KERNEL__
19
20#define FTP_PORT 21
21
22#define NUM_SEQ_TO_REMEMBER 2
23/* This structure exists only once per master */
24struct ip_ct_ftp_master {
25 /* Valid seq positions for cmd matching after newline */
26 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];
27 /* 0 means seq_match_aft_nl not set */
28 int seq_aft_nl_num[IP_CT_DIR_MAX];
29};
30
31struct ip_conntrack_expect;
32
33/* For NAT to hook in when we find a packet which describes what other
34 * connection we should expect. */
35extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb,
36 enum ip_conntrack_info ctinfo,
37 enum ip_ct_ftp_type type,
38 unsigned int matchoff,
39 unsigned int matchlen,
40 struct ip_conntrack_expect *exp,
41 u32 *seq);
42#endif /* __KERNEL__ */
43
44#endif /* _IP_CONNTRACK_FTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_h323.h b/include/linux/netfilter_ipv4/ip_conntrack_h323.h
deleted file mode 100644
index 18f769818f4e..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_h323.h
+++ /dev/null
@@ -1,89 +0,0 @@
1#ifndef _IP_CONNTRACK_H323_H
2#define _IP_CONNTRACK_H323_H
3
4#ifdef __KERNEL__
5
6#include <linux/netfilter/nf_conntrack_h323_asn1.h>
7
8#define RAS_PORT 1719
9#define Q931_PORT 1720
10#define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */
11
12/* This structure exists only once per master */
13struct ip_ct_h323_master {
14
15 /* Original and NATed Q.931 or H.245 signal ports */
16 u_int16_t sig_port[IP_CT_DIR_MAX];
17
18 /* Original and NATed RTP ports */
19 u_int16_t rtp_port[H323_RTP_CHANNEL_MAX][IP_CT_DIR_MAX];
20
21 union {
22 /* RAS connection timeout */
23 u_int32_t timeout;
24
25 /* Next TPKT length (for separate TPKT header and data) */
26 u_int16_t tpkt_len[IP_CT_DIR_MAX];
27 };
28};
29
30struct ip_conntrack_expect;
31
32extern int get_h225_addr(unsigned char *data, TransportAddress * addr,
33 __be32 * ip, u_int16_t * port);
34extern void ip_conntrack_h245_expect(struct ip_conntrack *new,
35 struct ip_conntrack_expect *this);
36extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
37 struct ip_conntrack_expect *this);
38extern int (*set_h245_addr_hook) (struct sk_buff ** pskb,
39 unsigned char **data, int dataoff,
40 H245_TransportAddress * addr,
41 __be32 ip, u_int16_t port);
42extern int (*set_h225_addr_hook) (struct sk_buff ** pskb,
43 unsigned char **data, int dataoff,
44 TransportAddress * addr,
45 __be32 ip, u_int16_t port);
46extern int (*set_sig_addr_hook) (struct sk_buff ** pskb,
47 struct ip_conntrack * ct,
48 enum ip_conntrack_info ctinfo,
49 unsigned char **data,
50 TransportAddress * addr, int count);
51extern int (*set_ras_addr_hook) (struct sk_buff ** pskb,
52 struct ip_conntrack * ct,
53 enum ip_conntrack_info ctinfo,
54 unsigned char **data,
55 TransportAddress * addr, int count);
56extern int (*nat_rtp_rtcp_hook) (struct sk_buff ** pskb,
57 struct ip_conntrack * ct,
58 enum ip_conntrack_info ctinfo,
59 unsigned char **data, int dataoff,
60 H245_TransportAddress * addr,
61 u_int16_t port, u_int16_t rtp_port,
62 struct ip_conntrack_expect * rtp_exp,
63 struct ip_conntrack_expect * rtcp_exp);
64extern int (*nat_t120_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
65 enum ip_conntrack_info ctinfo,
66 unsigned char **data, int dataoff,
67 H245_TransportAddress * addr, u_int16_t port,
68 struct ip_conntrack_expect * exp);
69extern int (*nat_h245_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
70 enum ip_conntrack_info ctinfo,
71 unsigned char **data, int dataoff,
72 TransportAddress * addr, u_int16_t port,
73 struct ip_conntrack_expect * exp);
74extern int (*nat_callforwarding_hook) (struct sk_buff ** pskb,
75 struct ip_conntrack * ct,
76 enum ip_conntrack_info ctinfo,
77 unsigned char **data, int dataoff,
78 TransportAddress * addr,
79 u_int16_t port,
80 struct ip_conntrack_expect * exp);
81extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
82 enum ip_conntrack_info ctinfo,
83 unsigned char **data, TransportAddress * addr,
84 int idx, u_int16_t port,
85 struct ip_conntrack_expect * exp);
86
87#endif
88
89#endif
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper.h b/include/linux/netfilter_ipv4/ip_conntrack_helper.h
deleted file mode 100644
index 77fe868d36ff..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/* IP connection tracking helpers. */
2#ifndef _IP_CONNTRACK_HELPER_H
3#define _IP_CONNTRACK_HELPER_H
4#include <linux/netfilter_ipv4/ip_conntrack.h>
5
6struct module;
7
8struct ip_conntrack_helper
9{
10 struct list_head list; /* Internal use. */
11
12 const char *name; /* name of the module */
13 struct module *me; /* pointer to self */
14 unsigned int max_expected; /* Maximum number of concurrent
15 * expected connections */
16 unsigned int timeout; /* timeout for expecteds */
17
18 /* Mask of things we will help (compared against server response) */
19 struct ip_conntrack_tuple tuple;
20 struct ip_conntrack_tuple mask;
21
22 /* Function to call when data passes; return verdict, or -1 to
23 invalidate. */
24 int (*help)(struct sk_buff **pskb,
25 struct ip_conntrack *ct,
26 enum ip_conntrack_info conntrackinfo);
27
28 void (*destroy)(struct ip_conntrack *ct);
29
30 int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct);
31};
32
33extern int ip_conntrack_helper_register(struct ip_conntrack_helper *);
34extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *);
35
36/* Allocate space for an expectation: this is mandatory before calling
37 ip_conntrack_expect_related. You will have to call put afterwards. */
38extern struct ip_conntrack_expect *
39ip_conntrack_expect_alloc(struct ip_conntrack *master);
40extern void ip_conntrack_expect_put(struct ip_conntrack_expect *exp);
41
42/* Add an expected connection: can have more than one per connection */
43extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp);
44extern void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp);
45
46#endif /*_IP_CONNTRACK_HELPER_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h b/include/linux/netfilter_ipv4/ip_conntrack_icmp.h
deleted file mode 100644
index eed5ee3e4744..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_icmp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_ICMP_H
2#define _IP_CONNTRACK_ICMP_H
3
4#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
5
6#endif /* _IP_CONNTRACK_ICMP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_irc.h b/include/linux/netfilter_ipv4/ip_conntrack_irc.h
deleted file mode 100644
index 16601e0d5626..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_irc.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/* IRC extension for IP connection tracking.
2 * (C) 2000 by Harald Welte <laforge@gnumonks.org>
3 * based on RR's ip_conntrack_ftp.h
4 *
5 * ip_conntrack_irc.h,v 1.6 2000/11/07 18:26:42 laforge Exp
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 *
13 */
14#ifndef _IP_CONNTRACK_IRC_H
15#define _IP_CONNTRACK_IRC_H
16
17/* This structure exists only once per master */
18struct ip_ct_irc_master {
19};
20
21#ifdef __KERNEL__
22extern unsigned int (*ip_nat_irc_hook)(struct sk_buff **pskb,
23 enum ip_conntrack_info ctinfo,
24 unsigned int matchoff,
25 unsigned int matchlen,
26 struct ip_conntrack_expect *exp);
27
28#define IRC_PORT 6667
29
30#endif /* __KERNEL__ */
31
32#endif /* _IP_CONNTRACK_IRC_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h b/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
deleted file mode 100644
index 2644b1faddd6..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_pptp.h
+++ /dev/null
@@ -1,326 +0,0 @@
1/* PPTP constants and structs */
2#ifndef _CONNTRACK_PPTP_H
3#define _CONNTRACK_PPTP_H
4
5/* state of the control session */
6enum pptp_ctrlsess_state {
7 PPTP_SESSION_NONE, /* no session present */
8 PPTP_SESSION_ERROR, /* some session error */
9 PPTP_SESSION_STOPREQ, /* stop_sess request seen */
10 PPTP_SESSION_REQUESTED, /* start_sess request seen */
11 PPTP_SESSION_CONFIRMED, /* session established */
12};
13
14/* state of the call inside the control session */
15enum pptp_ctrlcall_state {
16 PPTP_CALL_NONE,
17 PPTP_CALL_ERROR,
18 PPTP_CALL_OUT_REQ,
19 PPTP_CALL_OUT_CONF,
20 PPTP_CALL_IN_REQ,
21 PPTP_CALL_IN_REP,
22 PPTP_CALL_IN_CONF,
23 PPTP_CALL_CLEAR_REQ,
24};
25
26
27/* conntrack private data */
28struct ip_ct_pptp_master {
29 enum pptp_ctrlsess_state sstate; /* session state */
30
31 /* everything below is going to be per-expectation in newnat,
32 * since there could be more than one call within one session */
33 enum pptp_ctrlcall_state cstate; /* call state */
34 __be16 pac_call_id; /* call id of PAC, host byte order */
35 __be16 pns_call_id; /* call id of PNS, host byte order */
36
37 /* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
38 * and therefore imposes a fixed limit on the number of maps */
39 struct ip_ct_gre_keymap *keymap_orig, *keymap_reply;
40};
41
42/* conntrack_expect private member */
43struct ip_ct_pptp_expect {
44 enum pptp_ctrlcall_state cstate; /* call state */
45 __be16 pac_call_id; /* call id of PAC */
46 __be16 pns_call_id; /* call id of PNS */
47};
48
49
50#ifdef __KERNEL__
51
52#define IP_CONNTR_PPTP PPTP_CONTROL_PORT
53
54#define PPTP_CONTROL_PORT 1723
55
56#define PPTP_PACKET_CONTROL 1
57#define PPTP_PACKET_MGMT 2
58
59#define PPTP_MAGIC_COOKIE 0x1a2b3c4d
60
61struct pptp_pkt_hdr {
62 __u16 packetLength;
63 __be16 packetType;
64 __be32 magicCookie;
65};
66
67/* PptpControlMessageType values */
68#define PPTP_START_SESSION_REQUEST 1
69#define PPTP_START_SESSION_REPLY 2
70#define PPTP_STOP_SESSION_REQUEST 3
71#define PPTP_STOP_SESSION_REPLY 4
72#define PPTP_ECHO_REQUEST 5
73#define PPTP_ECHO_REPLY 6
74#define PPTP_OUT_CALL_REQUEST 7
75#define PPTP_OUT_CALL_REPLY 8
76#define PPTP_IN_CALL_REQUEST 9
77#define PPTP_IN_CALL_REPLY 10
78#define PPTP_IN_CALL_CONNECT 11
79#define PPTP_CALL_CLEAR_REQUEST 12
80#define PPTP_CALL_DISCONNECT_NOTIFY 13
81#define PPTP_WAN_ERROR_NOTIFY 14
82#define PPTP_SET_LINK_INFO 15
83
84#define PPTP_MSG_MAX 15
85
86/* PptpGeneralError values */
87#define PPTP_ERROR_CODE_NONE 0
88#define PPTP_NOT_CONNECTED 1
89#define PPTP_BAD_FORMAT 2
90#define PPTP_BAD_VALUE 3
91#define PPTP_NO_RESOURCE 4
92#define PPTP_BAD_CALLID 5
93#define PPTP_REMOVE_DEVICE_ERROR 6
94
95struct PptpControlHeader {
96 __be16 messageType;
97 __u16 reserved;
98};
99
100/* FramingCapability Bitmap Values */
101#define PPTP_FRAME_CAP_ASYNC 0x1
102#define PPTP_FRAME_CAP_SYNC 0x2
103
104/* BearerCapability Bitmap Values */
105#define PPTP_BEARER_CAP_ANALOG 0x1
106#define PPTP_BEARER_CAP_DIGITAL 0x2
107
108struct PptpStartSessionRequest {
109 __be16 protocolVersion;
110 __u16 reserved1;
111 __be32 framingCapability;
112 __be32 bearerCapability;
113 __be16 maxChannels;
114 __be16 firmwareRevision;
115 __u8 hostName[64];
116 __u8 vendorString[64];
117};
118
119/* PptpStartSessionResultCode Values */
120#define PPTP_START_OK 1
121#define PPTP_START_GENERAL_ERROR 2
122#define PPTP_START_ALREADY_CONNECTED 3
123#define PPTP_START_NOT_AUTHORIZED 4
124#define PPTP_START_UNKNOWN_PROTOCOL 5
125
126struct PptpStartSessionReply {
127 __be16 protocolVersion;
128 __u8 resultCode;
129 __u8 generalErrorCode;
130 __be32 framingCapability;
131 __be32 bearerCapability;
132 __be16 maxChannels;
133 __be16 firmwareRevision;
134 __u8 hostName[64];
135 __u8 vendorString[64];
136};
137
138/* PptpStopReasons */
139#define PPTP_STOP_NONE 1
140#define PPTP_STOP_PROTOCOL 2
141#define PPTP_STOP_LOCAL_SHUTDOWN 3
142
143struct PptpStopSessionRequest {
144 __u8 reason;
145 __u8 reserved1;
146 __u16 reserved2;
147};
148
149/* PptpStopSessionResultCode */
150#define PPTP_STOP_OK 1
151#define PPTP_STOP_GENERAL_ERROR 2
152
153struct PptpStopSessionReply {
154 __u8 resultCode;
155 __u8 generalErrorCode;
156 __u16 reserved1;
157};
158
159struct PptpEchoRequest {
160 __be32 identNumber;
161};
162
163/* PptpEchoReplyResultCode */
164#define PPTP_ECHO_OK 1
165#define PPTP_ECHO_GENERAL_ERROR 2
166
167struct PptpEchoReply {
168 __be32 identNumber;
169 __u8 resultCode;
170 __u8 generalErrorCode;
171 __u16 reserved;
172};
173
174/* PptpFramingType */
175#define PPTP_ASYNC_FRAMING 1
176#define PPTP_SYNC_FRAMING 2
177#define PPTP_DONT_CARE_FRAMING 3
178
179/* PptpCallBearerType */
180#define PPTP_ANALOG_TYPE 1
181#define PPTP_DIGITAL_TYPE 2
182#define PPTP_DONT_CARE_BEARER_TYPE 3
183
184struct PptpOutCallRequest {
185 __be16 callID;
186 __be16 callSerialNumber;
187 __be32 minBPS;
188 __be32 maxBPS;
189 __be32 bearerType;
190 __be32 framingType;
191 __be16 packetWindow;
192 __be16 packetProcDelay;
193 __be16 phoneNumberLength;
194 __u16 reserved1;
195 __u8 phoneNumber[64];
196 __u8 subAddress[64];
197};
198
199/* PptpCallResultCode */
200#define PPTP_OUTCALL_CONNECT 1
201#define PPTP_OUTCALL_GENERAL_ERROR 2
202#define PPTP_OUTCALL_NO_CARRIER 3
203#define PPTP_OUTCALL_BUSY 4
204#define PPTP_OUTCALL_NO_DIAL_TONE 5
205#define PPTP_OUTCALL_TIMEOUT 6
206#define PPTP_OUTCALL_DONT_ACCEPT 7
207
208struct PptpOutCallReply {
209 __be16 callID;
210 __be16 peersCallID;
211 __u8 resultCode;
212 __u8 generalErrorCode;
213 __be16 causeCode;
214 __be32 connectSpeed;
215 __be16 packetWindow;
216 __be16 packetProcDelay;
217 __be32 physChannelID;
218};
219
220struct PptpInCallRequest {
221 __be16 callID;
222 __be16 callSerialNumber;
223 __be32 callBearerType;
224 __be32 physChannelID;
225 __be16 dialedNumberLength;
226 __be16 dialingNumberLength;
227 __u8 dialedNumber[64];
228 __u8 dialingNumber[64];
229 __u8 subAddress[64];
230};
231
232/* PptpInCallResultCode */
233#define PPTP_INCALL_ACCEPT 1
234#define PPTP_INCALL_GENERAL_ERROR 2
235#define PPTP_INCALL_DONT_ACCEPT 3
236
237struct PptpInCallReply {
238 __be16 callID;
239 __be16 peersCallID;
240 __u8 resultCode;
241 __u8 generalErrorCode;
242 __be16 packetWindow;
243 __be16 packetProcDelay;
244 __u16 reserved;
245};
246
247struct PptpInCallConnected {
248 __be16 peersCallID;
249 __u16 reserved;
250 __be32 connectSpeed;
251 __be16 packetWindow;
252 __be16 packetProcDelay;
253 __be32 callFramingType;
254};
255
256struct PptpClearCallRequest {
257 __be16 callID;
258 __u16 reserved;
259};
260
261struct PptpCallDisconnectNotify {
262 __be16 callID;
263 __u8 resultCode;
264 __u8 generalErrorCode;
265 __be16 causeCode;
266 __u16 reserved;
267 __u8 callStatistics[128];
268};
269
270struct PptpWanErrorNotify {
271 __be16 peersCallID;
272 __u16 reserved;
273 __be32 crcErrors;
274 __be32 framingErrors;
275 __be32 hardwareOverRuns;
276 __be32 bufferOverRuns;
277 __be32 timeoutErrors;
278 __be32 alignmentErrors;
279};
280
281struct PptpSetLinkInfo {
282 __be16 peersCallID;
283 __u16 reserved;
284 __be32 sendAccm;
285 __be32 recvAccm;
286};
287
288union pptp_ctrl_union {
289 struct PptpStartSessionRequest sreq;
290 struct PptpStartSessionReply srep;
291 struct PptpStopSessionRequest streq;
292 struct PptpStopSessionReply strep;
293 struct PptpOutCallRequest ocreq;
294 struct PptpOutCallReply ocack;
295 struct PptpInCallRequest icreq;
296 struct PptpInCallReply icack;
297 struct PptpInCallConnected iccon;
298 struct PptpClearCallRequest clrreq;
299 struct PptpCallDisconnectNotify disc;
300 struct PptpWanErrorNotify wanerr;
301 struct PptpSetLinkInfo setlink;
302};
303
304extern int
305(*ip_nat_pptp_hook_outbound)(struct sk_buff **pskb,
306 struct ip_conntrack *ct,
307 enum ip_conntrack_info ctinfo,
308 struct PptpControlHeader *ctlh,
309 union pptp_ctrl_union *pptpReq);
310
311extern int
312(*ip_nat_pptp_hook_inbound)(struct sk_buff **pskb,
313 struct ip_conntrack *ct,
314 enum ip_conntrack_info ctinfo,
315 struct PptpControlHeader *ctlh,
316 union pptp_ctrl_union *pptpReq);
317
318extern void
319(*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig,
320 struct ip_conntrack_expect *exp_reply);
321
322extern void
323(*ip_nat_pptp_hook_expectfn)(struct ip_conntrack *ct,
324 struct ip_conntrack_expect *exp);
325#endif /* __KERNEL__ */
326#endif /* _CONNTRACK_PPTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
deleted file mode 100644
index e371e0fc1672..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h
+++ /dev/null
@@ -1,114 +0,0 @@
1#ifndef _CONNTRACK_PROTO_GRE_H
2#define _CONNTRACK_PROTO_GRE_H
3#include <asm/byteorder.h>
4
5/* GRE PROTOCOL HEADER */
6
7/* GRE Version field */
8#define GRE_VERSION_1701 0x0
9#define GRE_VERSION_PPTP 0x1
10
11/* GRE Protocol field */
12#define GRE_PROTOCOL_PPTP 0x880B
13
14/* GRE Flags */
15#define GRE_FLAG_C 0x80
16#define GRE_FLAG_R 0x40
17#define GRE_FLAG_K 0x20
18#define GRE_FLAG_S 0x10
19#define GRE_FLAG_A 0x80
20
21#define GRE_IS_C(f) ((f)&GRE_FLAG_C)
22#define GRE_IS_R(f) ((f)&GRE_FLAG_R)
23#define GRE_IS_K(f) ((f)&GRE_FLAG_K)
24#define GRE_IS_S(f) ((f)&GRE_FLAG_S)
25#define GRE_IS_A(f) ((f)&GRE_FLAG_A)
26
27/* GRE is a mess: Four different standards */
28struct gre_hdr {
29#if defined(__LITTLE_ENDIAN_BITFIELD)
30 __u16 rec:3,
31 srr:1,
32 seq:1,
33 key:1,
34 routing:1,
35 csum:1,
36 version:3,
37 reserved:4,
38 ack:1;
39#elif defined(__BIG_ENDIAN_BITFIELD)
40 __u16 csum:1,
41 routing:1,
42 key:1,
43 seq:1,
44 srr:1,
45 rec:3,
46 ack:1,
47 reserved:4,
48 version:3;
49#else
50#error "Adjust your <asm/byteorder.h> defines"
51#endif
52 __be16 protocol;
53};
54
55/* modified GRE header for PPTP */
56struct gre_hdr_pptp {
57 __u8 flags; /* bitfield */
58 __u8 version; /* should be GRE_VERSION_PPTP */
59 __be16 protocol; /* should be GRE_PROTOCOL_PPTP */
60 __be16 payload_len; /* size of ppp payload, not inc. gre header */
61 __be16 call_id; /* peer's call_id for this session */
62 __be32 seq; /* sequence number. Present if S==1 */
63 __be32 ack; /* seq number of highest packet recieved by */
64 /* sender in this session */
65};
66
67
68/* this is part of ip_conntrack */
69struct ip_ct_gre {
70 unsigned int stream_timeout;
71 unsigned int timeout;
72};
73
74#ifdef __KERNEL__
75struct ip_conntrack_expect;
76struct ip_conntrack;
77
78/* structure for original <-> reply keymap */
79struct ip_ct_gre_keymap {
80 struct list_head list;
81
82 struct ip_conntrack_tuple tuple;
83};
84
85/* add new tuple->key_reply pair to keymap */
86int ip_ct_gre_keymap_add(struct ip_conntrack *ct,
87 struct ip_conntrack_tuple *t,
88 int reply);
89
90/* delete keymap entries */
91void ip_ct_gre_keymap_destroy(struct ip_conntrack *ct);
92
93
94/* get pointer to gre key, if present */
95static inline __be32 *gre_key(struct gre_hdr *greh)
96{
97 if (!greh->key)
98 return NULL;
99 if (greh->csum || greh->routing)
100 return (__be32 *) (greh+sizeof(*greh)+4);
101 return (__be32 *) (greh+sizeof(*greh));
102}
103
104/* get pointer ot gre csum, if present */
105static inline __sum16 *gre_csum(struct gre_hdr *greh)
106{
107 if (!greh->csum)
108 return NULL;
109 return (__sum16 *) (greh+sizeof(*greh));
110}
111
112#endif /* __KERNEL__ */
113
114#endif /* _CONNTRACK_PROTO_GRE_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h b/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
deleted file mode 100644
index 2c76b879e3dc..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_protocol.h
+++ /dev/null
@@ -1,98 +0,0 @@
1/* Header for use in defining a given protocol for connection tracking. */
2#ifndef _IP_CONNTRACK_PROTOCOL_H
3#define _IP_CONNTRACK_PROTOCOL_H
4#include <linux/netfilter_ipv4/ip_conntrack.h>
5#include <linux/netfilter/nfnetlink_conntrack.h>
6
7struct seq_file;
8
9struct ip_conntrack_protocol
10{
11 /* Protocol number. */
12 u_int8_t proto;
13
14 /* Protocol name */
15 const char *name;
16
17 /* Try to fill in the third arg: dataoff is offset past IP
18 hdr. Return true if possible. */
19 int (*pkt_to_tuple)(const struct sk_buff *skb,
20 unsigned int dataoff,
21 struct ip_conntrack_tuple *tuple);
22
23 /* Invert the per-proto part of the tuple: ie. turn xmit into reply.
24 * Some packets can't be inverted: return 0 in that case.
25 */
26 int (*invert_tuple)(struct ip_conntrack_tuple *inverse,
27 const struct ip_conntrack_tuple *orig);
28
29 /* Print out the per-protocol part of the tuple. Return like seq_* */
30 int (*print_tuple)(struct seq_file *,
31 const struct ip_conntrack_tuple *);
32
33 /* Print out the private part of the conntrack. */
34 int (*print_conntrack)(struct seq_file *, const struct ip_conntrack *);
35
36 /* Returns verdict for packet, or -1 for invalid. */
37 int (*packet)(struct ip_conntrack *conntrack,
38 const struct sk_buff *skb,
39 enum ip_conntrack_info ctinfo);
40
41 /* Called when a new connection for this protocol found;
42 * returns TRUE if it's OK. If so, packet() called next. */
43 int (*new)(struct ip_conntrack *conntrack, const struct sk_buff *skb);
44
45 /* Called when a conntrack entry is destroyed */
46 void (*destroy)(struct ip_conntrack *conntrack);
47
48 int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
49 unsigned int hooknum);
50
51 /* convert protoinfo to nfnetink attributes */
52 int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa,
53 const struct ip_conntrack *ct);
54
55 /* convert nfnetlink attributes to protoinfo */
56 int (*from_nfattr)(struct nfattr *tb[], struct ip_conntrack *ct);
57
58 int (*tuple_to_nfattr)(struct sk_buff *skb,
59 const struct ip_conntrack_tuple *t);
60 int (*nfattr_to_tuple)(struct nfattr *tb[],
61 struct ip_conntrack_tuple *t);
62
63 /* Module (if any) which this is connected to. */
64 struct module *me;
65};
66
67/* Protocol registration. */
68extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto);
69extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto);
70/* Existing built-in protocols */
71extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp;
72extern struct ip_conntrack_protocol ip_conntrack_protocol_udp;
73extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp;
74extern struct ip_conntrack_protocol ip_conntrack_generic_protocol;
75extern int ip_conntrack_protocol_tcp_init(void);
76
77/* Log invalid packets */
78extern unsigned int ip_ct_log_invalid;
79
80extern int ip_ct_port_tuple_to_nfattr(struct sk_buff *,
81 const struct ip_conntrack_tuple *);
82extern int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[],
83 struct ip_conntrack_tuple *);
84
85#ifdef CONFIG_SYSCTL
86#ifdef DEBUG_INVALID_PACKETS
87#define LOG_INVALID(proto) \
88 (ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW)
89#else
90#define LOG_INVALID(proto) \
91 ((ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW) \
92 && net_ratelimit())
93#endif
94#else
95#define LOG_INVALID(proto) 0
96#endif /* CONFIG_SYSCTL */
97
98#endif /*_IP_CONNTRACK_PROTOCOL_H*/
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h b/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
deleted file mode 100644
index 4099a041a32a..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_sctp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_SCTP_H
2#define _IP_CONNTRACK_SCTP_H
3
4#include <linux/netfilter/nf_conntrack_sctp.h>
5
6#endif /* _IP_CONNTRACK_SCTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_sip.h b/include/linux/netfilter_ipv4/ip_conntrack_sip.h
deleted file mode 100644
index bef6c646defa..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_sip.h
+++ /dev/null
@@ -1,40 +0,0 @@
1#ifndef __IP_CONNTRACK_SIP_H__
2#define __IP_CONNTRACK_SIP_H__
3#ifdef __KERNEL__
4
5#define SIP_PORT 5060
6#define SIP_TIMEOUT 3600
7
8enum sip_header_pos {
9 POS_REG_REQ_URI,
10 POS_REQ_URI,
11 POS_FROM,
12 POS_TO,
13 POS_VIA,
14 POS_CONTACT,
15 POS_CONTENT,
16 POS_MEDIA,
17 POS_OWNER,
18 POS_CONNECTION,
19 POS_SDP_HEADER,
20};
21
22extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb,
23 enum ip_conntrack_info ctinfo,
24 struct ip_conntrack *ct,
25 const char **dptr);
26extern unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb,
27 enum ip_conntrack_info ctinfo,
28 struct ip_conntrack_expect *exp,
29 const char *dptr);
30
31extern int ct_sip_get_info(const char *dptr, size_t dlen,
32 unsigned int *matchoff,
33 unsigned int *matchlen,
34 enum sip_header_pos pos);
35extern int ct_sip_lnlen(const char *line, const char *limit);
36extern const char *ct_sip_search(const char *needle, const char *haystack,
37 size_t needle_len, size_t haystack_len,
38 int case_sensitive);
39#endif /* __KERNEL__ */
40#endif /* __IP_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h b/include/linux/netfilter_ipv4/ip_conntrack_tcp.h
deleted file mode 100644
index 876b8fb17e68..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tcp.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _IP_CONNTRACK_TCP_H
2#define _IP_CONNTRACK_TCP_H
3
4#include <linux/netfilter/nf_conntrack_tcp.h>
5
6#endif /* _IP_CONNTRACK_TCP_H */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h b/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
deleted file mode 100644
index a404fc0abf0e..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tftp.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _IP_CT_TFTP
2#define _IP_CT_TFTP
3
4#define TFTP_PORT 69
5
6struct tftphdr {
7 __be16 opcode;
8};
9
10#define TFTP_OPCODE_READ 1
11#define TFTP_OPCODE_WRITE 2
12#define TFTP_OPCODE_DATA 3
13#define TFTP_OPCODE_ACK 4
14#define TFTP_OPCODE_ERROR 5
15
16extern unsigned int (*ip_nat_tftp_hook)(struct sk_buff **pskb,
17 enum ip_conntrack_info ctinfo,
18 struct ip_conntrack_expect *exp);
19
20#endif /* _IP_CT_TFTP */
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h b/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
deleted file mode 100644
index c228bde74c33..000000000000
--- a/include/linux/netfilter_ipv4/ip_conntrack_tuple.h
+++ /dev/null
@@ -1,146 +0,0 @@
1#ifndef _IP_CONNTRACK_TUPLE_H
2#define _IP_CONNTRACK_TUPLE_H
3
4#include <linux/types.h>
5#include <linux/netfilter/nf_conntrack_tuple_common.h>
6
7/* A `tuple' is a structure containing the information to uniquely
8 identify a connection. ie. if two packets have the same tuple, they
9 are in the same connection; if not, they are not.
10
11 We divide the structure along "manipulatable" and
12 "non-manipulatable" lines, for the benefit of the NAT code.
13*/
14
15/* The protocol-specific manipulable parts of the tuple: always in
16 network order! */
17union ip_conntrack_manip_proto
18{
19 /* Add other protocols here. */
20 u_int16_t all;
21
22 struct {
23 __be16 port;
24 } tcp;
25 struct {
26 __be16 port;
27 } udp;
28 struct {
29 __be16 id;
30 } icmp;
31 struct {
32 __be16 port;
33 } sctp;
34 struct {
35 __be16 key; /* key is 32bit, pptp only uses 16 */
36 } gre;
37};
38
39/* The manipulable part of the tuple. */
40struct ip_conntrack_manip
41{
42 __be32 ip;
43 union ip_conntrack_manip_proto u;
44};
45
46/* This contains the information to distinguish a connection. */
47struct ip_conntrack_tuple
48{
49 struct ip_conntrack_manip src;
50
51 /* These are the parts of the tuple which are fixed. */
52 struct {
53 __be32 ip;
54 union {
55 /* Add other protocols here. */
56 u_int16_t all;
57
58 struct {
59 __be16 port;
60 } tcp;
61 struct {
62 __be16 port;
63 } udp;
64 struct {
65 u_int8_t type, code;
66 } icmp;
67 struct {
68 __be16 port;
69 } sctp;
70 struct {
71 __be16 key; /* key is 32bit,
72 * pptp only uses 16 */
73 } gre;
74 } u;
75
76 /* The protocol. */
77 u_int8_t protonum;
78
79 /* The direction (for tuplehash) */
80 u_int8_t dir;
81 } dst;
82};
83
84/* This is optimized opposed to a memset of the whole structure. Everything we
85 * really care about is the source/destination unions */
86#define IP_CT_TUPLE_U_BLANK(tuple) \
87 do { \
88 (tuple)->src.u.all = 0; \
89 (tuple)->dst.u.all = 0; \
90 } while (0)
91
92#ifdef __KERNEL__
93
94#define DUMP_TUPLE(tp) \
95DEBUGP("tuple %p: %u %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", \
96 (tp), (tp)->dst.protonum, \
97 NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \
98 NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all))
99
100/* If we're the first tuple, it's the original dir. */
101#define DIRECTION(h) ((enum ip_conntrack_dir)(h)->tuple.dst.dir)
102
103/* Connections have two entries in the hash table: one for each way */
104struct ip_conntrack_tuple_hash
105{
106 struct list_head list;
107
108 struct ip_conntrack_tuple tuple;
109};
110
111#endif /* __KERNEL__ */
112
113static inline int ip_ct_tuple_src_equal(const struct ip_conntrack_tuple *t1,
114 const struct ip_conntrack_tuple *t2)
115{
116 return t1->src.ip == t2->src.ip
117 && t1->src.u.all == t2->src.u.all;
118}
119
120static inline int ip_ct_tuple_dst_equal(const struct ip_conntrack_tuple *t1,
121 const struct ip_conntrack_tuple *t2)
122{
123 return t1->dst.ip == t2->dst.ip
124 && t1->dst.u.all == t2->dst.u.all
125 && t1->dst.protonum == t2->dst.protonum;
126}
127
128static inline int ip_ct_tuple_equal(const struct ip_conntrack_tuple *t1,
129 const struct ip_conntrack_tuple *t2)
130{
131 return ip_ct_tuple_src_equal(t1, t2) && ip_ct_tuple_dst_equal(t1, t2);
132}
133
134static inline int ip_ct_tuple_mask_cmp(const struct ip_conntrack_tuple *t,
135 const struct ip_conntrack_tuple *tuple,
136 const struct ip_conntrack_tuple *mask)
137{
138 return !(((t->src.ip ^ tuple->src.ip) & mask->src.ip)
139 || ((t->dst.ip ^ tuple->dst.ip) & mask->dst.ip)
140 || ((t->src.u.all ^ tuple->src.u.all) & mask->src.u.all)
141 || ((t->dst.u.all ^ tuple->dst.u.all) & mask->dst.u.all)
142 || ((t->dst.protonum ^ tuple->dst.protonum)
143 & mask->dst.protonum));
144}
145
146#endif /* _IP_CONNTRACK_TUPLE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat.h b/include/linux/netfilter_ipv4/ip_nat.h
deleted file mode 100644
index bbca89aab813..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat.h
+++ /dev/null
@@ -1,79 +0,0 @@
1#ifndef _IP_NAT_H
2#define _IP_NAT_H
3#include <linux/netfilter_ipv4.h>
4#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
5
6#define IP_NAT_MAPPING_TYPE_MAX_NAMELEN 16
7
8enum ip_nat_manip_type
9{
10 IP_NAT_MANIP_SRC,
11 IP_NAT_MANIP_DST
12};
13
14/* SRC manip occurs POST_ROUTING or LOCAL_IN */
15#define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING && (hooknum) != NF_IP_LOCAL_IN)
16
17#define IP_NAT_RANGE_MAP_IPS 1
18#define IP_NAT_RANGE_PROTO_SPECIFIED 2
19#define IP_NAT_RANGE_PROTO_RANDOM 4 /* add randomness to "port" selection */
20
21/* NAT sequence number modifications */
22struct ip_nat_seq {
23 /* position of the last TCP sequence number
24 * modification (if any) */
25 u_int32_t correction_pos;
26 /* sequence number offset before and after last modification */
27 int16_t offset_before, offset_after;
28};
29
30/* Single range specification. */
31struct ip_nat_range
32{
33 /* Set to OR of flags above. */
34 unsigned int flags;
35
36 /* Inclusive: network order. */
37 __be32 min_ip, max_ip;
38
39 /* Inclusive: network order */
40 union ip_conntrack_manip_proto min, max;
41};
42
43/* For backwards compat: don't use in modern code. */
44struct ip_nat_multi_range_compat
45{
46 unsigned int rangesize; /* Must be 1. */
47
48 /* hangs off end. */
49 struct ip_nat_range range[1];
50};
51
52#ifdef __KERNEL__
53#include <linux/list.h>
54
55/* Protects NAT hash tables, and NAT-private part of conntracks. */
56extern rwlock_t ip_nat_lock;
57
58/* The structure embedded in the conntrack structure. */
59struct ip_nat_info
60{
61 struct list_head bysource;
62 struct ip_nat_seq seq[IP_CT_DIR_MAX];
63};
64
65struct ip_conntrack;
66
67/* Set up the info structure to map into this range. */
68extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack,
69 const struct ip_nat_range *range,
70 unsigned int hooknum);
71
72/* Is this tuple already taken? (not by us)*/
73extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple,
74 const struct ip_conntrack *ignored_conntrack);
75
76#else /* !__KERNEL__: iptables wants this to compile. */
77#define ip_nat_multi_range ip_nat_multi_range_compat
78#endif /*__KERNEL__*/
79#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat_core.h b/include/linux/netfilter_ipv4/ip_nat_core.h
deleted file mode 100644
index 60566f9fd7b3..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_core.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _IP_NAT_CORE_H
2#define _IP_NAT_CORE_H
3#include <linux/list.h>
4#include <linux/netfilter_ipv4/ip_conntrack.h>
5
6/* This header used to share core functionality between the standalone
7 NAT module, and the compatibility layer's use of NAT for masquerading. */
8
9extern unsigned int ip_nat_packet(struct ip_conntrack *ct,
10 enum ip_conntrack_info conntrackinfo,
11 unsigned int hooknum,
12 struct sk_buff **pskb);
13
14extern int ip_nat_icmp_reply_translation(struct ip_conntrack *ct,
15 enum ip_conntrack_info ctinfo,
16 unsigned int hooknum,
17 struct sk_buff **pskb);
18#endif /* _IP_NAT_CORE_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_helper.h b/include/linux/netfilter_ipv4/ip_nat_helper.h
deleted file mode 100644
index bf9cb105c885..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_helper.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef _IP_NAT_HELPER_H
2#define _IP_NAT_HELPER_H
3/* NAT protocol helper routines. */
4
5#include <linux/netfilter_ipv4/ip_conntrack.h>
6#include <linux/module.h>
7
8struct sk_buff;
9
10/* These return true or false. */
11extern int ip_nat_mangle_tcp_packet(struct sk_buff **skb,
12 struct ip_conntrack *ct,
13 enum ip_conntrack_info ctinfo,
14 unsigned int match_offset,
15 unsigned int match_len,
16 const char *rep_buffer,
17 unsigned int rep_len);
18extern int ip_nat_mangle_udp_packet(struct sk_buff **skb,
19 struct ip_conntrack *ct,
20 enum ip_conntrack_info ctinfo,
21 unsigned int match_offset,
22 unsigned int match_len,
23 const char *rep_buffer,
24 unsigned int rep_len);
25extern int ip_nat_seq_adjust(struct sk_buff **pskb,
26 struct ip_conntrack *ct,
27 enum ip_conntrack_info ctinfo);
28
29/* Setup NAT on this expected conntrack so it follows master, but goes
30 * to port ct->master->saved_proto. */
31extern void ip_nat_follow_master(struct ip_conntrack *ct,
32 struct ip_conntrack_expect *this);
33#endif
diff --git a/include/linux/netfilter_ipv4/ip_nat_pptp.h b/include/linux/netfilter_ipv4/ip_nat_pptp.h
deleted file mode 100644
index 36668bf0f373..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_pptp.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/* PPTP constants and structs */
2#ifndef _NAT_PPTP_H
3#define _NAT_PPTP_H
4
5/* conntrack private data */
6struct ip_nat_pptp {
7 __be16 pns_call_id; /* NAT'ed PNS call id */
8 __be16 pac_call_id; /* NAT'ed PAC call id */
9};
10
11#endif /* _NAT_PPTP_H */
diff --git a/include/linux/netfilter_ipv4/ip_nat_protocol.h b/include/linux/netfilter_ipv4/ip_nat_protocol.h
deleted file mode 100644
index 612a43614e7b..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_protocol.h
+++ /dev/null
@@ -1,74 +0,0 @@
1/* Header for use in defining a given protocol. */
2#ifndef _IP_NAT_PROTOCOL_H
3#define _IP_NAT_PROTOCOL_H
4#include <linux/init.h>
5#include <linux/list.h>
6
7#include <linux/netfilter_ipv4/ip_nat.h>
8#include <linux/netfilter/nfnetlink_conntrack.h>
9
10struct iphdr;
11struct ip_nat_range;
12
13struct ip_nat_protocol
14{
15 /* Protocol name */
16 const char *name;
17
18 /* Protocol number. */
19 unsigned int protonum;
20
21 struct module *me;
22
23 /* Translate a packet to the target according to manip type.
24 Return true if succeeded. */
25 int (*manip_pkt)(struct sk_buff **pskb,
26 unsigned int iphdroff,
27 const struct ip_conntrack_tuple *tuple,
28 enum ip_nat_manip_type maniptype);
29
30 /* Is the manipable part of the tuple between min and max incl? */
31 int (*in_range)(const struct ip_conntrack_tuple *tuple,
32 enum ip_nat_manip_type maniptype,
33 const union ip_conntrack_manip_proto *min,
34 const union ip_conntrack_manip_proto *max);
35
36 /* Alter the per-proto part of the tuple (depending on
37 maniptype), to give a unique tuple in the given range if
38 possible; return false if not. Per-protocol part of tuple
39 is initialized to the incoming packet. */
40 int (*unique_tuple)(struct ip_conntrack_tuple *tuple,
41 const struct ip_nat_range *range,
42 enum ip_nat_manip_type maniptype,
43 const struct ip_conntrack *conntrack);
44
45 int (*range_to_nfattr)(struct sk_buff *skb,
46 const struct ip_nat_range *range);
47
48 int (*nfattr_to_range)(struct nfattr *tb[],
49 struct ip_nat_range *range);
50};
51
52/* Protocol registration. */
53extern int ip_nat_protocol_register(struct ip_nat_protocol *proto);
54extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto);
55
56extern struct ip_nat_protocol *ip_nat_proto_find_get(u_int8_t protocol);
57extern void ip_nat_proto_put(struct ip_nat_protocol *proto);
58
59/* Built-in protocols. */
60extern struct ip_nat_protocol ip_nat_protocol_tcp;
61extern struct ip_nat_protocol ip_nat_protocol_udp;
62extern struct ip_nat_protocol ip_nat_protocol_icmp;
63extern struct ip_nat_protocol ip_nat_unknown_protocol;
64
65extern int init_protocols(void) __init;
66extern void cleanup_protocols(void);
67extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum);
68
69extern int ip_nat_port_range_to_nfattr(struct sk_buff *skb,
70 const struct ip_nat_range *range);
71extern int ip_nat_port_nfattr_to_range(struct nfattr *tb[],
72 struct ip_nat_range *range);
73
74#endif /*_IP_NAT_PROTO_H*/
diff --git a/include/linux/netfilter_ipv4/ip_nat_rule.h b/include/linux/netfilter_ipv4/ip_nat_rule.h
deleted file mode 100644
index 73b9552e6a89..000000000000
--- a/include/linux/netfilter_ipv4/ip_nat_rule.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _IP_NAT_RULE_H
2#define _IP_NAT_RULE_H
3#include <linux/netfilter_ipv4/ip_conntrack.h>
4#include <linux/netfilter_ipv4/ip_tables.h>
5#include <linux/netfilter_ipv4/ip_nat.h>
6
7#ifdef __KERNEL__
8
9extern int ip_nat_rule_init(void) __init;
10extern void ip_nat_rule_cleanup(void);
11extern int ip_nat_rule_find(struct sk_buff **pskb,
12 unsigned int hooknum,
13 const struct net_device *in,
14 const struct net_device *out,
15 struct ip_conntrack *ct,
16 struct ip_nat_info *info);
17
18extern unsigned int
19alloc_null_binding(struct ip_conntrack *conntrack,
20 struct ip_nat_info *info,
21 unsigned int hooknum);
22
23extern unsigned int
24alloc_null_binding_confirmed(struct ip_conntrack *conntrack,
25 struct ip_nat_info *info,
26 unsigned int hooknum);
27#endif
28#endif /* _IP_NAT_RULE_H */
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h
index cc4c0b2269af..be6e682a85ec 100644
--- a/include/linux/netfilter_ipv4/ipt_SAME.h
+++ b/include/linux/netfilter_ipv4/ipt_SAME.h
@@ -13,7 +13,7 @@ struct ipt_same_info
13 u_int32_t *iparray; 13 u_int32_t *iparray;
14 14
15 /* hangs off end. */ 15 /* hangs off end. */
16 struct ip_nat_range range[IPT_SAME_MAX_RANGE]; 16 struct nf_nat_range range[IPT_SAME_MAX_RANGE];
17}; 17};
18 18
19#endif /*_IPT_SAME_H*/ 19#endif /*_IPT_SAME_H*/
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 2a20f488ac1b..f41688f56632 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -138,6 +138,11 @@ struct nlattr
138#include <linux/capability.h> 138#include <linux/capability.h>
139#include <linux/skbuff.h> 139#include <linux/skbuff.h>
140 140
141static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)
142{
143 return (struct nlmsghdr *)skb->data;
144}
145
141struct netlink_skb_parms 146struct netlink_skb_parms
142{ 147{
143 struct ucred creds; /* Skb credentials */ 148 struct ucred creds; /* Skb credentials */
@@ -152,7 +157,10 @@ struct netlink_skb_parms
152#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) 157#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds)
153 158
154 159
155extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module); 160extern struct sock *netlink_kernel_create(int unit, unsigned int groups,
161 void (*input)(struct sock *sk, int len),
162 struct mutex *cb_mutex,
163 struct module *module);
156extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 164extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
157extern int netlink_has_listeners(struct sock *sk, unsigned int group); 165extern int netlink_has_listeners(struct sock *sk, unsigned int group);
158extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 166extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
@@ -171,9 +179,16 @@ int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol);
171 179
172/* 180/*
173 * skb should fit one page. This choice is good for headerless malloc. 181 * skb should fit one page. This choice is good for headerless malloc.
182 * But we should limit to 8K so that userspace does not have to
183 * use enormous buffer sizes on recvmsg() calls just to avoid
184 * MSG_TRUNC when PAGE_SIZE is very large.
174 */ 185 */
175#define NLMSG_GOODORDER 0 186#if PAGE_SIZE < 8192UL
176#define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER)) 187#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(PAGE_SIZE)
188#else
189#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(8192UL)
190#endif
191
177#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN) 192#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN)
178 193
179 194
@@ -217,18 +232,6 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
217#define NLMSG_PUT(skb, pid, seq, type, len) \ 232#define NLMSG_PUT(skb, pid, seq, type, len) \
218 NLMSG_NEW(skb, pid, seq, type, len, 0) 233 NLMSG_NEW(skb, pid, seq, type, len, 0)
219 234
220#define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \
221 NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \
222 (cb)->nlh->nlmsg_seq, type, len, flags)
223
224#define NLMSG_END(skb, nlh) \
225({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \
226 (skb)->len; })
227
228#define NLMSG_CANCEL(skb, nlh) \
229({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \
230 -1; })
231
232extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 235extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
233 struct nlmsghdr *nlh, 236 struct nlmsghdr *nlh,
234 int (*dump)(struct sk_buff *skb, struct netlink_callback*), 237 int (*dump)(struct sk_buff *skb, struct netlink_callback*),
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
new file mode 100644
index 000000000000..9a30ba2ca75e
--- /dev/null
+++ b/include/linux/nl80211.h
@@ -0,0 +1,38 @@
1#ifndef __LINUX_NL80211_H
2#define __LINUX_NL80211_H
3/*
4 * 802.11 netlink interface public header
5 *
6 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
7 */
8
9/**
10 * enum nl80211_iftype - (virtual) interface types
11 * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides
12 * @NL80211_IFTYPE_ADHOC: independent BSS member
13 * @NL80211_IFTYPE_STATION: managed BSS member
14 * @NL80211_IFTYPE_AP: access point
15 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
16 * @NL80211_IFTYPE_WDS: wireless distribution interface
17 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
18 * @__NL80211_IFTYPE_AFTER_LAST: internal use
19 *
20 * These values are used with the NL80211_ATTR_IFTYPE
21 * to set the type of an interface.
22 *
23 */
24enum nl80211_iftype {
25 NL80211_IFTYPE_UNSPECIFIED,
26 NL80211_IFTYPE_ADHOC,
27 NL80211_IFTYPE_STATION,
28 NL80211_IFTYPE_AP,
29 NL80211_IFTYPE_AP_VLAN,
30 NL80211_IFTYPE_WDS,
31 NL80211_IFTYPE_MONITOR,
32
33 /* keep last */
34 __NL80211_IFTYPE_AFTER_LAST
35};
36#define NL80211_IFTYPE_MAX (__NL80211_IFTYPE_AFTER_LAST - 1)
37
38#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 4a629ea70cc4..1fae30af91f3 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -574,13 +574,6 @@ extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, in
574#define rtattr_parse_nested(tb, max, rta) \ 574#define rtattr_parse_nested(tb, max, rta) \
575 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta))) 575 rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta)))
576 576
577struct rtnetlink_link
578{
579 int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr);
580 int (*dumpit)(struct sk_buff *, struct netlink_callback *cb);
581};
582
583extern struct rtnetlink_link * rtnetlink_links[NPROTO];
584extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); 577extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo);
585extern int rtnl_unicast(struct sk_buff *skb, u32 pid); 578extern int rtnl_unicast(struct sk_buff *skb, u32 pid);
586extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, 579extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group,
@@ -605,7 +598,7 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
605 598
606#define RTA_PUT_NOHDR(skb, attrlen, data) \ 599#define RTA_PUT_NOHDR(skb, attrlen, data) \
607({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \ 600({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \
608 memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \ 601 memset(skb_tail_pointer(skb) - (RTA_ALIGN(attrlen) - attrlen), 0, \
609 RTA_ALIGN(attrlen) - attrlen); }) 602 RTA_ALIGN(attrlen) - attrlen); })
610 603
611#define RTA_PUT_U8(skb, attrtype, value) \ 604#define RTA_PUT_U8(skb, attrtype, value) \
@@ -637,12 +630,12 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
637 RTA_PUT(skb, attrtype, 0, NULL); 630 RTA_PUT(skb, attrtype, 0, NULL);
638 631
639#define RTA_NEST(skb, type) \ 632#define RTA_NEST(skb, type) \
640({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \ 633({ struct rtattr *__start = (struct rtattr *)skb_tail_pointer(skb); \
641 RTA_PUT(skb, type, 0, NULL); \ 634 RTA_PUT(skb, type, 0, NULL); \
642 __start; }) 635 __start; })
643 636
644#define RTA_NEST_END(skb, start) \ 637#define RTA_NEST_END(skb, start) \
645({ (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \ 638({ (start)->rta_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
646 (skb)->len; }) 639 (skb)->len; })
647 640
648#define RTA_NEST_CANCEL(skb, start) \ 641#define RTA_NEST_CANCEL(skb, start) \
diff --git a/include/linux/rxrpc.h b/include/linux/rxrpc.h
new file mode 100644
index 000000000000..f7b826b565c7
--- /dev/null
+++ b/include/linux/rxrpc.h
@@ -0,0 +1,62 @@
1/* AF_RXRPC parameters
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_RXRPC_H
13#define _LINUX_RXRPC_H
14
15#include <linux/in.h>
16#include <linux/in6.h>
17
18/*
19 * RxRPC socket address
20 */
21struct sockaddr_rxrpc {
22 sa_family_t srx_family; /* address family */
23 u16 srx_service; /* service desired */
24 u16 transport_type; /* type of transport socket (SOCK_DGRAM) */
25 u16 transport_len; /* length of transport address */
26 union {
27 sa_family_t family; /* transport address family */
28 struct sockaddr_in sin; /* IPv4 transport address */
29 struct sockaddr_in6 sin6; /* IPv6 transport address */
30 } transport;
31};
32
33/*
34 * RxRPC socket options
35 */
36#define RXRPC_SECURITY_KEY 1 /* [clnt] set client security key */
37#define RXRPC_SECURITY_KEYRING 2 /* [srvr] set ring of server security keys */
38#define RXRPC_EXCLUSIVE_CONNECTION 3 /* [clnt] use exclusive RxRPC connection */
39#define RXRPC_MIN_SECURITY_LEVEL 4 /* minimum security level */
40
41/*
42 * RxRPC control messages
43 * - terminal messages mean that a user call ID tag can be recycled
44 */
45#define RXRPC_USER_CALL_ID 1 /* user call ID specifier */
46#define RXRPC_ABORT 2 /* abort request / notification [terminal] */
47#define RXRPC_ACK 3 /* [Server] RPC op final ACK received [terminal] */
48#define RXRPC_NET_ERROR 5 /* network error received [terminal] */
49#define RXRPC_BUSY 6 /* server busy received [terminal] */
50#define RXRPC_LOCAL_ERROR 7 /* local error generated [terminal] */
51#define RXRPC_NEW_CALL 8 /* [Server] new incoming call notification */
52#define RXRPC_ACCEPT 9 /* [Server] accept request */
53
54/*
55 * RxRPC security levels
56 */
57#define RXRPC_SECURITY_PLAIN 0 /* plain secure-checksummed packets only */
58#define RXRPC_SECURITY_AUTH 1 /* authenticated packets */
59#define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */
60
61
62#endif /* _LINUX_RXRPC_H */
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index d4f86560bfff..d70df61a029f 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -63,6 +63,15 @@ typedef struct sctphdr {
63 __be32 checksum; 63 __be32 checksum;
64} __attribute__((packed)) sctp_sctphdr_t; 64} __attribute__((packed)) sctp_sctphdr_t;
65 65
66#ifdef __KERNEL__
67#include <linux/skbuff.h>
68
69static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
70{
71 return (struct sctphdr *)skb_transport_header(skb);
72}
73#endif
74
66/* Section 3.2. Chunk Field Descriptions. */ 75/* Section 3.2. Chunk Field Descriptions. */
67typedef struct sctp_chunkhdr { 76typedef struct sctp_chunkhdr {
68 __u8 type; 77 __u8 type;
diff --git a/include/linux/sdla_fr.h b/include/linux/sdla_fr.h
deleted file mode 100644
index cdfa77fcb06b..000000000000
--- a/include/linux/sdla_fr.h
+++ /dev/null
@@ -1,638 +0,0 @@
1/*****************************************************************************
2* sdla_fr.h Sangoma frame relay firmware API definitions.
3*
4* Author: Gideon Hack
5* Nenad Corbic <ncorbic@sangoma.com>
6*
7* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
8*
9* This program is free software; you can redistribute it and/or
10* modify it under the terms of the GNU General Public License
11* as published by the Free Software Foundation; either version
12* 2 of the License, or (at your option) any later version.
13* ============================================================================
14* Oct 04, 1999 Gideon Hack Updated API structures
15* Jun 02, 1999 Gideon Hack Modifications for S514 support
16* Oct 12, 1997 Jaspreet Singh Added FR_READ_DLCI_IB_MAPPING
17* Jul 21, 1997 Jaspreet Singh Changed FRRES_TOO_LONG and FRRES_TOO_MANY to
18* 0x05 and 0x06 respectively.
19* Dec 23, 1996 Gene Kozin v2.0
20* Apr 29, 1996 Gene Kozin v1.0 (merged version S502 & S508 definitions).
21* Sep 26, 1995 Gene Kozin Initial version.
22*****************************************************************************/
23#ifndef _SDLA_FR_H
24#define _SDLA_FR_H
25
26/*----------------------------------------------------------------------------
27 * Notes:
28 * ------
29 * 1. All structures defined in this file are byte-alined.
30 *
31 * Compiler Platform
32 * -------- --------
33 * GNU C Linux
34 */
35
36#ifndef PACKED
37# define PACKED __attribute__((packed))
38#endif /* PACKED */
39
40/* Adapter memory layout */
41#define FR_MB_VECTOR 0xE000 /* mailbox window vector */
42#define FR502_RX_VECTOR 0xA000 /* S502 direct receive window vector */
43#define FR502_MBOX_OFFS 0xF60 /* S502 mailbox offset */
44#define FR508_MBOX_OFFS 0 /* S508 mailbox offset */
45#define FR502_FLAG_OFFS 0x1FF0 /* S502 status flags offset */
46#define FR508_FLAG_OFFS 0x1000 /* S508 status flags offset */
47#define FR502_RXMB_OFFS 0x900 /* S502 direct receive mailbox offset */
48#define FR508_TXBC_OFFS 0x1100 /* S508 Tx buffer info offset */
49#define FR508_RXBC_OFFS 0x1120 /* S508 Rx buffer info offset */
50
51/* Important constants */
52#define FR502_MAX_DATA 4096 /* maximum data buffer length */
53#define FR508_MAX_DATA 4080 /* maximum data buffer length */
54#define MIN_LGTH_FR_DATA_CFG 300 /* min Information frame length
55(for configuration purposes) */
56#define FR_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* max Information frame length */
57
58#define HIGHEST_VALID_DLCI 991
59
60/****** Data Structures *****************************************************/
61
62/*----------------------------------------------------------------------------
63 * Frame relay command block.
64 */
65typedef struct fr_cmd
66{
67 unsigned char command PACKED; /* command code */
68 unsigned short length PACKED; /* length of data buffer */
69 unsigned char result PACKED; /* return code */
70 unsigned short dlci PACKED; /* DLCI number */
71 unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
72 unsigned short rxlost1 PACKED; /* frames discarded at int. level */
73 unsigned long rxlost2 PACKED; /* frames discarded at app. level */
74 unsigned char rsrv[2] PACKED; /* reserved for future use */
75} fr_cmd_t;
76
77/* 'command' field defines */
78#define FR_WRITE 0x01
79#define FR_READ 0x02
80#define FR_ISSUE_IS_FRAME 0x03
81#define FR_SET_CONFIG 0x10
82#define FR_READ_CONFIG 0x11
83#define FR_COMM_DISABLE 0x12
84#define FR_COMM_ENABLE 0x13
85#define FR_READ_STATUS 0x14
86#define FR_READ_STATISTICS 0x15
87#define FR_FLUSH_STATISTICS 0x16
88#define FR_LIST_ACTIVE_DLCI 0x17
89#define FR_FLUSH_DATA_BUFFERS 0x18
90#define FR_READ_ADD_DLC_STATS 0x19
91#define FR_ADD_DLCI 0x20
92#define FR_DELETE_DLCI 0x21
93#define FR_ACTIVATE_DLCI 0x22
94#define FR_DEACTIVATE_DLCI 0x22
95#define FR_READ_MODEM_STATUS 0x30
96#define FR_SET_MODEM_STATUS 0x31
97#define FR_READ_ERROR_STATS 0x32
98#define FR_FLUSH_ERROR_STATS 0x33
99#define FR_READ_DLCI_IB_MAPPING 0x34
100#define FR_READ_CODE_VERSION 0x40
101#define FR_SET_INTR_MODE 0x50
102#define FR_READ_INTR_MODE 0x51
103#define FR_SET_TRACE_CONFIG 0x60
104#define FR_FT1_STATUS_CTRL 0x80
105#define FR_SET_FT1_MODE 0x81
106
107/* Special UDP drivers management commands */
108#define FPIPE_ENABLE_TRACING 0x41
109#define FPIPE_DISABLE_TRACING 0x42
110#define FPIPE_GET_TRACE_INFO 0x43
111#define FPIPE_FT1_READ_STATUS 0x44
112#define FPIPE_DRIVER_STAT_IFSEND 0x45
113#define FPIPE_DRIVER_STAT_INTR 0x46
114#define FPIPE_DRIVER_STAT_GEN 0x47
115#define FPIPE_FLUSH_DRIVER_STATS 0x48
116#define FPIPE_ROUTER_UP_TIME 0x49
117
118/* 'result' field defines */
119#define FRRES_OK 0x00 /* command executed successfully */
120#define FRRES_DISABLED 0x01 /* communications not enabled */
121#define FRRES_INOPERATIVE 0x02 /* channel inoperative */
122#define FRRES_DLCI_INACTIVE 0x03 /* DLCI is inactive */
123#define FRRES_DLCI_INVALID 0x04 /* DLCI is not configured */
124#define FRRES_TOO_LONG 0x05
125#define FRRES_TOO_MANY 0x06
126#define FRRES_CIR_OVERFLOW 0x07 /* Tx throughput has exceeded CIR */
127#define FRRES_BUFFER_OVERFLOW 0x08
128#define FRRES_MODEM_FAILURE 0x10 /* DCD and/or CTS dropped */
129#define FRRES_CHANNEL_DOWN 0x11 /* channel became inoperative */
130#define FRRES_CHANNEL_UP 0x12 /* channel became operative */
131#define FRRES_DLCI_CHANGE 0x13 /* DLCI status (or number) changed */
132#define FRRES_DLCI_MISMATCH 0x14
133#define FRRES_INVALID_CMD 0x1F /* invalid command */
134
135/* 'attr' field defines */
136#define FRATTR_
137
138/*----------------------------------------------------------------------------
139 * Frame relay mailbox.
140 * This structure is located at offset FR50?_MBOX_OFFS into FR_MB_VECTOR.
141 * For S502 it is also located at offset FR502_RXMB_OFFS into
142 * FR502_RX_VECTOR.
143 */
144typedef struct fr_mbox
145{
146 unsigned char opflag PACKED; /* 00h: execution flag */
147 fr_cmd_t cmd PACKED; /* 01h: command block */
148 unsigned char data[1] PACKED; /* 10h: variable length data buffer */
149} fr_mbox_t;
150
151/*----------------------------------------------------------------------------
152 * S502 frame relay status flags.
153 * This structure is located at offset FR502_FLAG_OFFS into FR_MB_VECTOR.
154 */
155typedef struct fr502_flags
156{
157 unsigned char rsrv1[1] PACKED; /* 00h: */
158 unsigned char tx_ready PACKED; /* 01h: Tx buffer available */
159 unsigned char rx_ready PACKED; /* 02h: Rx frame available */
160 unsigned char event PACKED; /* 03h: asynchronous event */
161 unsigned char mstatus PACKED; /* 04h: modem status */
162 unsigned char rsrv2[8] PACKED; /* 05h: */
163 unsigned char iflag PACKED; /* 0Dh: interrupt flag */
164 unsigned char imask PACKED; /* 0Eh: interrupt mask */
165} fr502_flags_t;
166
167/*----------------------------------------------------------------------------
168 * S508 frame relay status flags.
169 * This structure is located at offset FR508_FLAG_OFFS into FR_MB_VECTOR.
170 */
171typedef struct fr508_flags
172{
173 unsigned char rsrv1[3] PACKED; /* 00h: reserved */
174 unsigned char event PACKED; /* 03h: asynchronous event */
175 unsigned char mstatus PACKED; /* 04h: modem status */
176 unsigned char rsrv2[11] PACKED; /* 05h: reserved */
177 unsigned char iflag PACKED; /* 10h: interrupt flag */
178 unsigned char imask PACKED; /* 11h: interrupt mask */
179 unsigned long tse_offs PACKED; /* 12h: Tx status element */
180 unsigned short dlci PACKED; /* 16h: DLCI NUMBER */
181} fr508_flags_t;
182
183/* 'event' field defines */
184#define FR_EVENT_STATUS 0x01 /* channel status change */
185#define FR_EVENT_DLC_STATUS 0x02 /* DLC status change */
186#define FR_EVENT_BAD_DLCI 0x04 /* FSR included wrong DLCI */
187#define FR_EVENT_LINK_DOWN 0x40 /* DCD or CTS low */
188
189/* 'mstatus' field defines */
190#define FR_MDM_DCD 0x08 /* mdm_status: DCD */
191#define FR_MDM_CTS 0x20 /* mdm_status: CTS */
192
193/* 'iflag' & 'imask' fields defines */
194#define FR_INTR_RXRDY 0x01 /* Rx ready */
195#define FR_INTR_TXRDY 0x02 /* Tx ready */
196#define FR_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */
197#define FR_INTR_READY 0x08 /* interface command completed */
198#define FR_INTR_DLC 0x10 /* DLC status change */
199#define FR_INTR_TIMER 0x20 /* millisecond timer */
200#define FR_INTR_TX_MULT_DLCIs 0x80 /* Tx interrupt on multiple DLCIs */
201
202
203/*----------------------------------------------------------------------------
204 * Receive Buffer Configuration Info. S508 only!
205 * This structure is located at offset FR508_RXBC_OFFS into FR_MB_VECTOR.
206 */
207typedef struct fr_buf_info
208{
209 unsigned short rse_num PACKED; /* 00h: number of status elements */
210 unsigned long rse_base PACKED; /* 02h: receive status array base */
211 unsigned long rse_next PACKED; /* 06h: next status element */
212 unsigned long buf_base PACKED; /* 0Ah: rotational buffer base */
213 unsigned short reserved PACKED; /* 0Eh: */
214 unsigned long buf_top PACKED; /* 10h: rotational buffer top */
215} fr_buf_info_t;
216
217/*----------------------------------------------------------------------------
218 * Buffer Status Element. S508 only!
219 * Array of structures of this type is located at offset defined by the
220 * 'rse_base' field of the frBufInfo_t structure into absolute adapter
221 * memory address space.
222 */
223typedef struct fr_rx_buf_ctl
224{
225 unsigned char flag PACKED; /* 00h: ready flag */
226 unsigned short length PACKED; /* 01h: frame length */
227 unsigned short dlci PACKED; /* 03h: DLCI */
228 unsigned char attr PACKED; /* 05h: FECN/BECN/DE/CR */
229 unsigned short tmstamp PACKED; /* 06h: time stamp */
230 unsigned short rsrv[2] PACKED; /* 08h: */
231 unsigned long offset PACKED; /* 0Ch: buffer absolute address */
232} fr_rx_buf_ctl_t;
233
234typedef struct fr_tx_buf_ctl
235{
236 unsigned char flag PACKED; /* 00h: ready flag */
237 unsigned short rsrv0[2] PACKED; /* 01h: */
238 unsigned short length PACKED; /* 05h: frame length */
239 unsigned short dlci PACKED; /* 07h: DLCI */
240 unsigned char attr PACKED; /* 09h: FECN/BECN/DE/CR */
241 unsigned short rsrv1 PACKED; /* 0Ah: */
242 unsigned long offset PACKED; /* 0Ch: buffer absolute address */
243} fr_tx_buf_ctl_t;
244
245/*----------------------------------------------------------------------------
246 * Global Configuration Block. Passed to FR_SET_CONFIG command when dlci == 0.
247 */
248typedef struct fr_conf
249{
250 unsigned short station PACKED; /* 00h: CPE/Node */
251 unsigned short options PACKED; /* 02h: configuration options */
252 unsigned short kbps PACKED; /* 04h: baud rate in kbps */
253 unsigned short port PACKED; /* 06h: RS-232/V.35 */
254 unsigned short mtu PACKED; /* 08h: max. transmit length */
255 unsigned short t391 PACKED; /* 0Ah: */
256 unsigned short t392 PACKED; /* 0Ch: */
257 unsigned short n391 PACKED; /* 0Eh: */
258 unsigned short n392 PACKED; /* 10h: */
259 unsigned short n393 PACKED; /* 12h: */
260 unsigned short cir_fwd PACKED; /* 14h: */
261 unsigned short bc_fwd PACKED; /* 16h: */
262 unsigned short be_fwd PACKED; /* 18h: */
263 unsigned short cir_bwd PACKED; /* 1Ah: */
264 unsigned short bc_bwd PACKED; /* 1Ch: */
265 unsigned short be_bwd PACKED; /* 1Eh: */
266 unsigned short dlci[0] PACKED; /* 20h: */
267} fr_conf_t;
268
269/* 'station_type' defines */
270#define FRCFG_STATION_CPE 0
271#define FRCFG_STATION_NODE 1
272
273/* 'conf_flags' defines */
274#define FRCFG_IGNORE_TX_CIR 0x0001
275#define FRCFG_IGNORE_RX_CIR 0x0002
276#define FRCFG_DONT_RETRANSMIT 0x0004
277#define FRCFG_IGNORE_CBS 0x0008
278#define FRCFG_THROUGHPUT 0x0010 /* enable throughput calculation */
279#define FRCFG_DIRECT_RX 0x0080 /* enable direct receive buffer */
280#define FRCFG_AUTO_CONFIG 0x8000 /* enable auto DLCI configuration */
281
282/* 'baud_rate' defines */
283#define FRCFG_BAUD_1200 12
284#define FRCFG_BAUD_2400 24
285#define FRCFG_BAUD_4800 48
286#define FRCFG_BAUD_9600 96
287#define FRCFG_BAUD_19200 19
288#define FRCFG_BAUD_38400 38
289#define FRCFG_BAUD_56000 56
290#define FRCFG_BAUD_64000 64
291#define FRCFG_BAUD_128000 128
292
293/* 'port_mode' defines */
294#define FRCFG_MODE_EXT_CLK 0x0000
295#define FRCFG_MODE_INT_CLK 0x0001
296#define FRCFG_MODE_V35 0x0000 /* S508 only */
297#define FRCFG_MODE_RS232 0x0002 /* S508 only */
298
299/* defines for line tracing */
300
301/* the line trace status element presented by the frame relay code */
302typedef struct {
303 unsigned char flag PACKED; /* ready flag */
304 unsigned short length PACKED; /* trace length */
305 unsigned char rsrv0[2] PACKED; /* reserved */
306 unsigned char attr PACKED; /* trace attributes */
307 unsigned short tmstamp PACKED; /* time stamp */
308 unsigned char rsrv1[4] PACKED; /* reserved */
309 unsigned long offset PACKED; /* buffer absolute address */
310} fr_trc_el_t;
311
312typedef struct {
313 unsigned char status PACKED; /* status flag */
314 unsigned char data_passed PACKED; /* 0 if no data passed, 1 if */
315 /* data passed */
316 unsigned short length PACKED; /* frame length */
317 unsigned short tmstamp PACKED; /* time stamp */
318} fpipemon_trc_hdr_t;
319
320typedef struct {
321 fpipemon_trc_hdr_t fpipemon_trc_hdr PACKED;
322 unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME] PACKED;
323} fpipemon_trc_t;
324
325/* bit settings for the 'status' byte - note that bits 1, 2 and 3 are used */
326/* for returning the number of frames being passed to fpipemon */
327#define TRC_OUTGOING_FRM 0x01
328#define TRC_ABORT_ERROR 0x10
329#define TRC_CRC_ERROR 0x20
330#define TRC_OVERRUN_ERROR 0x40
331#define MORE_TRC_DATA 0x80
332
333#define MAX_FRMS_TRACED 0x07
334
335#define NO_TRC_ELEMENTS_OFF 0x9000
336#define BASE_TRC_ELEMENTS_OFF 0x9002
337#define TRC_ACTIVE 0x01
338#define FLUSH_TRC_BUFFERS 0x02
339#define FLUSH_TRC_STATISTICS 0x04
340#define TRC_SIGNALLING_FRMS 0x10
341#define TRC_INFO_FRMS 0x20
342#define ACTIVATE_TRC (TRC_ACTIVE | TRC_SIGNALLING_FRMS | TRC_INFO_FRMS)
343#define RESET_TRC (FLUSH_TRC_BUFFERS | FLUSH_TRC_STATISTICS)
344
345/*----------------------------------------------------------------------------
346 * Channel configuration.
347 * This structure is passed to the FR_SET_CONFIG command when dlci != 0.
348 */
349typedef struct fr_dlc_conf
350{
351 unsigned short conf_flags PACKED; /* 00h: configuration bits */
352 unsigned short cir_fwd PACKED; /* 02h: */
353 unsigned short bc_fwd PACKED; /* 04h: */
354 unsigned short be_fwd PACKED; /* 06h: */
355 unsigned short cir_bwd PACKED; /* 08h: */
356 unsigned short bc_bwd PACKED; /* 0Ah: */
357 unsigned short be_bwd PACKED; /* 0Ch: */
358} fr_dlc_conf_t;
359
360/*----------------------------------------------------------------------------
361 * S502 interrupt mode control block.
362 * This structure is passed to the FR_SET_INTR_FLAGS and returned by the
363 * FR_READ_INTR_FLAGS commands.
364 */
365typedef struct fr502_intr_ctl
366{
367 unsigned char mode PACKED; /* 00h: interrupt enable flags */
368 unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
369} fr502_intr_ctl_t;
370
371/*----------------------------------------------------------------------------
372 * S508 interrupt mode control block.
373 * This structure is passed to the FR_SET_INTR_FLAGS and returned by the
374 * FR_READ_INTR_FLAGS commands.
375 */
376typedef struct fr508_intr_ctl
377{
378 unsigned char mode PACKED; /* 00h: interrupt enable flags */
379 unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
380 unsigned char irq PACKED; /* 03h: IRQ level to activate */
381 unsigned char flags PACKED; /* 04h: ?? */
382 unsigned short timeout PACKED; /* 05h: ms, for timer interrupt */
383} fr508_intr_ctl_t;
384
385/*----------------------------------------------------------------------------
386 * Channel status.
387 * This structure is returned by the FR_READ_STATUS command.
388 */
389typedef struct fr_dlc_Status
390{
391 unsigned char status PACKED; /* 00h: link/DLCI status */
392 struct
393 {
394 unsigned short dlci PACKED; /* 01h: DLCI number */
395 unsigned char status PACKED; /* 03h: DLCI status */
396 } circuit[1] PACKED;
397} fr_dlc_status_t;
398
399/* 'status' defines */
400#define FR_LINK_INOPER 0x00 /* for global status (DLCI == 0) */
401#define FR_LINK_OPER 0x01
402#define FR_DLCI_DELETED 0x01 /* for circuit status (DLCI != 0) */
403#define FR_DLCI_ACTIVE 0x02
404#define FR_DLCI_WAITING 0x04
405#define FR_DLCI_NEW 0x08
406#define FR_DLCI_REPORT 0x40
407
408/*----------------------------------------------------------------------------
409 * Global Statistics Block.
410 * This structure is returned by the FR_READ_STATISTICS command when
411 * dcli == 0.
412 */
413typedef struct fr_link_stat
414{
415 unsigned short rx_too_long PACKED; /* 00h: */
416 unsigned short rx_dropped PACKED; /* 02h: */
417 unsigned short rx_dropped2 PACKED; /* 04h: */
418 unsigned short rx_bad_dlci PACKED; /* 06h: */
419 unsigned short rx_bad_format PACKED; /* 08h: */
420 unsigned short retransmitted PACKED; /* 0Ah: */
421 unsigned short cpe_tx_FSE PACKED; /* 0Ch: */
422 unsigned short cpe_tx_LIV PACKED; /* 0Eh: */
423 unsigned short cpe_rx_FSR PACKED; /* 10h: */
424 unsigned short cpe_rx_LIV PACKED; /* 12h: */
425 unsigned short node_rx_FSE PACKED; /* 14h: */
426 unsigned short node_rx_LIV PACKED; /* 16h: */
427 unsigned short node_tx_FSR PACKED; /* 18h: */
428 unsigned short node_tx_LIV PACKED; /* 1Ah: */
429 unsigned short rx_ISF_err PACKED; /* 1Ch: */
430 unsigned short rx_unsolicited PACKED; /* 1Eh: */
431 unsigned short rx_SSN_err PACKED; /* 20h: */
432 unsigned short rx_RSN_err PACKED; /* 22h: */
433 unsigned short T391_timeouts PACKED; /* 24h: */
434 unsigned short T392_timeouts PACKED; /* 26h: */
435 unsigned short N392_reached PACKED; /* 28h: */
436 unsigned short cpe_SSN_RSN PACKED; /* 2Ah: */
437 unsigned short current_SSN PACKED; /* 2Ch: */
438 unsigned short current_RSN PACKED; /* 2Eh: */
439 unsigned short curreny_T391 PACKED; /* 30h: */
440 unsigned short current_T392 PACKED; /* 32h: */
441 unsigned short current_N392 PACKED; /* 34h: */
442 unsigned short current_N393 PACKED; /* 36h: */
443} fr_link_stat_t;
444
445/*----------------------------------------------------------------------------
446 * DLCI statistics.
447 * This structure is returned by the FR_READ_STATISTICS command when
448 * dlci != 0.
449 */
450typedef struct fr_dlci_stat
451{
452 unsigned long tx_frames PACKED; /* 00h: */
453 unsigned long tx_bytes PACKED; /* 04h: */
454 unsigned long rx_frames PACKED; /* 08h: */
455 unsigned long rx_bytes PACKED; /* 0Ch: */
456 unsigned long rx_dropped PACKED; /* 10h: */
457 unsigned long rx_inactive PACKED; /* 14h: */
458 unsigned long rx_exceed_CIR PACKED; /* 18h: */
459 unsigned long rx_DE_set PACKED; /* 1Ch: */
460 unsigned long tx_throughput PACKED; /* 20h: */
461 unsigned long tx_calc_timer PACKED; /* 24h: */
462 unsigned long rx_throughput PACKED; /* 28h: */
463 unsigned long rx_calc_timer PACKED; /* 2Ch: */
464} fr_dlci_stat_t;
465
466/*----------------------------------------------------------------------------
467 * Communications error statistics.
468 * This structure is returned by the FR_READ_ERROR_STATS command.
469 */
470typedef struct fr_comm_stat
471{
472 unsigned char rx_overruns PACKED; /* 00h: */
473 unsigned char rx_bad_crc PACKED; /* 01h: */
474 unsigned char rx_aborts PACKED; /* 02h: */
475 unsigned char rx_too_long PACKED; /* 03h: */
476 unsigned char tx_aborts PACKED; /* 04h: */
477 unsigned char tx_underruns PACKED; /* 05h: */
478 unsigned char tx_missed_undr PACKED; /* 06h: */
479 unsigned char dcd_dropped PACKED; /* 07h: */
480 unsigned char cts_dropped PACKED; /* 08h: */
481} fr_comm_stat_t;
482
483/*----------------------------------------------------------------------------
484 * Defines for the FR_ISSUE_IS_FRAME command.
485 */
486#define FR_ISF_LVE 2 /* issue Link Verification Enquiry */
487#define FR_ISF_FSE 3 /* issue Full Status Enquiry */
488
489/*----------------------------------------------------------------------------
490 * Frame Relay ARP Header -- Used for Dynamic route creation with InvARP
491 */
492
493typedef struct arphdr_fr
494 {
495 unsigned short ar_hrd PACKED; /* format of hardware addr */
496 unsigned short ar_pro PACKED; /* format of protocol addr */
497 unsigned char ar_hln PACKED; /* length of hardware addr */
498 unsigned char ar_pln PACKED; /* length of protocol addr */
499 unsigned short ar_op PACKED; /* ARP opcode */
500 unsigned short ar_sha PACKED; /* Sender DLCI addr 2 bytes */
501 unsigned long ar_sip PACKED; /* Sender IP addr 4 bytes */
502 unsigned short ar_tha PACKED; /* Target DLCI addr 2 bytes */
503 unsigned long ar_tip PACKED; /* Target IP addr 4 bytes */
504 } arphdr_fr_t;
505
506/*----------------------------------------------------------------------------
507 * Frame Relay RFC 1490 SNAP Header -- Used to check for ARP packets
508 */
509typedef struct arphdr_1490
510 {
511 unsigned char control PACKED; /* UI, etc... */
512 unsigned char pad PACKED; /* Pad */
513 unsigned char NLPID PACKED; /* SNAP */
514 unsigned char OUI[3] PACKED; /* Ethertype, etc... */
515 unsigned short PID PACKED; /* ARP, IP, etc... */
516 } arphdr_1490_t;
517
518/* UDP/IP packet (for UDP management) layout */
519
520/* The embedded control block for UDP mgmt
521 This is essentially a mailbox structure, without the large data field */
522
523typedef struct {
524 unsigned char opp_flag PACKED; /* the opp flag */
525 unsigned char command PACKED; /* command code */
526 unsigned short length PACKED; /* length of data buffer */
527 unsigned char result PACKED; /* return code */
528 unsigned short dlci PACKED; /* DLCI number */
529 unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
530 unsigned short rxlost1 PACKED; /* frames discarded at int. level */
531 unsigned long rxlost2 PACKED; /* frames discarded at app. level */
532 unsigned char rsrv[2] PACKED; /* reserved for future use */
533} cblock_t;
534
535
536/* UDP management packet layout (data area of ip packet) */
537
538typedef struct {
539 unsigned char control PACKED;
540 unsigned char NLPID PACKED;
541} fr_encap_hdr_t;
542
543typedef struct {
544// fr_encap_hdr_t fr_encap_hdr PACKED;
545 ip_pkt_t ip_pkt PACKED;
546 udp_pkt_t udp_pkt PACKED;
547 wp_mgmt_t wp_mgmt PACKED;
548 cblock_t cblock PACKED;
549 unsigned char data[4080] PACKED;
550} fr_udp_pkt_t;
551
552
553/* valid ip_protocol for UDP management */
554#define UDPMGMT_UDP_PROTOCOL 0x11
555
556#define UDPMGMT_FPIPE_SIGNATURE "FPIPE8ND"
557#define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS"
558
559/* values for request/reply byte */
560#define UDPMGMT_REQUEST 0x01
561#define UDPMGMT_REPLY 0x02
562#define UDP_OFFSET 12
563
564typedef struct {
565 unsigned long if_send_entry;
566 unsigned long if_send_skb_null;
567 unsigned long if_send_broadcast;
568 unsigned long if_send_multicast;
569 unsigned long if_send_critical_ISR;
570 unsigned long if_send_critical_non_ISR;
571 unsigned long if_send_busy;
572 unsigned long if_send_busy_timeout;
573 unsigned long if_send_DRVSTATS_request;
574 unsigned long if_send_FPIPE_request;
575 unsigned long if_send_wan_disconnected;
576 unsigned long if_send_dlci_disconnected;
577 unsigned long if_send_no_bfrs;
578 unsigned long if_send_adptr_bfrs_full;
579 unsigned long if_send_bfrs_passed_to_adptr;
580 unsigned long if_send_consec_send_fail;
581} drvstats_if_send_t;
582
583typedef struct {
584 unsigned long rx_intr_no_socket;
585 unsigned long rx_intr_dev_not_started;
586 unsigned long rx_intr_DRVSTATS_request;
587 unsigned long rx_intr_FPIPE_request;
588 unsigned long rx_intr_bfr_not_passed_to_stack;
589 unsigned long rx_intr_bfr_passed_to_stack;
590 } drvstats_rx_intr_t;
591
592typedef struct {
593 unsigned long UDP_FPIPE_mgmt_kmalloc_err;
594 unsigned long UDP_FPIPE_mgmt_direction_err;
595 unsigned long UDP_FPIPE_mgmt_adptr_type_err;
596 unsigned long UDP_FPIPE_mgmt_adptr_cmnd_OK;
597 unsigned long UDP_FPIPE_mgmt_adptr_cmnd_timeout;
598 unsigned long UDP_FPIPE_mgmt_adptr_send_passed;
599 unsigned long UDP_FPIPE_mgmt_adptr_send_failed;
600 unsigned long UDP_FPIPE_mgmt_not_passed_to_stack;
601 unsigned long UDP_FPIPE_mgmt_passed_to_stack;
602 unsigned long UDP_FPIPE_mgmt_no_socket;
603 unsigned long UDP_DRVSTATS_mgmt_kmalloc_err;
604 unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_OK;
605 unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_timeout;
606 unsigned long UDP_DRVSTATS_mgmt_adptr_send_passed;
607 unsigned long UDP_DRVSTATS_mgmt_adptr_send_failed;
608 unsigned long UDP_DRVSTATS_mgmt_not_passed_to_stack;
609 unsigned long UDP_DRVSTATS_mgmt_passed_to_stack;
610 unsigned long UDP_DRVSTATS_mgmt_no_socket;
611} drvstats_gen_t;
612
613typedef struct {
614 unsigned char attr PACKED;
615 unsigned short time_stamp PACKED;
616 unsigned char reserved[13] PACKED;
617} api_rx_hdr_t;
618
619typedef struct {
620 api_rx_hdr_t api_rx_hdr PACKED;
621 void * data PACKED;
622} api_rx_element_t;
623
624typedef struct {
625 unsigned char attr PACKED;
626 unsigned char reserved[15] PACKED;
627} api_tx_hdr_t;
628
629typedef struct {
630 api_tx_hdr_t api_tx_hdr PACKED;
631 void * data PACKED;
632} api_tx_element_t;
633
634#ifdef _MSC_
635# pragma pack()
636#endif
637#endif /* _SDLA_FR_H */
638
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 5992f65b4184..2694cb3ca763 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -27,20 +27,24 @@
27#include <net/checksum.h> 27#include <net/checksum.h>
28#include <linux/rcupdate.h> 28#include <linux/rcupdate.h>
29#include <linux/dmaengine.h> 29#include <linux/dmaengine.h>
30#include <linux/hrtimer.h>
30 31
31#define HAVE_ALLOC_SKB /* For the drivers to know */ 32#define HAVE_ALLOC_SKB /* For the drivers to know */
32#define HAVE_ALIGNABLE_SKB /* Ditto 8) */ 33#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
33 34
35/* Don't change this without changing skb_csum_unnecessary! */
34#define CHECKSUM_NONE 0 36#define CHECKSUM_NONE 0
35#define CHECKSUM_PARTIAL 1 37#define CHECKSUM_UNNECESSARY 1
36#define CHECKSUM_UNNECESSARY 2 38#define CHECKSUM_COMPLETE 2
37#define CHECKSUM_COMPLETE 3 39#define CHECKSUM_PARTIAL 3
38 40
39#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ 41#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \
40 ~(SMP_CACHE_BYTES - 1)) 42 ~(SMP_CACHE_BYTES - 1))
41#define SKB_MAX_ORDER(X, ORDER) (((PAGE_SIZE << (ORDER)) - (X) - \ 43#define SKB_WITH_OVERHEAD(X) \
42 sizeof(struct skb_shared_info)) & \ 44 (((X) - sizeof(struct skb_shared_info)) & \
43 ~(SMP_CACHE_BYTES - 1)) 45 ~(SMP_CACHE_BYTES - 1))
46#define SKB_MAX_ORDER(X, ORDER) \
47 SKB_WITH_OVERHEAD((PAGE_SIZE << (ORDER)) - (X))
44#define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0)) 48#define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0))
45#define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2)) 49#define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2))
46 50
@@ -66,8 +70,8 @@
66 * NONE: skb is checksummed by protocol or csum is not required. 70 * NONE: skb is checksummed by protocol or csum is not required.
67 * 71 *
68 * PARTIAL: device is required to csum packet as seen by hard_start_xmit 72 * PARTIAL: device is required to csum packet as seen by hard_start_xmit
69 * from skb->h.raw to the end and to record the checksum 73 * from skb->transport_header to the end and to record the checksum
70 * at skb->h.raw+skb->csum. 74 * at skb->transport_header + skb->csum.
71 * 75 *
72 * Device must show its capabilities in dev->features, set 76 * Device must show its capabilities in dev->features, set
73 * at device setup time. 77 * at device setup time.
@@ -83,12 +87,13 @@
83 */ 87 */
84 88
85struct net_device; 89struct net_device;
90struct scatterlist;
86 91
87#ifdef CONFIG_NETFILTER 92#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
88struct nf_conntrack { 93struct nf_conntrack {
89 atomic_t use; 94 atomic_t use;
90 void (*destroy)(struct nf_conntrack *);
91}; 95};
96#endif
92 97
93#ifdef CONFIG_BRIDGE_NETFILTER 98#ifdef CONFIG_BRIDGE_NETFILTER
94struct nf_bridge_info { 99struct nf_bridge_info {
@@ -103,8 +108,6 @@ struct nf_bridge_info {
103}; 108};
104#endif 109#endif
105 110
106#endif
107
108struct sk_buff_head { 111struct sk_buff_head {
109 /* These two members must be first. */ 112 /* These two members must be first. */
110 struct sk_buff *next; 113 struct sk_buff *next;
@@ -156,11 +159,6 @@ struct skb_shared_info {
156#define SKB_DATAREF_SHIFT 16 159#define SKB_DATAREF_SHIFT 16
157#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1) 160#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)
158 161
159struct skb_timeval {
160 u32 off_sec;
161 u32 off_usec;
162};
163
164 162
165enum { 163enum {
166 SKB_FCLONE_UNAVAILABLE, 164 SKB_FCLONE_UNAVAILABLE,
@@ -181,6 +179,16 @@ enum {
181 SKB_GSO_TCPV6 = 1 << 4, 179 SKB_GSO_TCPV6 = 1 << 4,
182}; 180};
183 181
182#if BITS_PER_LONG > 32
183#define NET_SKBUFF_DATA_USES_OFFSET 1
184#endif
185
186#ifdef NET_SKBUFF_DATA_USES_OFFSET
187typedef unsigned int sk_buff_data_t;
188#else
189typedef unsigned char *sk_buff_data_t;
190#endif
191
184/** 192/**
185 * struct sk_buff - socket buffer 193 * struct sk_buff - socket buffer
186 * @next: Next buffer in list 194 * @next: Next buffer in list
@@ -190,15 +198,17 @@ enum {
190 * @dev: Device we arrived on/are leaving by 198 * @dev: Device we arrived on/are leaving by
191 * @iif: ifindex of device we arrived on 199 * @iif: ifindex of device we arrived on
192 * @h: Transport layer header 200 * @h: Transport layer header
193 * @nh: Network layer header 201 * @network_header: Network layer header
194 * @mac: Link layer header 202 * @mac_header: Link layer header
195 * @dst: destination entry 203 * @dst: destination entry
196 * @sp: the security path, used for xfrm 204 * @sp: the security path, used for xfrm
197 * @cb: Control buffer. Free for use by every layer. Put private vars here 205 * @cb: Control buffer. Free for use by every layer. Put private vars here
198 * @len: Length of actual data 206 * @len: Length of actual data
199 * @data_len: Data length 207 * @data_len: Data length
200 * @mac_len: Length of link layer header 208 * @mac_len: Length of link layer header
201 * @csum: Checksum 209 * @csum: Checksum (must include start/offset pair)
210 * @csum_start: Offset from skb->head where checksumming should start
211 * @csum_offset: Offset from csum_start where checksum should be stored
202 * @local_df: allow local fragmentation 212 * @local_df: allow local fragmentation
203 * @cloned: Head may be cloned (check refcnt to be sure) 213 * @cloned: Head may be cloned (check refcnt to be sure)
204 * @nohdr: Payload reference only, must not modify header 214 * @nohdr: Payload reference only, must not modify header
@@ -233,32 +243,11 @@ struct sk_buff {
233 struct sk_buff *prev; 243 struct sk_buff *prev;
234 244
235 struct sock *sk; 245 struct sock *sk;
236 struct skb_timeval tstamp; 246 ktime_t tstamp;
237 struct net_device *dev; 247 struct net_device *dev;
238 int iif; 248 int iif;
239 /* 4 byte hole on 64 bit*/ 249 /* 4 byte hole on 64 bit*/
240 250
241 union {
242 struct tcphdr *th;
243 struct udphdr *uh;
244 struct icmphdr *icmph;
245 struct igmphdr *igmph;
246 struct iphdr *ipiph;
247 struct ipv6hdr *ipv6h;
248 unsigned char *raw;
249 } h;
250
251 union {
252 struct iphdr *iph;
253 struct ipv6hdr *ipv6h;
254 struct arphdr *arph;
255 unsigned char *raw;
256 } nh;
257
258 union {
259 unsigned char *raw;
260 } mac;
261
262 struct dst_entry *dst; 251 struct dst_entry *dst;
263 struct sec_path *sp; 252 struct sec_path *sp;
264 253
@@ -275,7 +264,10 @@ struct sk_buff {
275 mac_len; 264 mac_len;
276 union { 265 union {
277 __wsum csum; 266 __wsum csum;
278 __u32 csum_offset; 267 struct {
268 __u16 csum_start;
269 __u16 csum_offset;
270 };
279 }; 271 };
280 __u32 priority; 272 __u32 priority;
281 __u8 local_df:1, 273 __u8 local_df:1,
@@ -289,15 +281,13 @@ struct sk_buff {
289 __be16 protocol; 281 __be16 protocol;
290 282
291 void (*destructor)(struct sk_buff *skb); 283 void (*destructor)(struct sk_buff *skb);
292#ifdef CONFIG_NETFILTER
293 struct nf_conntrack *nfct;
294#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 284#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
285 struct nf_conntrack *nfct;
295 struct sk_buff *nfct_reasm; 286 struct sk_buff *nfct_reasm;
296#endif 287#endif
297#ifdef CONFIG_BRIDGE_NETFILTER 288#ifdef CONFIG_BRIDGE_NETFILTER
298 struct nf_bridge_info *nf_bridge; 289 struct nf_bridge_info *nf_bridge;
299#endif 290#endif
300#endif /* CONFIG_NETFILTER */
301#ifdef CONFIG_NET_SCHED 291#ifdef CONFIG_NET_SCHED
302 __u16 tc_index; /* traffic control index */ 292 __u16 tc_index; /* traffic control index */
303#ifdef CONFIG_NET_CLS_ACT 293#ifdef CONFIG_NET_CLS_ACT
@@ -313,13 +303,16 @@ struct sk_buff {
313 303
314 __u32 mark; 304 __u32 mark;
315 305
306 sk_buff_data_t transport_header;
307 sk_buff_data_t network_header;
308 sk_buff_data_t mac_header;
316 /* These elements must be at the end, see alloc_skb() for details. */ 309 /* These elements must be at the end, see alloc_skb() for details. */
310 sk_buff_data_t tail;
311 sk_buff_data_t end;
312 unsigned char *head,
313 *data;
317 unsigned int truesize; 314 unsigned int truesize;
318 atomic_t users; 315 atomic_t users;
319 unsigned char *head,
320 *data,
321 *tail,
322 *end;
323}; 316};
324 317
325#ifdef __KERNEL__ 318#ifdef __KERNEL__
@@ -361,6 +354,11 @@ extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
361extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb, 354extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
362 int newheadroom, int newtailroom, 355 int newheadroom, int newtailroom,
363 gfp_t priority); 356 gfp_t priority);
357extern int skb_to_sgvec(struct sk_buff *skb,
358 struct scatterlist *sg, int offset,
359 int len);
360extern int skb_cow_data(struct sk_buff *skb, int tailbits,
361 struct sk_buff **trailer);
364extern int skb_pad(struct sk_buff *skb, int pad); 362extern int skb_pad(struct sk_buff *skb, int pad);
365#define dev_kfree_skb(a) kfree_skb(a) 363#define dev_kfree_skb(a) kfree_skb(a)
366extern void skb_over_panic(struct sk_buff *skb, int len, 364extern void skb_over_panic(struct sk_buff *skb, int len,
@@ -402,8 +400,20 @@ extern unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
402 unsigned int to, struct ts_config *config, 400 unsigned int to, struct ts_config *config,
403 struct ts_state *state); 401 struct ts_state *state);
404 402
403#ifdef NET_SKBUFF_DATA_USES_OFFSET
404static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
405{
406 return skb->head + skb->end;
407}
408#else
409static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
410{
411 return skb->end;
412}
413#endif
414
405/* Internal */ 415/* Internal */
406#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end)) 416#define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB)))
407 417
408/** 418/**
409 * skb_queue_empty - check if a queue is empty 419 * skb_queue_empty - check if a queue is empty
@@ -822,12 +832,46 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
822#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) 832#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list)
823#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) 833#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
824 834
835#ifdef NET_SKBUFF_DATA_USES_OFFSET
836static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
837{
838 return skb->head + skb->tail;
839}
840
841static inline void skb_reset_tail_pointer(struct sk_buff *skb)
842{
843 skb->tail = skb->data - skb->head;
844}
845
846static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
847{
848 skb_reset_tail_pointer(skb);
849 skb->tail += offset;
850}
851#else /* NET_SKBUFF_DATA_USES_OFFSET */
852static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
853{
854 return skb->tail;
855}
856
857static inline void skb_reset_tail_pointer(struct sk_buff *skb)
858{
859 skb->tail = skb->data;
860}
861
862static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
863{
864 skb->tail = skb->data + offset;
865}
866
867#endif /* NET_SKBUFF_DATA_USES_OFFSET */
868
825/* 869/*
826 * Add data to an sk_buff 870 * Add data to an sk_buff
827 */ 871 */
828static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) 872static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
829{ 873{
830 unsigned char *tmp = skb->tail; 874 unsigned char *tmp = skb_tail_pointer(skb);
831 SKB_LINEAR_ASSERT(skb); 875 SKB_LINEAR_ASSERT(skb);
832 skb->tail += len; 876 skb->tail += len;
833 skb->len += len; 877 skb->len += len;
@@ -845,11 +889,11 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
845 */ 889 */
846static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) 890static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
847{ 891{
848 unsigned char *tmp = skb->tail; 892 unsigned char *tmp = skb_tail_pointer(skb);
849 SKB_LINEAR_ASSERT(skb); 893 SKB_LINEAR_ASSERT(skb);
850 skb->tail += len; 894 skb->tail += len;
851 skb->len += len; 895 skb->len += len;
852 if (unlikely(skb->tail>skb->end)) 896 if (unlikely(skb->tail > skb->end))
853 skb_over_panic(skb, len, current_text_addr()); 897 skb_over_panic(skb, len, current_text_addr());
854 return tmp; 898 return tmp;
855} 899}
@@ -962,6 +1006,130 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
962 skb->tail += len; 1006 skb->tail += len;
963} 1007}
964 1008
1009#ifdef NET_SKBUFF_DATA_USES_OFFSET
1010static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1011{
1012 return skb->head + skb->transport_header;
1013}
1014
1015static inline void skb_reset_transport_header(struct sk_buff *skb)
1016{
1017 skb->transport_header = skb->data - skb->head;
1018}
1019
1020static inline void skb_set_transport_header(struct sk_buff *skb,
1021 const int offset)
1022{
1023 skb_reset_transport_header(skb);
1024 skb->transport_header += offset;
1025}
1026
1027static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1028{
1029 return skb->head + skb->network_header;
1030}
1031
1032static inline void skb_reset_network_header(struct sk_buff *skb)
1033{
1034 skb->network_header = skb->data - skb->head;
1035}
1036
1037static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1038{
1039 skb_reset_network_header(skb);
1040 skb->network_header += offset;
1041}
1042
1043static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1044{
1045 return skb->head + skb->mac_header;
1046}
1047
1048static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1049{
1050 return skb->mac_header != ~0U;
1051}
1052
1053static inline void skb_reset_mac_header(struct sk_buff *skb)
1054{
1055 skb->mac_header = skb->data - skb->head;
1056}
1057
1058static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1059{
1060 skb_reset_mac_header(skb);
1061 skb->mac_header += offset;
1062}
1063
1064#else /* NET_SKBUFF_DATA_USES_OFFSET */
1065
1066static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
1067{
1068 return skb->transport_header;
1069}
1070
1071static inline void skb_reset_transport_header(struct sk_buff *skb)
1072{
1073 skb->transport_header = skb->data;
1074}
1075
1076static inline void skb_set_transport_header(struct sk_buff *skb,
1077 const int offset)
1078{
1079 skb->transport_header = skb->data + offset;
1080}
1081
1082static inline unsigned char *skb_network_header(const struct sk_buff *skb)
1083{
1084 return skb->network_header;
1085}
1086
1087static inline void skb_reset_network_header(struct sk_buff *skb)
1088{
1089 skb->network_header = skb->data;
1090}
1091
1092static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
1093{
1094 skb->network_header = skb->data + offset;
1095}
1096
1097static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
1098{
1099 return skb->mac_header;
1100}
1101
1102static inline int skb_mac_header_was_set(const struct sk_buff *skb)
1103{
1104 return skb->mac_header != NULL;
1105}
1106
1107static inline void skb_reset_mac_header(struct sk_buff *skb)
1108{
1109 skb->mac_header = skb->data;
1110}
1111
1112static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1113{
1114 skb->mac_header = skb->data + offset;
1115}
1116#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1117
1118static inline int skb_transport_offset(const struct sk_buff *skb)
1119{
1120 return skb_transport_header(skb) - skb->data;
1121}
1122
1123static inline u32 skb_network_header_len(const struct sk_buff *skb)
1124{
1125 return skb->transport_header - skb->network_header;
1126}
1127
1128static inline int skb_network_offset(const struct sk_buff *skb)
1129{
1130 return skb_network_header(skb) - skb->data;
1131}
1132
965/* 1133/*
966 * CPUs often take a performance hit when accessing unaligned memory 1134 * CPUs often take a performance hit when accessing unaligned memory
967 * locations. The actual performance hit varies, it can be small if the 1135 * locations. The actual performance hit varies, it can be small if the
@@ -1013,8 +1181,8 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
1013 WARN_ON(1); 1181 WARN_ON(1);
1014 return; 1182 return;
1015 } 1183 }
1016 skb->len = len; 1184 skb->len = len;
1017 skb->tail = skb->data + len; 1185 skb_set_tail_pointer(skb, len);
1018} 1186}
1019 1187
1020/** 1188/**
@@ -1326,8 +1494,8 @@ extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
1326 int len, __wsum csum); 1494 int len, __wsum csum);
1327extern int skb_copy_bits(const struct sk_buff *skb, int offset, 1495extern int skb_copy_bits(const struct sk_buff *skb, int offset,
1328 void *to, int len); 1496 void *to, int len);
1329extern int skb_store_bits(const struct sk_buff *skb, int offset, 1497extern int skb_store_bits(struct sk_buff *skb, int offset,
1330 void *from, int len); 1498 const void *from, int len);
1331extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, 1499extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb,
1332 int offset, u8 *to, int len, 1500 int offset, u8 *to, int len,
1333 __wsum csum); 1501 __wsum csum);
@@ -1351,8 +1519,36 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1351 return buffer; 1519 return buffer;
1352} 1520}
1353 1521
1522static inline void skb_copy_from_linear_data(const struct sk_buff *skb,
1523 void *to,
1524 const unsigned int len)
1525{
1526 memcpy(to, skb->data, len);
1527}
1528
1529static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
1530 const int offset, void *to,
1531 const unsigned int len)
1532{
1533 memcpy(to, skb->data + offset, len);
1534}
1535
1536static inline void skb_copy_to_linear_data(struct sk_buff *skb,
1537 const void *from,
1538 const unsigned int len)
1539{
1540 memcpy(skb->data, from, len);
1541}
1542
1543static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
1544 const int offset,
1545 const void *from,
1546 const unsigned int len)
1547{
1548 memcpy(skb->data + offset, from, len);
1549}
1550
1354extern void skb_init(void); 1551extern void skb_init(void);
1355extern void skb_add_mtu(int mtu);
1356 1552
1357/** 1553/**
1358 * skb_get_timestamp - get timestamp from a skb 1554 * skb_get_timestamp - get timestamp from a skb
@@ -1365,29 +1561,28 @@ extern void skb_add_mtu(int mtu);
1365 */ 1561 */
1366static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp) 1562static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp)
1367{ 1563{
1368 stamp->tv_sec = skb->tstamp.off_sec; 1564 *stamp = ktime_to_timeval(skb->tstamp);
1369 stamp->tv_usec = skb->tstamp.off_usec;
1370} 1565}
1371 1566
1372/** 1567static inline void __net_timestamp(struct sk_buff *skb)
1373 * skb_set_timestamp - set timestamp of a skb 1568{
1374 * @skb: skb to set stamp of 1569 skb->tstamp = ktime_get_real();
1375 * @stamp: pointer to struct timeval to get stamp from 1570}
1376 * 1571
1377 * Timestamps are stored in the skb as offsets to a base timestamp. 1572static inline ktime_t net_timedelta(ktime_t t)
1378 * This function converts a struct timeval to an offset and stores
1379 * it in the skb.
1380 */
1381static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *stamp)
1382{ 1573{
1383 skb->tstamp.off_sec = stamp->tv_sec; 1574 return ktime_sub(ktime_get_real(), t);
1384 skb->tstamp.off_usec = stamp->tv_usec;
1385} 1575}
1386 1576
1387extern void __net_timestamp(struct sk_buff *skb);
1388 1577
1578extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
1389extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 1579extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1390 1580
1581static inline int skb_csum_unnecessary(const struct sk_buff *skb)
1582{
1583 return skb->ip_summed & CHECKSUM_UNNECESSARY;
1584}
1585
1391/** 1586/**
1392 * skb_checksum_complete - Calculate checksum of an entire packet 1587 * skb_checksum_complete - Calculate checksum of an entire packet
1393 * @skb: packet to process 1588 * @skb: packet to process
@@ -1406,22 +1601,22 @@ extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1406 */ 1601 */
1407static inline unsigned int skb_checksum_complete(struct sk_buff *skb) 1602static inline unsigned int skb_checksum_complete(struct sk_buff *skb)
1408{ 1603{
1409 return skb->ip_summed != CHECKSUM_UNNECESSARY && 1604 return skb_csum_unnecessary(skb) ?
1410 __skb_checksum_complete(skb); 1605 0 : __skb_checksum_complete(skb);
1411} 1606}
1412 1607
1413#ifdef CONFIG_NETFILTER 1608#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1609extern void nf_conntrack_destroy(struct nf_conntrack *nfct);
1414static inline void nf_conntrack_put(struct nf_conntrack *nfct) 1610static inline void nf_conntrack_put(struct nf_conntrack *nfct)
1415{ 1611{
1416 if (nfct && atomic_dec_and_test(&nfct->use)) 1612 if (nfct && atomic_dec_and_test(&nfct->use))
1417 nfct->destroy(nfct); 1613 nf_conntrack_destroy(nfct);
1418} 1614}
1419static inline void nf_conntrack_get(struct nf_conntrack *nfct) 1615static inline void nf_conntrack_get(struct nf_conntrack *nfct)
1420{ 1616{
1421 if (nfct) 1617 if (nfct)
1422 atomic_inc(&nfct->use); 1618 atomic_inc(&nfct->use);
1423} 1619}
1424#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1425static inline void nf_conntrack_get_reasm(struct sk_buff *skb) 1620static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
1426{ 1621{
1427 if (skb) 1622 if (skb)
@@ -1447,9 +1642,9 @@ static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
1447#endif /* CONFIG_BRIDGE_NETFILTER */ 1642#endif /* CONFIG_BRIDGE_NETFILTER */
1448static inline void nf_reset(struct sk_buff *skb) 1643static inline void nf_reset(struct sk_buff *skb)
1449{ 1644{
1645#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1450 nf_conntrack_put(skb->nfct); 1646 nf_conntrack_put(skb->nfct);
1451 skb->nfct = NULL; 1647 skb->nfct = NULL;
1452#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1453 nf_conntrack_put_reasm(skb->nfct_reasm); 1648 nf_conntrack_put_reasm(skb->nfct_reasm);
1454 skb->nfct_reasm = NULL; 1649 skb->nfct_reasm = NULL;
1455#endif 1650#endif
@@ -1459,9 +1654,33 @@ static inline void nf_reset(struct sk_buff *skb)
1459#endif 1654#endif
1460} 1655}
1461 1656
1462#else /* CONFIG_NETFILTER */ 1657/* Note: This doesn't put any conntrack and bridge info in dst. */
1463static inline void nf_reset(struct sk_buff *skb) {} 1658static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
1464#endif /* CONFIG_NETFILTER */ 1659{
1660#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1661 dst->nfct = src->nfct;
1662 nf_conntrack_get(src->nfct);
1663 dst->nfctinfo = src->nfctinfo;
1664 dst->nfct_reasm = src->nfct_reasm;
1665 nf_conntrack_get_reasm(src->nfct_reasm);
1666#endif
1667#ifdef CONFIG_BRIDGE_NETFILTER
1668 dst->nf_bridge = src->nf_bridge;
1669 nf_bridge_get(src->nf_bridge);
1670#endif
1671}
1672
1673static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
1674{
1675#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1676 nf_conntrack_put(dst->nfct);
1677 nf_conntrack_put_reasm(dst->nfct_reasm);
1678#endif
1679#ifdef CONFIG_BRIDGE_NETFILTER
1680 nf_bridge_put(dst->nf_bridge);
1681#endif
1682 __nf_copy(dst, src);
1683}
1465 1684
1466#ifdef CONFIG_NETWORK_SECMARK 1685#ifdef CONFIG_NETWORK_SECMARK
1467static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from) 1686static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from)
@@ -1486,5 +1705,12 @@ static inline int skb_is_gso(const struct sk_buff *skb)
1486 return skb_shinfo(skb)->gso_size; 1705 return skb_shinfo(skb)->gso_size;
1487} 1706}
1488 1707
1708static inline void skb_forward_csum(struct sk_buff *skb)
1709{
1710 /* Unfortunately we don't support this one. Any brave souls? */
1711 if (skb->ip_summed == CHECKSUM_COMPLETE)
1712 skb->ip_summed = CHECKSUM_NONE;
1713}
1714
1489#endif /* __KERNEL__ */ 1715#endif /* __KERNEL__ */
1490#endif /* _LINUX_SKBUFF_H */ 1716#endif /* _LINUX_SKBUFF_H */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index fcd35a210e7f..6e7c9483a6a6 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -188,7 +188,8 @@ struct ucred {
188#define AF_TIPC 30 /* TIPC sockets */ 188#define AF_TIPC 30 /* TIPC sockets */
189#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 189#define AF_BLUETOOTH 31 /* Bluetooth sockets */
190#define AF_IUCV 32 /* IUCV sockets */ 190#define AF_IUCV 32 /* IUCV sockets */
191#define AF_MAX 33 /* For now.. */ 191#define AF_RXRPC 33 /* RxRPC sockets */
192#define AF_MAX 34 /* For now.. */
192 193
193/* Protocol families, same as address families. */ 194/* Protocol families, same as address families. */
194#define PF_UNSPEC AF_UNSPEC 195#define PF_UNSPEC AF_UNSPEC
@@ -222,6 +223,7 @@ struct ucred {
222#define PF_TIPC AF_TIPC 223#define PF_TIPC AF_TIPC
223#define PF_BLUETOOTH AF_BLUETOOTH 224#define PF_BLUETOOTH AF_BLUETOOTH
224#define PF_IUCV AF_IUCV 225#define PF_IUCV AF_IUCV
226#define PF_RXRPC AF_RXRPC
225#define PF_MAX AF_MAX 227#define PF_MAX AF_MAX
226 228
227/* Maximum queue length specifiable by listen. */ 229/* Maximum queue length specifiable by listen. */
@@ -284,6 +286,7 @@ struct ucred {
284#define SOL_DCCP 269 286#define SOL_DCCP 269
285#define SOL_NETLINK 270 287#define SOL_NETLINK 270
286#define SOL_TIPC 271 288#define SOL_TIPC 271
289#define SOL_RXRPC 272
287 290
288/* IPX options */ 291/* IPX options */
289#define IPX_TYPE 1 292#define IPX_TYPE 1
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 9a8970bf99a6..47f1c53332ce 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -290,6 +290,7 @@ enum
290 NET_CORE_BUDGET=19, 290 NET_CORE_BUDGET=19,
291 NET_CORE_AEVENT_ETIME=20, 291 NET_CORE_AEVENT_ETIME=20,
292 NET_CORE_AEVENT_RSEQTH=21, 292 NET_CORE_AEVENT_RSEQTH=21,
293 NET_CORE_WARNINGS=22,
293}; 294};
294 295
295/* /proc/sys/net/ethernet */ 296/* /proc/sys/net/ethernet */
@@ -438,6 +439,8 @@ enum
438 NET_CIPSOV4_RBM_STRICTVALID=121, 439 NET_CIPSOV4_RBM_STRICTVALID=121,
439 NET_TCP_AVAIL_CONG_CONTROL=122, 440 NET_TCP_AVAIL_CONG_CONTROL=122,
440 NET_TCP_ALLOWED_CONG_CONTROL=123, 441 NET_TCP_ALLOWED_CONG_CONTROL=123,
442 NET_TCP_MAX_SSTHRESH=124,
443 NET_TCP_FRTO_RESPONSE=125,
441}; 444};
442 445
443enum { 446enum {
@@ -789,6 +792,7 @@ enum {
789 NET_BRIDGE_NF_CALL_IPTABLES = 2, 792 NET_BRIDGE_NF_CALL_IPTABLES = 2,
790 NET_BRIDGE_NF_CALL_IP6TABLES = 3, 793 NET_BRIDGE_NF_CALL_IP6TABLES = 3,
791 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4, 794 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
795 NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5,
792}; 796};
793 797
794/* CTL_FS names: */ 798/* CTL_FS names: */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 29d3089038ab..c6b9f92e8289 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -178,6 +178,21 @@ struct tcp_md5sig {
178#include <net/inet_connection_sock.h> 178#include <net/inet_connection_sock.h>
179#include <net/inet_timewait_sock.h> 179#include <net/inet_timewait_sock.h>
180 180
181static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
182{
183 return (struct tcphdr *)skb_transport_header(skb);
184}
185
186static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
187{
188 return tcp_hdr(skb)->doff * 4;
189}
190
191static inline unsigned int tcp_optlen(const struct sk_buff *skb)
192{
193 return (tcp_hdr(skb)->doff - 5) * 4;
194}
195
181/* This defines a selective acknowledgement block. */ 196/* This defines a selective acknowledgement block. */
182struct tcp_sack_block_wire { 197struct tcp_sack_block_wire {
183 __be32 start_seq; 198 __be32 start_seq;
@@ -242,6 +257,8 @@ struct tcp_sock {
242 * See RFC793 and RFC1122. The RFC writes these in capitals. 257 * See RFC793 and RFC1122. The RFC writes these in capitals.
243 */ 258 */
244 u32 rcv_nxt; /* What we want to receive next */ 259 u32 rcv_nxt; /* What we want to receive next */
260 u32 copied_seq; /* Head of yet unread data */
261 u32 rcv_wup; /* rcv_nxt on last window update sent */
245 u32 snd_nxt; /* Next sequence we send */ 262 u32 snd_nxt; /* Next sequence we send */
246 263
247 u32 snd_una; /* First byte we want an ack for */ 264 u32 snd_una; /* First byte we want an ack for */
@@ -300,17 +317,15 @@ struct tcp_sock {
300 u32 snd_ssthresh; /* Slow start size threshold */ 317 u32 snd_ssthresh; /* Slow start size threshold */
301 u32 snd_cwnd; /* Sending congestion window */ 318 u32 snd_cwnd; /* Sending congestion window */
302 u16 snd_cwnd_cnt; /* Linear increase counter */ 319 u16 snd_cwnd_cnt; /* Linear increase counter */
303 u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */ 320 u32 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
304 u32 snd_cwnd_used; 321 u32 snd_cwnd_used;
305 u32 snd_cwnd_stamp; 322 u32 snd_cwnd_stamp;
306 323
307 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 324 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
308 325
309 u32 rcv_wnd; /* Current receiver window */ 326 u32 rcv_wnd; /* Current receiver window */
310 u32 rcv_wup; /* rcv_nxt on last window update sent */
311 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 327 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
312 u32 pushed_seq; /* Last pushed seq, required to talk to windows */ 328 u32 pushed_seq; /* Last pushed seq, required to talk to windows */
313 u32 copied_seq; /* Head of yet unread data */
314 329
315/* SACKs data */ 330/* SACKs data */
316 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 331 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 7e08c07efe0f..6de445c31a64 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -26,6 +26,15 @@ struct udphdr {
26 __sum16 check; 26 __sum16 check;
27}; 27};
28 28
29#ifdef __KERNEL__
30#include <linux/skbuff.h>
31
32static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
33{
34 return (struct udphdr *)skb_transport_header(skb);
35}
36#endif
37
29/* UDP socket options */ 38/* UDP socket options */
30#define UDP_CORK 1 /* Never send partially complete segments */ 39#define UDP_CORK 1 /* Never send partially complete segments */
31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ 40#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 2a7b38d87018..b8abfc74d038 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -191,14 +191,15 @@ int execute_in_process_context(work_func_t fn, struct execute_work *);
191 191
192/* 192/*
193 * Kill off a pending schedule_delayed_work(). Note that the work callback 193 * Kill off a pending schedule_delayed_work(). Note that the work callback
194 * function may still be running on return from cancel_delayed_work(). Run 194 * function may still be running on return from cancel_delayed_work(), unless
195 * flush_scheduled_work() to wait on it. 195 * it returns 1 and the work doesn't re-arm itself. Run flush_workqueue() or
196 * cancel_work_sync() to wait on it.
196 */ 197 */
197static inline int cancel_delayed_work(struct delayed_work *work) 198static inline int cancel_delayed_work(struct delayed_work *work)
198{ 199{
199 int ret; 200 int ret;
200 201
201 ret = del_timer_sync(&work->timer); 202 ret = del_timer(&work->timer);
202 if (ret) 203 if (ret)
203 work_release(&work->work); 204 work_release(&work->work);
204 return ret; 205 return ret;
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 15ca89e9961b..9c656a5cf842 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -181,6 +181,10 @@ enum {
181 XFRM_MSG_MIGRATE, 181 XFRM_MSG_MIGRATE,
182#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE 182#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE
183 183
184 XFRM_MSG_NEWSADINFO,
185#define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO
186 XFRM_MSG_GETSADINFO,
187#define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO
184 __XFRM_MSG_MAX 188 __XFRM_MSG_MAX
185}; 189};
186#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 190#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -234,6 +238,17 @@ enum xfrm_ae_ftype_t {
234#define XFRM_AE_MAX (__XFRM_AE_MAX - 1) 238#define XFRM_AE_MAX (__XFRM_AE_MAX - 1)
235}; 239};
236 240
241/* SAD Table filter flags */
242enum xfrm_sad_ftype_t {
243 XFRM_SAD_UNSPEC,
244 XFRM_SAD_HMASK=1,
245 XFRM_SAD_HMAX=2,
246 XFRM_SAD_CNT=4,
247 __XFRM_SAD_MAX
248
249#define XFRM_SAD_MAX (__XFRM_SAD_MAX - 1)
250};
251
237struct xfrm_userpolicy_type { 252struct xfrm_userpolicy_type {
238 __u8 type; 253 __u8 type;
239 __u16 reserved1; 254 __u16 reserved1;
@@ -265,6 +280,16 @@ enum xfrm_attr_type_t {
265#define XFRMA_MAX (__XFRMA_MAX - 1) 280#define XFRMA_MAX (__XFRMA_MAX - 1)
266}; 281};
267 282
283enum xfrm_sadattr_type_t {
284 XFRMA_SAD_UNSPEC,
285 XFRMA_SADHMASK,
286 XFRMA_SADHMAX,
287 XFRMA_SADCNT,
288 __XFRMA_SAD_MAX
289
290#define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1)
291};
292
268struct xfrm_usersa_info { 293struct xfrm_usersa_info {
269 struct xfrm_selector sel; 294 struct xfrm_selector sel;
270 struct xfrm_id id; 295 struct xfrm_id id;