aboutsummaryrefslogtreecommitdiffstats
path: root/src/include/linux
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2007-04-29 18:19:02 +0000
committerAndreas Steffen <andreas.steffen@strongswan.org>2007-04-29 18:19:02 +0000
commita26b6acf92716b4c2ebf962f3a1d6ecdbcc7d645 (patch)
tree41f1c99391ae288406262cc2b195b3d0b319e6d2 /src/include/linux
parentc6f1e1b16c79301f2ef4f98f3bef3006ca307690 (diff)
downloadstrongswan-a26b6acf92716b4c2ebf962f3a1d6ecdbcc7d645.tar.bz2
strongswan-a26b6acf92716b4c2ebf962f3a1d6ecdbcc7d645.tar.xz
reverted to original header files
Diffstat (limited to 'src/include/linux')
-rw-r--r--src/include/linux/ipsec.h2
-rw-r--r--src/include/linux/netlink.h47
-rw-r--r--src/include/linux/pfkeyv2.h4
-rw-r--r--src/include/linux/rtnetlink.h256
-rw-r--r--src/include/linux/udp.h63
-rw-r--r--src/include/linux/xfrm.h188
6 files changed, 315 insertions, 245 deletions
diff --git a/src/include/linux/ipsec.h b/src/include/linux/ipsec.h
index 81ac63a18..d3c527616 100644
--- a/src/include/linux/ipsec.h
+++ b/src/include/linux/ipsec.h
@@ -3,7 +3,7 @@
/* The definitions, required to talk to KAME racoon IKE. */
-#include "pfkeyv2.h"
+#include <linux/pfkeyv2.h>
#define IPSEC_PORT_ANY 0
#define IPSEC_ULPROTO_ANY 255
diff --git a/src/include/linux/netlink.h b/src/include/linux/netlink.h
index 4289ce937..af65dc499 100644
--- a/src/include/linux/netlink.h
+++ b/src/include/linux/netlink.h
@@ -1,8 +1,8 @@
#ifndef __LINUX_NETLINK_H
#define __LINUX_NETLINK_H
-#include <stdint.h>
-#include <sys/socket.h> /* for sa_family_t */
+#include <linux/socket.h> /* for sa_family_t */
+#include <linux/types.h>
#define NETLINK_ROUTE 0 /* Routing/device hook */
#define NETLINK_W1 1 /* 1-wire subsystem */
@@ -28,17 +28,17 @@ struct sockaddr_nl
{
sa_family_t nl_family; /* AF_NETLINK */
unsigned short nl_pad; /* zero */
- uint32_t nl_pid; /* process pid */
- uint32_t nl_groups; /* multicast groups mask */
+ __u32 nl_pid; /* process pid */
+ __u32 nl_groups; /* multicast groups mask */
};
struct nlmsghdr
{
- uint32_t nlmsg_len; /* Length of message including header */
- uint16_t nlmsg_type; /* Message content */
- uint16_t nlmsg_flags; /* Additional flags */
- uint32_t nlmsg_seq; /* Sequence number */
- uint32_t nlmsg_pid; /* Sending process PID */
+ __u32 nlmsg_len; /* Length of message including header */
+ __u16 nlmsg_type; /* Message content */
+ __u16 nlmsg_flags; /* Additional flags */
+ __u32 nlmsg_seq; /* Sequence number */
+ __u32 nlmsg_pid; /* Sending process PID */
};
/* Flags values */
@@ -101,7 +101,7 @@ struct nlmsgerr
struct nl_pktinfo
{
- uint32_t group;
+ __u32 group;
};
#define NET_MAJOR 36 /* Major 36 is reserved for networking */
@@ -122,8 +122,8 @@ enum {
struct nlattr
{
- uint16_t nla_len;
- uint16_t nla_type;
+ __u16 nla_len;
+ __u16 nla_type;
};
#define NLA_ALIGNTO 4
@@ -132,15 +132,18 @@ struct nlattr
#ifdef __KERNEL__
+#include <linux/capability.h>
+#include <linux/skbuff.h>
+
struct netlink_skb_parms
{
struct ucred creds; /* Skb credentials */
- uint32_t pid;
- uint32_t dst_pid;
- uint32_t dst_group;
+ __u32 pid;
+ __u32 dst_pid;
+ __u32 dst_group;
kernel_cap_t eff_cap;
- uint32_t loginuid; /* Login (audit) uid */
- uint32_t sid; /* SELinux security id */
+ __u32 loginuid; /* Login (audit) uid */
+ __u32 sid; /* SELinux security id */
};
#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb))
@@ -150,10 +153,10 @@ struct netlink_skb_parms
extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), 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, uint32_t pid, int nonblock);
-extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, uint32_t pid,
- uint32_t group, gfp_t allocation);
-extern void netlink_set_err(struct sock *ssk, uint32_t pid, uint32_t group, int code);
+extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
+extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
+ __u32 group, gfp_t allocation);
+extern void netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code);
extern int netlink_register_notifier(struct notifier_block *nb);
extern int netlink_unregister_notifier(struct notifier_block *nb);
@@ -188,7 +191,7 @@ struct netlink_notify
};
static __inline__ struct nlmsghdr *
-__nlmsg_put(struct sk_buff *skb, uint32_t pid, uint32_t seq, int type, int len, int flags)
+__nlmsg_put(struct sk_buff *skb, __u32 pid, __u32 seq, int type, int len, int flags)
{
struct nlmsghdr *nlh;
int size = NLMSG_LENGTH(len);
diff --git a/src/include/linux/pfkeyv2.h b/src/include/linux/pfkeyv2.h
index 5ef4e7b75..bac0fb389 100644
--- a/src/include/linux/pfkeyv2.h
+++ b/src/include/linux/pfkeyv2.h
@@ -6,7 +6,7 @@
#ifndef _LINUX_PFKEY2_H
#define _LINUX_PFKEY2_H
-#include <stdint.h>
+#include <linux/types.h>
#define PF_KEY_V2 2
#define PFKEYV2_REVISION 199806L
@@ -159,7 +159,7 @@ struct sadb_spirange {
struct sadb_x_kmprivate {
uint16_t sadb_x_kmprivate_len;
uint16_t sadb_x_kmprivate_exttype;
- uint32_t sadb_x_kmprivate_reserved;
+ u_int32_t sadb_x_kmprivate_reserved;
} __attribute__((packed));
/* sizeof(struct sadb_x_kmprivate) == 8 */
diff --git a/src/include/linux/rtnetlink.h b/src/include/linux/rtnetlink.h
index 1a3749d4c..98a5c80a5 100644
--- a/src/include/linux/rtnetlink.h
+++ b/src/include/linux/rtnetlink.h
@@ -1,8 +1,7 @@
#ifndef __LINUX_RTNETLINK_H
#define __LINUX_RTNETLINK_H
-#include "netlink.h"
-#include <stdint.h>
+#include <linux/netlink.h>
/****
* Routing/neighbour discovery messages.
@@ -310,16 +309,16 @@ struct rtnexthop
struct rta_cacheinfo
{
- uint32_t rta_clntref;
- uint32_t rta_lastuse;
- int32_t rta_expires;
- uint32_t rta_error;
- uint32_t rta_used;
+ __u32 rta_clntref;
+ __u32 rta_lastuse;
+ __s32 rta_expires;
+ __u32 rta_error;
+ __u32 rta_used;
#define RTNETLINK_HAVE_PEERINFO 1
- uint32_t rta_id;
- uint32_t rta_ts;
- uint32_t rta_tsage;
+ __u32 rta_id;
+ __u32 rta_ts;
+ __u32 rta_tsage;
};
/* RTM_METRICS --- array of struct rtattr with types of RTAX_* */
@@ -364,23 +363,23 @@ enum
struct rta_session
{
- uint8_t proto;
- uint8_t pad1;
- uint16_t pad2;
+ __u8 proto;
+ __u8 pad1;
+ __u16 pad2;
union {
struct {
- uint16_t sport;
- uint16_t dport;
+ __u16 sport;
+ __u16 dport;
} ports;
struct {
- uint8_t type;
- uint8_t code;
- uint16_t ident;
+ __u8 type;
+ __u8 code;
+ __u16 ident;
} icmpt;
- uint32_t spi;
+ __u32 spi;
} u;
};
@@ -424,10 +423,10 @@ enum
struct ifa_cacheinfo
{
- uint32_t ifa_prefered;
- uint32_t ifa_valid;
- uint32_t cstamp; /* created timestamp, hundredths of seconds */
- uint32_t tstamp; /* updated timestamp, hundredths of seconds */
+ __u32 ifa_prefered;
+ __u32 ifa_valid;
+ __u32 cstamp; /* created timestamp, hundredths of seconds */
+ __u32 tstamp; /* updated timestamp, hundredths of seconds */
};
@@ -452,9 +451,9 @@ struct ndmsg
unsigned char ndm_pad1;
unsigned short ndm_pad2;
int ndm_ifindex; /* Link index */
- uint16_t ndm_state;
- uint8_t ndm_flags;
- uint8_t ndm_type;
+ __u16 ndm_state;
+ __u8 ndm_flags;
+ __u8 ndm_type;
};
enum
@@ -498,10 +497,10 @@ enum
struct nda_cacheinfo
{
- uint32_t ndm_confirmed;
- uint32_t ndm_used;
- uint32_t ndm_updated;
- uint32_t ndm_refcnt;
+ __u32 ndm_confirmed;
+ __u32 ndm_used;
+ __u32 ndm_updated;
+ __u32 ndm_refcnt;
};
@@ -532,69 +531,69 @@ struct nda_cacheinfo
struct ndt_stats
{
- uint64_t ndts_allocs;
- uint64_t ndts_destroys;
- uint64_t ndts_hash_grows;
- uint64_t ndts_res_failed;
- uint64_t ndts_lookups;
- uint64_t ndts_hits;
- uint64_t ndts_rcv_probes_mcast;
- uint64_t ndts_rcv_probes_ucast;
- uint64_t ndts_periodic_gc_runs;
- uint64_t ndts_forced_gc_runs;
+ __u64 ndts_allocs;
+ __u64 ndts_destroys;
+ __u64 ndts_hash_grows;
+ __u64 ndts_res_failed;
+ __u64 ndts_lookups;
+ __u64 ndts_hits;
+ __u64 ndts_rcv_probes_mcast;
+ __u64 ndts_rcv_probes_ucast;
+ __u64 ndts_periodic_gc_runs;
+ __u64 ndts_forced_gc_runs;
};
enum {
NDTPA_UNSPEC,
- NDTPA_IFINDEX, /* uint32_t, unchangeable */
- NDTPA_REFCNT, /* uint32_t, read-only */
- NDTPA_REACHABLE_TIME, /* uint64_t, read-only, msecs */
- NDTPA_BASE_REACHABLE_TIME, /* uint64_t, msecs */
- NDTPA_RETRANS_TIME, /* uint64_t, msecs */
- NDTPA_GC_STALETIME, /* uint64_t, msecs */
- NDTPA_DELAY_PROBE_TIME, /* uint64_t, msecs */
- NDTPA_QUEUE_LEN, /* uint32_t */
- NDTPA_APP_PROBES, /* uint32_t */
- NDTPA_UCAST_PROBES, /* uint32_t */
- NDTPA_MCAST_PROBES, /* uint32_t */
- NDTPA_ANYCAST_DELAY, /* uint64_t, msecs */
- NDTPA_PROXY_DELAY, /* uint64_t, msecs */
- NDTPA_PROXY_QLEN, /* uint32_t */
- NDTPA_LOCKTIME, /* uint64_t, msecs */
+ NDTPA_IFINDEX, /* __u32, unchangeable */
+ NDTPA_REFCNT, /* __u32, read-only */
+ NDTPA_REACHABLE_TIME, /* __u64, read-only, msecs */
+ NDTPA_BASE_REACHABLE_TIME, /* __u64, msecs */
+ NDTPA_RETRANS_TIME, /* __u64, msecs */
+ NDTPA_GC_STALETIME, /* __u64, msecs */
+ NDTPA_DELAY_PROBE_TIME, /* __u64, msecs */
+ NDTPA_QUEUE_LEN, /* __u32 */
+ NDTPA_APP_PROBES, /* __u32 */
+ NDTPA_UCAST_PROBES, /* __u32 */
+ NDTPA_MCAST_PROBES, /* __u32 */
+ NDTPA_ANYCAST_DELAY, /* __u64, msecs */
+ NDTPA_PROXY_DELAY, /* __u64, msecs */
+ NDTPA_PROXY_QLEN, /* __u32 */
+ NDTPA_LOCKTIME, /* __u64, msecs */
__NDTPA_MAX
};
#define NDTPA_MAX (__NDTPA_MAX - 1)
struct ndtmsg
{
- uint8_t ndtm_family;
- uint8_t ndtm_pad1;
- uint16_t ndtm_pad2;
+ __u8 ndtm_family;
+ __u8 ndtm_pad1;
+ __u16 ndtm_pad2;
};
struct ndt_config
{
- uint16_t ndtc_key_len;
- uint16_t ndtc_entry_size;
- uint32_t ndtc_entries;
- uint32_t ndtc_last_flush; /* delta to now in msecs */
- uint32_t ndtc_last_rand; /* delta to now in msecs */
- uint32_t ndtc_hash_rnd;
- uint32_t ndtc_hash_mask;
- uint32_t ndtc_hash_chain_gc;
- uint32_t ndtc_proxy_qlen;
+ __u16 ndtc_key_len;
+ __u16 ndtc_entry_size;
+ __u32 ndtc_entries;
+ __u32 ndtc_last_flush; /* delta to now in msecs */
+ __u32 ndtc_last_rand; /* delta to now in msecs */
+ __u32 ndtc_hash_rnd;
+ __u32 ndtc_hash_mask;
+ __u32 ndtc_hash_chain_gc;
+ __u32 ndtc_proxy_qlen;
};
enum {
NDTA_UNSPEC,
NDTA_NAME, /* char *, unchangeable */
- NDTA_THRESH1, /* uint32_t */
- NDTA_THRESH2, /* uint32_t */
- NDTA_THRESH3, /* uint32_t */
+ NDTA_THRESH1, /* __u32 */
+ NDTA_THRESH2, /* __u32 */
+ NDTA_THRESH3, /* __u32 */
NDTA_CONFIG, /* struct ndt_config, read-only */
NDTA_PARMS, /* nested TLV NDTPA_* */
NDTA_STATS, /* struct ndt_stats, read-only */
- NDTA_GC_INTERVAL, /* uint64_t, msecs */
+ NDTA_GC_INTERVAL, /* __u64, msecs */
__NDTA_MAX
};
#define NDTA_MAX (__NDTA_MAX - 1)
@@ -660,53 +659,53 @@ enum
struct prefix_cacheinfo
{
- uint32_t preferred_time;
- uint32_t valid_time;
+ __u32 preferred_time;
+ __u32 valid_time;
};
/* The struct should be in sync with struct net_device_stats */
struct rtnl_link_stats
{
- uint32_t rx_packets; /* total packets received */
- uint32_t tx_packets; /* total packets transmitted */
- uint32_t rx_bytes; /* total bytes received */
- uint32_t tx_bytes; /* total bytes transmitted */
- uint32_t rx_errors; /* bad packets received */
- uint32_t tx_errors; /* packet transmit problems */
- uint32_t rx_dropped; /* no space in linux buffers */
- uint32_t tx_dropped; /* no space available in linux */
- uint32_t multicast; /* multicast packets received */
- uint32_t collisions;
+ __u32 rx_packets; /* total packets received */
+ __u32 tx_packets; /* total packets transmitted */
+ __u32 rx_bytes; /* total bytes received */
+ __u32 tx_bytes; /* total bytes transmitted */
+ __u32 rx_errors; /* bad packets received */
+ __u32 tx_errors; /* packet transmit problems */
+ __u32 rx_dropped; /* no space in linux buffers */
+ __u32 tx_dropped; /* no space available in linux */
+ __u32 multicast; /* multicast packets received */
+ __u32 collisions;
/* detailed rx_errors: */
- uint32_t rx_length_errors;
- uint32_t rx_over_errors; /* receiver ring buff overflow */
- uint32_t rx_crc_errors; /* recved pkt with crc error */
- uint32_t rx_frame_errors; /* recv'd frame alignment error */
- uint32_t rx_fifo_errors; /* recv'r fifo overrun */
- uint32_t rx_missed_errors; /* receiver missed packet */
+ __u32 rx_length_errors;
+ __u32 rx_over_errors; /* receiver ring buff overflow */
+ __u32 rx_crc_errors; /* recved pkt with crc error */
+ __u32 rx_frame_errors; /* recv'd frame alignment error */
+ __u32 rx_fifo_errors; /* recv'r fifo overrun */
+ __u32 rx_missed_errors; /* receiver missed packet */
/* detailed tx_errors */
- uint32_t tx_aborted_errors;
- uint32_t tx_carrier_errors;
- uint32_t tx_fifo_errors;
- uint32_t tx_heartbeat_errors;
- uint32_t tx_window_errors;
+ __u32 tx_aborted_errors;
+ __u32 tx_carrier_errors;
+ __u32 tx_fifo_errors;
+ __u32 tx_heartbeat_errors;
+ __u32 tx_window_errors;
/* for cslip etc */
- uint32_t rx_compressed;
- uint32_t tx_compressed;
+ __u32 rx_compressed;
+ __u32 tx_compressed;
};
/* The struct should be in sync with struct ifmap */
struct rtnl_link_ifmap
{
- uint64_t mem_start;
- uint64_t mem_end;
- uint64_t base_addr;
- uint16_t irq;
- uint8_t dma;
- uint8_t port;
+ __u64 mem_start;
+ __u64 mem_end;
+ __u64 base_addr;
+ __u16 irq;
+ __u8 dma;
+ __u8 port;
};
enum
@@ -791,10 +790,10 @@ enum
struct ifla_cacheinfo
{
- uint32_t max_reasm_len;
- uint32_t tstamp; /* ipv6InterfaceTable updated timestamp */
- uint32_t reachable_time;
- uint32_t retrans_time;
+ __u32 max_reasm_len;
+ __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
+ __u32 reachable_time;
+ __u32 retrans_time;
};
/*****************************************************************
@@ -807,9 +806,9 @@ struct tcmsg
unsigned char tcm__pad1;
unsigned short tcm__pad2;
int tcm_ifindex;
- uint32_t tcm_handle;
- uint32_t tcm_parent;
- uint32_t tcm_info;
+ __u32 tcm_handle;
+ __u32 tcm_parent;
+ __u32 tcm_info;
};
enum
@@ -910,6 +909,9 @@ struct tcamsg
#ifdef __KERNEL__
+#include <linux/config.h>
+#include <linux/mutex.h>
+
extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size);
static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str)
{
@@ -931,8 +933,8 @@ struct rtnetlink_link
};
extern struct rtnetlink_link * rtnetlink_links[NPROTO];
-extern int rtnetlink_send(struct sk_buff *skb, uint32_t pid, uint32_t group, int echo);
-extern int rtnetlink_put_metrics(struct sk_buff *skb, uint32_t *metrics);
+extern int rtnetlink_send(struct sk_buff *skb, __u32 pid, __u32 group, int echo);
+extern int rtnetlink_put_metrics(struct sk_buff *skb, __u32 *metrics);
extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data);
@@ -952,20 +954,20 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
RTA_ALIGN(attrlen) - attrlen); })
#define RTA_PUT_U8(skb, attrtype, value) \
-({ uint8_t _tmp = (value); \
- RTA_PUT(skb, attrtype, sizeof(uint8_t), &_tmp); })
+({ __u8 _tmp = (value); \
+ RTA_PUT(skb, attrtype, sizeof(__u8), &_tmp); })
#define RTA_PUT_U16(skb, attrtype, value) \
-({ uint16_t _tmp = (value); \
- RTA_PUT(skb, attrtype, sizeof(uint16_t), &_tmp); })
+({ __u16 _tmp = (value); \
+ RTA_PUT(skb, attrtype, sizeof(__u16), &_tmp); })
#define RTA_PUT_U32(skb, attrtype, value) \
-({ uint32_t _tmp = (value); \
- RTA_PUT(skb, attrtype, sizeof(uint32_t), &_tmp); })
+({ __u32 _tmp = (value); \
+ RTA_PUT(skb, attrtype, sizeof(__u32), &_tmp); })
#define RTA_PUT_U64(skb, attrtype, value) \
-({ uint64_t _tmp = (value); \
- RTA_PUT(skb, attrtype, sizeof(uint64_t), &_tmp); })
+({ __u64 _tmp = (value); \
+ RTA_PUT(skb, attrtype, sizeof(__u64), &_tmp); })
#define RTA_PUT_SECS(skb, attrtype, value) \
RTA_PUT_U64(skb, attrtype, (value) / HZ)
@@ -994,23 +996,23 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
-1; })
#define RTA_GET_U8(rta) \
-({ if (!rta || RTA_PAYLOAD(rta) < sizeof(uint8_t)) \
+({ if (!rta || RTA_PAYLOAD(rta) < sizeof(__u8)) \
goto rtattr_failure; \
- *(uint8_t *) RTA_DATA(rta); })
+ *(__u8 *) RTA_DATA(rta); })
#define RTA_GET_U16(rta) \
-({ if (!rta || RTA_PAYLOAD(rta) < sizeof(uint16_t)) \
+({ if (!rta || RTA_PAYLOAD(rta) < sizeof(__u16)) \
goto rtattr_failure; \
- *(uint16_t *) RTA_DATA(rta); })
+ *(__u16 *) RTA_DATA(rta); })
#define RTA_GET_U32(rta) \
-({ if (!rta || RTA_PAYLOAD(rta) < sizeof(uint32_t)) \
+({ if (!rta || RTA_PAYLOAD(rta) < sizeof(__u32)) \
goto rtattr_failure; \
- *(uint32_t *) RTA_DATA(rta); })
+ *(__u32 *) RTA_DATA(rta); })
#define RTA_GET_U64(rta) \
-({ uint64_t _tmp; \
- if (!rta || RTA_PAYLOAD(rta) < sizeof(uint64_t)) \
+({ __u64 _tmp; \
+ if (!rta || RTA_PAYLOAD(rta) < sizeof(__u64)) \
goto rtattr_failure; \
memcpy(&_tmp, RTA_DATA(rta), sizeof(_tmp)); \
_tmp; })
diff --git a/src/include/linux/udp.h b/src/include/linux/udp.h
new file mode 100644
index 000000000..2ee121bd0
--- /dev/null
+++ b/src/include/linux/udp.h
@@ -0,0 +1,63 @@
+/*
+ * INET An implementation of the TCP/IP protocol suite for the LINUX
+ * operating system. INET is implemented using the BSD Socket
+ * interface as the means of communication with the user level.
+ *
+ * Definitions for the UDP protocol.
+ *
+ * Version: @(#)udp.h 1.0.2 04/28/93
+ *
+ * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
+ *
+ * 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_UDP_H
+#define _LINUX_UDP_H
+
+#include <linux/types.h>
+
+struct udphdr {
+ __u16 source;
+ __u16 dest;
+ __u16 len;
+ __u16 check;
+};
+
+/* UDP socket options */
+#define UDP_CORK 1 /* Never send partially complete segments */
+#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
+
+/* UDP encapsulation types */
+#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
+#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */
+
+#ifdef __KERNEL__
+#include <linux/config.h>
+#include <linux/types.h>
+
+#include <net/inet_sock.h>
+
+struct udp_sock {
+ /* inet_sock has to be the first member */
+ struct inet_sock inet;
+ int pending; /* Any pending frames ? */
+ unsigned int corkflag; /* Cork is required */
+ __u16 encap_type; /* Is this an Encapsulation socket? */
+ /*
+ * Following member retains the infomation to create a UDP header
+ * when the socket is uncorked.
+ */
+ __u16 len; /* total length of pending frames */
+};
+
+static __inline__ struct udp_sock *udp_sk(const struct sock *sk)
+{
+ return (struct udp_sock *)sk;
+}
+
+#endif
+
+#endif /* _LINUX_UDP_H */
diff --git a/src/include/linux/xfrm.h b/src/include/linux/xfrm.h
index 9c0c52833..6b42cc474 100644
--- a/src/include/linux/xfrm.h
+++ b/src/include/linux/xfrm.h
@@ -1,7 +1,7 @@
#ifndef _LINUX_XFRM_H
#define _LINUX_XFRM_H
-#include <stdint.h>
+#include <linux/types.h>
/* All of the structures in this file may not change size as they are
* passed into the kernel from userspace via netlink sockets.
@@ -12,8 +12,8 @@
*/
typedef union
{
- uint32_t a4;
- uint32_t a6[4];
+ __u32 a4;
+ __u32 a6[4];
} xfrm_address_t;
/* Ident of a specific xfrm_state. It is used on input to lookup
@@ -23,16 +23,16 @@ typedef union
struct xfrm_id
{
xfrm_address_t daddr;
- uint32_t spi;
- uint8_t proto;
+ __u32 spi;
+ __u8 proto;
};
struct xfrm_sec_ctx {
- uint8_t ctx_doi;
- uint8_t ctx_alg;
- uint16_t ctx_len;
- uint32_t ctx_sid;
- char ctx_str[0];
+ __u8 ctx_doi;
+ __u8 ctx_alg;
+ __u16 ctx_len;
+ __u32 ctx_sid;
+ char ctx_str[0];
};
/* Security Context Domains of Interpretation */
@@ -49,57 +49,57 @@ struct xfrm_selector
{
xfrm_address_t daddr;
xfrm_address_t saddr;
- uint16_t dport;
- uint16_t dport_mask;
- uint16_t sport;
- uint16_t sport_mask;
- uint16_t family;
- uint8_t prefixlen_d;
- uint8_t prefixlen_s;
- uint8_t proto;
+ __u16 dport;
+ __u16 dport_mask;
+ __u16 sport;
+ __u16 sport_mask;
+ __u16 family;
+ __u8 prefixlen_d;
+ __u8 prefixlen_s;
+ __u8 proto;
int ifindex;
uid_t user;
};
-#define XFRM_INF (~(uint64_t)0)
+#define XFRM_INF (~(__u64)0)
struct xfrm_lifetime_cfg
{
- uint64_t soft_byte_limit;
- uint64_t hard_byte_limit;
- uint64_t soft_packet_limit;
- uint64_t hard_packet_limit;
- uint64_t soft_add_expires_seconds;
- uint64_t hard_add_expires_seconds;
- uint64_t soft_use_expires_seconds;
- uint64_t hard_use_expires_seconds;
+ __u64 soft_byte_limit;
+ __u64 hard_byte_limit;
+ __u64 soft_packet_limit;
+ __u64 hard_packet_limit;
+ __u64 soft_add_expires_seconds;
+ __u64 hard_add_expires_seconds;
+ __u64 soft_use_expires_seconds;
+ __u64 hard_use_expires_seconds;
};
struct xfrm_lifetime_cur
{
- uint64_t bytes;
- uint64_t packets;
- uint64_t add_time;
- uint64_t use_time;
+ __u64 bytes;
+ __u64 packets;
+ __u64 add_time;
+ __u64 use_time;
};
struct xfrm_replay_state
{
- uint32_t oseq;
- uint32_t seq;
- uint32_t bitmap;
+ __u32 oseq;
+ __u32 seq;
+ __u32 bitmap;
};
struct xfrm_algo {
char alg_name[64];
- int alg_key_len; /* in bits */
+ int alg_key_len; /* in bits */
char alg_key[0];
};
struct xfrm_stats {
- uint32_t replay_window;
- uint32_t replay;
- uint32_t integrity_failed;
+ __u32 replay_window;
+ __u32 replay;
+ __u32 integrity_failed;
};
enum
@@ -171,30 +171,30 @@ enum {
* NOTE: Same format as sadb_x_sec_ctx
*/
struct xfrm_user_sec_ctx {
- uint16_t len;
- uint16_t exttype;
- uint8_t ctx_alg; /* LSMs: e.g., selinux == 1 */
- uint8_t ctx_doi;
- uint16_t ctx_len;
+ __u16 len;
+ __u16 exttype;
+ __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */
+ __u8 ctx_doi;
+ __u16 ctx_len;
};
struct xfrm_user_tmpl {
- struct xfrm_id id;
- uint16_t family;
- xfrm_address_t saddr;
- uint32_t reqid;
- uint8_t mode;
- uint8_t share;
- uint8_t optional;
- uint32_t aalgos;
- uint32_t ealgos;
- uint32_t calgos;
+ struct xfrm_id id;
+ __u16 family;
+ xfrm_address_t saddr;
+ __u32 reqid;
+ __u8 mode;
+ __u8 share;
+ __u8 optional;
+ __u32 aalgos;
+ __u32 ealgos;
+ __u32 calgos;
};
struct xfrm_encap_tmpl {
- uint16_t encap_type;
- uint16_t encap_sport;
- uint16_t encap_dport;
+ __u16 encap_type;
+ __u16 encap_sport;
+ __u16 encap_dport;
xfrm_address_t encap_oa;
};
@@ -235,91 +235,93 @@ enum xfrm_attr_type_t {
struct xfrm_usersa_info {
struct xfrm_selector sel;
- struct xfrm_id id;
- xfrm_address_t saddr;
+ struct xfrm_id id;
+ xfrm_address_t saddr;
struct xfrm_lifetime_cfg lft;
struct xfrm_lifetime_cur curlft;
- struct xfrm_stats stats;
- uint32_t seq;
- uint32_t reqid;
- uint16_t family;
- uint8_t mode; /* 0=transport,1=tunnel */
- uint8_t replay_window;
- uint8_t flags;
+ struct xfrm_stats stats;
+ __u32 seq;
+ __u32 reqid;
+ __u16 family;
+ __u8 mode; /* 0=transport,1=tunnel */
+ __u8 replay_window;
+ __u8 flags;
#define XFRM_STATE_NOECN 1
#define XFRM_STATE_DECAP_DSCP 2
#define XFRM_STATE_NOPMTUDISC 4
};
struct xfrm_usersa_id {
- xfrm_address_t daddr;
- uint32_t spi;
- uint16_t family;
- uint8_t proto;
+ xfrm_address_t daddr;
+ __u32 spi;
+ __u16 family;
+ __u8 proto;
};
struct xfrm_aevent_id {
- struct xfrm_usersa_id sa_id;
- uint32_t flags;
+ struct xfrm_usersa_id sa_id;
+ __u32 flags;
};
struct xfrm_userspi_info {
- struct xfrm_usersa_info info;
- uint32_t min;
- uint32_t max;
+ struct xfrm_usersa_info info;
+ __u32 min;
+ __u32 max;
};
struct xfrm_userpolicy_info {
struct xfrm_selector sel;
struct xfrm_lifetime_cfg lft;
struct xfrm_lifetime_cur curlft;
- uint32_t priority;
- uint32_t index;
- uint8_t dir;
- uint8_t action;
+ __u32 priority;
+ __u32 index;
+ __u8 dir;
+ __u8 action;
#define XFRM_POLICY_ALLOW 0
#define XFRM_POLICY_BLOCK 1
- uint8_t flags;
+ __u8 flags;
#define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */
- uint8_t share;
+ __u8 share;
};
struct xfrm_userpolicy_id {
- struct xfrm_selector sel;
- uint32_t index;
- uint8_t dir;
+ struct xfrm_selector sel;
+ __u32 index;
+ __u8 dir;
};
struct xfrm_user_acquire {
- struct xfrm_id id;
- xfrm_address_t saddr;
+ struct xfrm_id id;
+ xfrm_address_t saddr;
struct xfrm_selector sel;
struct xfrm_userpolicy_info policy;
- uint32_t aalgos;
- uint32_t ealgos;
- uint32_t calgos;
- uint32_t seq;
+ __u32 aalgos;
+ __u32 ealgos;
+ __u32 calgos;
+ __u32 seq;
};
struct xfrm_user_expire {
struct xfrm_usersa_info state;
- uint8_t hard;
+ __u8 hard;
};
struct xfrm_user_polexpire {
struct xfrm_userpolicy_info pol;
- uint8_t hard;
+ __u8 hard;
};
struct xfrm_usersa_flush {
- uint8_t proto;
+ __u8 proto;
};
+#ifndef __KERNEL__
/* backwards compatibility for userspace */
#define XFRMGRP_ACQUIRE 1
#define XFRMGRP_EXPIRE 2
-#define XFRMGRP_SA 4
+#define XFRMGRP_SA 4
#define XFRMGRP_POLICY 8
+#endif
enum xfrm_nlgroups {
XFRMNLGRP_NONE,