aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ip.h21
-rw-r--r--include/linux/ipv6.h13
-rw-r--r--include/linux/netlink.h24
-rw-r--r--include/linux/rtnetlink.h176
-rw-r--r--include/linux/slab.h1
-rw-r--r--include/linux/tcp.h28
-rw-r--r--include/linux/xfrm.h4
7 files changed, 247 insertions, 20 deletions
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 8438c68591f9..31e7cedd9f84 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -81,6 +81,7 @@
81#ifdef __KERNEL__ 81#ifdef __KERNEL__
82#include <linux/config.h> 82#include <linux/config.h>
83#include <linux/types.h> 83#include <linux/types.h>
84#include <net/request_sock.h>
84#include <net/sock.h> 85#include <net/sock.h>
85#include <linux/igmp.h> 86#include <linux/igmp.h>
86#include <net/flow.h> 87#include <net/flow.h>
@@ -107,6 +108,26 @@ struct ip_options {
107 108
108#define optlength(opt) (sizeof(struct ip_options) + opt->optlen) 109#define optlength(opt) (sizeof(struct ip_options) + opt->optlen)
109 110
111struct inet_request_sock {
112 struct request_sock req;
113 u32 loc_addr;
114 u32 rmt_addr;
115 u16 rmt_port;
116 u16 snd_wscale : 4,
117 rcv_wscale : 4,
118 tstamp_ok : 1,
119 sack_ok : 1,
120 wscale_ok : 1,
121 ecn_ok : 1,
122 acked : 1;
123 struct ip_options *opt;
124};
125
126static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
127{
128 return (struct inet_request_sock *)sk;
129}
130
110struct ipv6_pinfo; 131struct ipv6_pinfo;
111 132
112struct inet_sock { 133struct inet_sock {
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index ab0d0efbf240..6fcd6a0ade24 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -193,6 +193,19 @@ struct inet6_skb_parm {
193 193
194#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 194#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
195 195
196struct tcp6_request_sock {
197 struct tcp_request_sock req;
198 struct in6_addr loc_addr;
199 struct in6_addr rmt_addr;
200 struct sk_buff *pktopts;
201 int iif;
202};
203
204static inline struct tcp6_request_sock *tcp6_rsk(const struct request_sock *sk)
205{
206 return (struct tcp6_request_sock *)sk;
207}
208
196/** 209/**
197 * struct ipv6_pinfo - ipv6 private area 210 * struct ipv6_pinfo - ipv6 private area
198 * 211 *
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index b2738ac8bc99..e38407a23d04 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -156,7 +156,7 @@ struct netlink_notify
156}; 156};
157 157
158static __inline__ struct nlmsghdr * 158static __inline__ struct nlmsghdr *
159__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len) 159__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
160{ 160{
161 struct nlmsghdr *nlh; 161 struct nlmsghdr *nlh;
162 int size = NLMSG_LENGTH(len); 162 int size = NLMSG_LENGTH(len);
@@ -164,15 +164,31 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len)
164 nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size)); 164 nlh = (struct nlmsghdr*)skb_put(skb, NLMSG_ALIGN(size));
165 nlh->nlmsg_type = type; 165 nlh->nlmsg_type = type;
166 nlh->nlmsg_len = size; 166 nlh->nlmsg_len = size;
167 nlh->nlmsg_flags = 0; 167 nlh->nlmsg_flags = flags;
168 nlh->nlmsg_pid = pid; 168 nlh->nlmsg_pid = pid;
169 nlh->nlmsg_seq = seq; 169 nlh->nlmsg_seq = seq;
170 return nlh; 170 return nlh;
171} 171}
172 172
173#define NLMSG_NEW(skb, pid, seq, type, len, flags) \
174({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \
175 goto nlmsg_failure; \
176 __nlmsg_put(skb, pid, seq, type, len, flags); })
177
173#define NLMSG_PUT(skb, pid, seq, type, len) \ 178#define NLMSG_PUT(skb, pid, seq, type, len) \
174({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) goto nlmsg_failure; \ 179 NLMSG_NEW(skb, pid, seq, type, len, 0)
175 __nlmsg_put(skb, pid, seq, type, len); }) 180
181#define NLMSG_NEW_ANSWER(skb, cb, type, len, flags) \
182 NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \
183 (cb)->nlh->nlmsg_seq, type, len, flags)
184
185#define NLMSG_END(skb, nlh) \
186({ (nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \
187 (skb)->len; })
188
189#define NLMSG_CANCEL(skb, nlh) \
190({ skb_trim(skb, (unsigned char *) (nlh) - (skb)->data); \
191 -1; })
176 192
177extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 193extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
178 struct nlmsghdr *nlh, 194 struct nlmsghdr *nlh,
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 91ac97c20777..e68dbf0bf579 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -89,6 +89,13 @@ enum {
89 RTM_GETANYCAST = 62, 89 RTM_GETANYCAST = 62,
90#define RTM_GETANYCAST RTM_GETANYCAST 90#define RTM_GETANYCAST RTM_GETANYCAST
91 91
92 RTM_NEWNEIGHTBL = 64,
93#define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL
94 RTM_GETNEIGHTBL = 66,
95#define RTM_GETNEIGHTBL RTM_GETNEIGHTBL
96 RTM_SETNEIGHTBL,
97#define RTM_SETNEIGHTBL RTM_SETNEIGHTBL
98
92 __RTM_MAX, 99 __RTM_MAX,
93#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) 100#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
94}; 101};
@@ -493,6 +500,106 @@ struct nda_cacheinfo
493 __u32 ndm_refcnt; 500 __u32 ndm_refcnt;
494}; 501};
495 502
503
504/*****************************************************************
505 * Neighbour tables specific messages.
506 *
507 * To retrieve the neighbour tables send RTM_GETNEIGHTBL with the
508 * NLM_F_DUMP flag set. Every neighbour table configuration is
509 * spread over multiple messages to avoid running into message
510 * size limits on systems with many interfaces. The first message
511 * in the sequence transports all not device specific data such as
512 * statistics, configuration, and the default parameter set.
513 * This message is followed by 0..n messages carrying device
514 * specific parameter sets.
515 * Although the ordering should be sufficient, NDTA_NAME can be
516 * used to identify sequences. The initial message can be identified
517 * by checking for NDTA_CONFIG. The device specific messages do
518 * not contain this TLV but have NDTPA_IFINDEX set to the
519 * corresponding interface index.
520 *
521 * To change neighbour table attributes, send RTM_SETNEIGHTBL
522 * with NDTA_NAME set. Changeable attribute include NDTA_THRESH[1-3],
523 * NDTA_GC_INTERVAL, and all TLVs in NDTA_PARMS unless marked
524 * otherwise. Device specific parameter sets can be changed by
525 * setting NDTPA_IFINDEX to the interface index of the corresponding
526 * device.
527 ****/
528
529struct ndt_stats
530{
531 __u64 ndts_allocs;
532 __u64 ndts_destroys;
533 __u64 ndts_hash_grows;
534 __u64 ndts_res_failed;
535 __u64 ndts_lookups;
536 __u64 ndts_hits;
537 __u64 ndts_rcv_probes_mcast;
538 __u64 ndts_rcv_probes_ucast;
539 __u64 ndts_periodic_gc_runs;
540 __u64 ndts_forced_gc_runs;
541};
542
543enum {
544 NDTPA_UNSPEC,
545 NDTPA_IFINDEX, /* u32, unchangeable */
546 NDTPA_REFCNT, /* u32, read-only */
547 NDTPA_REACHABLE_TIME, /* u64, read-only, msecs */
548 NDTPA_BASE_REACHABLE_TIME, /* u64, msecs */
549 NDTPA_RETRANS_TIME, /* u64, msecs */
550 NDTPA_GC_STALETIME, /* u64, msecs */
551 NDTPA_DELAY_PROBE_TIME, /* u64, msecs */
552 NDTPA_QUEUE_LEN, /* u32 */
553 NDTPA_APP_PROBES, /* u32 */
554 NDTPA_UCAST_PROBES, /* u32 */
555 NDTPA_MCAST_PROBES, /* u32 */
556 NDTPA_ANYCAST_DELAY, /* u64, msecs */
557 NDTPA_PROXY_DELAY, /* u64, msecs */
558 NDTPA_PROXY_QLEN, /* u32 */
559 NDTPA_LOCKTIME, /* u64, msecs */
560 __NDTPA_MAX
561};
562#define NDTPA_MAX (__NDTPA_MAX - 1)
563
564struct ndtmsg
565{
566 __u8 ndtm_family;
567 __u8 ndtm_pad1;
568 __u16 ndtm_pad2;
569};
570
571struct ndt_config
572{
573 __u16 ndtc_key_len;
574 __u16 ndtc_entry_size;
575 __u32 ndtc_entries;
576 __u32 ndtc_last_flush; /* delta to now in msecs */
577 __u32 ndtc_last_rand; /* delta to now in msecs */
578 __u32 ndtc_hash_rnd;
579 __u32 ndtc_hash_mask;
580 __u32 ndtc_hash_chain_gc;
581 __u32 ndtc_proxy_qlen;
582};
583
584enum {
585 NDTA_UNSPEC,
586 NDTA_NAME, /* char *, unchangeable */
587 NDTA_THRESH1, /* u32 */
588 NDTA_THRESH2, /* u32 */
589 NDTA_THRESH3, /* u32 */
590 NDTA_CONFIG, /* struct ndt_config, read-only */
591 NDTA_PARMS, /* nested TLV NDTPA_* */
592 NDTA_STATS, /* struct ndt_stats, read-only */
593 NDTA_GC_INTERVAL, /* u64, msecs */
594 __NDTA_MAX
595};
596#define NDTA_MAX (__NDTA_MAX - 1)
597
598#define NDTA_RTA(r) ((struct rtattr*)(((char*)(r)) + \
599 NLMSG_ALIGN(sizeof(struct ndtmsg))))
600#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
601
602
496/**** 603/****
497 * General form of address family dependent message. 604 * General form of address family dependent message.
498 ****/ 605 ****/
@@ -789,6 +896,75 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
789({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \ 896({ if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \
790 goto rtattr_failure; \ 897 goto rtattr_failure; \
791 memcpy(skb_put(skb, RTA_ALIGN(attrlen)), data, attrlen); }) 898 memcpy(skb_put(skb, RTA_ALIGN(attrlen)), data, attrlen); })
899
900#define RTA_PUT_U8(skb, attrtype, value) \
901({ u8 _tmp = (value); \
902 RTA_PUT(skb, attrtype, sizeof(u8), &_tmp); })
903
904#define RTA_PUT_U16(skb, attrtype, value) \
905({ u16 _tmp = (value); \
906 RTA_PUT(skb, attrtype, sizeof(u16), &_tmp); })
907
908#define RTA_PUT_U32(skb, attrtype, value) \
909({ u32 _tmp = (value); \
910 RTA_PUT(skb, attrtype, sizeof(u32), &_tmp); })
911
912#define RTA_PUT_U64(skb, attrtype, value) \
913({ u64 _tmp = (value); \
914 RTA_PUT(skb, attrtype, sizeof(u64), &_tmp); })
915
916#define RTA_PUT_SECS(skb, attrtype, value) \
917 RTA_PUT_U64(skb, attrtype, (value) / HZ)
918
919#define RTA_PUT_MSECS(skb, attrtype, value) \
920 RTA_PUT_U64(skb, attrtype, jiffies_to_msecs(value))
921
922#define RTA_PUT_STRING(skb, attrtype, value) \
923 RTA_PUT(skb, attrtype, strlen(value) + 1, value)
924
925#define RTA_PUT_FLAG(skb, attrtype) \
926 RTA_PUT(skb, attrtype, 0, NULL);
927
928#define RTA_NEST(skb, type) \
929({ struct rtattr *__start = (struct rtattr *) (skb)->tail; \
930 RTA_PUT(skb, type, 0, NULL); \
931 __start; })
932
933#define RTA_NEST_END(skb, start) \
934({ (start)->rta_len = ((skb)->tail - (unsigned char *) (start)); \
935 (skb)->len; })
936
937#define RTA_NEST_CANCEL(skb, start) \
938({ if (start) \
939 skb_trim(skb, (unsigned char *) (start) - (skb)->data); \
940 -1; })
941
942#define RTA_GET_U8(rta) \
943({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u8)) \
944 goto rtattr_failure; \
945 *(u8 *) RTA_DATA(rta); })
946
947#define RTA_GET_U16(rta) \
948({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u16)) \
949 goto rtattr_failure; \
950 *(u16 *) RTA_DATA(rta); })
951
952#define RTA_GET_U32(rta) \
953({ if (!rta || RTA_PAYLOAD(rta) < sizeof(u32)) \
954 goto rtattr_failure; \
955 *(u32 *) RTA_DATA(rta); })
956
957#define RTA_GET_U64(rta) \
958({ u64 _tmp; \
959 if (!rta || RTA_PAYLOAD(rta) < sizeof(u64)) \
960 goto rtattr_failure; \
961 memcpy(&_tmp, RTA_DATA(rta), sizeof(_tmp)); \
962 _tmp; })
963
964#define RTA_GET_FLAG(rta) (!!(rta))
965
966#define RTA_GET_SECS(rta) ((unsigned long) RTA_GET_U64(rta) * HZ)
967#define RTA_GET_MSECS(rta) (msecs_to_jiffies((unsigned long) RTA_GET_U64(rta)))
792 968
793static inline struct rtattr * 969static inline struct rtattr *
794__rta_reserve(struct sk_buff *skb, int attrtype, int attrlen) 970__rta_reserve(struct sk_buff *skb, int attrtype, int attrlen)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 7d66385ae750..76cf7e60216c 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -64,6 +64,7 @@ extern int kmem_cache_shrink(kmem_cache_t *);
64extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast); 64extern void *kmem_cache_alloc(kmem_cache_t *, unsigned int __nocast);
65extern void kmem_cache_free(kmem_cache_t *, void *); 65extern void kmem_cache_free(kmem_cache_t *, void *);
66extern unsigned int kmem_cache_size(kmem_cache_t *); 66extern unsigned int kmem_cache_size(kmem_cache_t *);
67extern const char *kmem_cache_name(kmem_cache_t *);
67extern kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags); 68extern kmem_cache_t *kmem_find_general_cachep(size_t size, int gfpflags);
68 69
69/* Size description struct for general caches. */ 70/* Size description struct for general caches. */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 14a55e3e3a50..97a7c9e03df5 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -230,6 +230,17 @@ struct tcp_options_received {
230 __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */ 230 __u16 mss_clamp; /* Maximal mss, negotiated at connection setup */
231}; 231};
232 232
233struct tcp_request_sock {
234 struct inet_request_sock req;
235 __u32 rcv_isn;
236 __u32 snt_isn;
237};
238
239static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
240{
241 return (struct tcp_request_sock *)req;
242}
243
233struct tcp_sock { 244struct tcp_sock {
234 /* inet_sock has to be the first member of tcp_sock */ 245 /* inet_sock has to be the first member of tcp_sock */
235 struct inet_sock inet; 246 struct inet_sock inet;
@@ -368,22 +379,7 @@ struct tcp_sock {
368 379
369 __u32 total_retrans; /* Total retransmits for entire connection */ 380 __u32 total_retrans; /* Total retransmits for entire connection */
370 381
371 /* The syn_wait_lock is necessary only to avoid proc interface having 382 struct request_sock_queue accept_queue; /* FIFO of established children */
372 * to grab the main lock sock while browsing the listening hash
373 * (otherwise it's deadlock prone).
374 * This lock is acquired in read mode only from listening_get_next()
375 * and it's acquired in write mode _only_ from code that is actively
376 * changing the syn_wait_queue. All readers that are holding
377 * the master sock lock don't need to grab this lock in read mode
378 * too as the syn_wait_queue writes are always protected from
379 * the main sock lock.
380 */
381 rwlock_t syn_wait_lock;
382 struct tcp_listen_opt *listen_opt;
383
384 /* FIFO of established children */
385 struct open_request *accept_queue;
386 struct open_request *accept_queue_tail;
387 383
388 unsigned int keepalive_time; /* time before keep alive takes place */ 384 unsigned int keepalive_time; /* time before keep alive takes place */
389 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 385 unsigned int keepalive_intvl; /* time interval between keep alive probes */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index fd2ef742a9fd..d68391a9b9f3 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -174,6 +174,8 @@ enum xfrm_attr_type_t {
174 XFRMA_ALG_COMP, /* struct xfrm_algo */ 174 XFRMA_ALG_COMP, /* struct xfrm_algo */
175 XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */ 175 XFRMA_ENCAP, /* struct xfrm_algo + struct xfrm_encap_tmpl */
176 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ 176 XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */
177 XFRMA_SA,
178 XFRMA_POLICY,
177 __XFRMA_MAX 179 __XFRMA_MAX
178 180
179#define XFRMA_MAX (__XFRMA_MAX - 1) 181#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -257,5 +259,7 @@ struct xfrm_usersa_flush {
257 259
258#define XFRMGRP_ACQUIRE 1 260#define XFRMGRP_ACQUIRE 1
259#define XFRMGRP_EXPIRE 2 261#define XFRMGRP_EXPIRE 2
262#define XFRMGRP_SA 4
263#define XFRMGRP_POLICY 8
260 264
261#endif /* _LINUX_XFRM_H */ 265#endif /* _LINUX_XFRM_H */