2 * Definitions for the SECurity layer
5 * Robert Muchsel <muchsel@acm.org>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
13 #ifndef _LINUX_IPSEC_H
14 #define _LINUX_IPSEC_H
16 #include <linux/config.h>
17 #include <linux/socket.h>
19 #include <linux/skbuff.h>
21 /* Values for the set/getsockopt calls */
23 /* These defines are compatible with NRL IPv6, however their semantics
26 #define IPSEC_LEVEL_NONE -1 /* send plaintext, accept any */
27 #define IPSEC_LEVEL_DEFAULT 0 /* encrypt/authenticate if possible */
28 /* the default MUST be 0, because a */
29 /* socket is initialized with 0's */
30 #define IPSEC_LEVEL_USE 1 /* use outbound, don't require inbound */
31 #define IPSEC_LEVEL_REQUIRE 2 /* require both directions */
32 #define IPSEC_LEVEL_UNIQUE 2 /* for compatibility only */
36 /* skb bit flags set on packet input processing */
38 #define RCV_SEC 0x0f /* options on receive */
39 #define RCV_AUTH 0x01 /* was authenticated */
40 #define RCV_CRYPT 0x02 /* was encrypted */
41 #define RCV_TUNNEL 0x04 /* was tunneled */
42 #define SND_SEC 0xf0 /* options on send, these are */
43 #define SND_AUTH 0x10 /* currently unused */
44 #define SND_CRYPT 0x20
45 #define SND_TUNNEL 0x40
48 * FIXME: ignores network encryption for now..
51 #ifdef CONFIG_NET_SECURITY
52 extern __inline__
int ipsec_sk_policy(struct sock
*sk
, struct sk_buff
*skb
)
54 return ((sk
->authentication
< IPSEC_LEVEL_REQUIRE
) ||
55 (skb
->security
& RCV_AUTH
)) &&
56 ((sk
->encryption
< IPSEC_LEVEL_REQUIRE
) ||
57 (skb
->security
& RCV_CRYPT
));
62 extern __inline__
int ipsec_sk_policy(struct sock
*sk
, struct sk_buff
*skb
)
68 #endif /* __KERNEL__ */
69 #endif /* _LINUX_IPSEC_H */