lib: check for integer-overflow in nlmsg_reserve()
[platform/upstream/libnl3.git] / include / linux / netfilter / nfnetlink_log.h
1 #ifndef _NFNETLINK_LOG_H
2 #define _NFNETLINK_LOG_H
3
4 /* This file describes the netlink messages (i.e. 'protocol packets'),
5  * and not any kind of function definitions.  It is shared between kernel and
6  * userspace.  Don't put kernel specific stuff in here */
7
8 #ifndef __aligned_be64
9 #define __aligned_be64 u_int64_t __attribute__((aligned(8)))
10 #endif
11
12 #include <linux/types.h>
13 #include <linux/netfilter/nfnetlink.h>
14
15 enum nfulnl_msg_types {
16         NFULNL_MSG_PACKET,              /* packet from kernel to userspace */
17         NFULNL_MSG_CONFIG,              /* connect to a particular queue */
18
19         NFULNL_MSG_MAX
20 };
21
22 struct nfulnl_msg_packet_hdr {
23         __be16          hw_protocol;    /* hw protocol (network order) */
24         __u8    hook;           /* netfilter hook */
25         __u8    _pad;
26 };
27
28 struct nfulnl_msg_packet_hw {
29         __be16          hw_addrlen;
30         __u16   _pad;
31         __u8    hw_addr[8];
32 };
33
34 struct nfulnl_msg_packet_timestamp {
35         __aligned_be64  sec;
36         __aligned_be64  usec;
37 };
38
39 enum nfulnl_attr_type {
40         NFULA_UNSPEC,
41         NFULA_PACKET_HDR,
42         NFULA_MARK,                     /* __u32 nfmark */
43         NFULA_TIMESTAMP,                /* nfulnl_msg_packet_timestamp */
44         NFULA_IFINDEX_INDEV,            /* __u32 ifindex */
45         NFULA_IFINDEX_OUTDEV,           /* __u32 ifindex */
46         NFULA_IFINDEX_PHYSINDEV,        /* __u32 ifindex */
47         NFULA_IFINDEX_PHYSOUTDEV,       /* __u32 ifindex */
48         NFULA_HWADDR,                   /* nfulnl_msg_packet_hw */
49         NFULA_PAYLOAD,                  /* opaque data payload */
50         NFULA_PREFIX,                   /* string prefix */
51         NFULA_UID,                      /* user id of socket */
52         NFULA_SEQ,                      /* instance-local sequence number */
53         NFULA_SEQ_GLOBAL,               /* global sequence number */
54         NFULA_GID,                      /* group id of socket */
55         NFULA_HWTYPE,                   /* hardware type */
56         NFULA_HWHEADER,                 /* hardware header */
57         NFULA_HWLEN,                    /* hardware header length */
58
59         __NFULA_MAX
60 };
61 #define NFULA_MAX (__NFULA_MAX - 1)
62
63 enum nfulnl_msg_config_cmds {
64         NFULNL_CFG_CMD_NONE,
65         NFULNL_CFG_CMD_BIND,
66         NFULNL_CFG_CMD_UNBIND,
67         NFULNL_CFG_CMD_PF_BIND,
68         NFULNL_CFG_CMD_PF_UNBIND,
69 };
70
71 struct nfulnl_msg_config_cmd {
72         __u8    command;        /* nfulnl_msg_config_cmds */
73 } __attribute__ ((packed));
74
75 struct nfulnl_msg_config_mode {
76         __be32          copy_range;
77         __u8    copy_mode;
78         __u8    _pad;
79 } __attribute__ ((packed));
80
81 enum nfulnl_attr_config {
82         NFULA_CFG_UNSPEC,
83         NFULA_CFG_CMD,                  /* nfulnl_msg_config_cmd */
84         NFULA_CFG_MODE,                 /* nfulnl_msg_config_mode */
85         NFULA_CFG_NLBUFSIZ,             /* __u32 buffer size */
86         NFULA_CFG_TIMEOUT,              /* __u32 in 1/100 s */
87         NFULA_CFG_QTHRESH,              /* __u32 */
88         NFULA_CFG_FLAGS,                /* __u16 */
89         __NFULA_CFG_MAX
90 };
91 #define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
92
93 #define NFULNL_COPY_NONE        0x00
94 #define NFULNL_COPY_META        0x01
95 #define NFULNL_COPY_PACKET      0x02
96 /* 0xff is reserved, don't use it for new copy modes. */
97
98 #define NFULNL_CFG_F_SEQ        0x0001
99 #define NFULNL_CFG_F_SEQ_GLOBAL 0x0002
100
101 #endif /* _NFNETLINK_LOG_H */