reverted to original header files

This commit is contained in:
Andreas Steffen
2007-04-29 18:19:02 +00:00
parent c6f1e1b16c
commit a26b6acf92
6 changed files with 315 additions and 245 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
/* The definitions, required to talk to KAME racoon IKE. */ /* The definitions, required to talk to KAME racoon IKE. */
#include "pfkeyv2.h" #include <linux/pfkeyv2.h>
#define IPSEC_PORT_ANY 0 #define IPSEC_PORT_ANY 0
#define IPSEC_ULPROTO_ANY 255 #define IPSEC_ULPROTO_ANY 255
+25 -22
View File
@@ -1,8 +1,8 @@
#ifndef __LINUX_NETLINK_H #ifndef __LINUX_NETLINK_H
#define __LINUX_NETLINK_H #define __LINUX_NETLINK_H
#include <stdint.h> #include <linux/socket.h> /* for sa_family_t */
#include <sys/socket.h> /* for sa_family_t */ #include <linux/types.h>
#define NETLINK_ROUTE 0 /* Routing/device hook */ #define NETLINK_ROUTE 0 /* Routing/device hook */
#define NETLINK_W1 1 /* 1-wire subsystem */ #define NETLINK_W1 1 /* 1-wire subsystem */
@@ -28,17 +28,17 @@ struct sockaddr_nl
{ {
sa_family_t nl_family; /* AF_NETLINK */ sa_family_t nl_family; /* AF_NETLINK */
unsigned short nl_pad; /* zero */ unsigned short nl_pad; /* zero */
uint32_t nl_pid; /* process pid */ __u32 nl_pid; /* process pid */
uint32_t nl_groups; /* multicast groups mask */ __u32 nl_groups; /* multicast groups mask */
}; };
struct nlmsghdr struct nlmsghdr
{ {
uint32_t nlmsg_len; /* Length of message including header */ __u32 nlmsg_len; /* Length of message including header */
uint16_t nlmsg_type; /* Message content */ __u16 nlmsg_type; /* Message content */
uint16_t nlmsg_flags; /* Additional flags */ __u16 nlmsg_flags; /* Additional flags */
uint32_t nlmsg_seq; /* Sequence number */ __u32 nlmsg_seq; /* Sequence number */
uint32_t nlmsg_pid; /* Sending process PID */ __u32 nlmsg_pid; /* Sending process PID */
}; };
/* Flags values */ /* Flags values */
@@ -101,7 +101,7 @@ struct nlmsgerr
struct nl_pktinfo struct nl_pktinfo
{ {
uint32_t group; __u32 group;
}; };
#define NET_MAJOR 36 /* Major 36 is reserved for networking */ #define NET_MAJOR 36 /* Major 36 is reserved for networking */
@@ -122,8 +122,8 @@ enum {
struct nlattr struct nlattr
{ {
uint16_t nla_len; __u16 nla_len;
uint16_t nla_type; __u16 nla_type;
}; };
#define NLA_ALIGNTO 4 #define NLA_ALIGNTO 4
@@ -132,15 +132,18 @@ struct nlattr
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/capability.h>
#include <linux/skbuff.h>
struct netlink_skb_parms struct netlink_skb_parms
{ {
struct ucred creds; /* Skb credentials */ struct ucred creds; /* Skb credentials */
uint32_t pid; __u32 pid;
uint32_t dst_pid; __u32 dst_pid;
uint32_t dst_group; __u32 dst_group;
kernel_cap_t eff_cap; kernel_cap_t eff_cap;
uint32_t loginuid; /* Login (audit) uid */ __u32 loginuid; /* Login (audit) uid */
uint32_t sid; /* SELinux security id */ __u32 sid; /* SELinux security id */
}; };
#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) #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 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 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_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_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, uint32_t pid, extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
uint32_t group, gfp_t allocation); __u32 group, gfp_t allocation);
extern void netlink_set_err(struct sock *ssk, uint32_t pid, uint32_t group, int code); 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_register_notifier(struct notifier_block *nb);
extern int netlink_unregister_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 * 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; struct nlmsghdr *nlh;
int size = NLMSG_LENGTH(len); int size = NLMSG_LENGTH(len);
+2 -2
View File
@@ -6,7 +6,7 @@
#ifndef _LINUX_PFKEY2_H #ifndef _LINUX_PFKEY2_H
#define _LINUX_PFKEY2_H #define _LINUX_PFKEY2_H
#include <stdint.h> #include <linux/types.h>
#define PF_KEY_V2 2 #define PF_KEY_V2 2
#define PFKEYV2_REVISION 199806L #define PFKEYV2_REVISION 199806L
@@ -159,7 +159,7 @@ struct sadb_spirange {
struct sadb_x_kmprivate { struct sadb_x_kmprivate {
uint16_t sadb_x_kmprivate_len; uint16_t sadb_x_kmprivate_len;
uint16_t sadb_x_kmprivate_exttype; uint16_t sadb_x_kmprivate_exttype;
uint32_t sadb_x_kmprivate_reserved; u_int32_t sadb_x_kmprivate_reserved;
} __attribute__((packed)); } __attribute__((packed));
/* sizeof(struct sadb_x_kmprivate) == 8 */ /* sizeof(struct sadb_x_kmprivate) == 8 */
+129 -127
View File
@@ -1,8 +1,7 @@
#ifndef __LINUX_RTNETLINK_H #ifndef __LINUX_RTNETLINK_H
#define __LINUX_RTNETLINK_H #define __LINUX_RTNETLINK_H
#include "netlink.h" #include <linux/netlink.h>
#include <stdint.h>
/**** /****
* Routing/neighbour discovery messages. * Routing/neighbour discovery messages.
@@ -310,16 +309,16 @@ struct rtnexthop
struct rta_cacheinfo struct rta_cacheinfo
{ {
uint32_t rta_clntref; __u32 rta_clntref;
uint32_t rta_lastuse; __u32 rta_lastuse;
int32_t rta_expires; __s32 rta_expires;
uint32_t rta_error; __u32 rta_error;
uint32_t rta_used; __u32 rta_used;
#define RTNETLINK_HAVE_PEERINFO 1 #define RTNETLINK_HAVE_PEERINFO 1
uint32_t rta_id; __u32 rta_id;
uint32_t rta_ts; __u32 rta_ts;
uint32_t rta_tsage; __u32 rta_tsage;
}; };
/* RTM_METRICS --- array of struct rtattr with types of RTAX_* */ /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */
@@ -364,23 +363,23 @@ enum
struct rta_session struct rta_session
{ {
uint8_t proto; __u8 proto;
uint8_t pad1; __u8 pad1;
uint16_t pad2; __u16 pad2;
union { union {
struct { struct {
uint16_t sport; __u16 sport;
uint16_t dport; __u16 dport;
} ports; } ports;
struct { struct {
uint8_t type; __u8 type;
uint8_t code; __u8 code;
uint16_t ident; __u16 ident;
} icmpt; } icmpt;
uint32_t spi; __u32 spi;
} u; } u;
}; };
@@ -424,10 +423,10 @@ enum
struct ifa_cacheinfo struct ifa_cacheinfo
{ {
uint32_t ifa_prefered; __u32 ifa_prefered;
uint32_t ifa_valid; __u32 ifa_valid;
uint32_t cstamp; /* created timestamp, hundredths of seconds */ __u32 cstamp; /* created timestamp, hundredths of seconds */
uint32_t tstamp; /* updated timestamp, hundredths of seconds */ __u32 tstamp; /* updated timestamp, hundredths of seconds */
}; };
@@ -452,9 +451,9 @@ struct ndmsg
unsigned char ndm_pad1; unsigned char ndm_pad1;
unsigned short ndm_pad2; unsigned short ndm_pad2;
int ndm_ifindex; /* Link index */ int ndm_ifindex; /* Link index */
uint16_t ndm_state; __u16 ndm_state;
uint8_t ndm_flags; __u8 ndm_flags;
uint8_t ndm_type; __u8 ndm_type;
}; };
enum enum
@@ -498,10 +497,10 @@ enum
struct nda_cacheinfo struct nda_cacheinfo
{ {
uint32_t ndm_confirmed; __u32 ndm_confirmed;
uint32_t ndm_used; __u32 ndm_used;
uint32_t ndm_updated; __u32 ndm_updated;
uint32_t ndm_refcnt; __u32 ndm_refcnt;
}; };
@@ -532,69 +531,69 @@ struct nda_cacheinfo
struct ndt_stats struct ndt_stats
{ {
uint64_t ndts_allocs; __u64 ndts_allocs;
uint64_t ndts_destroys; __u64 ndts_destroys;
uint64_t ndts_hash_grows; __u64 ndts_hash_grows;
uint64_t ndts_res_failed; __u64 ndts_res_failed;
uint64_t ndts_lookups; __u64 ndts_lookups;
uint64_t ndts_hits; __u64 ndts_hits;
uint64_t ndts_rcv_probes_mcast; __u64 ndts_rcv_probes_mcast;
uint64_t ndts_rcv_probes_ucast; __u64 ndts_rcv_probes_ucast;
uint64_t ndts_periodic_gc_runs; __u64 ndts_periodic_gc_runs;
uint64_t ndts_forced_gc_runs; __u64 ndts_forced_gc_runs;
}; };
enum { enum {
NDTPA_UNSPEC, NDTPA_UNSPEC,
NDTPA_IFINDEX, /* uint32_t, unchangeable */ NDTPA_IFINDEX, /* __u32, unchangeable */
NDTPA_REFCNT, /* uint32_t, read-only */ NDTPA_REFCNT, /* __u32, read-only */
NDTPA_REACHABLE_TIME, /* uint64_t, read-only, msecs */ NDTPA_REACHABLE_TIME, /* __u64, read-only, msecs */
NDTPA_BASE_REACHABLE_TIME, /* uint64_t, msecs */ NDTPA_BASE_REACHABLE_TIME, /* __u64, msecs */
NDTPA_RETRANS_TIME, /* uint64_t, msecs */ NDTPA_RETRANS_TIME, /* __u64, msecs */
NDTPA_GC_STALETIME, /* uint64_t, msecs */ NDTPA_GC_STALETIME, /* __u64, msecs */
NDTPA_DELAY_PROBE_TIME, /* uint64_t, msecs */ NDTPA_DELAY_PROBE_TIME, /* __u64, msecs */
NDTPA_QUEUE_LEN, /* uint32_t */ NDTPA_QUEUE_LEN, /* __u32 */
NDTPA_APP_PROBES, /* uint32_t */ NDTPA_APP_PROBES, /* __u32 */
NDTPA_UCAST_PROBES, /* uint32_t */ NDTPA_UCAST_PROBES, /* __u32 */
NDTPA_MCAST_PROBES, /* uint32_t */ NDTPA_MCAST_PROBES, /* __u32 */
NDTPA_ANYCAST_DELAY, /* uint64_t, msecs */ NDTPA_ANYCAST_DELAY, /* __u64, msecs */
NDTPA_PROXY_DELAY, /* uint64_t, msecs */ NDTPA_PROXY_DELAY, /* __u64, msecs */
NDTPA_PROXY_QLEN, /* uint32_t */ NDTPA_PROXY_QLEN, /* __u32 */
NDTPA_LOCKTIME, /* uint64_t, msecs */ NDTPA_LOCKTIME, /* __u64, msecs */
__NDTPA_MAX __NDTPA_MAX
}; };
#define NDTPA_MAX (__NDTPA_MAX - 1) #define NDTPA_MAX (__NDTPA_MAX - 1)
struct ndtmsg struct ndtmsg
{ {
uint8_t ndtm_family; __u8 ndtm_family;
uint8_t ndtm_pad1; __u8 ndtm_pad1;
uint16_t ndtm_pad2; __u16 ndtm_pad2;
}; };
struct ndt_config struct ndt_config
{ {
uint16_t ndtc_key_len; __u16 ndtc_key_len;
uint16_t ndtc_entry_size; __u16 ndtc_entry_size;
uint32_t ndtc_entries; __u32 ndtc_entries;
uint32_t ndtc_last_flush; /* delta to now in msecs */ __u32 ndtc_last_flush; /* delta to now in msecs */
uint32_t ndtc_last_rand; /* delta to now in msecs */ __u32 ndtc_last_rand; /* delta to now in msecs */
uint32_t ndtc_hash_rnd; __u32 ndtc_hash_rnd;
uint32_t ndtc_hash_mask; __u32 ndtc_hash_mask;
uint32_t ndtc_hash_chain_gc; __u32 ndtc_hash_chain_gc;
uint32_t ndtc_proxy_qlen; __u32 ndtc_proxy_qlen;
}; };
enum { enum {
NDTA_UNSPEC, NDTA_UNSPEC,
NDTA_NAME, /* char *, unchangeable */ NDTA_NAME, /* char *, unchangeable */
NDTA_THRESH1, /* uint32_t */ NDTA_THRESH1, /* __u32 */
NDTA_THRESH2, /* uint32_t */ NDTA_THRESH2, /* __u32 */
NDTA_THRESH3, /* uint32_t */ NDTA_THRESH3, /* __u32 */
NDTA_CONFIG, /* struct ndt_config, read-only */ NDTA_CONFIG, /* struct ndt_config, read-only */
NDTA_PARMS, /* nested TLV NDTPA_* */ NDTA_PARMS, /* nested TLV NDTPA_* */
NDTA_STATS, /* struct ndt_stats, read-only */ NDTA_STATS, /* struct ndt_stats, read-only */
NDTA_GC_INTERVAL, /* uint64_t, msecs */ NDTA_GC_INTERVAL, /* __u64, msecs */
__NDTA_MAX __NDTA_MAX
}; };
#define NDTA_MAX (__NDTA_MAX - 1) #define NDTA_MAX (__NDTA_MAX - 1)
@@ -660,53 +659,53 @@ enum
struct prefix_cacheinfo struct prefix_cacheinfo
{ {
uint32_t preferred_time; __u32 preferred_time;
uint32_t valid_time; __u32 valid_time;
}; };
/* The struct should be in sync with struct net_device_stats */ /* The struct should be in sync with struct net_device_stats */
struct rtnl_link_stats struct rtnl_link_stats
{ {
uint32_t rx_packets; /* total packets received */ __u32 rx_packets; /* total packets received */
uint32_t tx_packets; /* total packets transmitted */ __u32 tx_packets; /* total packets transmitted */
uint32_t rx_bytes; /* total bytes received */ __u32 rx_bytes; /* total bytes received */
uint32_t tx_bytes; /* total bytes transmitted */ __u32 tx_bytes; /* total bytes transmitted */
uint32_t rx_errors; /* bad packets received */ __u32 rx_errors; /* bad packets received */
uint32_t tx_errors; /* packet transmit problems */ __u32 tx_errors; /* packet transmit problems */
uint32_t rx_dropped; /* no space in linux buffers */ __u32 rx_dropped; /* no space in linux buffers */
uint32_t tx_dropped; /* no space available in linux */ __u32 tx_dropped; /* no space available in linux */
uint32_t multicast; /* multicast packets received */ __u32 multicast; /* multicast packets received */
uint32_t collisions; __u32 collisions;
/* detailed rx_errors: */ /* detailed rx_errors: */
uint32_t rx_length_errors; __u32 rx_length_errors;
uint32_t rx_over_errors; /* receiver ring buff overflow */ __u32 rx_over_errors; /* receiver ring buff overflow */
uint32_t rx_crc_errors; /* recved pkt with crc error */ __u32 rx_crc_errors; /* recved pkt with crc error */
uint32_t rx_frame_errors; /* recv'd frame alignment error */ __u32 rx_frame_errors; /* recv'd frame alignment error */
uint32_t rx_fifo_errors; /* recv'r fifo overrun */ __u32 rx_fifo_errors; /* recv'r fifo overrun */
uint32_t rx_missed_errors; /* receiver missed packet */ __u32 rx_missed_errors; /* receiver missed packet */
/* detailed tx_errors */ /* detailed tx_errors */
uint32_t tx_aborted_errors; __u32 tx_aborted_errors;
uint32_t tx_carrier_errors; __u32 tx_carrier_errors;
uint32_t tx_fifo_errors; __u32 tx_fifo_errors;
uint32_t tx_heartbeat_errors; __u32 tx_heartbeat_errors;
uint32_t tx_window_errors; __u32 tx_window_errors;
/* for cslip etc */ /* for cslip etc */
uint32_t rx_compressed; __u32 rx_compressed;
uint32_t tx_compressed; __u32 tx_compressed;
}; };
/* The struct should be in sync with struct ifmap */ /* The struct should be in sync with struct ifmap */
struct rtnl_link_ifmap struct rtnl_link_ifmap
{ {
uint64_t mem_start; __u64 mem_start;
uint64_t mem_end; __u64 mem_end;
uint64_t base_addr; __u64 base_addr;
uint16_t irq; __u16 irq;
uint8_t dma; __u8 dma;
uint8_t port; __u8 port;
}; };
enum enum
@@ -791,10 +790,10 @@ enum
struct ifla_cacheinfo struct ifla_cacheinfo
{ {
uint32_t max_reasm_len; __u32 max_reasm_len;
uint32_t tstamp; /* ipv6InterfaceTable updated timestamp */ __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
uint32_t reachable_time; __u32 reachable_time;
uint32_t retrans_time; __u32 retrans_time;
}; };
/***************************************************************** /*****************************************************************
@@ -807,9 +806,9 @@ struct tcmsg
unsigned char tcm__pad1; unsigned char tcm__pad1;
unsigned short tcm__pad2; unsigned short tcm__pad2;
int tcm_ifindex; int tcm_ifindex;
uint32_t tcm_handle; __u32 tcm_handle;
uint32_t tcm_parent; __u32 tcm_parent;
uint32_t tcm_info; __u32 tcm_info;
}; };
enum enum
@@ -910,6 +909,9 @@ struct tcamsg
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/config.h>
#include <linux/mutex.h>
extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size); 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) 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 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_send(struct sk_buff *skb, __u32 pid, __u32 group, int echo);
extern int rtnetlink_put_metrics(struct sk_buff *skb, uint32_t *metrics); 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); 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); }) RTA_ALIGN(attrlen) - attrlen); })
#define RTA_PUT_U8(skb, attrtype, value) \ #define RTA_PUT_U8(skb, attrtype, value) \
({ uint8_t _tmp = (value); \ ({ __u8 _tmp = (value); \
RTA_PUT(skb, attrtype, sizeof(uint8_t), &_tmp); }) RTA_PUT(skb, attrtype, sizeof(__u8), &_tmp); })
#define RTA_PUT_U16(skb, attrtype, value) \ #define RTA_PUT_U16(skb, attrtype, value) \
({ uint16_t _tmp = (value); \ ({ __u16 _tmp = (value); \
RTA_PUT(skb, attrtype, sizeof(uint16_t), &_tmp); }) RTA_PUT(skb, attrtype, sizeof(__u16), &_tmp); })
#define RTA_PUT_U32(skb, attrtype, value) \ #define RTA_PUT_U32(skb, attrtype, value) \
({ uint32_t _tmp = (value); \ ({ __u32 _tmp = (value); \
RTA_PUT(skb, attrtype, sizeof(uint32_t), &_tmp); }) RTA_PUT(skb, attrtype, sizeof(__u32), &_tmp); })
#define RTA_PUT_U64(skb, attrtype, value) \ #define RTA_PUT_U64(skb, attrtype, value) \
({ uint64_t _tmp = (value); \ ({ __u64 _tmp = (value); \
RTA_PUT(skb, attrtype, sizeof(uint64_t), &_tmp); }) RTA_PUT(skb, attrtype, sizeof(__u64), &_tmp); })
#define RTA_PUT_SECS(skb, attrtype, value) \ #define RTA_PUT_SECS(skb, attrtype, value) \
RTA_PUT_U64(skb, attrtype, (value) / HZ) 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; }) -1; })
#define RTA_GET_U8(rta) \ #define RTA_GET_U8(rta) \
({ if (!rta || RTA_PAYLOAD(rta) < sizeof(uint8_t)) \ ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(__u8)) \
goto rtattr_failure; \ goto rtattr_failure; \
*(uint8_t *) RTA_DATA(rta); }) *(__u8 *) RTA_DATA(rta); })
#define RTA_GET_U16(rta) \ #define RTA_GET_U16(rta) \
({ if (!rta || RTA_PAYLOAD(rta) < sizeof(uint16_t)) \ ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(__u16)) \
goto rtattr_failure; \ goto rtattr_failure; \
*(uint16_t *) RTA_DATA(rta); }) *(__u16 *) RTA_DATA(rta); })
#define RTA_GET_U32(rta) \ #define RTA_GET_U32(rta) \
({ if (!rta || RTA_PAYLOAD(rta) < sizeof(uint32_t)) \ ({ if (!rta || RTA_PAYLOAD(rta) < sizeof(__u32)) \
goto rtattr_failure; \ goto rtattr_failure; \
*(uint32_t *) RTA_DATA(rta); }) *(__u32 *) RTA_DATA(rta); })
#define RTA_GET_U64(rta) \ #define RTA_GET_U64(rta) \
({ uint64_t _tmp; \ ({ __u64 _tmp; \
if (!rta || RTA_PAYLOAD(rta) < sizeof(uint64_t)) \ if (!rta || RTA_PAYLOAD(rta) < sizeof(__u64)) \
goto rtattr_failure; \ goto rtattr_failure; \
memcpy(&_tmp, RTA_DATA(rta), sizeof(_tmp)); \ memcpy(&_tmp, RTA_DATA(rta), sizeof(_tmp)); \
_tmp; }) _tmp; })
+63
View File
@@ -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, <[email protected]>
*
* 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 */
+95 -93
View File
@@ -1,7 +1,7 @@
#ifndef _LINUX_XFRM_H #ifndef _LINUX_XFRM_H
#define _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 /* All of the structures in this file may not change size as they are
* passed into the kernel from userspace via netlink sockets. * passed into the kernel from userspace via netlink sockets.
@@ -12,8 +12,8 @@
*/ */
typedef union typedef union
{ {
uint32_t a4; __u32 a4;
uint32_t a6[4]; __u32 a6[4];
} xfrm_address_t; } xfrm_address_t;
/* Ident of a specific xfrm_state. It is used on input to lookup /* Ident of a specific xfrm_state. It is used on input to lookup
@@ -23,16 +23,16 @@ typedef union
struct xfrm_id struct xfrm_id
{ {
xfrm_address_t daddr; xfrm_address_t daddr;
uint32_t spi; __u32 spi;
uint8_t proto; __u8 proto;
}; };
struct xfrm_sec_ctx { struct xfrm_sec_ctx {
uint8_t ctx_doi; __u8 ctx_doi;
uint8_t ctx_alg; __u8 ctx_alg;
uint16_t ctx_len; __u16 ctx_len;
uint32_t ctx_sid; __u32 ctx_sid;
char ctx_str[0]; char ctx_str[0];
}; };
/* Security Context Domains of Interpretation */ /* Security Context Domains of Interpretation */
@@ -49,57 +49,57 @@ struct xfrm_selector
{ {
xfrm_address_t daddr; xfrm_address_t daddr;
xfrm_address_t saddr; xfrm_address_t saddr;
uint16_t dport; __u16 dport;
uint16_t dport_mask; __u16 dport_mask;
uint16_t sport; __u16 sport;
uint16_t sport_mask; __u16 sport_mask;
uint16_t family; __u16 family;
uint8_t prefixlen_d; __u8 prefixlen_d;
uint8_t prefixlen_s; __u8 prefixlen_s;
uint8_t proto; __u8 proto;
int ifindex; int ifindex;
uid_t user; uid_t user;
}; };
#define XFRM_INF (~(uint64_t)0) #define XFRM_INF (~(__u64)0)
struct xfrm_lifetime_cfg struct xfrm_lifetime_cfg
{ {
uint64_t soft_byte_limit; __u64 soft_byte_limit;
uint64_t hard_byte_limit; __u64 hard_byte_limit;
uint64_t soft_packet_limit; __u64 soft_packet_limit;
uint64_t hard_packet_limit; __u64 hard_packet_limit;
uint64_t soft_add_expires_seconds; __u64 soft_add_expires_seconds;
uint64_t hard_add_expires_seconds; __u64 hard_add_expires_seconds;
uint64_t soft_use_expires_seconds; __u64 soft_use_expires_seconds;
uint64_t hard_use_expires_seconds; __u64 hard_use_expires_seconds;
}; };
struct xfrm_lifetime_cur struct xfrm_lifetime_cur
{ {
uint64_t bytes; __u64 bytes;
uint64_t packets; __u64 packets;
uint64_t add_time; __u64 add_time;
uint64_t use_time; __u64 use_time;
}; };
struct xfrm_replay_state struct xfrm_replay_state
{ {
uint32_t oseq; __u32 oseq;
uint32_t seq; __u32 seq;
uint32_t bitmap; __u32 bitmap;
}; };
struct xfrm_algo { struct xfrm_algo {
char alg_name[64]; char alg_name[64];
int alg_key_len; /* in bits */ int alg_key_len; /* in bits */
char alg_key[0]; char alg_key[0];
}; };
struct xfrm_stats { struct xfrm_stats {
uint32_t replay_window; __u32 replay_window;
uint32_t replay; __u32 replay;
uint32_t integrity_failed; __u32 integrity_failed;
}; };
enum enum
@@ -171,30 +171,30 @@ enum {
* NOTE: Same format as sadb_x_sec_ctx * NOTE: Same format as sadb_x_sec_ctx
*/ */
struct xfrm_user_sec_ctx { struct xfrm_user_sec_ctx {
uint16_t len; __u16 len;
uint16_t exttype; __u16 exttype;
uint8_t ctx_alg; /* LSMs: e.g., selinux == 1 */ __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */
uint8_t ctx_doi; __u8 ctx_doi;
uint16_t ctx_len; __u16 ctx_len;
}; };
struct xfrm_user_tmpl { struct xfrm_user_tmpl {
struct xfrm_id id; struct xfrm_id id;
uint16_t family; __u16 family;
xfrm_address_t saddr; xfrm_address_t saddr;
uint32_t reqid; __u32 reqid;
uint8_t mode; __u8 mode;
uint8_t share; __u8 share;
uint8_t optional; __u8 optional;
uint32_t aalgos; __u32 aalgos;
uint32_t ealgos; __u32 ealgos;
uint32_t calgos; __u32 calgos;
}; };
struct xfrm_encap_tmpl { struct xfrm_encap_tmpl {
uint16_t encap_type; __u16 encap_type;
uint16_t encap_sport; __u16 encap_sport;
uint16_t encap_dport; __u16 encap_dport;
xfrm_address_t encap_oa; xfrm_address_t encap_oa;
}; };
@@ -235,91 +235,93 @@ enum xfrm_attr_type_t {
struct xfrm_usersa_info { struct xfrm_usersa_info {
struct xfrm_selector sel; struct xfrm_selector sel;
struct xfrm_id id; struct xfrm_id id;
xfrm_address_t saddr; xfrm_address_t saddr;
struct xfrm_lifetime_cfg lft; struct xfrm_lifetime_cfg lft;
struct xfrm_lifetime_cur curlft; struct xfrm_lifetime_cur curlft;
struct xfrm_stats stats; struct xfrm_stats stats;
uint32_t seq; __u32 seq;
uint32_t reqid; __u32 reqid;
uint16_t family; __u16 family;
uint8_t mode; /* 0=transport,1=tunnel */ __u8 mode; /* 0=transport,1=tunnel */
uint8_t replay_window; __u8 replay_window;
uint8_t flags; __u8 flags;
#define XFRM_STATE_NOECN 1 #define XFRM_STATE_NOECN 1
#define XFRM_STATE_DECAP_DSCP 2 #define XFRM_STATE_DECAP_DSCP 2
#define XFRM_STATE_NOPMTUDISC 4 #define XFRM_STATE_NOPMTUDISC 4
}; };
struct xfrm_usersa_id { struct xfrm_usersa_id {
xfrm_address_t daddr; xfrm_address_t daddr;
uint32_t spi; __u32 spi;
uint16_t family; __u16 family;
uint8_t proto; __u8 proto;
}; };
struct xfrm_aevent_id { struct xfrm_aevent_id {
struct xfrm_usersa_id sa_id; struct xfrm_usersa_id sa_id;
uint32_t flags; __u32 flags;
}; };
struct xfrm_userspi_info { struct xfrm_userspi_info {
struct xfrm_usersa_info info; struct xfrm_usersa_info info;
uint32_t min; __u32 min;
uint32_t max; __u32 max;
}; };
struct xfrm_userpolicy_info { struct xfrm_userpolicy_info {
struct xfrm_selector sel; struct xfrm_selector sel;
struct xfrm_lifetime_cfg lft; struct xfrm_lifetime_cfg lft;
struct xfrm_lifetime_cur curlft; struct xfrm_lifetime_cur curlft;
uint32_t priority; __u32 priority;
uint32_t index; __u32 index;
uint8_t dir; __u8 dir;
uint8_t action; __u8 action;
#define XFRM_POLICY_ALLOW 0 #define XFRM_POLICY_ALLOW 0
#define XFRM_POLICY_BLOCK 1 #define XFRM_POLICY_BLOCK 1
uint8_t flags; __u8 flags;
#define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ #define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */
uint8_t share; __u8 share;
}; };
struct xfrm_userpolicy_id { struct xfrm_userpolicy_id {
struct xfrm_selector sel; struct xfrm_selector sel;
uint32_t index; __u32 index;
uint8_t dir; __u8 dir;
}; };
struct xfrm_user_acquire { struct xfrm_user_acquire {
struct xfrm_id id; struct xfrm_id id;
xfrm_address_t saddr; xfrm_address_t saddr;
struct xfrm_selector sel; struct xfrm_selector sel;
struct xfrm_userpolicy_info policy; struct xfrm_userpolicy_info policy;
uint32_t aalgos; __u32 aalgos;
uint32_t ealgos; __u32 ealgos;
uint32_t calgos; __u32 calgos;
uint32_t seq; __u32 seq;
}; };
struct xfrm_user_expire { struct xfrm_user_expire {
struct xfrm_usersa_info state; struct xfrm_usersa_info state;
uint8_t hard; __u8 hard;
}; };
struct xfrm_user_polexpire { struct xfrm_user_polexpire {
struct xfrm_userpolicy_info pol; struct xfrm_userpolicy_info pol;
uint8_t hard; __u8 hard;
}; };
struct xfrm_usersa_flush { struct xfrm_usersa_flush {
uint8_t proto; __u8 proto;
}; };
#ifndef __KERNEL__
/* backwards compatibility for userspace */ /* backwards compatibility for userspace */
#define XFRMGRP_ACQUIRE 1 #define XFRMGRP_ACQUIRE 1
#define XFRMGRP_EXPIRE 2 #define XFRMGRP_EXPIRE 2
#define XFRMGRP_SA 4 #define XFRMGRP_SA 4
#define XFRMGRP_POLICY 8 #define XFRMGRP_POLICY 8
#endif
enum xfrm_nlgroups { enum xfrm_nlgroups {
XFRMNLGRP_NONE, XFRMNLGRP_NONE,