Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/mtd/Kconfig Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This commit is contained in:
@@ -69,9 +69,7 @@ header-y += hdsmart.h
|
||||
header-y += hysdn_if.h
|
||||
header-y += i2c-dev.h
|
||||
header-y += i8k.h
|
||||
header-y += icmp.h
|
||||
header-y += if_arcnet.h
|
||||
header-y += if_arp.h
|
||||
header-y += if_bonding.h
|
||||
header-y += if_cablemodem.h
|
||||
header-y += if_fc.h
|
||||
@@ -88,7 +86,6 @@ header-y += if_tunnel.h
|
||||
header-y += in6.h
|
||||
header-y += in_route.h
|
||||
header-y += ioctl.h
|
||||
header-y += ip.h
|
||||
header-y += ipmi_msgdefs.h
|
||||
header-y += ip_mp_alg.h
|
||||
header-y += ipsec.h
|
||||
@@ -116,6 +113,7 @@ header-y += netrom.h
|
||||
header-y += nfs2.h
|
||||
header-y += nfs4_mount.h
|
||||
header-y += nfs_mount.h
|
||||
header-y += nl80211.h
|
||||
header-y += oom.h
|
||||
header-y += param.h
|
||||
header-y += pci_regs.h
|
||||
@@ -210,8 +208,10 @@ unifdef-y += hiddev.h
|
||||
unifdef-y += hpet.h
|
||||
unifdef-y += i2c.h
|
||||
unifdef-y += i2o-dev.h
|
||||
unifdef-y += icmp.h
|
||||
unifdef-y += icmpv6.h
|
||||
unifdef-y += if_addr.h
|
||||
unifdef-y += if_arp.h
|
||||
unifdef-y += if_bridge.h
|
||||
unifdef-y += if_ec.h
|
||||
unifdef-y += if_eql.h
|
||||
@@ -231,6 +231,7 @@ unifdef-y += inet_diag.h
|
||||
unifdef-y += in.h
|
||||
unifdef-y += inotify.h
|
||||
unifdef-y += input.h
|
||||
unifdef-y += ip.h
|
||||
unifdef-y += ipc.h
|
||||
unifdef-y += ipmi.h
|
||||
unifdef-y += ipv6.h
|
||||
|
||||
@@ -101,7 +101,7 @@ struct ddpehdr {
|
||||
|
||||
static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
|
||||
{
|
||||
return (struct ddpehdr *)skb->h.raw;
|
||||
return (struct ddpehdr *)skb_transport_header(skb);
|
||||
}
|
||||
|
||||
/* AppleTalk AARP headers */
|
||||
@@ -129,7 +129,7 @@ struct elapaarp {
|
||||
|
||||
static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
|
||||
{
|
||||
return (struct elapaarp *)skb->h.raw;
|
||||
return (struct elapaarp *)skb_transport_header(skb);
|
||||
}
|
||||
|
||||
/* Not specified - how long till we drop a resolved entry */
|
||||
|
||||
@@ -260,19 +260,20 @@ enum {
|
||||
|
||||
static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct dccp_hdr *)skb->h.raw;
|
||||
return (struct dccp_hdr *)skb_transport_header(skb);
|
||||
}
|
||||
|
||||
static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
|
||||
{
|
||||
skb->h.raw = skb_push(skb, headlen);
|
||||
memset(skb->h.raw, 0, headlen);
|
||||
return dccp_hdr(skb);
|
||||
skb_push(skb, headlen);
|
||||
skb_reset_transport_header(skb);
|
||||
return memset(skb_transport_header(skb), 0, headlen);
|
||||
}
|
||||
|
||||
static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr));
|
||||
return (struct dccp_hdr_ext *)(skb_transport_header(skb) +
|
||||
sizeof(struct dccp_hdr));
|
||||
}
|
||||
|
||||
static 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)
|
||||
|
||||
static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb)
|
||||
{
|
||||
return (struct dccp_hdr_request *)(skb->h.raw + dccp_basic_hdr_len(skb));
|
||||
return (struct dccp_hdr_request *)(skb_transport_header(skb) +
|
||||
dccp_basic_hdr_len(skb));
|
||||
}
|
||||
|
||||
static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct dccp_hdr_ack_bits *)(skb->h.raw + dccp_basic_hdr_len(skb));
|
||||
return (struct dccp_hdr_ack_bits *)(skb_transport_header(skb) +
|
||||
dccp_basic_hdr_len(skb));
|
||||
}
|
||||
|
||||
static 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)
|
||||
|
||||
static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb)
|
||||
{
|
||||
return (struct dccp_hdr_response *)(skb->h.raw + dccp_basic_hdr_len(skb));
|
||||
return (struct dccp_hdr_response *)(skb_transport_header(skb) +
|
||||
dccp_basic_hdr_len(skb));
|
||||
}
|
||||
|
||||
static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb)
|
||||
{
|
||||
return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb));
|
||||
return (struct dccp_hdr_reset *)(skb_transport_header(skb) +
|
||||
dccp_basic_hdr_len(skb));
|
||||
}
|
||||
|
||||
static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh)
|
||||
@@ -460,26 +465,27 @@ struct dccp_ackvec;
|
||||
* @dccps_service_list - second .. last service code on passive socket
|
||||
* @dccps_timestamp_time - time of latest TIMESTAMP option
|
||||
* @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
|
||||
* @dccps_l_ack_ratio -
|
||||
* @dccps_r_ack_ratio -
|
||||
* @dccps_l_ack_ratio - feature-local Ack Ratio
|
||||
* @dccps_r_ack_ratio - feature-remote Ack Ratio
|
||||
* @dccps_pcslen - sender partial checksum coverage (via sockopt)
|
||||
* @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
|
||||
* @dccps_ndp_count - number of Non Data Packets since last data packet
|
||||
* @dccps_mss_cache -
|
||||
* @dccps_minisock -
|
||||
* @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
|
||||
* @dccps_minisock - associated minisock (accessed via dccp_msk)
|
||||
* @dccps_hc_rx_ackvec - rx half connection ack vector
|
||||
* @dccps_hc_rx_ccid -
|
||||
* @dccps_hc_tx_ccid -
|
||||
* @dccps_options_received -
|
||||
* @dccps_epoch -
|
||||
* @dccps_role - Role of this sock, one of %dccp_role
|
||||
* @dccps_hc_rx_insert_options -
|
||||
* @dccps_hc_tx_insert_options -
|
||||
* @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
|
||||
* @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection)
|
||||
* @dccps_options_received - parsed set of retrieved options
|
||||
* @dccps_role - role of this sock, one of %dccp_role
|
||||
* @dccps_hc_rx_insert_options - receiver wants to add options when acking
|
||||
* @dccps_hc_tx_insert_options - sender wants to add options when sending
|
||||
* @dccps_xmit_timer - timer for when CCID is not ready to send
|
||||
* @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs)
|
||||
*/
|
||||
struct dccp_sock {
|
||||
/* inet_connection_sock has to be the first member of dccp_sock */
|
||||
struct inet_connection_sock dccps_inet_connection;
|
||||
#define dccps_syn_rtt dccps_inet_connection.icsk_ack.lrcvtime
|
||||
__u64 dccps_swl;
|
||||
__u64 dccps_swh;
|
||||
__u64 dccps_awl;
|
||||
|
||||
@@ -5,8 +5,13 @@
|
||||
#include <linux/rtnetlink.h>
|
||||
|
||||
/* rule is permanent, and cannot be deleted */
|
||||
#define FIB_RULE_PERMANENT 1
|
||||
#define FIB_RULE_INVERT 2
|
||||
#define FIB_RULE_PERMANENT 0x00000001
|
||||
#define FIB_RULE_INVERT 0x00000002
|
||||
#define FIB_RULE_UNRESOLVED 0x00000004
|
||||
#define FIB_RULE_DEV_DETACHED 0x00000008
|
||||
|
||||
/* try to find source address in routing lookups */
|
||||
#define FIB_RULE_FIND_SADDR 0x00010000
|
||||
|
||||
struct fib_rule_hdr
|
||||
{
|
||||
@@ -29,7 +34,7 @@ enum
|
||||
FRA_DST, /* destination address */
|
||||
FRA_SRC, /* source address */
|
||||
FRA_IFNAME, /* interface name */
|
||||
FRA_UNUSED1,
|
||||
FRA_GOTO, /* target to jump to (FR_ACT_GOTO) */
|
||||
FRA_UNUSED2,
|
||||
FRA_PRIORITY, /* priority/preference */
|
||||
FRA_UNUSED3,
|
||||
@@ -51,8 +56,8 @@ enum
|
||||
{
|
||||
FR_ACT_UNSPEC,
|
||||
FR_ACT_TO_TBL, /* Pass to fixed table */
|
||||
FR_ACT_RES1,
|
||||
FR_ACT_RES2,
|
||||
FR_ACT_GOTO, /* Jump to another rule */
|
||||
FR_ACT_NOP, /* No operation */
|
||||
FR_ACT_RES3,
|
||||
FR_ACT_RES4,
|
||||
FR_ACT_BLACKHOLE, /* Drop without notification */
|
||||
|
||||
@@ -843,8 +843,13 @@ extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
|
||||
extern int fcntl_getlease(struct file *filp);
|
||||
|
||||
/* fs/sync.c */
|
||||
extern int do_sync_file_range(struct file *file, loff_t offset, loff_t endbyte,
|
||||
unsigned int flags);
|
||||
extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset,
|
||||
loff_t endbyte, unsigned int flags);
|
||||
static inline int do_sync_file_range(struct file *file, loff_t offset,
|
||||
loff_t endbyte, unsigned int flags)
|
||||
{
|
||||
return do_sync_mapping_range(file->f_mapping, offset, endbyte, flags);
|
||||
}
|
||||
|
||||
/* fs/locks.c */
|
||||
extern void locks_init_lock(struct file_lock *);
|
||||
|
||||
@@ -132,8 +132,8 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
|
||||
{
|
||||
hdlc_device *hdlc = dev_to_hdlc(dev);
|
||||
|
||||
skb->mac.raw = skb->data;
|
||||
skb->dev = dev;
|
||||
skb->dev = dev;
|
||||
skb_reset_mac_header(skb);
|
||||
|
||||
if (hdlc->proto->type_trans)
|
||||
return hdlc->proto->type_trans(skb, dev);
|
||||
|
||||
@@ -82,6 +82,15 @@ struct icmphdr {
|
||||
} un;
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct icmphdr *)skb_transport_header(skb);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* constants for (set|get)sockopt
|
||||
*/
|
||||
|
||||
@@ -75,6 +75,15 @@ struct icmp6hdr {
|
||||
#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct icmp6hdr *)skb_transport_header(skb);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define ICMPV6_ROUTER_PREF_LOW 0x3
|
||||
#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
|
||||
#define ICMPV6_ROUTER_PREF_HIGH 0x1
|
||||
|
||||
@@ -39,6 +39,7 @@ enum
|
||||
#define IFA_F_TEMPORARY IFA_F_SECONDARY
|
||||
|
||||
#define IFA_F_NODAD 0x02
|
||||
#define IFA_F_OPTIMISTIC 0x04
|
||||
#define IFA_F_HOMEADDRESS 0x10
|
||||
#define IFA_F_DEPRECATED 0x20
|
||||
#define IFA_F_TENTATIVE 0x40
|
||||
|
||||
@@ -148,4 +148,13 @@ struct arphdr
|
||||
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct arphdr *)skb_network_header(skb);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_IF_ARP_H */
|
||||
|
||||
@@ -105,7 +105,8 @@ struct __fdb_entry
|
||||
#include <linux/netdevice.h>
|
||||
|
||||
extern void brioctl_set(int (*ioctl_hook)(unsigned int, void __user *));
|
||||
extern int (*br_handle_frame_hook)(struct net_bridge_port *p, struct sk_buff **pskb);
|
||||
extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
|
||||
struct sk_buff *skb);
|
||||
extern int (*br_should_route_hook)(struct sk_buff **pskb);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
|
||||
#define ETH_P_IPX 0x8137 /* IPX over DIX */
|
||||
#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
|
||||
#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */
|
||||
#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
|
||||
#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
|
||||
* defined in draft-wilson-wrec-wccp-v2-00.txt */
|
||||
@@ -112,7 +113,7 @@ struct ethhdr {
|
||||
|
||||
static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct ethhdr *)skb->mac.raw;
|
||||
return (struct ethhdr *)skb_mac_header(skb);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
|
||||
@@ -126,6 +126,7 @@ enum
|
||||
IFLA_INET6_STATS, /* statistics */
|
||||
IFLA_INET6_MCAST, /* MC things. What of them? */
|
||||
IFLA_INET6_CACHEINFO, /* time values and max reasm size */
|
||||
IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
|
||||
__IFLA_INET6_MAX
|
||||
};
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ struct sockaddr_ll
|
||||
#define PACKET_STATISTICS 6
|
||||
#define PACKET_COPY_THRESH 7
|
||||
#define PACKET_AUXDATA 8
|
||||
#define PACKET_ORIGDEV 9
|
||||
|
||||
struct tpacket_stats
|
||||
{
|
||||
|
||||
@@ -111,7 +111,17 @@ struct pppoe_hdr {
|
||||
struct pppoe_tag tag[0];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Length of entire PPPoE + PPP header */
|
||||
#define PPPOE_SES_HLEN 8
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct pppoe_hdr *)skb_network_header(skb);
|
||||
}
|
||||
|
||||
struct pppoe_opt {
|
||||
struct net_device *dev; /* device associated with socket*/
|
||||
int ifindex; /* ifindex of device associated with socket */
|
||||
|
||||
@@ -47,7 +47,7 @@ struct trh_hdr {
|
||||
|
||||
static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct trh_hdr *)skb->mac.raw;
|
||||
return (struct trh_hdr *)skb_mac_header(skb);
|
||||
}
|
||||
#ifdef CONFIG_SYSCTL
|
||||
extern struct ctl_table tr_table[];
|
||||
|
||||
@@ -51,7 +51,7 @@ struct vlan_ethhdr {
|
||||
|
||||
static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct vlan_ethhdr *)skb->mac.raw;
|
||||
return (struct vlan_ethhdr *)skb_mac_header(skb);
|
||||
}
|
||||
|
||||
struct vlan_hdr {
|
||||
@@ -275,8 +275,8 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
|
||||
veth->h_vlan_TCI = htons(tag);
|
||||
|
||||
skb->protocol = __constant_htons(ETH_P_8021Q);
|
||||
skb->mac.raw -= VLAN_HLEN;
|
||||
skb->nh.raw -= VLAN_HLEN;
|
||||
skb->mac_header -= VLAN_HLEN;
|
||||
skb->network_header -= VLAN_HLEN;
|
||||
|
||||
return skb;
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* if_wanipe_common.h Sangoma Driver/Socket common area definitions.
|
||||
*
|
||||
* Author: Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 2000 Sangoma Technologies Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
* Jan 13, 2000 Nenad Corbic Initial version
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef _WANPIPE_SOCK_DRIVER_COMMON_H
|
||||
#define _WANPIPE_SOCK_DRIVER_COMMON_H
|
||||
|
||||
typedef struct {
|
||||
struct net_device *slave;
|
||||
atomic_t packet_sent;
|
||||
atomic_t receive_block;
|
||||
atomic_t command;
|
||||
atomic_t disconnect;
|
||||
atomic_t driver_busy;
|
||||
long common_critical;
|
||||
struct timer_list *tx_timer;
|
||||
struct sock *sk; /* Wanpipe Sock bind's here */
|
||||
int (*func)(struct sk_buff *skb, struct net_device *dev,
|
||||
struct sock *sk);
|
||||
|
||||
struct work_struct wanpipe_work; /* deferred keventd work */
|
||||
unsigned char rw_bind; /* Sock bind state */
|
||||
unsigned char usedby;
|
||||
unsigned char state;
|
||||
unsigned char svc;
|
||||
unsigned short lcn;
|
||||
void *mbox;
|
||||
} wanpipe_common_t;
|
||||
|
||||
|
||||
enum {
|
||||
WANSOCK_UNCONFIGURED, /* link/channel is not configured */
|
||||
WANSOCK_DISCONNECTED, /* link/channel is disconnected */
|
||||
WANSOCK_CONNECTING, /* connection is in progress */
|
||||
WANSOCK_CONNECTED, /* link/channel is operational */
|
||||
WANSOCK_LIMIT, /* for verification only */
|
||||
WANSOCK_DUALPORT, /* for Dual Port cards */
|
||||
WANSOCK_DISCONNECTING,
|
||||
WANSOCK_BINDED,
|
||||
WANSOCK_BIND_LISTEN,
|
||||
WANSOCK_LISTEN
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -80,6 +80,27 @@ struct igmpv3_query {
|
||||
__be32 srcs[0];
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct igmphdr *)skb_transport_header(skb);
|
||||
}
|
||||
|
||||
static inline struct igmpv3_report *
|
||||
igmpv3_report_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct igmpv3_report *)skb_transport_header(skb);
|
||||
}
|
||||
|
||||
static inline struct igmpv3_query *
|
||||
igmpv3_query_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct igmpv3_query *)skb_transport_header(skb);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
|
||||
#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
|
||||
#define IGMP_DVMRP 0x13 /* DVMRP routing */
|
||||
|
||||
@@ -83,6 +83,7 @@ struct in_addr {
|
||||
#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
|
||||
#define IP_PMTUDISC_WANT 1 /* Use per route hints */
|
||||
#define IP_PMTUDISC_DO 2 /* Always DF */
|
||||
#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */
|
||||
|
||||
#define IP_MULTICAST_IF 32
|
||||
#define IP_MULTICAST_TTL 33
|
||||
|
||||
@@ -44,10 +44,8 @@ struct in6_addr
|
||||
* NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
|
||||
* in network byte order, not in host byte order as are the IPv4 equivalents
|
||||
*/
|
||||
#if 0
|
||||
extern const struct in6_addr in6addr_any;
|
||||
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
|
||||
#endif
|
||||
extern const struct in6_addr in6addr_loopback;
|
||||
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
|
||||
|
||||
@@ -179,6 +177,7 @@ struct in6_flowlabel_req
|
||||
#define IPV6_PMTUDISC_DONT 0
|
||||
#define IPV6_PMTUDISC_WANT 1
|
||||
#define IPV6_PMTUDISC_DO 2
|
||||
#define IPV6_PMTUDISC_PROBE 3
|
||||
|
||||
/* Flowlabel */
|
||||
#define IPV6_FLOWLABEL_MGR 32
|
||||
|
||||
@@ -104,6 +104,20 @@ struct iphdr {
|
||||
/*The options start here. */
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct iphdr *)skb_network_header(skb);
|
||||
}
|
||||
|
||||
static inline struct iphdr *ipip_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct iphdr *)skb_transport_header(skb);
|
||||
}
|
||||
#endif
|
||||
|
||||
struct ip_auth_hdr {
|
||||
__u8 nexthdr;
|
||||
__u8 hdrlen; /* This one is measured in 32 bit units! */
|
||||
|
||||
@@ -178,6 +178,9 @@ struct ipv6_devconf {
|
||||
#endif
|
||||
__s32 proxy_ndp;
|
||||
__s32 accept_source_route;
|
||||
#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
|
||||
__s32 optimistic_dad;
|
||||
#endif
|
||||
void *sysctl;
|
||||
};
|
||||
|
||||
@@ -208,6 +211,7 @@ enum {
|
||||
DEVCONF_PROXY_NDP,
|
||||
__DEVCONF_OPTIMISTIC_DAD,
|
||||
DEVCONF_ACCEPT_SOURCE_ROUTE,
|
||||
DEVCONF_OPTIMISTIC_DAD,
|
||||
DEVCONF_MAX
|
||||
};
|
||||
|
||||
@@ -219,6 +223,16 @@ enum {
|
||||
#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
|
||||
#include <net/inet_sock.h>
|
||||
|
||||
static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct ipv6hdr *)skb_network_header(skb);
|
||||
}
|
||||
|
||||
static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct ipv6hdr *)skb_transport_header(skb);
|
||||
}
|
||||
|
||||
/*
|
||||
This structure contains results of exthdrs parsing
|
||||
as offsets from skb->nh.
|
||||
|
||||
@@ -84,7 +84,7 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
|
||||
/* A special optimized version that handles 1 or more of u32s.
|
||||
* The length parameter here is the number of u32s in the key.
|
||||
*/
|
||||
static inline u32 jhash2(u32 *k, u32 length, u32 initval)
|
||||
static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
|
||||
{
|
||||
u32 a, b, c, len;
|
||||
|
||||
|
||||
@@ -160,6 +160,8 @@ struct key {
|
||||
*/
|
||||
union {
|
||||
struct list_head link;
|
||||
unsigned long x[2];
|
||||
void *p[2];
|
||||
} type_data;
|
||||
|
||||
/* key data
|
||||
|
||||
@@ -259,6 +259,12 @@ static inline s64 ktime_to_ns(const ktime_t kt)
|
||||
|
||||
#endif
|
||||
|
||||
static inline s64 ktime_to_us(const ktime_t kt)
|
||||
{
|
||||
struct timeval tv = ktime_to_timeval(kt);
|
||||
return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
|
||||
}
|
||||
|
||||
/*
|
||||
* The resolution of the clocks. The resolution value is returned in
|
||||
* the clock_getres() system call to give application programmers an
|
||||
|
||||
202
include/linux/mtd/ubi.h
Normal file
202
include/linux/mtd/ubi.h
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Copyright (c) International Business Machines Corp., 2006
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
||||
* the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Artem Bityutskiy (Битюцкий Артём)
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_UBI_H__
|
||||
#define __LINUX_UBI_H__
|
||||
|
||||
#include <asm/ioctl.h>
|
||||
#include <linux/types.h>
|
||||
#include <mtd/ubi-user.h>
|
||||
|
||||
/*
|
||||
* UBI data type hint constants.
|
||||
*
|
||||
* UBI_LONGTERM: long-term data
|
||||
* UBI_SHORTTERM: short-term data
|
||||
* UBI_UNKNOWN: data persistence is unknown
|
||||
*
|
||||
* These constants are used when data is written to UBI volumes in order to
|
||||
* help the UBI wear-leveling unit to find more appropriate physical
|
||||
* eraseblocks.
|
||||
*/
|
||||
enum {
|
||||
UBI_LONGTERM = 1,
|
||||
UBI_SHORTTERM,
|
||||
UBI_UNKNOWN
|
||||
};
|
||||
|
||||
/*
|
||||
* enum ubi_open_mode - UBI volume open mode constants.
|
||||
*
|
||||
* UBI_READONLY: read-only mode
|
||||
* UBI_READWRITE: read-write mode
|
||||
* UBI_EXCLUSIVE: exclusive mode
|
||||
*/
|
||||
enum {
|
||||
UBI_READONLY = 1,
|
||||
UBI_READWRITE,
|
||||
UBI_EXCLUSIVE
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ubi_volume_info - UBI volume description data structure.
|
||||
* @vol_id: volume ID
|
||||
* @ubi_num: UBI device number this volume belongs to
|
||||
* @size: how many physical eraseblocks are reserved for this volume
|
||||
* @used_bytes: how many bytes of data this volume contains
|
||||
* @used_ebs: how many physical eraseblocks of this volume actually contain any
|
||||
* data
|
||||
* @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME)
|
||||
* @corrupted: non-zero if the volume is corrupted (static volumes only)
|
||||
* @upd_marker: non-zero if the volume has update marker set
|
||||
* @alignment: volume alignment
|
||||
* @usable_leb_size: how many bytes are available in logical eraseblocks of
|
||||
* this volume
|
||||
* @name_len: volume name length
|
||||
* @name: volume name
|
||||
* @cdev: UBI volume character device major and minor numbers
|
||||
*
|
||||
* The @corrupted flag is only relevant to static volumes and is always zero
|
||||
* for dynamic ones. This is because UBI does not care about dynamic volume
|
||||
* data protection and only cares about protecting static volume data.
|
||||
*
|
||||
* The @upd_marker flag is set if the volume update operation was interrupted.
|
||||
* Before touching the volume data during the update operation, UBI first sets
|
||||
* the update marker flag for this volume. If the volume update operation was
|
||||
* further interrupted, the update marker indicates this. If the update marker
|
||||
* is set, the contents of the volume is certainly damaged and a new volume
|
||||
* update operation has to be started.
|
||||
*
|
||||
* To put it differently, @corrupted and @upd_marker fields have different
|
||||
* semantics:
|
||||
* o the @corrupted flag means that this static volume is corrupted for some
|
||||
* reasons, but not because an interrupted volume update
|
||||
* o the @upd_marker field means that the volume is damaged because of an
|
||||
* interrupted update operation.
|
||||
*
|
||||
* I.e., the @corrupted flag is never set if the @upd_marker flag is set.
|
||||
*
|
||||
* The @used_bytes and @used_ebs fields are only really needed for static
|
||||
* volumes and contain the number of bytes stored in this static volume and how
|
||||
* many eraseblock this data occupies. In case of dynamic volumes, the
|
||||
* @used_bytes field is equivalent to @size*@usable_leb_size, and the @used_ebs
|
||||
* field is equivalent to @size.
|
||||
*
|
||||
* In general, logical eraseblock size is a property of the UBI device, not
|
||||
* of the UBI volume. Indeed, the logical eraseblock size depends on the
|
||||
* physical eraseblock size and on how much bytes UBI headers consume. But
|
||||
* because of the volume alignment (@alignment), the usable size of logical
|
||||
* eraseblocks if a volume may be less. The following equation is true:
|
||||
* @usable_leb_size = LEB size - (LEB size mod @alignment),
|
||||
* where LEB size is the logical eraseblock size defined by the UBI device.
|
||||
*
|
||||
* The alignment is multiple to the minimal flash input/output unit size or %1
|
||||
* if all the available space is used.
|
||||
*
|
||||
* To put this differently, alignment may be considered is a way to change
|
||||
* volume logical eraseblock sizes.
|
||||
*/
|
||||
struct ubi_volume_info {
|
||||
int ubi_num;
|
||||
int vol_id;
|
||||
int size;
|
||||
long long used_bytes;
|
||||
int used_ebs;
|
||||
int vol_type;
|
||||
int corrupted;
|
||||
int upd_marker;
|
||||
int alignment;
|
||||
int usable_leb_size;
|
||||
int name_len;
|
||||
const char *name;
|
||||
dev_t cdev;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ubi_device_info - UBI device description data structure.
|
||||
* @ubi_num: ubi device number
|
||||
* @leb_size: logical eraseblock size on this UBI device
|
||||
* @min_io_size: minimal I/O unit size
|
||||
* @ro_mode: if this device is in read-only mode
|
||||
* @cdev: UBI character device major and minor numbers
|
||||
*
|
||||
* Note, @leb_size is the logical eraseblock size offered by the UBI device.
|
||||
* Volumes of this UBI device may have smaller logical eraseblock size if their
|
||||
* alignment is not equivalent to %1.
|
||||
*/
|
||||
struct ubi_device_info {
|
||||
int ubi_num;
|
||||
int leb_size;
|
||||
int min_io_size;
|
||||
int ro_mode;
|
||||
dev_t cdev;
|
||||
};
|
||||
|
||||
/* UBI descriptor given to users when they open UBI volumes */
|
||||
struct ubi_volume_desc;
|
||||
|
||||
int ubi_get_device_info(int ubi_num, struct ubi_device_info *di);
|
||||
void ubi_get_volume_info(struct ubi_volume_desc *desc,
|
||||
struct ubi_volume_info *vi);
|
||||
struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode);
|
||||
struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name,
|
||||
int mode);
|
||||
void ubi_close_volume(struct ubi_volume_desc *desc);
|
||||
int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
|
||||
int len, int check);
|
||||
int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
|
||||
int offset, int len, int dtype);
|
||||
int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
|
||||
int len, int dtype);
|
||||
int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum);
|
||||
int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum);
|
||||
int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum);
|
||||
|
||||
/*
|
||||
* This function is the same as the 'ubi_leb_read()' function, but it does not
|
||||
* provide the checking capability.
|
||||
*/
|
||||
static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf,
|
||||
int offset, int len)
|
||||
{
|
||||
return ubi_leb_read(desc, lnum, buf, offset, len, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is the same as the 'ubi_leb_write()' functions, but it does
|
||||
* not have the data type argument.
|
||||
*/
|
||||
static inline int ubi_write(struct ubi_volume_desc *desc, int lnum,
|
||||
const void *buf, int offset, int len)
|
||||
{
|
||||
return ubi_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is the same as the 'ubi_leb_change()' functions, but it does
|
||||
* not have the data type argument.
|
||||
*/
|
||||
static inline int ubi_change(struct ubi_volume_desc *desc, int lnum,
|
||||
const void *buf, int len)
|
||||
{
|
||||
return ubi_leb_change(desc, lnum, buf, len, UBI_UNKNOWN);
|
||||
}
|
||||
|
||||
#endif /* !__LINUX_UBI_H__ */
|
||||
@@ -24,7 +24,7 @@
|
||||
struct poll_table_struct;
|
||||
struct inode;
|
||||
|
||||
#define NPROTO 33 /* should be enough for now.. */
|
||||
#define NPROTO 34 /* should be enough for now.. */
|
||||
|
||||
#define SYS_SOCKET 1 /* sys_socket(2) */
|
||||
#define SYS_BIND 2 /* sys_bind(2) */
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
struct vlan_group;
|
||||
struct ethtool_ops;
|
||||
struct netpoll_info;
|
||||
/* 802.11 specific */
|
||||
struct wireless_dev;
|
||||
/* source back-compat hooks */
|
||||
#define SET_ETHTOOL_OPS(netdev,ops) \
|
||||
( (netdev)->ethtool_ops = (ops) )
|
||||
@@ -323,6 +325,7 @@ struct net_device
|
||||
#define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
|
||||
#define NETIF_F_GSO 2048 /* Enable software GSO. */
|
||||
#define NETIF_F_LLTX 4096 /* LockLess TX */
|
||||
#define NETIF_F_INTERNAL_STATS 8192 /* Use stats structure in net_device */
|
||||
|
||||
/* Segmentation offload features */
|
||||
#define NETIF_F_GSO_SHIFT 16
|
||||
@@ -347,13 +350,15 @@ struct net_device
|
||||
|
||||
|
||||
struct net_device_stats* (*get_stats)(struct net_device *dev);
|
||||
struct net_device_stats stats;
|
||||
|
||||
#ifdef CONFIG_WIRELESS_EXT
|
||||
/* List of functions to handle Wireless Extensions (instead of ioctl).
|
||||
* See <net/iw_handler.h> for details. Jean II */
|
||||
const struct iw_handler_def * wireless_handlers;
|
||||
/* Instance data managed by the core of Wireless Extensions. */
|
||||
struct iw_public_data * wireless_data;
|
||||
|
||||
#endif
|
||||
const struct ethtool_ops *ethtool_ops;
|
||||
|
||||
/*
|
||||
@@ -398,6 +403,8 @@ struct net_device
|
||||
void *ip6_ptr; /* IPv6 specific data */
|
||||
void *ec_ptr; /* Econet specific data */
|
||||
void *ax25_ptr; /* AX.25 specific data */
|
||||
struct wireless_dev *ieee80211_ptr; /* IEEE 802.11 specific data,
|
||||
assign before registering */
|
||||
|
||||
/*
|
||||
* Cache line mostly used on receive path (including eth_type_trans())
|
||||
|
||||
@@ -281,9 +281,6 @@ extern void nf_reinject(struct sk_buff *skb,
|
||||
struct nf_info *info,
|
||||
unsigned int verdict);
|
||||
|
||||
extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
|
||||
extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
|
||||
|
||||
/* FIXME: Before cache is ever used, this must be implemented for real. */
|
||||
extern void nf_invalidate_cache(int pf);
|
||||
|
||||
@@ -388,11 +385,18 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
|
||||
struct flowi;
|
||||
static inline void
|
||||
nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {}
|
||||
#endif /*CONFIG_NETFILTER*/
|
||||
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
|
||||
extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
|
||||
extern void (*nf_ct_destroy)(struct nf_conntrack *);
|
||||
#else
|
||||
static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
|
||||
#endif
|
||||
|
||||
#endif /*__KERNEL__*/
|
||||
#endif /*__LINUX_NETFILTER_H*/
|
||||
|
||||
@@ -30,6 +30,11 @@ enum tcp_conntrack {
|
||||
/* Be liberal in window checking */
|
||||
#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08
|
||||
|
||||
struct nf_ct_tcp_flags {
|
||||
u_int8_t flags;
|
||||
u_int8_t mask;
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
struct ip_ct_tcp_state {
|
||||
|
||||
@@ -62,11 +62,11 @@ struct nfattr
|
||||
#define NFA_DATA(nfa) ((void *)(((char *)(nfa)) + NFA_LENGTH(0)))
|
||||
#define NFA_PAYLOAD(nfa) ((int)((nfa)->nfa_len) - NFA_LENGTH(0))
|
||||
#define NFA_NEST(skb, type) \
|
||||
({ struct nfattr *__start = (struct nfattr *) (skb)->tail; \
|
||||
({ struct nfattr *__start = (struct nfattr *)skb_tail_pointer(skb); \
|
||||
NFA_PUT(skb, (NFNL_NFA_NEST | type), 0, NULL); \
|
||||
__start; })
|
||||
#define NFA_NEST_END(skb, start) \
|
||||
({ (start)->nfa_len = ((skb)->tail - (unsigned char *) (start)); \
|
||||
({ (start)->nfa_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
|
||||
(skb)->len; })
|
||||
#define NFA_NEST_CANCEL(skb, start) \
|
||||
({ if (start) \
|
||||
@@ -111,7 +111,7 @@ struct nfgenmsg {
|
||||
struct nfnl_callback
|
||||
{
|
||||
int (*call)(struct sock *nl, struct sk_buff *skb,
|
||||
struct nlmsghdr *nlh, struct nfattr *cda[], int *errp);
|
||||
struct nlmsghdr *nlh, struct nfattr *cda[]);
|
||||
u_int16_t attr_count; /* number of nfattr's */
|
||||
};
|
||||
|
||||
@@ -129,19 +129,6 @@ extern void __nfa_fill(struct sk_buff *skb, int attrtype,
|
||||
({ if (skb_tailroom(skb) < (int)NFA_SPACE(attrlen)) goto nfattr_failure; \
|
||||
__nfa_fill(skb, attrtype, attrlen, data); })
|
||||
|
||||
extern struct semaphore nfnl_sem;
|
||||
|
||||
#define nfnl_shlock() down(&nfnl_sem)
|
||||
#define nfnl_shlock_nowait() down_trylock(&nfnl_sem)
|
||||
|
||||
#define nfnl_shunlock() do { up(&nfnl_sem); \
|
||||
if(nfnl && nfnl->sk_receive_queue.qlen) \
|
||||
nfnl->sk_data_ready(nfnl, 0); \
|
||||
} while(0)
|
||||
|
||||
extern void nfnl_lock(void);
|
||||
extern void nfnl_unlock(void);
|
||||
|
||||
extern int nfnetlink_subsys_register(struct nfnetlink_subsystem *n);
|
||||
extern int nfnetlink_subsys_unregister(struct nfnetlink_subsystem *n);
|
||||
|
||||
|
||||
@@ -83,6 +83,10 @@ enum ctattr_protoinfo {
|
||||
enum ctattr_protoinfo_tcp {
|
||||
CTA_PROTOINFO_TCP_UNSPEC,
|
||||
CTA_PROTOINFO_TCP_STATE,
|
||||
CTA_PROTOINFO_TCP_WSCALE_ORIGINAL,
|
||||
CTA_PROTOINFO_TCP_WSCALE_REPLY,
|
||||
CTA_PROTOINFO_TCP_FLAGS_ORIGINAL,
|
||||
CTA_PROTOINFO_TCP_FLAGS_REPLY,
|
||||
__CTA_PROTOINFO_TCP_MAX
|
||||
};
|
||||
#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <linux/netfilter.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include <linux/if_pppox.h>
|
||||
|
||||
/* Bridge Hooks */
|
||||
/* After promisc drops, checksum checks. */
|
||||
@@ -58,8 +59,14 @@ static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
|
||||
* enough room for the encapsulating header (if there is one). */
|
||||
static inline int nf_bridge_pad(const struct sk_buff *skb)
|
||||
{
|
||||
return (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q))
|
||||
? VLAN_HLEN : 0;
|
||||
int padding = 0;
|
||||
|
||||
if (skb->nf_bridge && skb->protocol == htons(ETH_P_8021Q))
|
||||
padding = VLAN_HLEN;
|
||||
else if (skb->nf_bridge && skb->protocol == htons(ETH_P_PPP_SES))
|
||||
padding = PPPOE_SES_HLEN;
|
||||
|
||||
return padding;
|
||||
}
|
||||
|
||||
struct bridge_skb_cb {
|
||||
|
||||
@@ -54,7 +54,7 @@ struct ebt_802_3_hdr {
|
||||
|
||||
static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct ebt_802_3_hdr *)skb->mac.raw;
|
||||
return (struct ebt_802_3_hdr *)skb_mac_header(skb);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
#define EBT_ARP_DST_IP 0x10
|
||||
#define EBT_ARP_SRC_MAC 0x20
|
||||
#define EBT_ARP_DST_MAC 0x40
|
||||
#define EBT_ARP_GRAT 0x80
|
||||
#define EBT_ARP_MASK (EBT_ARP_OPCODE | EBT_ARP_HTYPE | EBT_ARP_PTYPE | \
|
||||
EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC)
|
||||
EBT_ARP_SRC_IP | EBT_ARP_DST_IP | EBT_ARP_SRC_MAC | EBT_ARP_DST_MAC | \
|
||||
EBT_ARP_GRAT)
|
||||
#define EBT_ARP_MATCH "arp"
|
||||
|
||||
struct ebt_arp_info
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
header-y += ip_conntrack_helper.h
|
||||
header-y += ip_conntrack_protocol.h
|
||||
header-y += ip_conntrack_sctp.h
|
||||
header-y += ip_conntrack_tcp.h
|
||||
header-y += ip_conntrack_tftp.h
|
||||
header-y += ip_nat_pptp.h
|
||||
header-y += ipt_addrtype.h
|
||||
header-y += ipt_ah.h
|
||||
header-y += ipt_CLASSIFY.h
|
||||
@@ -49,13 +43,5 @@ header-y += ipt_ttl.h
|
||||
header-y += ipt_TTL.h
|
||||
header-y += ipt_ULOG.h
|
||||
|
||||
unifdef-y += ip_conntrack.h
|
||||
unifdef-y += ip_conntrack_h323.h
|
||||
unifdef-y += ip_conntrack_irc.h
|
||||
unifdef-y += ip_conntrack_pptp.h
|
||||
unifdef-y += ip_conntrack_proto_gre.h
|
||||
unifdef-y += ip_conntrack_tuple.h
|
||||
unifdef-y += ip_nat.h
|
||||
unifdef-y += ip_nat_rule.h
|
||||
unifdef-y += ip_queue.h
|
||||
unifdef-y += ip_tables.h
|
||||
|
||||
@@ -1,402 +0,0 @@
|
||||
#ifndef _IP_CONNTRACK_H
|
||||
#define _IP_CONNTRACK_H
|
||||
|
||||
#include <linux/netfilter/nf_conntrack_common.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
#include <linux/timer.h>
|
||||
#include <linux/netfilter_ipv4/ip_conntrack_tcp.h>
|
||||
#include <linux/netfilter_ipv4/ip_conntrack_icmp.h>
|
||||
#include <linux/netfilter_ipv4/ip_conntrack_proto_gre.h>
|
||||
#include <linux/netfilter_ipv4/ip_conntrack_sctp.h>
|
||||
|
||||
/* per conntrack: protocol private data */
|
||||
union ip_conntrack_proto {
|
||||
/* insert conntrack proto private data here */
|
||||
struct ip_ct_gre gre;
|
||||
struct ip_ct_sctp sctp;
|
||||
struct ip_ct_tcp tcp;
|
||||
struct ip_ct_icmp icmp;
|
||||
};
|
||||
|
||||
union ip_conntrack_expect_proto {
|
||||
/* insert expect proto private data here */
|
||||
};
|
||||
|
||||
/* Add protocol helper include file here */
|
||||
#include <linux/netfilter_ipv4/ip_conntrack_h323.h>
|
||||
#include <linux/netfilter_ipv4/ip_conntrack_pptp.h>
|
||||
#include <linux/netfilter_ipv4/ip_conntrack_amanda.h>
|
||||
#include <linux/netfilter_ipv4/ip_conntrack_ftp.h>
|
||||
#include <linux/netfilter_ipv4/ip_conntrack_irc.h>
|
||||
|
||||
/* per conntrack: application helper private data */
|
||||
union ip_conntrack_help {
|
||||
/* insert conntrack helper private data (master) here */
|
||||
struct ip_ct_h323_master ct_h323_info;
|
||||
struct ip_ct_pptp_master ct_pptp_info;
|
||||
struct ip_ct_ftp_master ct_ftp_info;
|
||||
struct ip_ct_irc_master ct_irc_info;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_IP_NF_NAT_NEEDED
|
||||
#include <linux/netfilter_ipv4/ip_nat.h>
|
||||
#include <linux/netfilter_ipv4/ip_nat_pptp.h>
|
||||
|
||||
/* per conntrack: nat application helper private data */
|
||||
union ip_conntrack_nat_help {
|
||||
/* insert nat helper private data here */
|
||||
struct ip_nat_pptp nat_pptp_info;
|
||||
};
|
||||
#endif
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
#ifdef CONFIG_NETFILTER_DEBUG
|
||||
#define IP_NF_ASSERT(x) \
|
||||
do { \
|
||||
if (!(x)) \
|
||||
/* Wooah! I'm tripping my conntrack in a frenzy of \
|
||||
netplay... */ \
|
||||
printk("NF_IP_ASSERT: %s:%i(%s)\n", \
|
||||
__FILE__, __LINE__, __FUNCTION__); \
|
||||
} while(0)
|
||||
#else
|
||||
#define IP_NF_ASSERT(x)
|
||||
#endif
|
||||
|
||||
struct ip_conntrack_helper;
|
||||
|
||||
struct ip_conntrack
|
||||
{
|
||||
/* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
|
||||
plus 1 for any connection(s) we are `master' for */
|
||||
struct nf_conntrack ct_general;
|
||||
|
||||
/* Have we seen traffic both ways yet? (bitset) */
|
||||
unsigned long status;
|
||||
|
||||
/* Timer function; drops refcnt when it goes off. */
|
||||
struct timer_list timeout;
|
||||
|
||||
#ifdef CONFIG_IP_NF_CT_ACCT
|
||||
/* Accounting Information (same cache line as other written members) */
|
||||
struct ip_conntrack_counter counters[IP_CT_DIR_MAX];
|
||||
#endif
|
||||
/* If we were expected by an expectation, this will be it */
|
||||
struct ip_conntrack *master;
|
||||
|
||||
/* Current number of expected connections */
|
||||
unsigned int expecting;
|
||||
|
||||
/* Unique ID that identifies this conntrack*/
|
||||
unsigned int id;
|
||||
|
||||
/* Helper, if any. */
|
||||
struct ip_conntrack_helper *helper;
|
||||
|
||||
/* Storage reserved for other modules: */
|
||||
union ip_conntrack_proto proto;
|
||||
|
||||
union ip_conntrack_help help;
|
||||
|
||||
#ifdef CONFIG_IP_NF_NAT_NEEDED
|
||||
struct {
|
||||
struct ip_nat_info info;
|
||||
union ip_conntrack_nat_help help;
|
||||
#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
|
||||
defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE)
|
||||
int masq_index;
|
||||
#endif
|
||||
} nat;
|
||||
#endif /* CONFIG_IP_NF_NAT_NEEDED */
|
||||
|
||||
#if defined(CONFIG_IP_NF_CONNTRACK_MARK)
|
||||
u_int32_t mark;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_IP_NF_CONNTRACK_SECMARK
|
||||
u_int32_t secmark;
|
||||
#endif
|
||||
|
||||
/* Traversed often, so hopefully in different cacheline to top */
|
||||
/* These are my tuples; original and reply */
|
||||
struct ip_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
|
||||
};
|
||||
|
||||
struct ip_conntrack_expect
|
||||
{
|
||||
/* Internal linked list (global expectation list) */
|
||||
struct list_head list;
|
||||
|
||||
/* We expect this tuple, with the following mask */
|
||||
struct ip_conntrack_tuple tuple, mask;
|
||||
|
||||
/* Function to call after setup and insertion */
|
||||
void (*expectfn)(struct ip_conntrack *new,
|
||||
struct ip_conntrack_expect *this);
|
||||
|
||||
/* The conntrack of the master connection */
|
||||
struct ip_conntrack *master;
|
||||
|
||||
/* Timer function; deletes the expectation. */
|
||||
struct timer_list timeout;
|
||||
|
||||
/* Usage count. */
|
||||
atomic_t use;
|
||||
|
||||
/* Unique ID */
|
||||
unsigned int id;
|
||||
|
||||
/* Flags */
|
||||
unsigned int flags;
|
||||
|
||||
#ifdef CONFIG_IP_NF_NAT_NEEDED
|
||||
__be32 saved_ip;
|
||||
/* This is the original per-proto part, used to map the
|
||||
* expected connection the way the recipient expects. */
|
||||
union ip_conntrack_manip_proto saved_proto;
|
||||
/* Direction relative to the master connection. */
|
||||
enum ip_conntrack_dir dir;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define IP_CT_EXPECT_PERMANENT 0x1
|
||||
|
||||
static inline struct ip_conntrack *
|
||||
tuplehash_to_ctrack(const struct ip_conntrack_tuple_hash *hash)
|
||||
{
|
||||
return container_of(hash, struct ip_conntrack,
|
||||
tuplehash[hash->tuple.dst.dir]);
|
||||
}
|
||||
|
||||
/* get master conntrack via master expectation */
|
||||
#define master_ct(conntr) (conntr->master)
|
||||
|
||||
/* Alter reply tuple (maybe alter helper). */
|
||||
extern void
|
||||
ip_conntrack_alter_reply(struct ip_conntrack *conntrack,
|
||||
const struct ip_conntrack_tuple *newreply);
|
||||
|
||||
/* Is this tuple taken? (ignoring any belonging to the given
|
||||
conntrack). */
|
||||
extern int
|
||||
ip_conntrack_tuple_taken(const struct ip_conntrack_tuple *tuple,
|
||||
const struct ip_conntrack *ignored_conntrack);
|
||||
|
||||
/* Return conntrack_info and tuple hash for given skb. */
|
||||
static inline struct ip_conntrack *
|
||||
ip_conntrack_get(const struct sk_buff *skb, enum ip_conntrack_info *ctinfo)
|
||||
{
|
||||
*ctinfo = skb->nfctinfo;
|
||||
return (struct ip_conntrack *)skb->nfct;
|
||||
}
|
||||
|
||||
/* decrement reference count on a conntrack */
|
||||
static inline void
|
||||
ip_conntrack_put(struct ip_conntrack *ct)
|
||||
{
|
||||
IP_NF_ASSERT(ct);
|
||||
nf_conntrack_put(&ct->ct_general);
|
||||
}
|
||||
|
||||
extern int invert_tuplepr(struct ip_conntrack_tuple *inverse,
|
||||
const struct ip_conntrack_tuple *orig);
|
||||
|
||||
extern void __ip_ct_refresh_acct(struct ip_conntrack *ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
const struct sk_buff *skb,
|
||||
unsigned long extra_jiffies,
|
||||
int do_acct);
|
||||
|
||||
/* Refresh conntrack for this many jiffies and do accounting */
|
||||
static inline void ip_ct_refresh_acct(struct ip_conntrack *ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
const struct sk_buff *skb,
|
||||
unsigned long extra_jiffies)
|
||||
{
|
||||
__ip_ct_refresh_acct(ct, ctinfo, skb, extra_jiffies, 1);
|
||||
}
|
||||
|
||||
/* Refresh conntrack for this many jiffies */
|
||||
static inline void ip_ct_refresh(struct ip_conntrack *ct,
|
||||
const struct sk_buff *skb,
|
||||
unsigned long extra_jiffies)
|
||||
{
|
||||
__ip_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
|
||||
}
|
||||
|
||||
/* These are for NAT. Icky. */
|
||||
/* Update TCP window tracking data when NAT mangles the packet */
|
||||
extern void ip_conntrack_tcp_update(struct sk_buff *skb,
|
||||
struct ip_conntrack *conntrack,
|
||||
enum ip_conntrack_dir dir);
|
||||
|
||||
/* Call me when a conntrack is destroyed. */
|
||||
extern void (*ip_conntrack_destroyed)(struct ip_conntrack *conntrack);
|
||||
|
||||
/* Fake conntrack entry for untracked connections */
|
||||
extern struct ip_conntrack ip_conntrack_untracked;
|
||||
|
||||
/* Returns new sk_buff, or NULL */
|
||||
struct sk_buff *
|
||||
ip_ct_gather_frags(struct sk_buff *skb, u_int32_t user);
|
||||
|
||||
/* Iterate over all conntracks: if iter returns true, it's deleted. */
|
||||
extern void
|
||||
ip_ct_iterate_cleanup(int (*iter)(struct ip_conntrack *i, void *data),
|
||||
void *data);
|
||||
|
||||
extern struct ip_conntrack_helper *
|
||||
__ip_conntrack_helper_find_byname(const char *);
|
||||
extern struct ip_conntrack_helper *
|
||||
ip_conntrack_helper_find_get(const struct ip_conntrack_tuple *tuple);
|
||||
extern void ip_conntrack_helper_put(struct ip_conntrack_helper *helper);
|
||||
|
||||
extern struct ip_conntrack_protocol *
|
||||
__ip_conntrack_proto_find(u_int8_t protocol);
|
||||
extern struct ip_conntrack_protocol *
|
||||
ip_conntrack_proto_find_get(u_int8_t protocol);
|
||||
extern void ip_conntrack_proto_put(struct ip_conntrack_protocol *proto);
|
||||
|
||||
extern void ip_ct_remove_expectations(struct ip_conntrack *ct);
|
||||
|
||||
extern struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *,
|
||||
struct ip_conntrack_tuple *);
|
||||
|
||||
extern void ip_conntrack_free(struct ip_conntrack *ct);
|
||||
|
||||
extern void ip_conntrack_hash_insert(struct ip_conntrack *ct);
|
||||
|
||||
extern struct ip_conntrack_expect *
|
||||
__ip_conntrack_expect_find(const struct ip_conntrack_tuple *tuple);
|
||||
|
||||
extern struct ip_conntrack_expect *
|
||||
ip_conntrack_expect_find_get(const struct ip_conntrack_tuple *tuple);
|
||||
|
||||
extern struct ip_conntrack_tuple_hash *
|
||||
__ip_conntrack_find(const struct ip_conntrack_tuple *tuple,
|
||||
const struct ip_conntrack *ignored_conntrack);
|
||||
|
||||
extern void ip_conntrack_flush(void);
|
||||
|
||||
/* It's confirmed if it is, or has been in the hash table. */
|
||||
static inline int is_confirmed(struct ip_conntrack *ct)
|
||||
{
|
||||
return test_bit(IPS_CONFIRMED_BIT, &ct->status);
|
||||
}
|
||||
|
||||
static inline int is_dying(struct ip_conntrack *ct)
|
||||
{
|
||||
return test_bit(IPS_DYING_BIT, &ct->status);
|
||||
}
|
||||
|
||||
extern unsigned int ip_conntrack_htable_size;
|
||||
extern int ip_conntrack_checksum;
|
||||
|
||||
#define CONNTRACK_STAT_INC(count) (__get_cpu_var(ip_conntrack_stat).count++)
|
||||
#define CONNTRACK_STAT_INC_ATOMIC(count) \
|
||||
do { \
|
||||
local_bh_disable(); \
|
||||
__get_cpu_var(ip_conntrack_stat).count++; \
|
||||
local_bh_enable(); \
|
||||
} while (0)
|
||||
|
||||
#ifdef CONFIG_IP_NF_CONNTRACK_EVENTS
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
struct ip_conntrack_ecache {
|
||||
struct ip_conntrack *ct;
|
||||
unsigned int events;
|
||||
};
|
||||
DECLARE_PER_CPU(struct ip_conntrack_ecache, ip_conntrack_ecache);
|
||||
|
||||
#define CONNTRACK_ECACHE(x) (__get_cpu_var(ip_conntrack_ecache).x)
|
||||
|
||||
extern struct atomic_notifier_head ip_conntrack_chain;
|
||||
extern struct atomic_notifier_head ip_conntrack_expect_chain;
|
||||
|
||||
static inline int ip_conntrack_register_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return atomic_notifier_chain_register(&ip_conntrack_chain, nb);
|
||||
}
|
||||
|
||||
static inline int ip_conntrack_unregister_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return atomic_notifier_chain_unregister(&ip_conntrack_chain, nb);
|
||||
}
|
||||
|
||||
static inline int
|
||||
ip_conntrack_expect_register_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return atomic_notifier_chain_register(&ip_conntrack_expect_chain, nb);
|
||||
}
|
||||
|
||||
static inline int
|
||||
ip_conntrack_expect_unregister_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return atomic_notifier_chain_unregister(&ip_conntrack_expect_chain,
|
||||
nb);
|
||||
}
|
||||
|
||||
extern void ip_ct_deliver_cached_events(const struct ip_conntrack *ct);
|
||||
extern void __ip_ct_event_cache_init(struct ip_conntrack *ct);
|
||||
|
||||
static inline void
|
||||
ip_conntrack_event_cache(enum ip_conntrack_events event,
|
||||
const struct sk_buff *skb)
|
||||
{
|
||||
struct ip_conntrack *ct = (struct ip_conntrack *)skb->nfct;
|
||||
struct ip_conntrack_ecache *ecache;
|
||||
|
||||
local_bh_disable();
|
||||
ecache = &__get_cpu_var(ip_conntrack_ecache);
|
||||
if (ct != ecache->ct)
|
||||
__ip_ct_event_cache_init(ct);
|
||||
ecache->events |= event;
|
||||
local_bh_enable();
|
||||
}
|
||||
|
||||
static inline void ip_conntrack_event(enum ip_conntrack_events event,
|
||||
struct ip_conntrack *ct)
|
||||
{
|
||||
if (is_confirmed(ct) && !is_dying(ct))
|
||||
atomic_notifier_call_chain(&ip_conntrack_chain, event, ct);
|
||||
}
|
||||
|
||||
static inline void
|
||||
ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
|
||||
struct ip_conntrack_expect *exp)
|
||||
{
|
||||
atomic_notifier_call_chain(&ip_conntrack_expect_chain, event, exp);
|
||||
}
|
||||
#else /* CONFIG_IP_NF_CONNTRACK_EVENTS */
|
||||
static inline void ip_conntrack_event_cache(enum ip_conntrack_events event,
|
||||
const struct sk_buff *skb) {}
|
||||
static inline void ip_conntrack_event(enum ip_conntrack_events event,
|
||||
struct ip_conntrack *ct) {}
|
||||
static inline void ip_ct_deliver_cached_events(const struct ip_conntrack *ct) {}
|
||||
static inline void
|
||||
ip_conntrack_expect_event(enum ip_conntrack_expect_events event,
|
||||
struct ip_conntrack_expect *exp) {}
|
||||
#endif /* CONFIG_IP_NF_CONNTRACK_EVENTS */
|
||||
|
||||
#ifdef CONFIG_IP_NF_NAT_NEEDED
|
||||
static inline int ip_nat_initialized(struct ip_conntrack *conntrack,
|
||||
enum ip_nat_manip_type manip)
|
||||
{
|
||||
if (manip == IP_NAT_MANIP_SRC)
|
||||
return test_bit(IPS_SRC_NAT_DONE_BIT, &conntrack->status);
|
||||
return test_bit(IPS_DST_NAT_DONE_BIT, &conntrack->status);
|
||||
}
|
||||
#endif /* CONFIG_IP_NF_NAT_NEEDED */
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _IP_CONNTRACK_H */
|
||||
@@ -1,11 +0,0 @@
|
||||
#ifndef _IP_CONNTRACK_AMANDA_H
|
||||
#define _IP_CONNTRACK_AMANDA_H
|
||||
/* AMANDA tracking. */
|
||||
|
||||
struct ip_conntrack_expect;
|
||||
extern unsigned int (*ip_nat_amanda_hook)(struct sk_buff **pskb,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned int matchoff,
|
||||
unsigned int matchlen,
|
||||
struct ip_conntrack_expect *exp);
|
||||
#endif /* _IP_CONNTRACK_AMANDA_H */
|
||||
@@ -1,61 +0,0 @@
|
||||
#ifndef _IP_CONNTRACK_CORE_H
|
||||
#define _IP_CONNTRACK_CORE_H
|
||||
#include <linux/netfilter.h>
|
||||
|
||||
#define MAX_IP_CT_PROTO 256
|
||||
extern struct ip_conntrack_protocol *ip_ct_protos[MAX_IP_CT_PROTO];
|
||||
|
||||
/* This header is used to share core functionality between the
|
||||
standalone connection tracking module, and the compatibility layer's use
|
||||
of connection tracking. */
|
||||
extern unsigned int ip_conntrack_in(unsigned int hooknum,
|
||||
struct sk_buff **pskb,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
int (*okfn)(struct sk_buff *));
|
||||
|
||||
extern int ip_conntrack_init(void);
|
||||
extern void ip_conntrack_cleanup(void);
|
||||
|
||||
struct ip_conntrack_protocol;
|
||||
|
||||
extern int
|
||||
ip_ct_get_tuple(const struct iphdr *iph,
|
||||
const struct sk_buff *skb,
|
||||
unsigned int dataoff,
|
||||
struct ip_conntrack_tuple *tuple,
|
||||
const struct ip_conntrack_protocol *protocol);
|
||||
|
||||
extern int
|
||||
ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse,
|
||||
const struct ip_conntrack_tuple *orig,
|
||||
const struct ip_conntrack_protocol *protocol);
|
||||
|
||||
/* Find a connection corresponding to a tuple. */
|
||||
struct ip_conntrack_tuple_hash *
|
||||
ip_conntrack_find_get(const struct ip_conntrack_tuple *tuple,
|
||||
const struct ip_conntrack *ignored_conntrack);
|
||||
|
||||
extern int __ip_conntrack_confirm(struct sk_buff **pskb);
|
||||
|
||||
/* Confirm a connection: returns NF_DROP if packet must be dropped. */
|
||||
static inline int ip_conntrack_confirm(struct sk_buff **pskb)
|
||||
{
|
||||
struct ip_conntrack *ct = (struct ip_conntrack *)(*pskb)->nfct;
|
||||
int ret = NF_ACCEPT;
|
||||
|
||||
if (ct) {
|
||||
if (!is_confirmed(ct) && !is_dying(ct))
|
||||
ret = __ip_conntrack_confirm(pskb);
|
||||
ip_ct_deliver_cached_events(ct);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern void ip_ct_unlink_expect(struct ip_conntrack_expect *exp);
|
||||
|
||||
extern struct list_head *ip_conntrack_hash;
|
||||
extern struct list_head ip_conntrack_expect_list;
|
||||
extern rwlock_t ip_conntrack_lock;
|
||||
#endif /* _IP_CONNTRACK_CORE_H */
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#ifndef _IP_CONNTRACK_FTP_H
|
||||
#define _IP_CONNTRACK_FTP_H
|
||||
/* FTP tracking. */
|
||||
|
||||
/* This enum is exposed to userspace */
|
||||
enum ip_ct_ftp_type
|
||||
{
|
||||
/* PORT command from client */
|
||||
IP_CT_FTP_PORT,
|
||||
/* PASV response from server */
|
||||
IP_CT_FTP_PASV,
|
||||
/* EPRT command from client */
|
||||
IP_CT_FTP_EPRT,
|
||||
/* EPSV response from server */
|
||||
IP_CT_FTP_EPSV,
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define FTP_PORT 21
|
||||
|
||||
#define NUM_SEQ_TO_REMEMBER 2
|
||||
/* This structure exists only once per master */
|
||||
struct ip_ct_ftp_master {
|
||||
/* Valid seq positions for cmd matching after newline */
|
||||
u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];
|
||||
/* 0 means seq_match_aft_nl not set */
|
||||
int seq_aft_nl_num[IP_CT_DIR_MAX];
|
||||
};
|
||||
|
||||
struct ip_conntrack_expect;
|
||||
|
||||
/* For NAT to hook in when we find a packet which describes what other
|
||||
* connection we should expect. */
|
||||
extern unsigned int (*ip_nat_ftp_hook)(struct sk_buff **pskb,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
enum ip_ct_ftp_type type,
|
||||
unsigned int matchoff,
|
||||
unsigned int matchlen,
|
||||
struct ip_conntrack_expect *exp,
|
||||
u32 *seq);
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _IP_CONNTRACK_FTP_H */
|
||||
@@ -1,89 +0,0 @@
|
||||
#ifndef _IP_CONNTRACK_H323_H
|
||||
#define _IP_CONNTRACK_H323_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/netfilter/nf_conntrack_h323_asn1.h>
|
||||
|
||||
#define RAS_PORT 1719
|
||||
#define Q931_PORT 1720
|
||||
#define H323_RTP_CHANNEL_MAX 4 /* Audio, video, FAX and other */
|
||||
|
||||
/* This structure exists only once per master */
|
||||
struct ip_ct_h323_master {
|
||||
|
||||
/* Original and NATed Q.931 or H.245 signal ports */
|
||||
u_int16_t sig_port[IP_CT_DIR_MAX];
|
||||
|
||||
/* Original and NATed RTP ports */
|
||||
u_int16_t rtp_port[H323_RTP_CHANNEL_MAX][IP_CT_DIR_MAX];
|
||||
|
||||
union {
|
||||
/* RAS connection timeout */
|
||||
u_int32_t timeout;
|
||||
|
||||
/* Next TPKT length (for separate TPKT header and data) */
|
||||
u_int16_t tpkt_len[IP_CT_DIR_MAX];
|
||||
};
|
||||
};
|
||||
|
||||
struct ip_conntrack_expect;
|
||||
|
||||
extern int get_h225_addr(unsigned char *data, TransportAddress * addr,
|
||||
__be32 * ip, u_int16_t * port);
|
||||
extern void ip_conntrack_h245_expect(struct ip_conntrack *new,
|
||||
struct ip_conntrack_expect *this);
|
||||
extern void ip_conntrack_q931_expect(struct ip_conntrack *new,
|
||||
struct ip_conntrack_expect *this);
|
||||
extern int (*set_h245_addr_hook) (struct sk_buff ** pskb,
|
||||
unsigned char **data, int dataoff,
|
||||
H245_TransportAddress * addr,
|
||||
__be32 ip, u_int16_t port);
|
||||
extern int (*set_h225_addr_hook) (struct sk_buff ** pskb,
|
||||
unsigned char **data, int dataoff,
|
||||
TransportAddress * addr,
|
||||
__be32 ip, u_int16_t port);
|
||||
extern int (*set_sig_addr_hook) (struct sk_buff ** pskb,
|
||||
struct ip_conntrack * ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned char **data,
|
||||
TransportAddress * addr, int count);
|
||||
extern int (*set_ras_addr_hook) (struct sk_buff ** pskb,
|
||||
struct ip_conntrack * ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned char **data,
|
||||
TransportAddress * addr, int count);
|
||||
extern int (*nat_rtp_rtcp_hook) (struct sk_buff ** pskb,
|
||||
struct ip_conntrack * ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned char **data, int dataoff,
|
||||
H245_TransportAddress * addr,
|
||||
u_int16_t port, u_int16_t rtp_port,
|
||||
struct ip_conntrack_expect * rtp_exp,
|
||||
struct ip_conntrack_expect * rtcp_exp);
|
||||
extern int (*nat_t120_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned char **data, int dataoff,
|
||||
H245_TransportAddress * addr, u_int16_t port,
|
||||
struct ip_conntrack_expect * exp);
|
||||
extern int (*nat_h245_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned char **data, int dataoff,
|
||||
TransportAddress * addr, u_int16_t port,
|
||||
struct ip_conntrack_expect * exp);
|
||||
extern int (*nat_callforwarding_hook) (struct sk_buff ** pskb,
|
||||
struct ip_conntrack * ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned char **data, int dataoff,
|
||||
TransportAddress * addr,
|
||||
u_int16_t port,
|
||||
struct ip_conntrack_expect * exp);
|
||||
extern int (*nat_q931_hook) (struct sk_buff ** pskb, struct ip_conntrack * ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned char **data, TransportAddress * addr,
|
||||
int idx, u_int16_t port,
|
||||
struct ip_conntrack_expect * exp);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,46 +0,0 @@
|
||||
/* IP connection tracking helpers. */
|
||||
#ifndef _IP_CONNTRACK_HELPER_H
|
||||
#define _IP_CONNTRACK_HELPER_H
|
||||
#include <linux/netfilter_ipv4/ip_conntrack.h>
|
||||
|
||||
struct module;
|
||||
|
||||
struct ip_conntrack_helper
|
||||
{
|
||||
struct list_head list; /* Internal use. */
|
||||
|
||||
const char *name; /* name of the module */
|
||||
struct module *me; /* pointer to self */
|
||||
unsigned int max_expected; /* Maximum number of concurrent
|
||||
* expected connections */
|
||||
unsigned int timeout; /* timeout for expecteds */
|
||||
|
||||
/* Mask of things we will help (compared against server response) */
|
||||
struct ip_conntrack_tuple tuple;
|
||||
struct ip_conntrack_tuple mask;
|
||||
|
||||
/* Function to call when data passes; return verdict, or -1 to
|
||||
invalidate. */
|
||||
int (*help)(struct sk_buff **pskb,
|
||||
struct ip_conntrack *ct,
|
||||
enum ip_conntrack_info conntrackinfo);
|
||||
|
||||
void (*destroy)(struct ip_conntrack *ct);
|
||||
|
||||
int (*to_nfattr)(struct sk_buff *skb, const struct ip_conntrack *ct);
|
||||
};
|
||||
|
||||
extern int ip_conntrack_helper_register(struct ip_conntrack_helper *);
|
||||
extern void ip_conntrack_helper_unregister(struct ip_conntrack_helper *);
|
||||
|
||||
/* Allocate space for an expectation: this is mandatory before calling
|
||||
ip_conntrack_expect_related. You will have to call put afterwards. */
|
||||
extern struct ip_conntrack_expect *
|
||||
ip_conntrack_expect_alloc(struct ip_conntrack *master);
|
||||
extern void ip_conntrack_expect_put(struct ip_conntrack_expect *exp);
|
||||
|
||||
/* Add an expected connection: can have more than one per connection */
|
||||
extern int ip_conntrack_expect_related(struct ip_conntrack_expect *exp);
|
||||
extern void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp);
|
||||
|
||||
#endif /*_IP_CONNTRACK_HELPER_H*/
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef _IP_CONNTRACK_ICMP_H
|
||||
#define _IP_CONNTRACK_ICMP_H
|
||||
|
||||
#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
|
||||
|
||||
#endif /* _IP_CONNTRACK_ICMP_H */
|
||||
@@ -1,32 +0,0 @@
|
||||
/* IRC extension for IP connection tracking.
|
||||
* (C) 2000 by Harald Welte <laforge@gnumonks.org>
|
||||
* based on RR's ip_conntrack_ftp.h
|
||||
*
|
||||
* ip_conntrack_irc.h,v 1.6 2000/11/07 18:26:42 laforge Exp
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef _IP_CONNTRACK_IRC_H
|
||||
#define _IP_CONNTRACK_IRC_H
|
||||
|
||||
/* This structure exists only once per master */
|
||||
struct ip_ct_irc_master {
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
extern unsigned int (*ip_nat_irc_hook)(struct sk_buff **pskb,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned int matchoff,
|
||||
unsigned int matchlen,
|
||||
struct ip_conntrack_expect *exp);
|
||||
|
||||
#define IRC_PORT 6667
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _IP_CONNTRACK_IRC_H */
|
||||
@@ -1,326 +0,0 @@
|
||||
/* PPTP constants and structs */
|
||||
#ifndef _CONNTRACK_PPTP_H
|
||||
#define _CONNTRACK_PPTP_H
|
||||
|
||||
/* state of the control session */
|
||||
enum pptp_ctrlsess_state {
|
||||
PPTP_SESSION_NONE, /* no session present */
|
||||
PPTP_SESSION_ERROR, /* some session error */
|
||||
PPTP_SESSION_STOPREQ, /* stop_sess request seen */
|
||||
PPTP_SESSION_REQUESTED, /* start_sess request seen */
|
||||
PPTP_SESSION_CONFIRMED, /* session established */
|
||||
};
|
||||
|
||||
/* state of the call inside the control session */
|
||||
enum pptp_ctrlcall_state {
|
||||
PPTP_CALL_NONE,
|
||||
PPTP_CALL_ERROR,
|
||||
PPTP_CALL_OUT_REQ,
|
||||
PPTP_CALL_OUT_CONF,
|
||||
PPTP_CALL_IN_REQ,
|
||||
PPTP_CALL_IN_REP,
|
||||
PPTP_CALL_IN_CONF,
|
||||
PPTP_CALL_CLEAR_REQ,
|
||||
};
|
||||
|
||||
|
||||
/* conntrack private data */
|
||||
struct ip_ct_pptp_master {
|
||||
enum pptp_ctrlsess_state sstate; /* session state */
|
||||
|
||||
/* everything below is going to be per-expectation in newnat,
|
||||
* since there could be more than one call within one session */
|
||||
enum pptp_ctrlcall_state cstate; /* call state */
|
||||
__be16 pac_call_id; /* call id of PAC, host byte order */
|
||||
__be16 pns_call_id; /* call id of PNS, host byte order */
|
||||
|
||||
/* in pre-2.6.11 this used to be per-expect. Now it is per-conntrack
|
||||
* and therefore imposes a fixed limit on the number of maps */
|
||||
struct ip_ct_gre_keymap *keymap_orig, *keymap_reply;
|
||||
};
|
||||
|
||||
/* conntrack_expect private member */
|
||||
struct ip_ct_pptp_expect {
|
||||
enum pptp_ctrlcall_state cstate; /* call state */
|
||||
__be16 pac_call_id; /* call id of PAC */
|
||||
__be16 pns_call_id; /* call id of PNS */
|
||||
};
|
||||
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define IP_CONNTR_PPTP PPTP_CONTROL_PORT
|
||||
|
||||
#define PPTP_CONTROL_PORT 1723
|
||||
|
||||
#define PPTP_PACKET_CONTROL 1
|
||||
#define PPTP_PACKET_MGMT 2
|
||||
|
||||
#define PPTP_MAGIC_COOKIE 0x1a2b3c4d
|
||||
|
||||
struct pptp_pkt_hdr {
|
||||
__u16 packetLength;
|
||||
__be16 packetType;
|
||||
__be32 magicCookie;
|
||||
};
|
||||
|
||||
/* PptpControlMessageType values */
|
||||
#define PPTP_START_SESSION_REQUEST 1
|
||||
#define PPTP_START_SESSION_REPLY 2
|
||||
#define PPTP_STOP_SESSION_REQUEST 3
|
||||
#define PPTP_STOP_SESSION_REPLY 4
|
||||
#define PPTP_ECHO_REQUEST 5
|
||||
#define PPTP_ECHO_REPLY 6
|
||||
#define PPTP_OUT_CALL_REQUEST 7
|
||||
#define PPTP_OUT_CALL_REPLY 8
|
||||
#define PPTP_IN_CALL_REQUEST 9
|
||||
#define PPTP_IN_CALL_REPLY 10
|
||||
#define PPTP_IN_CALL_CONNECT 11
|
||||
#define PPTP_CALL_CLEAR_REQUEST 12
|
||||
#define PPTP_CALL_DISCONNECT_NOTIFY 13
|
||||
#define PPTP_WAN_ERROR_NOTIFY 14
|
||||
#define PPTP_SET_LINK_INFO 15
|
||||
|
||||
#define PPTP_MSG_MAX 15
|
||||
|
||||
/* PptpGeneralError values */
|
||||
#define PPTP_ERROR_CODE_NONE 0
|
||||
#define PPTP_NOT_CONNECTED 1
|
||||
#define PPTP_BAD_FORMAT 2
|
||||
#define PPTP_BAD_VALUE 3
|
||||
#define PPTP_NO_RESOURCE 4
|
||||
#define PPTP_BAD_CALLID 5
|
||||
#define PPTP_REMOVE_DEVICE_ERROR 6
|
||||
|
||||
struct PptpControlHeader {
|
||||
__be16 messageType;
|
||||
__u16 reserved;
|
||||
};
|
||||
|
||||
/* FramingCapability Bitmap Values */
|
||||
#define PPTP_FRAME_CAP_ASYNC 0x1
|
||||
#define PPTP_FRAME_CAP_SYNC 0x2
|
||||
|
||||
/* BearerCapability Bitmap Values */
|
||||
#define PPTP_BEARER_CAP_ANALOG 0x1
|
||||
#define PPTP_BEARER_CAP_DIGITAL 0x2
|
||||
|
||||
struct PptpStartSessionRequest {
|
||||
__be16 protocolVersion;
|
||||
__u16 reserved1;
|
||||
__be32 framingCapability;
|
||||
__be32 bearerCapability;
|
||||
__be16 maxChannels;
|
||||
__be16 firmwareRevision;
|
||||
__u8 hostName[64];
|
||||
__u8 vendorString[64];
|
||||
};
|
||||
|
||||
/* PptpStartSessionResultCode Values */
|
||||
#define PPTP_START_OK 1
|
||||
#define PPTP_START_GENERAL_ERROR 2
|
||||
#define PPTP_START_ALREADY_CONNECTED 3
|
||||
#define PPTP_START_NOT_AUTHORIZED 4
|
||||
#define PPTP_START_UNKNOWN_PROTOCOL 5
|
||||
|
||||
struct PptpStartSessionReply {
|
||||
__be16 protocolVersion;
|
||||
__u8 resultCode;
|
||||
__u8 generalErrorCode;
|
||||
__be32 framingCapability;
|
||||
__be32 bearerCapability;
|
||||
__be16 maxChannels;
|
||||
__be16 firmwareRevision;
|
||||
__u8 hostName[64];
|
||||
__u8 vendorString[64];
|
||||
};
|
||||
|
||||
/* PptpStopReasons */
|
||||
#define PPTP_STOP_NONE 1
|
||||
#define PPTP_STOP_PROTOCOL 2
|
||||
#define PPTP_STOP_LOCAL_SHUTDOWN 3
|
||||
|
||||
struct PptpStopSessionRequest {
|
||||
__u8 reason;
|
||||
__u8 reserved1;
|
||||
__u16 reserved2;
|
||||
};
|
||||
|
||||
/* PptpStopSessionResultCode */
|
||||
#define PPTP_STOP_OK 1
|
||||
#define PPTP_STOP_GENERAL_ERROR 2
|
||||
|
||||
struct PptpStopSessionReply {
|
||||
__u8 resultCode;
|
||||
__u8 generalErrorCode;
|
||||
__u16 reserved1;
|
||||
};
|
||||
|
||||
struct PptpEchoRequest {
|
||||
__be32 identNumber;
|
||||
};
|
||||
|
||||
/* PptpEchoReplyResultCode */
|
||||
#define PPTP_ECHO_OK 1
|
||||
#define PPTP_ECHO_GENERAL_ERROR 2
|
||||
|
||||
struct PptpEchoReply {
|
||||
__be32 identNumber;
|
||||
__u8 resultCode;
|
||||
__u8 generalErrorCode;
|
||||
__u16 reserved;
|
||||
};
|
||||
|
||||
/* PptpFramingType */
|
||||
#define PPTP_ASYNC_FRAMING 1
|
||||
#define PPTP_SYNC_FRAMING 2
|
||||
#define PPTP_DONT_CARE_FRAMING 3
|
||||
|
||||
/* PptpCallBearerType */
|
||||
#define PPTP_ANALOG_TYPE 1
|
||||
#define PPTP_DIGITAL_TYPE 2
|
||||
#define PPTP_DONT_CARE_BEARER_TYPE 3
|
||||
|
||||
struct PptpOutCallRequest {
|
||||
__be16 callID;
|
||||
__be16 callSerialNumber;
|
||||
__be32 minBPS;
|
||||
__be32 maxBPS;
|
||||
__be32 bearerType;
|
||||
__be32 framingType;
|
||||
__be16 packetWindow;
|
||||
__be16 packetProcDelay;
|
||||
__be16 phoneNumberLength;
|
||||
__u16 reserved1;
|
||||
__u8 phoneNumber[64];
|
||||
__u8 subAddress[64];
|
||||
};
|
||||
|
||||
/* PptpCallResultCode */
|
||||
#define PPTP_OUTCALL_CONNECT 1
|
||||
#define PPTP_OUTCALL_GENERAL_ERROR 2
|
||||
#define PPTP_OUTCALL_NO_CARRIER 3
|
||||
#define PPTP_OUTCALL_BUSY 4
|
||||
#define PPTP_OUTCALL_NO_DIAL_TONE 5
|
||||
#define PPTP_OUTCALL_TIMEOUT 6
|
||||
#define PPTP_OUTCALL_DONT_ACCEPT 7
|
||||
|
||||
struct PptpOutCallReply {
|
||||
__be16 callID;
|
||||
__be16 peersCallID;
|
||||
__u8 resultCode;
|
||||
__u8 generalErrorCode;
|
||||
__be16 causeCode;
|
||||
__be32 connectSpeed;
|
||||
__be16 packetWindow;
|
||||
__be16 packetProcDelay;
|
||||
__be32 physChannelID;
|
||||
};
|
||||
|
||||
struct PptpInCallRequest {
|
||||
__be16 callID;
|
||||
__be16 callSerialNumber;
|
||||
__be32 callBearerType;
|
||||
__be32 physChannelID;
|
||||
__be16 dialedNumberLength;
|
||||
__be16 dialingNumberLength;
|
||||
__u8 dialedNumber[64];
|
||||
__u8 dialingNumber[64];
|
||||
__u8 subAddress[64];
|
||||
};
|
||||
|
||||
/* PptpInCallResultCode */
|
||||
#define PPTP_INCALL_ACCEPT 1
|
||||
#define PPTP_INCALL_GENERAL_ERROR 2
|
||||
#define PPTP_INCALL_DONT_ACCEPT 3
|
||||
|
||||
struct PptpInCallReply {
|
||||
__be16 callID;
|
||||
__be16 peersCallID;
|
||||
__u8 resultCode;
|
||||
__u8 generalErrorCode;
|
||||
__be16 packetWindow;
|
||||
__be16 packetProcDelay;
|
||||
__u16 reserved;
|
||||
};
|
||||
|
||||
struct PptpInCallConnected {
|
||||
__be16 peersCallID;
|
||||
__u16 reserved;
|
||||
__be32 connectSpeed;
|
||||
__be16 packetWindow;
|
||||
__be16 packetProcDelay;
|
||||
__be32 callFramingType;
|
||||
};
|
||||
|
||||
struct PptpClearCallRequest {
|
||||
__be16 callID;
|
||||
__u16 reserved;
|
||||
};
|
||||
|
||||
struct PptpCallDisconnectNotify {
|
||||
__be16 callID;
|
||||
__u8 resultCode;
|
||||
__u8 generalErrorCode;
|
||||
__be16 causeCode;
|
||||
__u16 reserved;
|
||||
__u8 callStatistics[128];
|
||||
};
|
||||
|
||||
struct PptpWanErrorNotify {
|
||||
__be16 peersCallID;
|
||||
__u16 reserved;
|
||||
__be32 crcErrors;
|
||||
__be32 framingErrors;
|
||||
__be32 hardwareOverRuns;
|
||||
__be32 bufferOverRuns;
|
||||
__be32 timeoutErrors;
|
||||
__be32 alignmentErrors;
|
||||
};
|
||||
|
||||
struct PptpSetLinkInfo {
|
||||
__be16 peersCallID;
|
||||
__u16 reserved;
|
||||
__be32 sendAccm;
|
||||
__be32 recvAccm;
|
||||
};
|
||||
|
||||
union pptp_ctrl_union {
|
||||
struct PptpStartSessionRequest sreq;
|
||||
struct PptpStartSessionReply srep;
|
||||
struct PptpStopSessionRequest streq;
|
||||
struct PptpStopSessionReply strep;
|
||||
struct PptpOutCallRequest ocreq;
|
||||
struct PptpOutCallReply ocack;
|
||||
struct PptpInCallRequest icreq;
|
||||
struct PptpInCallReply icack;
|
||||
struct PptpInCallConnected iccon;
|
||||
struct PptpClearCallRequest clrreq;
|
||||
struct PptpCallDisconnectNotify disc;
|
||||
struct PptpWanErrorNotify wanerr;
|
||||
struct PptpSetLinkInfo setlink;
|
||||
};
|
||||
|
||||
extern int
|
||||
(*ip_nat_pptp_hook_outbound)(struct sk_buff **pskb,
|
||||
struct ip_conntrack *ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
struct PptpControlHeader *ctlh,
|
||||
union pptp_ctrl_union *pptpReq);
|
||||
|
||||
extern int
|
||||
(*ip_nat_pptp_hook_inbound)(struct sk_buff **pskb,
|
||||
struct ip_conntrack *ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
struct PptpControlHeader *ctlh,
|
||||
union pptp_ctrl_union *pptpReq);
|
||||
|
||||
extern void
|
||||
(*ip_nat_pptp_hook_exp_gre)(struct ip_conntrack_expect *exp_orig,
|
||||
struct ip_conntrack_expect *exp_reply);
|
||||
|
||||
extern void
|
||||
(*ip_nat_pptp_hook_expectfn)(struct ip_conntrack *ct,
|
||||
struct ip_conntrack_expect *exp);
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _CONNTRACK_PPTP_H */
|
||||
@@ -1,114 +0,0 @@
|
||||
#ifndef _CONNTRACK_PROTO_GRE_H
|
||||
#define _CONNTRACK_PROTO_GRE_H
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
/* GRE PROTOCOL HEADER */
|
||||
|
||||
/* GRE Version field */
|
||||
#define GRE_VERSION_1701 0x0
|
||||
#define GRE_VERSION_PPTP 0x1
|
||||
|
||||
/* GRE Protocol field */
|
||||
#define GRE_PROTOCOL_PPTP 0x880B
|
||||
|
||||
/* GRE Flags */
|
||||
#define GRE_FLAG_C 0x80
|
||||
#define GRE_FLAG_R 0x40
|
||||
#define GRE_FLAG_K 0x20
|
||||
#define GRE_FLAG_S 0x10
|
||||
#define GRE_FLAG_A 0x80
|
||||
|
||||
#define GRE_IS_C(f) ((f)&GRE_FLAG_C)
|
||||
#define GRE_IS_R(f) ((f)&GRE_FLAG_R)
|
||||
#define GRE_IS_K(f) ((f)&GRE_FLAG_K)
|
||||
#define GRE_IS_S(f) ((f)&GRE_FLAG_S)
|
||||
#define GRE_IS_A(f) ((f)&GRE_FLAG_A)
|
||||
|
||||
/* GRE is a mess: Four different standards */
|
||||
struct gre_hdr {
|
||||
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
||||
__u16 rec:3,
|
||||
srr:1,
|
||||
seq:1,
|
||||
key:1,
|
||||
routing:1,
|
||||
csum:1,
|
||||
version:3,
|
||||
reserved:4,
|
||||
ack:1;
|
||||
#elif defined(__BIG_ENDIAN_BITFIELD)
|
||||
__u16 csum:1,
|
||||
routing:1,
|
||||
key:1,
|
||||
seq:1,
|
||||
srr:1,
|
||||
rec:3,
|
||||
ack:1,
|
||||
reserved:4,
|
||||
version:3;
|
||||
#else
|
||||
#error "Adjust your <asm/byteorder.h> defines"
|
||||
#endif
|
||||
__be16 protocol;
|
||||
};
|
||||
|
||||
/* modified GRE header for PPTP */
|
||||
struct gre_hdr_pptp {
|
||||
__u8 flags; /* bitfield */
|
||||
__u8 version; /* should be GRE_VERSION_PPTP */
|
||||
__be16 protocol; /* should be GRE_PROTOCOL_PPTP */
|
||||
__be16 payload_len; /* size of ppp payload, not inc. gre header */
|
||||
__be16 call_id; /* peer's call_id for this session */
|
||||
__be32 seq; /* sequence number. Present if S==1 */
|
||||
__be32 ack; /* seq number of highest packet recieved by */
|
||||
/* sender in this session */
|
||||
};
|
||||
|
||||
|
||||
/* this is part of ip_conntrack */
|
||||
struct ip_ct_gre {
|
||||
unsigned int stream_timeout;
|
||||
unsigned int timeout;
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
struct ip_conntrack_expect;
|
||||
struct ip_conntrack;
|
||||
|
||||
/* structure for original <-> reply keymap */
|
||||
struct ip_ct_gre_keymap {
|
||||
struct list_head list;
|
||||
|
||||
struct ip_conntrack_tuple tuple;
|
||||
};
|
||||
|
||||
/* add new tuple->key_reply pair to keymap */
|
||||
int ip_ct_gre_keymap_add(struct ip_conntrack *ct,
|
||||
struct ip_conntrack_tuple *t,
|
||||
int reply);
|
||||
|
||||
/* delete keymap entries */
|
||||
void ip_ct_gre_keymap_destroy(struct ip_conntrack *ct);
|
||||
|
||||
|
||||
/* get pointer to gre key, if present */
|
||||
static inline __be32 *gre_key(struct gre_hdr *greh)
|
||||
{
|
||||
if (!greh->key)
|
||||
return NULL;
|
||||
if (greh->csum || greh->routing)
|
||||
return (__be32 *) (greh+sizeof(*greh)+4);
|
||||
return (__be32 *) (greh+sizeof(*greh));
|
||||
}
|
||||
|
||||
/* get pointer ot gre csum, if present */
|
||||
static inline __sum16 *gre_csum(struct gre_hdr *greh)
|
||||
{
|
||||
if (!greh->csum)
|
||||
return NULL;
|
||||
return (__sum16 *) (greh+sizeof(*greh));
|
||||
}
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _CONNTRACK_PROTO_GRE_H */
|
||||
@@ -1,98 +0,0 @@
|
||||
/* Header for use in defining a given protocol for connection tracking. */
|
||||
#ifndef _IP_CONNTRACK_PROTOCOL_H
|
||||
#define _IP_CONNTRACK_PROTOCOL_H
|
||||
#include <linux/netfilter_ipv4/ip_conntrack.h>
|
||||
#include <linux/netfilter/nfnetlink_conntrack.h>
|
||||
|
||||
struct seq_file;
|
||||
|
||||
struct ip_conntrack_protocol
|
||||
{
|
||||
/* Protocol number. */
|
||||
u_int8_t proto;
|
||||
|
||||
/* Protocol name */
|
||||
const char *name;
|
||||
|
||||
/* Try to fill in the third arg: dataoff is offset past IP
|
||||
hdr. Return true if possible. */
|
||||
int (*pkt_to_tuple)(const struct sk_buff *skb,
|
||||
unsigned int dataoff,
|
||||
struct ip_conntrack_tuple *tuple);
|
||||
|
||||
/* Invert the per-proto part of the tuple: ie. turn xmit into reply.
|
||||
* Some packets can't be inverted: return 0 in that case.
|
||||
*/
|
||||
int (*invert_tuple)(struct ip_conntrack_tuple *inverse,
|
||||
const struct ip_conntrack_tuple *orig);
|
||||
|
||||
/* Print out the per-protocol part of the tuple. Return like seq_* */
|
||||
int (*print_tuple)(struct seq_file *,
|
||||
const struct ip_conntrack_tuple *);
|
||||
|
||||
/* Print out the private part of the conntrack. */
|
||||
int (*print_conntrack)(struct seq_file *, const struct ip_conntrack *);
|
||||
|
||||
/* Returns verdict for packet, or -1 for invalid. */
|
||||
int (*packet)(struct ip_conntrack *conntrack,
|
||||
const struct sk_buff *skb,
|
||||
enum ip_conntrack_info ctinfo);
|
||||
|
||||
/* Called when a new connection for this protocol found;
|
||||
* returns TRUE if it's OK. If so, packet() called next. */
|
||||
int (*new)(struct ip_conntrack *conntrack, const struct sk_buff *skb);
|
||||
|
||||
/* Called when a conntrack entry is destroyed */
|
||||
void (*destroy)(struct ip_conntrack *conntrack);
|
||||
|
||||
int (*error)(struct sk_buff *skb, enum ip_conntrack_info *ctinfo,
|
||||
unsigned int hooknum);
|
||||
|
||||
/* convert protoinfo to nfnetink attributes */
|
||||
int (*to_nfattr)(struct sk_buff *skb, struct nfattr *nfa,
|
||||
const struct ip_conntrack *ct);
|
||||
|
||||
/* convert nfnetlink attributes to protoinfo */
|
||||
int (*from_nfattr)(struct nfattr *tb[], struct ip_conntrack *ct);
|
||||
|
||||
int (*tuple_to_nfattr)(struct sk_buff *skb,
|
||||
const struct ip_conntrack_tuple *t);
|
||||
int (*nfattr_to_tuple)(struct nfattr *tb[],
|
||||
struct ip_conntrack_tuple *t);
|
||||
|
||||
/* Module (if any) which this is connected to. */
|
||||
struct module *me;
|
||||
};
|
||||
|
||||
/* Protocol registration. */
|
||||
extern int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto);
|
||||
extern void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto);
|
||||
/* Existing built-in protocols */
|
||||
extern struct ip_conntrack_protocol ip_conntrack_protocol_tcp;
|
||||
extern struct ip_conntrack_protocol ip_conntrack_protocol_udp;
|
||||
extern struct ip_conntrack_protocol ip_conntrack_protocol_icmp;
|
||||
extern struct ip_conntrack_protocol ip_conntrack_generic_protocol;
|
||||
extern int ip_conntrack_protocol_tcp_init(void);
|
||||
|
||||
/* Log invalid packets */
|
||||
extern unsigned int ip_ct_log_invalid;
|
||||
|
||||
extern int ip_ct_port_tuple_to_nfattr(struct sk_buff *,
|
||||
const struct ip_conntrack_tuple *);
|
||||
extern int ip_ct_port_nfattr_to_tuple(struct nfattr *tb[],
|
||||
struct ip_conntrack_tuple *);
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
#ifdef DEBUG_INVALID_PACKETS
|
||||
#define LOG_INVALID(proto) \
|
||||
(ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW)
|
||||
#else
|
||||
#define LOG_INVALID(proto) \
|
||||
((ip_ct_log_invalid == (proto) || ip_ct_log_invalid == IPPROTO_RAW) \
|
||||
&& net_ratelimit())
|
||||
#endif
|
||||
#else
|
||||
#define LOG_INVALID(proto) 0
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
#endif /*_IP_CONNTRACK_PROTOCOL_H*/
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef _IP_CONNTRACK_SCTP_H
|
||||
#define _IP_CONNTRACK_SCTP_H
|
||||
|
||||
#include <linux/netfilter/nf_conntrack_sctp.h>
|
||||
|
||||
#endif /* _IP_CONNTRACK_SCTP_H */
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef __IP_CONNTRACK_SIP_H__
|
||||
#define __IP_CONNTRACK_SIP_H__
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define SIP_PORT 5060
|
||||
#define SIP_TIMEOUT 3600
|
||||
|
||||
enum sip_header_pos {
|
||||
POS_REG_REQ_URI,
|
||||
POS_REQ_URI,
|
||||
POS_FROM,
|
||||
POS_TO,
|
||||
POS_VIA,
|
||||
POS_CONTACT,
|
||||
POS_CONTENT,
|
||||
POS_MEDIA,
|
||||
POS_OWNER,
|
||||
POS_CONNECTION,
|
||||
POS_SDP_HEADER,
|
||||
};
|
||||
|
||||
extern unsigned int (*ip_nat_sip_hook)(struct sk_buff **pskb,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
struct ip_conntrack *ct,
|
||||
const char **dptr);
|
||||
extern unsigned int (*ip_nat_sdp_hook)(struct sk_buff **pskb,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
struct ip_conntrack_expect *exp,
|
||||
const char *dptr);
|
||||
|
||||
extern int ct_sip_get_info(const char *dptr, size_t dlen,
|
||||
unsigned int *matchoff,
|
||||
unsigned int *matchlen,
|
||||
enum sip_header_pos pos);
|
||||
extern int ct_sip_lnlen(const char *line, const char *limit);
|
||||
extern const char *ct_sip_search(const char *needle, const char *haystack,
|
||||
size_t needle_len, size_t haystack_len,
|
||||
int case_sensitive);
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* __IP_CONNTRACK_SIP_H__ */
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef _IP_CONNTRACK_TCP_H
|
||||
#define _IP_CONNTRACK_TCP_H
|
||||
|
||||
#include <linux/netfilter/nf_conntrack_tcp.h>
|
||||
|
||||
#endif /* _IP_CONNTRACK_TCP_H */
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef _IP_CT_TFTP
|
||||
#define _IP_CT_TFTP
|
||||
|
||||
#define TFTP_PORT 69
|
||||
|
||||
struct tftphdr {
|
||||
__be16 opcode;
|
||||
};
|
||||
|
||||
#define TFTP_OPCODE_READ 1
|
||||
#define TFTP_OPCODE_WRITE 2
|
||||
#define TFTP_OPCODE_DATA 3
|
||||
#define TFTP_OPCODE_ACK 4
|
||||
#define TFTP_OPCODE_ERROR 5
|
||||
|
||||
extern unsigned int (*ip_nat_tftp_hook)(struct sk_buff **pskb,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
struct ip_conntrack_expect *exp);
|
||||
|
||||
#endif /* _IP_CT_TFTP */
|
||||
@@ -1,146 +0,0 @@
|
||||
#ifndef _IP_CONNTRACK_TUPLE_H
|
||||
#define _IP_CONNTRACK_TUPLE_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/netfilter/nf_conntrack_tuple_common.h>
|
||||
|
||||
/* A `tuple' is a structure containing the information to uniquely
|
||||
identify a connection. ie. if two packets have the same tuple, they
|
||||
are in the same connection; if not, they are not.
|
||||
|
||||
We divide the structure along "manipulatable" and
|
||||
"non-manipulatable" lines, for the benefit of the NAT code.
|
||||
*/
|
||||
|
||||
/* The protocol-specific manipulable parts of the tuple: always in
|
||||
network order! */
|
||||
union ip_conntrack_manip_proto
|
||||
{
|
||||
/* Add other protocols here. */
|
||||
u_int16_t all;
|
||||
|
||||
struct {
|
||||
__be16 port;
|
||||
} tcp;
|
||||
struct {
|
||||
__be16 port;
|
||||
} udp;
|
||||
struct {
|
||||
__be16 id;
|
||||
} icmp;
|
||||
struct {
|
||||
__be16 port;
|
||||
} sctp;
|
||||
struct {
|
||||
__be16 key; /* key is 32bit, pptp only uses 16 */
|
||||
} gre;
|
||||
};
|
||||
|
||||
/* The manipulable part of the tuple. */
|
||||
struct ip_conntrack_manip
|
||||
{
|
||||
__be32 ip;
|
||||
union ip_conntrack_manip_proto u;
|
||||
};
|
||||
|
||||
/* This contains the information to distinguish a connection. */
|
||||
struct ip_conntrack_tuple
|
||||
{
|
||||
struct ip_conntrack_manip src;
|
||||
|
||||
/* These are the parts of the tuple which are fixed. */
|
||||
struct {
|
||||
__be32 ip;
|
||||
union {
|
||||
/* Add other protocols here. */
|
||||
u_int16_t all;
|
||||
|
||||
struct {
|
||||
__be16 port;
|
||||
} tcp;
|
||||
struct {
|
||||
__be16 port;
|
||||
} udp;
|
||||
struct {
|
||||
u_int8_t type, code;
|
||||
} icmp;
|
||||
struct {
|
||||
__be16 port;
|
||||
} sctp;
|
||||
struct {
|
||||
__be16 key; /* key is 32bit,
|
||||
* pptp only uses 16 */
|
||||
} gre;
|
||||
} u;
|
||||
|
||||
/* The protocol. */
|
||||
u_int8_t protonum;
|
||||
|
||||
/* The direction (for tuplehash) */
|
||||
u_int8_t dir;
|
||||
} dst;
|
||||
};
|
||||
|
||||
/* This is optimized opposed to a memset of the whole structure. Everything we
|
||||
* really care about is the source/destination unions */
|
||||
#define IP_CT_TUPLE_U_BLANK(tuple) \
|
||||
do { \
|
||||
(tuple)->src.u.all = 0; \
|
||||
(tuple)->dst.u.all = 0; \
|
||||
} while (0)
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define DUMP_TUPLE(tp) \
|
||||
DEBUGP("tuple %p: %u %u.%u.%u.%u:%hu -> %u.%u.%u.%u:%hu\n", \
|
||||
(tp), (tp)->dst.protonum, \
|
||||
NIPQUAD((tp)->src.ip), ntohs((tp)->src.u.all), \
|
||||
NIPQUAD((tp)->dst.ip), ntohs((tp)->dst.u.all))
|
||||
|
||||
/* If we're the first tuple, it's the original dir. */
|
||||
#define DIRECTION(h) ((enum ip_conntrack_dir)(h)->tuple.dst.dir)
|
||||
|
||||
/* Connections have two entries in the hash table: one for each way */
|
||||
struct ip_conntrack_tuple_hash
|
||||
{
|
||||
struct list_head list;
|
||||
|
||||
struct ip_conntrack_tuple tuple;
|
||||
};
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
static inline int ip_ct_tuple_src_equal(const struct ip_conntrack_tuple *t1,
|
||||
const struct ip_conntrack_tuple *t2)
|
||||
{
|
||||
return t1->src.ip == t2->src.ip
|
||||
&& t1->src.u.all == t2->src.u.all;
|
||||
}
|
||||
|
||||
static inline int ip_ct_tuple_dst_equal(const struct ip_conntrack_tuple *t1,
|
||||
const struct ip_conntrack_tuple *t2)
|
||||
{
|
||||
return t1->dst.ip == t2->dst.ip
|
||||
&& t1->dst.u.all == t2->dst.u.all
|
||||
&& t1->dst.protonum == t2->dst.protonum;
|
||||
}
|
||||
|
||||
static inline int ip_ct_tuple_equal(const struct ip_conntrack_tuple *t1,
|
||||
const struct ip_conntrack_tuple *t2)
|
||||
{
|
||||
return ip_ct_tuple_src_equal(t1, t2) && ip_ct_tuple_dst_equal(t1, t2);
|
||||
}
|
||||
|
||||
static inline int ip_ct_tuple_mask_cmp(const struct ip_conntrack_tuple *t,
|
||||
const struct ip_conntrack_tuple *tuple,
|
||||
const struct ip_conntrack_tuple *mask)
|
||||
{
|
||||
return !(((t->src.ip ^ tuple->src.ip) & mask->src.ip)
|
||||
|| ((t->dst.ip ^ tuple->dst.ip) & mask->dst.ip)
|
||||
|| ((t->src.u.all ^ tuple->src.u.all) & mask->src.u.all)
|
||||
|| ((t->dst.u.all ^ tuple->dst.u.all) & mask->dst.u.all)
|
||||
|| ((t->dst.protonum ^ tuple->dst.protonum)
|
||||
& mask->dst.protonum));
|
||||
}
|
||||
|
||||
#endif /* _IP_CONNTRACK_TUPLE_H */
|
||||
@@ -1,79 +0,0 @@
|
||||
#ifndef _IP_NAT_H
|
||||
#define _IP_NAT_H
|
||||
#include <linux/netfilter_ipv4.h>
|
||||
#include <linux/netfilter_ipv4/ip_conntrack_tuple.h>
|
||||
|
||||
#define IP_NAT_MAPPING_TYPE_MAX_NAMELEN 16
|
||||
|
||||
enum ip_nat_manip_type
|
||||
{
|
||||
IP_NAT_MANIP_SRC,
|
||||
IP_NAT_MANIP_DST
|
||||
};
|
||||
|
||||
/* SRC manip occurs POST_ROUTING or LOCAL_IN */
|
||||
#define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING && (hooknum) != NF_IP_LOCAL_IN)
|
||||
|
||||
#define IP_NAT_RANGE_MAP_IPS 1
|
||||
#define IP_NAT_RANGE_PROTO_SPECIFIED 2
|
||||
#define IP_NAT_RANGE_PROTO_RANDOM 4 /* add randomness to "port" selection */
|
||||
|
||||
/* NAT sequence number modifications */
|
||||
struct ip_nat_seq {
|
||||
/* position of the last TCP sequence number
|
||||
* modification (if any) */
|
||||
u_int32_t correction_pos;
|
||||
/* sequence number offset before and after last modification */
|
||||
int16_t offset_before, offset_after;
|
||||
};
|
||||
|
||||
/* Single range specification. */
|
||||
struct ip_nat_range
|
||||
{
|
||||
/* Set to OR of flags above. */
|
||||
unsigned int flags;
|
||||
|
||||
/* Inclusive: network order. */
|
||||
__be32 min_ip, max_ip;
|
||||
|
||||
/* Inclusive: network order */
|
||||
union ip_conntrack_manip_proto min, max;
|
||||
};
|
||||
|
||||
/* For backwards compat: don't use in modern code. */
|
||||
struct ip_nat_multi_range_compat
|
||||
{
|
||||
unsigned int rangesize; /* Must be 1. */
|
||||
|
||||
/* hangs off end. */
|
||||
struct ip_nat_range range[1];
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/list.h>
|
||||
|
||||
/* Protects NAT hash tables, and NAT-private part of conntracks. */
|
||||
extern rwlock_t ip_nat_lock;
|
||||
|
||||
/* The structure embedded in the conntrack structure. */
|
||||
struct ip_nat_info
|
||||
{
|
||||
struct list_head bysource;
|
||||
struct ip_nat_seq seq[IP_CT_DIR_MAX];
|
||||
};
|
||||
|
||||
struct ip_conntrack;
|
||||
|
||||
/* Set up the info structure to map into this range. */
|
||||
extern unsigned int ip_nat_setup_info(struct ip_conntrack *conntrack,
|
||||
const struct ip_nat_range *range,
|
||||
unsigned int hooknum);
|
||||
|
||||
/* Is this tuple already taken? (not by us)*/
|
||||
extern int ip_nat_used_tuple(const struct ip_conntrack_tuple *tuple,
|
||||
const struct ip_conntrack *ignored_conntrack);
|
||||
|
||||
#else /* !__KERNEL__: iptables wants this to compile. */
|
||||
#define ip_nat_multi_range ip_nat_multi_range_compat
|
||||
#endif /*__KERNEL__*/
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
#ifndef _IP_NAT_CORE_H
|
||||
#define _IP_NAT_CORE_H
|
||||
#include <linux/list.h>
|
||||
#include <linux/netfilter_ipv4/ip_conntrack.h>
|
||||
|
||||
/* This header used to share core functionality between the standalone
|
||||
NAT module, and the compatibility layer's use of NAT for masquerading. */
|
||||
|
||||
extern unsigned int ip_nat_packet(struct ip_conntrack *ct,
|
||||
enum ip_conntrack_info conntrackinfo,
|
||||
unsigned int hooknum,
|
||||
struct sk_buff **pskb);
|
||||
|
||||
extern int ip_nat_icmp_reply_translation(struct ip_conntrack *ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned int hooknum,
|
||||
struct sk_buff **pskb);
|
||||
#endif /* _IP_NAT_CORE_H */
|
||||
@@ -1,33 +0,0 @@
|
||||
#ifndef _IP_NAT_HELPER_H
|
||||
#define _IP_NAT_HELPER_H
|
||||
/* NAT protocol helper routines. */
|
||||
|
||||
#include <linux/netfilter_ipv4/ip_conntrack.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
struct sk_buff;
|
||||
|
||||
/* These return true or false. */
|
||||
extern int ip_nat_mangle_tcp_packet(struct sk_buff **skb,
|
||||
struct ip_conntrack *ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned int match_offset,
|
||||
unsigned int match_len,
|
||||
const char *rep_buffer,
|
||||
unsigned int rep_len);
|
||||
extern int ip_nat_mangle_udp_packet(struct sk_buff **skb,
|
||||
struct ip_conntrack *ct,
|
||||
enum ip_conntrack_info ctinfo,
|
||||
unsigned int match_offset,
|
||||
unsigned int match_len,
|
||||
const char *rep_buffer,
|
||||
unsigned int rep_len);
|
||||
extern int ip_nat_seq_adjust(struct sk_buff **pskb,
|
||||
struct ip_conntrack *ct,
|
||||
enum ip_conntrack_info ctinfo);
|
||||
|
||||
/* Setup NAT on this expected conntrack so it follows master, but goes
|
||||
* to port ct->master->saved_proto. */
|
||||
extern void ip_nat_follow_master(struct ip_conntrack *ct,
|
||||
struct ip_conntrack_expect *this);
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
/* PPTP constants and structs */
|
||||
#ifndef _NAT_PPTP_H
|
||||
#define _NAT_PPTP_H
|
||||
|
||||
/* conntrack private data */
|
||||
struct ip_nat_pptp {
|
||||
__be16 pns_call_id; /* NAT'ed PNS call id */
|
||||
__be16 pac_call_id; /* NAT'ed PAC call id */
|
||||
};
|
||||
|
||||
#endif /* _NAT_PPTP_H */
|
||||
@@ -1,74 +0,0 @@
|
||||
/* Header for use in defining a given protocol. */
|
||||
#ifndef _IP_NAT_PROTOCOL_H
|
||||
#define _IP_NAT_PROTOCOL_H
|
||||
#include <linux/init.h>
|
||||
#include <linux/list.h>
|
||||
|
||||
#include <linux/netfilter_ipv4/ip_nat.h>
|
||||
#include <linux/netfilter/nfnetlink_conntrack.h>
|
||||
|
||||
struct iphdr;
|
||||
struct ip_nat_range;
|
||||
|
||||
struct ip_nat_protocol
|
||||
{
|
||||
/* Protocol name */
|
||||
const char *name;
|
||||
|
||||
/* Protocol number. */
|
||||
unsigned int protonum;
|
||||
|
||||
struct module *me;
|
||||
|
||||
/* Translate a packet to the target according to manip type.
|
||||
Return true if succeeded. */
|
||||
int (*manip_pkt)(struct sk_buff **pskb,
|
||||
unsigned int iphdroff,
|
||||
const struct ip_conntrack_tuple *tuple,
|
||||
enum ip_nat_manip_type maniptype);
|
||||
|
||||
/* Is the manipable part of the tuple between min and max incl? */
|
||||
int (*in_range)(const struct ip_conntrack_tuple *tuple,
|
||||
enum ip_nat_manip_type maniptype,
|
||||
const union ip_conntrack_manip_proto *min,
|
||||
const union ip_conntrack_manip_proto *max);
|
||||
|
||||
/* Alter the per-proto part of the tuple (depending on
|
||||
maniptype), to give a unique tuple in the given range if
|
||||
possible; return false if not. Per-protocol part of tuple
|
||||
is initialized to the incoming packet. */
|
||||
int (*unique_tuple)(struct ip_conntrack_tuple *tuple,
|
||||
const struct ip_nat_range *range,
|
||||
enum ip_nat_manip_type maniptype,
|
||||
const struct ip_conntrack *conntrack);
|
||||
|
||||
int (*range_to_nfattr)(struct sk_buff *skb,
|
||||
const struct ip_nat_range *range);
|
||||
|
||||
int (*nfattr_to_range)(struct nfattr *tb[],
|
||||
struct ip_nat_range *range);
|
||||
};
|
||||
|
||||
/* Protocol registration. */
|
||||
extern int ip_nat_protocol_register(struct ip_nat_protocol *proto);
|
||||
extern void ip_nat_protocol_unregister(struct ip_nat_protocol *proto);
|
||||
|
||||
extern struct ip_nat_protocol *ip_nat_proto_find_get(u_int8_t protocol);
|
||||
extern void ip_nat_proto_put(struct ip_nat_protocol *proto);
|
||||
|
||||
/* Built-in protocols. */
|
||||
extern struct ip_nat_protocol ip_nat_protocol_tcp;
|
||||
extern struct ip_nat_protocol ip_nat_protocol_udp;
|
||||
extern struct ip_nat_protocol ip_nat_protocol_icmp;
|
||||
extern struct ip_nat_protocol ip_nat_unknown_protocol;
|
||||
|
||||
extern int init_protocols(void) __init;
|
||||
extern void cleanup_protocols(void);
|
||||
extern struct ip_nat_protocol *find_nat_proto(u_int16_t protonum);
|
||||
|
||||
extern int ip_nat_port_range_to_nfattr(struct sk_buff *skb,
|
||||
const struct ip_nat_range *range);
|
||||
extern int ip_nat_port_nfattr_to_range(struct nfattr *tb[],
|
||||
struct ip_nat_range *range);
|
||||
|
||||
#endif /*_IP_NAT_PROTO_H*/
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef _IP_NAT_RULE_H
|
||||
#define _IP_NAT_RULE_H
|
||||
#include <linux/netfilter_ipv4/ip_conntrack.h>
|
||||
#include <linux/netfilter_ipv4/ip_tables.h>
|
||||
#include <linux/netfilter_ipv4/ip_nat.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
extern int ip_nat_rule_init(void) __init;
|
||||
extern void ip_nat_rule_cleanup(void);
|
||||
extern int ip_nat_rule_find(struct sk_buff **pskb,
|
||||
unsigned int hooknum,
|
||||
const struct net_device *in,
|
||||
const struct net_device *out,
|
||||
struct ip_conntrack *ct,
|
||||
struct ip_nat_info *info);
|
||||
|
||||
extern unsigned int
|
||||
alloc_null_binding(struct ip_conntrack *conntrack,
|
||||
struct ip_nat_info *info,
|
||||
unsigned int hooknum);
|
||||
|
||||
extern unsigned int
|
||||
alloc_null_binding_confirmed(struct ip_conntrack *conntrack,
|
||||
struct ip_nat_info *info,
|
||||
unsigned int hooknum);
|
||||
#endif
|
||||
#endif /* _IP_NAT_RULE_H */
|
||||
@@ -13,7 +13,7 @@ struct ipt_same_info
|
||||
u_int32_t *iparray;
|
||||
|
||||
/* hangs off end. */
|
||||
struct ip_nat_range range[IPT_SAME_MAX_RANGE];
|
||||
struct nf_nat_range range[IPT_SAME_MAX_RANGE];
|
||||
};
|
||||
|
||||
#endif /*_IPT_SAME_H*/
|
||||
|
||||
@@ -138,6 +138,11 @@ struct nlattr
|
||||
#include <linux/capability.h>
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct nlmsghdr *)skb->data;
|
||||
}
|
||||
|
||||
struct netlink_skb_parms
|
||||
{
|
||||
struct ucred creds; /* Skb credentials */
|
||||
@@ -152,7 +157,10 @@ struct netlink_skb_parms
|
||||
#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds)
|
||||
|
||||
|
||||
extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module);
|
||||
extern struct sock *netlink_kernel_create(int unit, unsigned int groups,
|
||||
void (*input)(struct sock *sk, int len),
|
||||
struct mutex *cb_mutex,
|
||||
struct module *module);
|
||||
extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
|
||||
extern int netlink_has_listeners(struct sock *sk, unsigned int group);
|
||||
extern 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);
|
||||
|
||||
/*
|
||||
* skb should fit one page. This choice is good for headerless malloc.
|
||||
* But we should limit to 8K so that userspace does not have to
|
||||
* use enormous buffer sizes on recvmsg() calls just to avoid
|
||||
* MSG_TRUNC when PAGE_SIZE is very large.
|
||||
*/
|
||||
#define NLMSG_GOODORDER 0
|
||||
#define NLMSG_GOODSIZE (SKB_MAX_ORDER(0, NLMSG_GOODORDER))
|
||||
#if PAGE_SIZE < 8192UL
|
||||
#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(PAGE_SIZE)
|
||||
#else
|
||||
#define NLMSG_GOODSIZE SKB_WITH_OVERHEAD(8192UL)
|
||||
#endif
|
||||
|
||||
#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN)
|
||||
|
||||
|
||||
@@ -217,18 +232,6 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
|
||||
#define NLMSG_PUT(skb, pid, seq, type, len) \
|
||||
NLMSG_NEW(skb, pid, seq, type, len, 0)
|
||||
|
||||
#define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \
|
||||
NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \
|
||||
(cb)->nlh->nlmsg_seq, type, len, flags)
|
||||
|
||||
#define NLMSG_END(skb, nlh) \
|
||||
({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \
|
||||
(skb)->len; })
|
||||
|
||||
#define NLMSG_CANCEL(skb, nlh) \
|
||||
({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \
|
||||
-1; })
|
||||
|
||||
extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
|
||||
struct nlmsghdr *nlh,
|
||||
int (*dump)(struct sk_buff *skb, struct netlink_callback*),
|
||||
|
||||
38
include/linux/nl80211.h
Normal file
38
include/linux/nl80211.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef __LINUX_NL80211_H
|
||||
#define __LINUX_NL80211_H
|
||||
/*
|
||||
* 802.11 netlink interface public header
|
||||
*
|
||||
* Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
|
||||
*/
|
||||
|
||||
/**
|
||||
* enum nl80211_iftype - (virtual) interface types
|
||||
* @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides
|
||||
* @NL80211_IFTYPE_ADHOC: independent BSS member
|
||||
* @NL80211_IFTYPE_STATION: managed BSS member
|
||||
* @NL80211_IFTYPE_AP: access point
|
||||
* @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
|
||||
* @NL80211_IFTYPE_WDS: wireless distribution interface
|
||||
* @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
|
||||
* @__NL80211_IFTYPE_AFTER_LAST: internal use
|
||||
*
|
||||
* These values are used with the NL80211_ATTR_IFTYPE
|
||||
* to set the type of an interface.
|
||||
*
|
||||
*/
|
||||
enum nl80211_iftype {
|
||||
NL80211_IFTYPE_UNSPECIFIED,
|
||||
NL80211_IFTYPE_ADHOC,
|
||||
NL80211_IFTYPE_STATION,
|
||||
NL80211_IFTYPE_AP,
|
||||
NL80211_IFTYPE_AP_VLAN,
|
||||
NL80211_IFTYPE_WDS,
|
||||
NL80211_IFTYPE_MONITOR,
|
||||
|
||||
/* keep last */
|
||||
__NL80211_IFTYPE_AFTER_LAST
|
||||
};
|
||||
#define NL80211_IFTYPE_MAX (__NL80211_IFTYPE_AFTER_LAST - 1)
|
||||
|
||||
#endif /* __LINUX_NL80211_H */
|
||||
@@ -133,7 +133,7 @@
|
||||
static inline void SetPageUptodate(struct page *page)
|
||||
{
|
||||
if (!test_and_set_bit(PG_uptodate, &page->flags))
|
||||
page_test_and_clear_dirty(page);
|
||||
page_clear_dirty(page);
|
||||
}
|
||||
#else
|
||||
#define SetPageUptodate(page) set_bit(PG_uptodate, &(page)->flags)
|
||||
|
||||
@@ -574,13 +574,6 @@ extern int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, in
|
||||
#define rtattr_parse_nested(tb, max, rta) \
|
||||
rtattr_parse((tb), (max), RTA_DATA((rta)), RTA_PAYLOAD((rta)))
|
||||
|
||||
struct rtnetlink_link
|
||||
{
|
||||
int (*doit)(struct sk_buff *, struct nlmsghdr*, void *attr);
|
||||
int (*dumpit)(struct sk_buff *, struct netlink_callback *cb);
|
||||
};
|
||||
|
||||
extern struct rtnetlink_link * rtnetlink_links[NPROTO];
|
||||
extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo);
|
||||
extern int rtnl_unicast(struct sk_buff *skb, u32 pid);
|
||||
extern 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
|
||||
|
||||
#define RTA_PUT_NOHDR(skb, attrlen, data) \
|
||||
({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \
|
||||
memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \
|
||||
memset(skb_tail_pointer(skb) - (RTA_ALIGN(attrlen) - attrlen), 0, \
|
||||
RTA_ALIGN(attrlen) - attrlen); })
|
||||
|
||||
#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
|
||||
RTA_PUT(skb, attrtype, 0, NULL);
|
||||
|
||||
#define RTA_NEST(skb, type) \
|
||||
({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \
|
||||
({ struct rtattr *__start = (struct rtattr *)skb_tail_pointer(skb); \
|
||||
RTA_PUT(skb, type, 0, NULL); \
|
||||
__start; })
|
||||
|
||||
#define RTA_NEST_END(skb, start) \
|
||||
({ (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \
|
||||
({ (start)->rta_len = skb_tail_pointer(skb) - (unsigned char *)(start); \
|
||||
(skb)->len; })
|
||||
|
||||
#define RTA_NEST_CANCEL(skb, start) \
|
||||
|
||||
62
include/linux/rxrpc.h
Normal file
62
include/linux/rxrpc.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* AF_RXRPC parameters
|
||||
*
|
||||
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
|
||||
* Written by David Howells (dhowells@redhat.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_RXRPC_H
|
||||
#define _LINUX_RXRPC_H
|
||||
|
||||
#include <linux/in.h>
|
||||
#include <linux/in6.h>
|
||||
|
||||
/*
|
||||
* RxRPC socket address
|
||||
*/
|
||||
struct sockaddr_rxrpc {
|
||||
sa_family_t srx_family; /* address family */
|
||||
u16 srx_service; /* service desired */
|
||||
u16 transport_type; /* type of transport socket (SOCK_DGRAM) */
|
||||
u16 transport_len; /* length of transport address */
|
||||
union {
|
||||
sa_family_t family; /* transport address family */
|
||||
struct sockaddr_in sin; /* IPv4 transport address */
|
||||
struct sockaddr_in6 sin6; /* IPv6 transport address */
|
||||
} transport;
|
||||
};
|
||||
|
||||
/*
|
||||
* RxRPC socket options
|
||||
*/
|
||||
#define RXRPC_SECURITY_KEY 1 /* [clnt] set client security key */
|
||||
#define RXRPC_SECURITY_KEYRING 2 /* [srvr] set ring of server security keys */
|
||||
#define RXRPC_EXCLUSIVE_CONNECTION 3 /* [clnt] use exclusive RxRPC connection */
|
||||
#define RXRPC_MIN_SECURITY_LEVEL 4 /* minimum security level */
|
||||
|
||||
/*
|
||||
* RxRPC control messages
|
||||
* - terminal messages mean that a user call ID tag can be recycled
|
||||
*/
|
||||
#define RXRPC_USER_CALL_ID 1 /* user call ID specifier */
|
||||
#define RXRPC_ABORT 2 /* abort request / notification [terminal] */
|
||||
#define RXRPC_ACK 3 /* [Server] RPC op final ACK received [terminal] */
|
||||
#define RXRPC_NET_ERROR 5 /* network error received [terminal] */
|
||||
#define RXRPC_BUSY 6 /* server busy received [terminal] */
|
||||
#define RXRPC_LOCAL_ERROR 7 /* local error generated [terminal] */
|
||||
#define RXRPC_NEW_CALL 8 /* [Server] new incoming call notification */
|
||||
#define RXRPC_ACCEPT 9 /* [Server] accept request */
|
||||
|
||||
/*
|
||||
* RxRPC security levels
|
||||
*/
|
||||
#define RXRPC_SECURITY_PLAIN 0 /* plain secure-checksummed packets only */
|
||||
#define RXRPC_SECURITY_AUTH 1 /* authenticated packets */
|
||||
#define RXRPC_SECURITY_ENCRYPT 2 /* encrypted packets */
|
||||
|
||||
|
||||
#endif /* _LINUX_RXRPC_H */
|
||||
@@ -196,13 +196,13 @@ extern void init_idle(struct task_struct *idle, int cpu);
|
||||
extern cpumask_t nohz_cpu_mask;
|
||||
|
||||
/*
|
||||
* Only dump TASK_* tasks. (-1 for all tasks)
|
||||
* Only dump TASK_* tasks. (0 for all tasks)
|
||||
*/
|
||||
extern void show_state_filter(unsigned long state_filter);
|
||||
|
||||
static inline void show_state(void)
|
||||
{
|
||||
show_state_filter(-1);
|
||||
show_state_filter(0);
|
||||
}
|
||||
|
||||
extern void show_regs(struct pt_regs *);
|
||||
|
||||
@@ -63,6 +63,15 @@ typedef struct sctphdr {
|
||||
__be32 checksum;
|
||||
} __attribute__((packed)) sctp_sctphdr_t;
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct sctphdr *)skb_transport_header(skb);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Section 3.2. Chunk Field Descriptions. */
|
||||
typedef struct sctp_chunkhdr {
|
||||
__u8 type;
|
||||
|
||||
@@ -1,638 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* sdla_fr.h Sangoma frame relay firmware API definitions.
|
||||
*
|
||||
* Author: Gideon Hack
|
||||
* Nenad Corbic <ncorbic@sangoma.com>
|
||||
*
|
||||
* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
* ============================================================================
|
||||
* Oct 04, 1999 Gideon Hack Updated API structures
|
||||
* Jun 02, 1999 Gideon Hack Modifications for S514 support
|
||||
* Oct 12, 1997 Jaspreet Singh Added FR_READ_DLCI_IB_MAPPING
|
||||
* Jul 21, 1997 Jaspreet Singh Changed FRRES_TOO_LONG and FRRES_TOO_MANY to
|
||||
* 0x05 and 0x06 respectively.
|
||||
* Dec 23, 1996 Gene Kozin v2.0
|
||||
* Apr 29, 1996 Gene Kozin v1.0 (merged version S502 & S508 definitions).
|
||||
* Sep 26, 1995 Gene Kozin Initial version.
|
||||
*****************************************************************************/
|
||||
#ifndef _SDLA_FR_H
|
||||
#define _SDLA_FR_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Notes:
|
||||
* ------
|
||||
* 1. All structures defined in this file are byte-alined.
|
||||
*
|
||||
* Compiler Platform
|
||||
* -------- --------
|
||||
* GNU C Linux
|
||||
*/
|
||||
|
||||
#ifndef PACKED
|
||||
# define PACKED __attribute__((packed))
|
||||
#endif /* PACKED */
|
||||
|
||||
/* Adapter memory layout */
|
||||
#define FR_MB_VECTOR 0xE000 /* mailbox window vector */
|
||||
#define FR502_RX_VECTOR 0xA000 /* S502 direct receive window vector */
|
||||
#define FR502_MBOX_OFFS 0xF60 /* S502 mailbox offset */
|
||||
#define FR508_MBOX_OFFS 0 /* S508 mailbox offset */
|
||||
#define FR502_FLAG_OFFS 0x1FF0 /* S502 status flags offset */
|
||||
#define FR508_FLAG_OFFS 0x1000 /* S508 status flags offset */
|
||||
#define FR502_RXMB_OFFS 0x900 /* S502 direct receive mailbox offset */
|
||||
#define FR508_TXBC_OFFS 0x1100 /* S508 Tx buffer info offset */
|
||||
#define FR508_RXBC_OFFS 0x1120 /* S508 Rx buffer info offset */
|
||||
|
||||
/* Important constants */
|
||||
#define FR502_MAX_DATA 4096 /* maximum data buffer length */
|
||||
#define FR508_MAX_DATA 4080 /* maximum data buffer length */
|
||||
#define MIN_LGTH_FR_DATA_CFG 300 /* min Information frame length
|
||||
(for configuration purposes) */
|
||||
#define FR_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* max Information frame length */
|
||||
|
||||
#define HIGHEST_VALID_DLCI 991
|
||||
|
||||
/****** Data Structures *****************************************************/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Frame relay command block.
|
||||
*/
|
||||
typedef struct fr_cmd
|
||||
{
|
||||
unsigned char command PACKED; /* command code */
|
||||
unsigned short length PACKED; /* length of data buffer */
|
||||
unsigned char result PACKED; /* return code */
|
||||
unsigned short dlci PACKED; /* DLCI number */
|
||||
unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
|
||||
unsigned short rxlost1 PACKED; /* frames discarded at int. level */
|
||||
unsigned long rxlost2 PACKED; /* frames discarded at app. level */
|
||||
unsigned char rsrv[2] PACKED; /* reserved for future use */
|
||||
} fr_cmd_t;
|
||||
|
||||
/* 'command' field defines */
|
||||
#define FR_WRITE 0x01
|
||||
#define FR_READ 0x02
|
||||
#define FR_ISSUE_IS_FRAME 0x03
|
||||
#define FR_SET_CONFIG 0x10
|
||||
#define FR_READ_CONFIG 0x11
|
||||
#define FR_COMM_DISABLE 0x12
|
||||
#define FR_COMM_ENABLE 0x13
|
||||
#define FR_READ_STATUS 0x14
|
||||
#define FR_READ_STATISTICS 0x15
|
||||
#define FR_FLUSH_STATISTICS 0x16
|
||||
#define FR_LIST_ACTIVE_DLCI 0x17
|
||||
#define FR_FLUSH_DATA_BUFFERS 0x18
|
||||
#define FR_READ_ADD_DLC_STATS 0x19
|
||||
#define FR_ADD_DLCI 0x20
|
||||
#define FR_DELETE_DLCI 0x21
|
||||
#define FR_ACTIVATE_DLCI 0x22
|
||||
#define FR_DEACTIVATE_DLCI 0x22
|
||||
#define FR_READ_MODEM_STATUS 0x30
|
||||
#define FR_SET_MODEM_STATUS 0x31
|
||||
#define FR_READ_ERROR_STATS 0x32
|
||||
#define FR_FLUSH_ERROR_STATS 0x33
|
||||
#define FR_READ_DLCI_IB_MAPPING 0x34
|
||||
#define FR_READ_CODE_VERSION 0x40
|
||||
#define FR_SET_INTR_MODE 0x50
|
||||
#define FR_READ_INTR_MODE 0x51
|
||||
#define FR_SET_TRACE_CONFIG 0x60
|
||||
#define FR_FT1_STATUS_CTRL 0x80
|
||||
#define FR_SET_FT1_MODE 0x81
|
||||
|
||||
/* Special UDP drivers management commands */
|
||||
#define FPIPE_ENABLE_TRACING 0x41
|
||||
#define FPIPE_DISABLE_TRACING 0x42
|
||||
#define FPIPE_GET_TRACE_INFO 0x43
|
||||
#define FPIPE_FT1_READ_STATUS 0x44
|
||||
#define FPIPE_DRIVER_STAT_IFSEND 0x45
|
||||
#define FPIPE_DRIVER_STAT_INTR 0x46
|
||||
#define FPIPE_DRIVER_STAT_GEN 0x47
|
||||
#define FPIPE_FLUSH_DRIVER_STATS 0x48
|
||||
#define FPIPE_ROUTER_UP_TIME 0x49
|
||||
|
||||
/* 'result' field defines */
|
||||
#define FRRES_OK 0x00 /* command executed successfully */
|
||||
#define FRRES_DISABLED 0x01 /* communications not enabled */
|
||||
#define FRRES_INOPERATIVE 0x02 /* channel inoperative */
|
||||
#define FRRES_DLCI_INACTIVE 0x03 /* DLCI is inactive */
|
||||
#define FRRES_DLCI_INVALID 0x04 /* DLCI is not configured */
|
||||
#define FRRES_TOO_LONG 0x05
|
||||
#define FRRES_TOO_MANY 0x06
|
||||
#define FRRES_CIR_OVERFLOW 0x07 /* Tx throughput has exceeded CIR */
|
||||
#define FRRES_BUFFER_OVERFLOW 0x08
|
||||
#define FRRES_MODEM_FAILURE 0x10 /* DCD and/or CTS dropped */
|
||||
#define FRRES_CHANNEL_DOWN 0x11 /* channel became inoperative */
|
||||
#define FRRES_CHANNEL_UP 0x12 /* channel became operative */
|
||||
#define FRRES_DLCI_CHANGE 0x13 /* DLCI status (or number) changed */
|
||||
#define FRRES_DLCI_MISMATCH 0x14
|
||||
#define FRRES_INVALID_CMD 0x1F /* invalid command */
|
||||
|
||||
/* 'attr' field defines */
|
||||
#define FRATTR_
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Frame relay mailbox.
|
||||
* This structure is located at offset FR50?_MBOX_OFFS into FR_MB_VECTOR.
|
||||
* For S502 it is also located at offset FR502_RXMB_OFFS into
|
||||
* FR502_RX_VECTOR.
|
||||
*/
|
||||
typedef struct fr_mbox
|
||||
{
|
||||
unsigned char opflag PACKED; /* 00h: execution flag */
|
||||
fr_cmd_t cmd PACKED; /* 01h: command block */
|
||||
unsigned char data[1] PACKED; /* 10h: variable length data buffer */
|
||||
} fr_mbox_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S502 frame relay status flags.
|
||||
* This structure is located at offset FR502_FLAG_OFFS into FR_MB_VECTOR.
|
||||
*/
|
||||
typedef struct fr502_flags
|
||||
{
|
||||
unsigned char rsrv1[1] PACKED; /* 00h: */
|
||||
unsigned char tx_ready PACKED; /* 01h: Tx buffer available */
|
||||
unsigned char rx_ready PACKED; /* 02h: Rx frame available */
|
||||
unsigned char event PACKED; /* 03h: asynchronous event */
|
||||
unsigned char mstatus PACKED; /* 04h: modem status */
|
||||
unsigned char rsrv2[8] PACKED; /* 05h: */
|
||||
unsigned char iflag PACKED; /* 0Dh: interrupt flag */
|
||||
unsigned char imask PACKED; /* 0Eh: interrupt mask */
|
||||
} fr502_flags_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S508 frame relay status flags.
|
||||
* This structure is located at offset FR508_FLAG_OFFS into FR_MB_VECTOR.
|
||||
*/
|
||||
typedef struct fr508_flags
|
||||
{
|
||||
unsigned char rsrv1[3] PACKED; /* 00h: reserved */
|
||||
unsigned char event PACKED; /* 03h: asynchronous event */
|
||||
unsigned char mstatus PACKED; /* 04h: modem status */
|
||||
unsigned char rsrv2[11] PACKED; /* 05h: reserved */
|
||||
unsigned char iflag PACKED; /* 10h: interrupt flag */
|
||||
unsigned char imask PACKED; /* 11h: interrupt mask */
|
||||
unsigned long tse_offs PACKED; /* 12h: Tx status element */
|
||||
unsigned short dlci PACKED; /* 16h: DLCI NUMBER */
|
||||
} fr508_flags_t;
|
||||
|
||||
/* 'event' field defines */
|
||||
#define FR_EVENT_STATUS 0x01 /* channel status change */
|
||||
#define FR_EVENT_DLC_STATUS 0x02 /* DLC status change */
|
||||
#define FR_EVENT_BAD_DLCI 0x04 /* FSR included wrong DLCI */
|
||||
#define FR_EVENT_LINK_DOWN 0x40 /* DCD or CTS low */
|
||||
|
||||
/* 'mstatus' field defines */
|
||||
#define FR_MDM_DCD 0x08 /* mdm_status: DCD */
|
||||
#define FR_MDM_CTS 0x20 /* mdm_status: CTS */
|
||||
|
||||
/* 'iflag' & 'imask' fields defines */
|
||||
#define FR_INTR_RXRDY 0x01 /* Rx ready */
|
||||
#define FR_INTR_TXRDY 0x02 /* Tx ready */
|
||||
#define FR_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */
|
||||
#define FR_INTR_READY 0x08 /* interface command completed */
|
||||
#define FR_INTR_DLC 0x10 /* DLC status change */
|
||||
#define FR_INTR_TIMER 0x20 /* millisecond timer */
|
||||
#define FR_INTR_TX_MULT_DLCIs 0x80 /* Tx interrupt on multiple DLCIs */
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Receive Buffer Configuration Info. S508 only!
|
||||
* This structure is located at offset FR508_RXBC_OFFS into FR_MB_VECTOR.
|
||||
*/
|
||||
typedef struct fr_buf_info
|
||||
{
|
||||
unsigned short rse_num PACKED; /* 00h: number of status elements */
|
||||
unsigned long rse_base PACKED; /* 02h: receive status array base */
|
||||
unsigned long rse_next PACKED; /* 06h: next status element */
|
||||
unsigned long buf_base PACKED; /* 0Ah: rotational buffer base */
|
||||
unsigned short reserved PACKED; /* 0Eh: */
|
||||
unsigned long buf_top PACKED; /* 10h: rotational buffer top */
|
||||
} fr_buf_info_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Buffer Status Element. S508 only!
|
||||
* Array of structures of this type is located at offset defined by the
|
||||
* 'rse_base' field of the frBufInfo_t structure into absolute adapter
|
||||
* memory address space.
|
||||
*/
|
||||
typedef struct fr_rx_buf_ctl
|
||||
{
|
||||
unsigned char flag PACKED; /* 00h: ready flag */
|
||||
unsigned short length PACKED; /* 01h: frame length */
|
||||
unsigned short dlci PACKED; /* 03h: DLCI */
|
||||
unsigned char attr PACKED; /* 05h: FECN/BECN/DE/CR */
|
||||
unsigned short tmstamp PACKED; /* 06h: time stamp */
|
||||
unsigned short rsrv[2] PACKED; /* 08h: */
|
||||
unsigned long offset PACKED; /* 0Ch: buffer absolute address */
|
||||
} fr_rx_buf_ctl_t;
|
||||
|
||||
typedef struct fr_tx_buf_ctl
|
||||
{
|
||||
unsigned char flag PACKED; /* 00h: ready flag */
|
||||
unsigned short rsrv0[2] PACKED; /* 01h: */
|
||||
unsigned short length PACKED; /* 05h: frame length */
|
||||
unsigned short dlci PACKED; /* 07h: DLCI */
|
||||
unsigned char attr PACKED; /* 09h: FECN/BECN/DE/CR */
|
||||
unsigned short rsrv1 PACKED; /* 0Ah: */
|
||||
unsigned long offset PACKED; /* 0Ch: buffer absolute address */
|
||||
} fr_tx_buf_ctl_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Global Configuration Block. Passed to FR_SET_CONFIG command when dlci == 0.
|
||||
*/
|
||||
typedef struct fr_conf
|
||||
{
|
||||
unsigned short station PACKED; /* 00h: CPE/Node */
|
||||
unsigned short options PACKED; /* 02h: configuration options */
|
||||
unsigned short kbps PACKED; /* 04h: baud rate in kbps */
|
||||
unsigned short port PACKED; /* 06h: RS-232/V.35 */
|
||||
unsigned short mtu PACKED; /* 08h: max. transmit length */
|
||||
unsigned short t391 PACKED; /* 0Ah: */
|
||||
unsigned short t392 PACKED; /* 0Ch: */
|
||||
unsigned short n391 PACKED; /* 0Eh: */
|
||||
unsigned short n392 PACKED; /* 10h: */
|
||||
unsigned short n393 PACKED; /* 12h: */
|
||||
unsigned short cir_fwd PACKED; /* 14h: */
|
||||
unsigned short bc_fwd PACKED; /* 16h: */
|
||||
unsigned short be_fwd PACKED; /* 18h: */
|
||||
unsigned short cir_bwd PACKED; /* 1Ah: */
|
||||
unsigned short bc_bwd PACKED; /* 1Ch: */
|
||||
unsigned short be_bwd PACKED; /* 1Eh: */
|
||||
unsigned short dlci[0] PACKED; /* 20h: */
|
||||
} fr_conf_t;
|
||||
|
||||
/* 'station_type' defines */
|
||||
#define FRCFG_STATION_CPE 0
|
||||
#define FRCFG_STATION_NODE 1
|
||||
|
||||
/* 'conf_flags' defines */
|
||||
#define FRCFG_IGNORE_TX_CIR 0x0001
|
||||
#define FRCFG_IGNORE_RX_CIR 0x0002
|
||||
#define FRCFG_DONT_RETRANSMIT 0x0004
|
||||
#define FRCFG_IGNORE_CBS 0x0008
|
||||
#define FRCFG_THROUGHPUT 0x0010 /* enable throughput calculation */
|
||||
#define FRCFG_DIRECT_RX 0x0080 /* enable direct receive buffer */
|
||||
#define FRCFG_AUTO_CONFIG 0x8000 /* enable auto DLCI configuration */
|
||||
|
||||
/* 'baud_rate' defines */
|
||||
#define FRCFG_BAUD_1200 12
|
||||
#define FRCFG_BAUD_2400 24
|
||||
#define FRCFG_BAUD_4800 48
|
||||
#define FRCFG_BAUD_9600 96
|
||||
#define FRCFG_BAUD_19200 19
|
||||
#define FRCFG_BAUD_38400 38
|
||||
#define FRCFG_BAUD_56000 56
|
||||
#define FRCFG_BAUD_64000 64
|
||||
#define FRCFG_BAUD_128000 128
|
||||
|
||||
/* 'port_mode' defines */
|
||||
#define FRCFG_MODE_EXT_CLK 0x0000
|
||||
#define FRCFG_MODE_INT_CLK 0x0001
|
||||
#define FRCFG_MODE_V35 0x0000 /* S508 only */
|
||||
#define FRCFG_MODE_RS232 0x0002 /* S508 only */
|
||||
|
||||
/* defines for line tracing */
|
||||
|
||||
/* the line trace status element presented by the frame relay code */
|
||||
typedef struct {
|
||||
unsigned char flag PACKED; /* ready flag */
|
||||
unsigned short length PACKED; /* trace length */
|
||||
unsigned char rsrv0[2] PACKED; /* reserved */
|
||||
unsigned char attr PACKED; /* trace attributes */
|
||||
unsigned short tmstamp PACKED; /* time stamp */
|
||||
unsigned char rsrv1[4] PACKED; /* reserved */
|
||||
unsigned long offset PACKED; /* buffer absolute address */
|
||||
} fr_trc_el_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char status PACKED; /* status flag */
|
||||
unsigned char data_passed PACKED; /* 0 if no data passed, 1 if */
|
||||
/* data passed */
|
||||
unsigned short length PACKED; /* frame length */
|
||||
unsigned short tmstamp PACKED; /* time stamp */
|
||||
} fpipemon_trc_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
fpipemon_trc_hdr_t fpipemon_trc_hdr PACKED;
|
||||
unsigned char data[FR_MAX_NO_DATA_BYTES_IN_FRAME] PACKED;
|
||||
} fpipemon_trc_t;
|
||||
|
||||
/* bit settings for the 'status' byte - note that bits 1, 2 and 3 are used */
|
||||
/* for returning the number of frames being passed to fpipemon */
|
||||
#define TRC_OUTGOING_FRM 0x01
|
||||
#define TRC_ABORT_ERROR 0x10
|
||||
#define TRC_CRC_ERROR 0x20
|
||||
#define TRC_OVERRUN_ERROR 0x40
|
||||
#define MORE_TRC_DATA 0x80
|
||||
|
||||
#define MAX_FRMS_TRACED 0x07
|
||||
|
||||
#define NO_TRC_ELEMENTS_OFF 0x9000
|
||||
#define BASE_TRC_ELEMENTS_OFF 0x9002
|
||||
#define TRC_ACTIVE 0x01
|
||||
#define FLUSH_TRC_BUFFERS 0x02
|
||||
#define FLUSH_TRC_STATISTICS 0x04
|
||||
#define TRC_SIGNALLING_FRMS 0x10
|
||||
#define TRC_INFO_FRMS 0x20
|
||||
#define ACTIVATE_TRC (TRC_ACTIVE | TRC_SIGNALLING_FRMS | TRC_INFO_FRMS)
|
||||
#define RESET_TRC (FLUSH_TRC_BUFFERS | FLUSH_TRC_STATISTICS)
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Channel configuration.
|
||||
* This structure is passed to the FR_SET_CONFIG command when dlci != 0.
|
||||
*/
|
||||
typedef struct fr_dlc_conf
|
||||
{
|
||||
unsigned short conf_flags PACKED; /* 00h: configuration bits */
|
||||
unsigned short cir_fwd PACKED; /* 02h: */
|
||||
unsigned short bc_fwd PACKED; /* 04h: */
|
||||
unsigned short be_fwd PACKED; /* 06h: */
|
||||
unsigned short cir_bwd PACKED; /* 08h: */
|
||||
unsigned short bc_bwd PACKED; /* 0Ah: */
|
||||
unsigned short be_bwd PACKED; /* 0Ch: */
|
||||
} fr_dlc_conf_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S502 interrupt mode control block.
|
||||
* This structure is passed to the FR_SET_INTR_FLAGS and returned by the
|
||||
* FR_READ_INTR_FLAGS commands.
|
||||
*/
|
||||
typedef struct fr502_intr_ctl
|
||||
{
|
||||
unsigned char mode PACKED; /* 00h: interrupt enable flags */
|
||||
unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
|
||||
} fr502_intr_ctl_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* S508 interrupt mode control block.
|
||||
* This structure is passed to the FR_SET_INTR_FLAGS and returned by the
|
||||
* FR_READ_INTR_FLAGS commands.
|
||||
*/
|
||||
typedef struct fr508_intr_ctl
|
||||
{
|
||||
unsigned char mode PACKED; /* 00h: interrupt enable flags */
|
||||
unsigned short tx_len PACKED; /* 01h: required Tx buffer size */
|
||||
unsigned char irq PACKED; /* 03h: IRQ level to activate */
|
||||
unsigned char flags PACKED; /* 04h: ?? */
|
||||
unsigned short timeout PACKED; /* 05h: ms, for timer interrupt */
|
||||
} fr508_intr_ctl_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Channel status.
|
||||
* This structure is returned by the FR_READ_STATUS command.
|
||||
*/
|
||||
typedef struct fr_dlc_Status
|
||||
{
|
||||
unsigned char status PACKED; /* 00h: link/DLCI status */
|
||||
struct
|
||||
{
|
||||
unsigned short dlci PACKED; /* 01h: DLCI number */
|
||||
unsigned char status PACKED; /* 03h: DLCI status */
|
||||
} circuit[1] PACKED;
|
||||
} fr_dlc_status_t;
|
||||
|
||||
/* 'status' defines */
|
||||
#define FR_LINK_INOPER 0x00 /* for global status (DLCI == 0) */
|
||||
#define FR_LINK_OPER 0x01
|
||||
#define FR_DLCI_DELETED 0x01 /* for circuit status (DLCI != 0) */
|
||||
#define FR_DLCI_ACTIVE 0x02
|
||||
#define FR_DLCI_WAITING 0x04
|
||||
#define FR_DLCI_NEW 0x08
|
||||
#define FR_DLCI_REPORT 0x40
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Global Statistics Block.
|
||||
* This structure is returned by the FR_READ_STATISTICS command when
|
||||
* dcli == 0.
|
||||
*/
|
||||
typedef struct fr_link_stat
|
||||
{
|
||||
unsigned short rx_too_long PACKED; /* 00h: */
|
||||
unsigned short rx_dropped PACKED; /* 02h: */
|
||||
unsigned short rx_dropped2 PACKED; /* 04h: */
|
||||
unsigned short rx_bad_dlci PACKED; /* 06h: */
|
||||
unsigned short rx_bad_format PACKED; /* 08h: */
|
||||
unsigned short retransmitted PACKED; /* 0Ah: */
|
||||
unsigned short cpe_tx_FSE PACKED; /* 0Ch: */
|
||||
unsigned short cpe_tx_LIV PACKED; /* 0Eh: */
|
||||
unsigned short cpe_rx_FSR PACKED; /* 10h: */
|
||||
unsigned short cpe_rx_LIV PACKED; /* 12h: */
|
||||
unsigned short node_rx_FSE PACKED; /* 14h: */
|
||||
unsigned short node_rx_LIV PACKED; /* 16h: */
|
||||
unsigned short node_tx_FSR PACKED; /* 18h: */
|
||||
unsigned short node_tx_LIV PACKED; /* 1Ah: */
|
||||
unsigned short rx_ISF_err PACKED; /* 1Ch: */
|
||||
unsigned short rx_unsolicited PACKED; /* 1Eh: */
|
||||
unsigned short rx_SSN_err PACKED; /* 20h: */
|
||||
unsigned short rx_RSN_err PACKED; /* 22h: */
|
||||
unsigned short T391_timeouts PACKED; /* 24h: */
|
||||
unsigned short T392_timeouts PACKED; /* 26h: */
|
||||
unsigned short N392_reached PACKED; /* 28h: */
|
||||
unsigned short cpe_SSN_RSN PACKED; /* 2Ah: */
|
||||
unsigned short current_SSN PACKED; /* 2Ch: */
|
||||
unsigned short current_RSN PACKED; /* 2Eh: */
|
||||
unsigned short curreny_T391 PACKED; /* 30h: */
|
||||
unsigned short current_T392 PACKED; /* 32h: */
|
||||
unsigned short current_N392 PACKED; /* 34h: */
|
||||
unsigned short current_N393 PACKED; /* 36h: */
|
||||
} fr_link_stat_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* DLCI statistics.
|
||||
* This structure is returned by the FR_READ_STATISTICS command when
|
||||
* dlci != 0.
|
||||
*/
|
||||
typedef struct fr_dlci_stat
|
||||
{
|
||||
unsigned long tx_frames PACKED; /* 00h: */
|
||||
unsigned long tx_bytes PACKED; /* 04h: */
|
||||
unsigned long rx_frames PACKED; /* 08h: */
|
||||
unsigned long rx_bytes PACKED; /* 0Ch: */
|
||||
unsigned long rx_dropped PACKED; /* 10h: */
|
||||
unsigned long rx_inactive PACKED; /* 14h: */
|
||||
unsigned long rx_exceed_CIR PACKED; /* 18h: */
|
||||
unsigned long rx_DE_set PACKED; /* 1Ch: */
|
||||
unsigned long tx_throughput PACKED; /* 20h: */
|
||||
unsigned long tx_calc_timer PACKED; /* 24h: */
|
||||
unsigned long rx_throughput PACKED; /* 28h: */
|
||||
unsigned long rx_calc_timer PACKED; /* 2Ch: */
|
||||
} fr_dlci_stat_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Communications error statistics.
|
||||
* This structure is returned by the FR_READ_ERROR_STATS command.
|
||||
*/
|
||||
typedef struct fr_comm_stat
|
||||
{
|
||||
unsigned char rx_overruns PACKED; /* 00h: */
|
||||
unsigned char rx_bad_crc PACKED; /* 01h: */
|
||||
unsigned char rx_aborts PACKED; /* 02h: */
|
||||
unsigned char rx_too_long PACKED; /* 03h: */
|
||||
unsigned char tx_aborts PACKED; /* 04h: */
|
||||
unsigned char tx_underruns PACKED; /* 05h: */
|
||||
unsigned char tx_missed_undr PACKED; /* 06h: */
|
||||
unsigned char dcd_dropped PACKED; /* 07h: */
|
||||
unsigned char cts_dropped PACKED; /* 08h: */
|
||||
} fr_comm_stat_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Defines for the FR_ISSUE_IS_FRAME command.
|
||||
*/
|
||||
#define FR_ISF_LVE 2 /* issue Link Verification Enquiry */
|
||||
#define FR_ISF_FSE 3 /* issue Full Status Enquiry */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Frame Relay ARP Header -- Used for Dynamic route creation with InvARP
|
||||
*/
|
||||
|
||||
typedef struct arphdr_fr
|
||||
{
|
||||
unsigned short ar_hrd PACKED; /* format of hardware addr */
|
||||
unsigned short ar_pro PACKED; /* format of protocol addr */
|
||||
unsigned char ar_hln PACKED; /* length of hardware addr */
|
||||
unsigned char ar_pln PACKED; /* length of protocol addr */
|
||||
unsigned short ar_op PACKED; /* ARP opcode */
|
||||
unsigned short ar_sha PACKED; /* Sender DLCI addr 2 bytes */
|
||||
unsigned long ar_sip PACKED; /* Sender IP addr 4 bytes */
|
||||
unsigned short ar_tha PACKED; /* Target DLCI addr 2 bytes */
|
||||
unsigned long ar_tip PACKED; /* Target IP addr 4 bytes */
|
||||
} arphdr_fr_t;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Frame Relay RFC 1490 SNAP Header -- Used to check for ARP packets
|
||||
*/
|
||||
typedef struct arphdr_1490
|
||||
{
|
||||
unsigned char control PACKED; /* UI, etc... */
|
||||
unsigned char pad PACKED; /* Pad */
|
||||
unsigned char NLPID PACKED; /* SNAP */
|
||||
unsigned char OUI[3] PACKED; /* Ethertype, etc... */
|
||||
unsigned short PID PACKED; /* ARP, IP, etc... */
|
||||
} arphdr_1490_t;
|
||||
|
||||
/* UDP/IP packet (for UDP management) layout */
|
||||
|
||||
/* The embedded control block for UDP mgmt
|
||||
This is essentially a mailbox structure, without the large data field */
|
||||
|
||||
typedef struct {
|
||||
unsigned char opp_flag PACKED; /* the opp flag */
|
||||
unsigned char command PACKED; /* command code */
|
||||
unsigned short length PACKED; /* length of data buffer */
|
||||
unsigned char result PACKED; /* return code */
|
||||
unsigned short dlci PACKED; /* DLCI number */
|
||||
unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */
|
||||
unsigned short rxlost1 PACKED; /* frames discarded at int. level */
|
||||
unsigned long rxlost2 PACKED; /* frames discarded at app. level */
|
||||
unsigned char rsrv[2] PACKED; /* reserved for future use */
|
||||
} cblock_t;
|
||||
|
||||
|
||||
/* UDP management packet layout (data area of ip packet) */
|
||||
|
||||
typedef struct {
|
||||
unsigned char control PACKED;
|
||||
unsigned char NLPID PACKED;
|
||||
} fr_encap_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
// fr_encap_hdr_t fr_encap_hdr PACKED;
|
||||
ip_pkt_t ip_pkt PACKED;
|
||||
udp_pkt_t udp_pkt PACKED;
|
||||
wp_mgmt_t wp_mgmt PACKED;
|
||||
cblock_t cblock PACKED;
|
||||
unsigned char data[4080] PACKED;
|
||||
} fr_udp_pkt_t;
|
||||
|
||||
|
||||
/* valid ip_protocol for UDP management */
|
||||
#define UDPMGMT_UDP_PROTOCOL 0x11
|
||||
|
||||
#define UDPMGMT_FPIPE_SIGNATURE "FPIPE8ND"
|
||||
#define UDPMGMT_DRVRSTATS_SIGNATURE "DRVSTATS"
|
||||
|
||||
/* values for request/reply byte */
|
||||
#define UDPMGMT_REQUEST 0x01
|
||||
#define UDPMGMT_REPLY 0x02
|
||||
#define UDP_OFFSET 12
|
||||
|
||||
typedef struct {
|
||||
unsigned long if_send_entry;
|
||||
unsigned long if_send_skb_null;
|
||||
unsigned long if_send_broadcast;
|
||||
unsigned long if_send_multicast;
|
||||
unsigned long if_send_critical_ISR;
|
||||
unsigned long if_send_critical_non_ISR;
|
||||
unsigned long if_send_busy;
|
||||
unsigned long if_send_busy_timeout;
|
||||
unsigned long if_send_DRVSTATS_request;
|
||||
unsigned long if_send_FPIPE_request;
|
||||
unsigned long if_send_wan_disconnected;
|
||||
unsigned long if_send_dlci_disconnected;
|
||||
unsigned long if_send_no_bfrs;
|
||||
unsigned long if_send_adptr_bfrs_full;
|
||||
unsigned long if_send_bfrs_passed_to_adptr;
|
||||
unsigned long if_send_consec_send_fail;
|
||||
} drvstats_if_send_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned long rx_intr_no_socket;
|
||||
unsigned long rx_intr_dev_not_started;
|
||||
unsigned long rx_intr_DRVSTATS_request;
|
||||
unsigned long rx_intr_FPIPE_request;
|
||||
unsigned long rx_intr_bfr_not_passed_to_stack;
|
||||
unsigned long rx_intr_bfr_passed_to_stack;
|
||||
} drvstats_rx_intr_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned long UDP_FPIPE_mgmt_kmalloc_err;
|
||||
unsigned long UDP_FPIPE_mgmt_direction_err;
|
||||
unsigned long UDP_FPIPE_mgmt_adptr_type_err;
|
||||
unsigned long UDP_FPIPE_mgmt_adptr_cmnd_OK;
|
||||
unsigned long UDP_FPIPE_mgmt_adptr_cmnd_timeout;
|
||||
unsigned long UDP_FPIPE_mgmt_adptr_send_passed;
|
||||
unsigned long UDP_FPIPE_mgmt_adptr_send_failed;
|
||||
unsigned long UDP_FPIPE_mgmt_not_passed_to_stack;
|
||||
unsigned long UDP_FPIPE_mgmt_passed_to_stack;
|
||||
unsigned long UDP_FPIPE_mgmt_no_socket;
|
||||
unsigned long UDP_DRVSTATS_mgmt_kmalloc_err;
|
||||
unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_OK;
|
||||
unsigned long UDP_DRVSTATS_mgmt_adptr_cmnd_timeout;
|
||||
unsigned long UDP_DRVSTATS_mgmt_adptr_send_passed;
|
||||
unsigned long UDP_DRVSTATS_mgmt_adptr_send_failed;
|
||||
unsigned long UDP_DRVSTATS_mgmt_not_passed_to_stack;
|
||||
unsigned long UDP_DRVSTATS_mgmt_passed_to_stack;
|
||||
unsigned long UDP_DRVSTATS_mgmt_no_socket;
|
||||
} drvstats_gen_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char attr PACKED;
|
||||
unsigned short time_stamp PACKED;
|
||||
unsigned char reserved[13] PACKED;
|
||||
} api_rx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_rx_hdr_t api_rx_hdr PACKED;
|
||||
void * data PACKED;
|
||||
} api_rx_element_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char attr PACKED;
|
||||
unsigned char reserved[15] PACKED;
|
||||
} api_tx_hdr_t;
|
||||
|
||||
typedef struct {
|
||||
api_tx_hdr_t api_tx_hdr PACKED;
|
||||
void * data PACKED;
|
||||
} api_tx_element_t;
|
||||
|
||||
#ifdef _MSC_
|
||||
# pragma pack()
|
||||
#endif
|
||||
#endif /* _SDLA_FR_H */
|
||||
|
||||
@@ -61,10 +61,10 @@ static inline void write_seqlock(seqlock_t *sl)
|
||||
{
|
||||
spin_lock(&sl->lock);
|
||||
++sl->sequence;
|
||||
smp_wmb();
|
||||
}
|
||||
smp_wmb();
|
||||
}
|
||||
|
||||
static inline void write_sequnlock(seqlock_t *sl)
|
||||
static inline void write_sequnlock(seqlock_t *sl)
|
||||
{
|
||||
smp_wmb();
|
||||
sl->sequence++;
|
||||
@@ -77,7 +77,7 @@ static inline int write_tryseqlock(seqlock_t *sl)
|
||||
|
||||
if (ret) {
|
||||
++sl->sequence;
|
||||
smp_wmb();
|
||||
smp_wmb();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -27,20 +27,24 @@
|
||||
#include <net/checksum.h>
|
||||
#include <linux/rcupdate.h>
|
||||
#include <linux/dmaengine.h>
|
||||
#include <linux/hrtimer.h>
|
||||
|
||||
#define HAVE_ALLOC_SKB /* For the drivers to know */
|
||||
#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
|
||||
|
||||
/* Don't change this without changing skb_csum_unnecessary! */
|
||||
#define CHECKSUM_NONE 0
|
||||
#define CHECKSUM_PARTIAL 1
|
||||
#define CHECKSUM_UNNECESSARY 2
|
||||
#define CHECKSUM_COMPLETE 3
|
||||
#define CHECKSUM_UNNECESSARY 1
|
||||
#define CHECKSUM_COMPLETE 2
|
||||
#define CHECKSUM_PARTIAL 3
|
||||
|
||||
#define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \
|
||||
~(SMP_CACHE_BYTES - 1))
|
||||
#define SKB_MAX_ORDER(X, ORDER) (((PAGE_SIZE << (ORDER)) - (X) - \
|
||||
sizeof(struct skb_shared_info)) & \
|
||||
~(SMP_CACHE_BYTES - 1))
|
||||
#define SKB_WITH_OVERHEAD(X) \
|
||||
(((X) - sizeof(struct skb_shared_info)) & \
|
||||
~(SMP_CACHE_BYTES - 1))
|
||||
#define SKB_MAX_ORDER(X, ORDER) \
|
||||
SKB_WITH_OVERHEAD((PAGE_SIZE << (ORDER)) - (X))
|
||||
#define SKB_MAX_HEAD(X) (SKB_MAX_ORDER((X), 0))
|
||||
#define SKB_MAX_ALLOC (SKB_MAX_ORDER(0, 2))
|
||||
|
||||
@@ -66,8 +70,8 @@
|
||||
* NONE: skb is checksummed by protocol or csum is not required.
|
||||
*
|
||||
* PARTIAL: device is required to csum packet as seen by hard_start_xmit
|
||||
* from skb->h.raw to the end and to record the checksum
|
||||
* at skb->h.raw+skb->csum.
|
||||
* from skb->transport_header to the end and to record the checksum
|
||||
* at skb->transport_header + skb->csum.
|
||||
*
|
||||
* Device must show its capabilities in dev->features, set
|
||||
* at device setup time.
|
||||
@@ -83,12 +87,13 @@
|
||||
*/
|
||||
|
||||
struct net_device;
|
||||
struct scatterlist;
|
||||
|
||||
#ifdef CONFIG_NETFILTER
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
struct nf_conntrack {
|
||||
atomic_t use;
|
||||
void (*destroy)(struct nf_conntrack *);
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
||||
struct nf_bridge_info {
|
||||
@@ -103,8 +108,6 @@ struct nf_bridge_info {
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
struct sk_buff_head {
|
||||
/* These two members must be first. */
|
||||
struct sk_buff *next;
|
||||
@@ -156,11 +159,6 @@ struct skb_shared_info {
|
||||
#define SKB_DATAREF_SHIFT 16
|
||||
#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)
|
||||
|
||||
struct skb_timeval {
|
||||
u32 off_sec;
|
||||
u32 off_usec;
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
SKB_FCLONE_UNAVAILABLE,
|
||||
@@ -181,6 +179,16 @@ enum {
|
||||
SKB_GSO_TCPV6 = 1 << 4,
|
||||
};
|
||||
|
||||
#if BITS_PER_LONG > 32
|
||||
#define NET_SKBUFF_DATA_USES_OFFSET 1
|
||||
#endif
|
||||
|
||||
#ifdef NET_SKBUFF_DATA_USES_OFFSET
|
||||
typedef unsigned int sk_buff_data_t;
|
||||
#else
|
||||
typedef unsigned char *sk_buff_data_t;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* struct sk_buff - socket buffer
|
||||
* @next: Next buffer in list
|
||||
@@ -190,15 +198,17 @@ enum {
|
||||
* @dev: Device we arrived on/are leaving by
|
||||
* @iif: ifindex of device we arrived on
|
||||
* @h: Transport layer header
|
||||
* @nh: Network layer header
|
||||
* @mac: Link layer header
|
||||
* @network_header: Network layer header
|
||||
* @mac_header: Link layer header
|
||||
* @dst: destination entry
|
||||
* @sp: the security path, used for xfrm
|
||||
* @cb: Control buffer. Free for use by every layer. Put private vars here
|
||||
* @len: Length of actual data
|
||||
* @data_len: Data length
|
||||
* @mac_len: Length of link layer header
|
||||
* @csum: Checksum
|
||||
* @csum: Checksum (must include start/offset pair)
|
||||
* @csum_start: Offset from skb->head where checksumming should start
|
||||
* @csum_offset: Offset from csum_start where checksum should be stored
|
||||
* @local_df: allow local fragmentation
|
||||
* @cloned: Head may be cloned (check refcnt to be sure)
|
||||
* @nohdr: Payload reference only, must not modify header
|
||||
@@ -233,32 +243,11 @@ struct sk_buff {
|
||||
struct sk_buff *prev;
|
||||
|
||||
struct sock *sk;
|
||||
struct skb_timeval tstamp;
|
||||
ktime_t tstamp;
|
||||
struct net_device *dev;
|
||||
int iif;
|
||||
/* 4 byte hole on 64 bit*/
|
||||
|
||||
union {
|
||||
struct tcphdr *th;
|
||||
struct udphdr *uh;
|
||||
struct icmphdr *icmph;
|
||||
struct igmphdr *igmph;
|
||||
struct iphdr *ipiph;
|
||||
struct ipv6hdr *ipv6h;
|
||||
unsigned char *raw;
|
||||
} h;
|
||||
|
||||
union {
|
||||
struct iphdr *iph;
|
||||
struct ipv6hdr *ipv6h;
|
||||
struct arphdr *arph;
|
||||
unsigned char *raw;
|
||||
} nh;
|
||||
|
||||
union {
|
||||
unsigned char *raw;
|
||||
} mac;
|
||||
|
||||
struct dst_entry *dst;
|
||||
struct sec_path *sp;
|
||||
|
||||
@@ -275,7 +264,10 @@ struct sk_buff {
|
||||
mac_len;
|
||||
union {
|
||||
__wsum csum;
|
||||
__u32 csum_offset;
|
||||
struct {
|
||||
__u16 csum_start;
|
||||
__u16 csum_offset;
|
||||
};
|
||||
};
|
||||
__u32 priority;
|
||||
__u8 local_df:1,
|
||||
@@ -289,15 +281,13 @@ struct sk_buff {
|
||||
__be16 protocol;
|
||||
|
||||
void (*destructor)(struct sk_buff *skb);
|
||||
#ifdef CONFIG_NETFILTER
|
||||
struct nf_conntrack *nfct;
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
struct nf_conntrack *nfct;
|
||||
struct sk_buff *nfct_reasm;
|
||||
#endif
|
||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
||||
struct nf_bridge_info *nf_bridge;
|
||||
#endif
|
||||
#endif /* CONFIG_NETFILTER */
|
||||
#ifdef CONFIG_NET_SCHED
|
||||
__u16 tc_index; /* traffic control index */
|
||||
#ifdef CONFIG_NET_CLS_ACT
|
||||
@@ -313,13 +303,16 @@ struct sk_buff {
|
||||
|
||||
__u32 mark;
|
||||
|
||||
sk_buff_data_t transport_header;
|
||||
sk_buff_data_t network_header;
|
||||
sk_buff_data_t mac_header;
|
||||
/* These elements must be at the end, see alloc_skb() for details. */
|
||||
sk_buff_data_t tail;
|
||||
sk_buff_data_t end;
|
||||
unsigned char *head,
|
||||
*data;
|
||||
unsigned int truesize;
|
||||
atomic_t users;
|
||||
unsigned char *head,
|
||||
*data,
|
||||
*tail,
|
||||
*end;
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
@@ -361,6 +354,11 @@ extern struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
|
||||
extern struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
|
||||
int newheadroom, int newtailroom,
|
||||
gfp_t priority);
|
||||
extern int skb_to_sgvec(struct sk_buff *skb,
|
||||
struct scatterlist *sg, int offset,
|
||||
int len);
|
||||
extern int skb_cow_data(struct sk_buff *skb, int tailbits,
|
||||
struct sk_buff **trailer);
|
||||
extern int skb_pad(struct sk_buff *skb, int pad);
|
||||
#define dev_kfree_skb(a) kfree_skb(a)
|
||||
extern 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,
|
||||
unsigned int to, struct ts_config *config,
|
||||
struct ts_state *state);
|
||||
|
||||
#ifdef NET_SKBUFF_DATA_USES_OFFSET
|
||||
static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->head + skb->end;
|
||||
}
|
||||
#else
|
||||
static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->end;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Internal */
|
||||
#define skb_shinfo(SKB) ((struct skb_shared_info *)((SKB)->end))
|
||||
#define skb_shinfo(SKB) ((struct skb_shared_info *)(skb_end_pointer(SKB)))
|
||||
|
||||
/**
|
||||
* 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,
|
||||
#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list)
|
||||
#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
|
||||
|
||||
#ifdef NET_SKBUFF_DATA_USES_OFFSET
|
||||
static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->head + skb->tail;
|
||||
}
|
||||
|
||||
static inline void skb_reset_tail_pointer(struct sk_buff *skb)
|
||||
{
|
||||
skb->tail = skb->data - skb->head;
|
||||
}
|
||||
|
||||
static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
|
||||
{
|
||||
skb_reset_tail_pointer(skb);
|
||||
skb->tail += offset;
|
||||
}
|
||||
#else /* NET_SKBUFF_DATA_USES_OFFSET */
|
||||
static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->tail;
|
||||
}
|
||||
|
||||
static inline void skb_reset_tail_pointer(struct sk_buff *skb)
|
||||
{
|
||||
skb->tail = skb->data;
|
||||
}
|
||||
|
||||
static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
|
||||
{
|
||||
skb->tail = skb->data + offset;
|
||||
}
|
||||
|
||||
#endif /* NET_SKBUFF_DATA_USES_OFFSET */
|
||||
|
||||
/*
|
||||
* Add data to an sk_buff
|
||||
*/
|
||||
static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
|
||||
{
|
||||
unsigned char *tmp = skb->tail;
|
||||
unsigned char *tmp = skb_tail_pointer(skb);
|
||||
SKB_LINEAR_ASSERT(skb);
|
||||
skb->tail += len;
|
||||
skb->len += len;
|
||||
@@ -845,11 +889,11 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
|
||||
*/
|
||||
static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
|
||||
{
|
||||
unsigned char *tmp = skb->tail;
|
||||
unsigned char *tmp = skb_tail_pointer(skb);
|
||||
SKB_LINEAR_ASSERT(skb);
|
||||
skb->tail += len;
|
||||
skb->len += len;
|
||||
if (unlikely(skb->tail>skb->end))
|
||||
if (unlikely(skb->tail > skb->end))
|
||||
skb_over_panic(skb, len, current_text_addr());
|
||||
return tmp;
|
||||
}
|
||||
@@ -962,6 +1006,130 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
|
||||
skb->tail += len;
|
||||
}
|
||||
|
||||
#ifdef NET_SKBUFF_DATA_USES_OFFSET
|
||||
static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->head + skb->transport_header;
|
||||
}
|
||||
|
||||
static inline void skb_reset_transport_header(struct sk_buff *skb)
|
||||
{
|
||||
skb->transport_header = skb->data - skb->head;
|
||||
}
|
||||
|
||||
static inline void skb_set_transport_header(struct sk_buff *skb,
|
||||
const int offset)
|
||||
{
|
||||
skb_reset_transport_header(skb);
|
||||
skb->transport_header += offset;
|
||||
}
|
||||
|
||||
static inline unsigned char *skb_network_header(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->head + skb->network_header;
|
||||
}
|
||||
|
||||
static inline void skb_reset_network_header(struct sk_buff *skb)
|
||||
{
|
||||
skb->network_header = skb->data - skb->head;
|
||||
}
|
||||
|
||||
static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
|
||||
{
|
||||
skb_reset_network_header(skb);
|
||||
skb->network_header += offset;
|
||||
}
|
||||
|
||||
static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->head + skb->mac_header;
|
||||
}
|
||||
|
||||
static inline int skb_mac_header_was_set(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->mac_header != ~0U;
|
||||
}
|
||||
|
||||
static inline void skb_reset_mac_header(struct sk_buff *skb)
|
||||
{
|
||||
skb->mac_header = skb->data - skb->head;
|
||||
}
|
||||
|
||||
static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
|
||||
{
|
||||
skb_reset_mac_header(skb);
|
||||
skb->mac_header += offset;
|
||||
}
|
||||
|
||||
#else /* NET_SKBUFF_DATA_USES_OFFSET */
|
||||
|
||||
static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->transport_header;
|
||||
}
|
||||
|
||||
static inline void skb_reset_transport_header(struct sk_buff *skb)
|
||||
{
|
||||
skb->transport_header = skb->data;
|
||||
}
|
||||
|
||||
static inline void skb_set_transport_header(struct sk_buff *skb,
|
||||
const int offset)
|
||||
{
|
||||
skb->transport_header = skb->data + offset;
|
||||
}
|
||||
|
||||
static inline unsigned char *skb_network_header(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->network_header;
|
||||
}
|
||||
|
||||
static inline void skb_reset_network_header(struct sk_buff *skb)
|
||||
{
|
||||
skb->network_header = skb->data;
|
||||
}
|
||||
|
||||
static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
|
||||
{
|
||||
skb->network_header = skb->data + offset;
|
||||
}
|
||||
|
||||
static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->mac_header;
|
||||
}
|
||||
|
||||
static inline int skb_mac_header_was_set(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->mac_header != NULL;
|
||||
}
|
||||
|
||||
static inline void skb_reset_mac_header(struct sk_buff *skb)
|
||||
{
|
||||
skb->mac_header = skb->data;
|
||||
}
|
||||
|
||||
static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
|
||||
{
|
||||
skb->mac_header = skb->data + offset;
|
||||
}
|
||||
#endif /* NET_SKBUFF_DATA_USES_OFFSET */
|
||||
|
||||
static inline int skb_transport_offset(const struct sk_buff *skb)
|
||||
{
|
||||
return skb_transport_header(skb) - skb->data;
|
||||
}
|
||||
|
||||
static inline u32 skb_network_header_len(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->transport_header - skb->network_header;
|
||||
}
|
||||
|
||||
static inline int skb_network_offset(const struct sk_buff *skb)
|
||||
{
|
||||
return skb_network_header(skb) - skb->data;
|
||||
}
|
||||
|
||||
/*
|
||||
* CPUs often take a performance hit when accessing unaligned memory
|
||||
* 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)
|
||||
WARN_ON(1);
|
||||
return;
|
||||
}
|
||||
skb->len = len;
|
||||
skb->tail = skb->data + len;
|
||||
skb->len = len;
|
||||
skb_set_tail_pointer(skb, len);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1326,8 +1494,8 @@ extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
|
||||
int len, __wsum csum);
|
||||
extern int skb_copy_bits(const struct sk_buff *skb, int offset,
|
||||
void *to, int len);
|
||||
extern int skb_store_bits(const struct sk_buff *skb, int offset,
|
||||
void *from, int len);
|
||||
extern int skb_store_bits(struct sk_buff *skb, int offset,
|
||||
const void *from, int len);
|
||||
extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb,
|
||||
int offset, u8 *to, int len,
|
||||
__wsum csum);
|
||||
@@ -1351,8 +1519,36 @@ static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static inline void skb_copy_from_linear_data(const struct sk_buff *skb,
|
||||
void *to,
|
||||
const unsigned int len)
|
||||
{
|
||||
memcpy(to, skb->data, len);
|
||||
}
|
||||
|
||||
static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
|
||||
const int offset, void *to,
|
||||
const unsigned int len)
|
||||
{
|
||||
memcpy(to, skb->data + offset, len);
|
||||
}
|
||||
|
||||
static inline void skb_copy_to_linear_data(struct sk_buff *skb,
|
||||
const void *from,
|
||||
const unsigned int len)
|
||||
{
|
||||
memcpy(skb->data, from, len);
|
||||
}
|
||||
|
||||
static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
|
||||
const int offset,
|
||||
const void *from,
|
||||
const unsigned int len)
|
||||
{
|
||||
memcpy(skb->data + offset, from, len);
|
||||
}
|
||||
|
||||
extern void skb_init(void);
|
||||
extern void skb_add_mtu(int mtu);
|
||||
|
||||
/**
|
||||
* skb_get_timestamp - get timestamp from a skb
|
||||
@@ -1365,29 +1561,28 @@ extern void skb_add_mtu(int mtu);
|
||||
*/
|
||||
static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp)
|
||||
{
|
||||
stamp->tv_sec = skb->tstamp.off_sec;
|
||||
stamp->tv_usec = skb->tstamp.off_usec;
|
||||
*stamp = ktime_to_timeval(skb->tstamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_set_timestamp - set timestamp of a skb
|
||||
* @skb: skb to set stamp of
|
||||
* @stamp: pointer to struct timeval to get stamp from
|
||||
*
|
||||
* Timestamps are stored in the skb as offsets to a base timestamp.
|
||||
* This function converts a struct timeval to an offset and stores
|
||||
* it in the skb.
|
||||
*/
|
||||
static inline void skb_set_timestamp(struct sk_buff *skb, const struct timeval *stamp)
|
||||
static inline void __net_timestamp(struct sk_buff *skb)
|
||||
{
|
||||
skb->tstamp.off_sec = stamp->tv_sec;
|
||||
skb->tstamp.off_usec = stamp->tv_usec;
|
||||
skb->tstamp = ktime_get_real();
|
||||
}
|
||||
|
||||
extern void __net_timestamp(struct sk_buff *skb);
|
||||
static inline ktime_t net_timedelta(ktime_t t)
|
||||
{
|
||||
return ktime_sub(ktime_get_real(), t);
|
||||
}
|
||||
|
||||
|
||||
extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
|
||||
extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
|
||||
|
||||
static inline int skb_csum_unnecessary(const struct sk_buff *skb)
|
||||
{
|
||||
return skb->ip_summed & CHECKSUM_UNNECESSARY;
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_checksum_complete - Calculate checksum of an entire packet
|
||||
* @skb: packet to process
|
||||
@@ -1406,22 +1601,22 @@ extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
|
||||
*/
|
||||
static inline unsigned int skb_checksum_complete(struct sk_buff *skb)
|
||||
{
|
||||
return skb->ip_summed != CHECKSUM_UNNECESSARY &&
|
||||
__skb_checksum_complete(skb);
|
||||
return skb_csum_unnecessary(skb) ?
|
||||
0 : __skb_checksum_complete(skb);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NETFILTER
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
extern void nf_conntrack_destroy(struct nf_conntrack *nfct);
|
||||
static inline void nf_conntrack_put(struct nf_conntrack *nfct)
|
||||
{
|
||||
if (nfct && atomic_dec_and_test(&nfct->use))
|
||||
nfct->destroy(nfct);
|
||||
nf_conntrack_destroy(nfct);
|
||||
}
|
||||
static inline void nf_conntrack_get(struct nf_conntrack *nfct)
|
||||
{
|
||||
if (nfct)
|
||||
atomic_inc(&nfct->use);
|
||||
}
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
static inline void nf_conntrack_get_reasm(struct sk_buff *skb)
|
||||
{
|
||||
if (skb)
|
||||
@@ -1447,9 +1642,9 @@ static inline void nf_bridge_get(struct nf_bridge_info *nf_bridge)
|
||||
#endif /* CONFIG_BRIDGE_NETFILTER */
|
||||
static inline void nf_reset(struct sk_buff *skb)
|
||||
{
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
nf_conntrack_put(skb->nfct);
|
||||
skb->nfct = NULL;
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
nf_conntrack_put_reasm(skb->nfct_reasm);
|
||||
skb->nfct_reasm = NULL;
|
||||
#endif
|
||||
@@ -1459,9 +1654,33 @@ static inline void nf_reset(struct sk_buff *skb)
|
||||
#endif
|
||||
}
|
||||
|
||||
#else /* CONFIG_NETFILTER */
|
||||
static inline void nf_reset(struct sk_buff *skb) {}
|
||||
#endif /* CONFIG_NETFILTER */
|
||||
/* Note: This doesn't put any conntrack and bridge info in dst. */
|
||||
static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
|
||||
{
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
dst->nfct = src->nfct;
|
||||
nf_conntrack_get(src->nfct);
|
||||
dst->nfctinfo = src->nfctinfo;
|
||||
dst->nfct_reasm = src->nfct_reasm;
|
||||
nf_conntrack_get_reasm(src->nfct_reasm);
|
||||
#endif
|
||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
||||
dst->nf_bridge = src->nf_bridge;
|
||||
nf_bridge_get(src->nf_bridge);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src)
|
||||
{
|
||||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
|
||||
nf_conntrack_put(dst->nfct);
|
||||
nf_conntrack_put_reasm(dst->nfct_reasm);
|
||||
#endif
|
||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
||||
nf_bridge_put(dst->nf_bridge);
|
||||
#endif
|
||||
__nf_copy(dst, src);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NETWORK_SECMARK
|
||||
static 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)
|
||||
return skb_shinfo(skb)->gso_size;
|
||||
}
|
||||
|
||||
static inline void skb_forward_csum(struct sk_buff *skb)
|
||||
{
|
||||
/* Unfortunately we don't support this one. Any brave souls? */
|
||||
if (skb->ip_summed == CHECKSUM_COMPLETE)
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
}
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_SKBUFF_H */
|
||||
|
||||
@@ -188,7 +188,8 @@ struct ucred {
|
||||
#define AF_TIPC 30 /* TIPC sockets */
|
||||
#define AF_BLUETOOTH 31 /* Bluetooth sockets */
|
||||
#define AF_IUCV 32 /* IUCV sockets */
|
||||
#define AF_MAX 33 /* For now.. */
|
||||
#define AF_RXRPC 33 /* RxRPC sockets */
|
||||
#define AF_MAX 34 /* For now.. */
|
||||
|
||||
/* Protocol families, same as address families. */
|
||||
#define PF_UNSPEC AF_UNSPEC
|
||||
@@ -222,6 +223,7 @@ struct ucred {
|
||||
#define PF_TIPC AF_TIPC
|
||||
#define PF_BLUETOOTH AF_BLUETOOTH
|
||||
#define PF_IUCV AF_IUCV
|
||||
#define PF_RXRPC AF_RXRPC
|
||||
#define PF_MAX AF_MAX
|
||||
|
||||
/* Maximum queue length specifiable by listen. */
|
||||
@@ -284,6 +286,7 @@ struct ucred {
|
||||
#define SOL_DCCP 269
|
||||
#define SOL_NETLINK 270
|
||||
#define SOL_TIPC 271
|
||||
#define SOL_RXRPC 272
|
||||
|
||||
/* IPX options */
|
||||
#define IPX_TYPE 1
|
||||
|
||||
@@ -47,6 +47,12 @@ extern int strncmp(const char *,const char *,__kernel_size_t);
|
||||
#ifndef __HAVE_ARCH_STRNICMP
|
||||
extern int strnicmp(const char *, const char *, __kernel_size_t);
|
||||
#endif
|
||||
#ifndef __HAVE_ARCH_STRCASECMP
|
||||
extern int strcasecmp(const char *s1, const char *s2);
|
||||
#endif
|
||||
#ifndef __HAVE_ARCH_STRNCASECMP
|
||||
extern int strncasecmp(const char *s1, const char *s2, size_t n);
|
||||
#endif
|
||||
#ifndef __HAVE_ARCH_STRCHR
|
||||
extern char * strchr(const char *,int);
|
||||
#endif
|
||||
|
||||
@@ -290,6 +290,7 @@ enum
|
||||
NET_CORE_BUDGET=19,
|
||||
NET_CORE_AEVENT_ETIME=20,
|
||||
NET_CORE_AEVENT_RSEQTH=21,
|
||||
NET_CORE_WARNINGS=22,
|
||||
};
|
||||
|
||||
/* /proc/sys/net/ethernet */
|
||||
@@ -438,6 +439,8 @@ enum
|
||||
NET_CIPSOV4_RBM_STRICTVALID=121,
|
||||
NET_TCP_AVAIL_CONG_CONTROL=122,
|
||||
NET_TCP_ALLOWED_CONG_CONTROL=123,
|
||||
NET_TCP_MAX_SSTHRESH=124,
|
||||
NET_TCP_FRTO_RESPONSE=125,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -789,6 +792,7 @@ enum {
|
||||
NET_BRIDGE_NF_CALL_IPTABLES = 2,
|
||||
NET_BRIDGE_NF_CALL_IP6TABLES = 3,
|
||||
NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
|
||||
NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5,
|
||||
};
|
||||
|
||||
/* CTL_FS names: */
|
||||
|
||||
@@ -178,6 +178,21 @@ struct tcp_md5sig {
|
||||
#include <net/inet_connection_sock.h>
|
||||
#include <net/inet_timewait_sock.h>
|
||||
|
||||
static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct tcphdr *)skb_transport_header(skb);
|
||||
}
|
||||
|
||||
static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
|
||||
{
|
||||
return tcp_hdr(skb)->doff * 4;
|
||||
}
|
||||
|
||||
static inline unsigned int tcp_optlen(const struct sk_buff *skb)
|
||||
{
|
||||
return (tcp_hdr(skb)->doff - 5) * 4;
|
||||
}
|
||||
|
||||
/* This defines a selective acknowledgement block. */
|
||||
struct tcp_sack_block_wire {
|
||||
__be32 start_seq;
|
||||
@@ -242,6 +257,8 @@ struct tcp_sock {
|
||||
* See RFC793 and RFC1122. The RFC writes these in capitals.
|
||||
*/
|
||||
u32 rcv_nxt; /* What we want to receive next */
|
||||
u32 copied_seq; /* Head of yet unread data */
|
||||
u32 rcv_wup; /* rcv_nxt on last window update sent */
|
||||
u32 snd_nxt; /* Next sequence we send */
|
||||
|
||||
u32 snd_una; /* First byte we want an ack for */
|
||||
@@ -300,17 +317,15 @@ struct tcp_sock {
|
||||
u32 snd_ssthresh; /* Slow start size threshold */
|
||||
u32 snd_cwnd; /* Sending congestion window */
|
||||
u16 snd_cwnd_cnt; /* Linear increase counter */
|
||||
u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
|
||||
u32 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
|
||||
u32 snd_cwnd_used;
|
||||
u32 snd_cwnd_stamp;
|
||||
|
||||
struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
|
||||
|
||||
u32 rcv_wnd; /* Current receiver window */
|
||||
u32 rcv_wup; /* rcv_nxt on last window update sent */
|
||||
u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
|
||||
u32 pushed_seq; /* Last pushed seq, required to talk to windows */
|
||||
u32 copied_seq; /* Head of yet unread data */
|
||||
|
||||
/* SACKs data */
|
||||
struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
|
||||
|
||||
@@ -26,6 +26,15 @@ struct udphdr {
|
||||
__sum16 check;
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
|
||||
{
|
||||
return (struct udphdr *)skb_transport_header(skb);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* UDP socket options */
|
||||
#define UDP_CORK 1 /* Never send partially complete segments */
|
||||
#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
|
||||
|
||||
@@ -191,14 +191,15 @@ int execute_in_process_context(work_func_t fn, struct execute_work *);
|
||||
|
||||
/*
|
||||
* Kill off a pending schedule_delayed_work(). Note that the work callback
|
||||
* function may still be running on return from cancel_delayed_work(). Run
|
||||
* flush_scheduled_work() to wait on it.
|
||||
* function may still be running on return from cancel_delayed_work(), unless
|
||||
* it returns 1 and the work doesn't re-arm itself. Run flush_workqueue() or
|
||||
* cancel_work_sync() to wait on it.
|
||||
*/
|
||||
static inline int cancel_delayed_work(struct delayed_work *work)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = del_timer_sync(&work->timer);
|
||||
ret = del_timer(&work->timer);
|
||||
if (ret)
|
||||
work_release(&work->work);
|
||||
return ret;
|
||||
|
||||
@@ -181,6 +181,10 @@ enum {
|
||||
XFRM_MSG_MIGRATE,
|
||||
#define XFRM_MSG_MIGRATE XFRM_MSG_MIGRATE
|
||||
|
||||
XFRM_MSG_NEWSADINFO,
|
||||
#define XFRM_MSG_NEWSADINFO XFRM_MSG_NEWSADINFO
|
||||
XFRM_MSG_GETSADINFO,
|
||||
#define XFRM_MSG_GETSADINFO XFRM_MSG_GETSADINFO
|
||||
__XFRM_MSG_MAX
|
||||
};
|
||||
#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
|
||||
@@ -234,6 +238,17 @@ enum xfrm_ae_ftype_t {
|
||||
#define XFRM_AE_MAX (__XFRM_AE_MAX - 1)
|
||||
};
|
||||
|
||||
/* SAD Table filter flags */
|
||||
enum xfrm_sad_ftype_t {
|
||||
XFRM_SAD_UNSPEC,
|
||||
XFRM_SAD_HMASK=1,
|
||||
XFRM_SAD_HMAX=2,
|
||||
XFRM_SAD_CNT=4,
|
||||
__XFRM_SAD_MAX
|
||||
|
||||
#define XFRM_SAD_MAX (__XFRM_SAD_MAX - 1)
|
||||
};
|
||||
|
||||
struct xfrm_userpolicy_type {
|
||||
__u8 type;
|
||||
__u16 reserved1;
|
||||
@@ -265,6 +280,16 @@ enum xfrm_attr_type_t {
|
||||
#define XFRMA_MAX (__XFRMA_MAX - 1)
|
||||
};
|
||||
|
||||
enum xfrm_sadattr_type_t {
|
||||
XFRMA_SAD_UNSPEC,
|
||||
XFRMA_SADHMASK,
|
||||
XFRMA_SADHMAX,
|
||||
XFRMA_SADCNT,
|
||||
__XFRMA_SAD_MAX
|
||||
|
||||
#define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1)
|
||||
};
|
||||
|
||||
struct xfrm_usersa_info {
|
||||
struct xfrm_selector sel;
|
||||
struct xfrm_id id;
|
||||
|
||||
Reference in New Issue
Block a user