netfilter
firewalling, NAT, and packet mangling for linux
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
proto.c File Reference
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <net/if_arp.h>
#include <arpa/inet.h>
#include <linux/netfilter.h>
#include <expression.h>
#include <headers.h>
#include <proto.h>
#include <gmputil.h>
#include <utils.h>
#include <netinet/ip_icmp.h>
#include <netinet/udp.h>
#include <netinet/tcp.h>
#include <netinet/ip.h>
#include <netinet/icmp6.h>
#include <net/ethernet.h>
Include dependency graph for proto.c:

Macros

#define HDR_TEMPLATE(__name, __dtype, __type, __member)
 
#define HDR_FIELD(__name, __struct, __member)   HDR_TEMPLATE(__name, &integer_type, __struct, __member)
 
#define HDR_BITFIELD(__name, __dtype,__offset, __len)
 
#define HDR_TYPE(__name, __dtype, __struct, __member)   HDR_TEMPLATE(__name, __dtype, __struct, __member)
 
#define INET_PROTOCOL(__name, __struct, __member)   HDR_TYPE(__name, &inet_protocol_type, __struct, __member)
 
#define INET_SERVICE(__name, __struct, __member)   HDR_TYPE(__name, &inet_service_type, __struct, __member)
 
#define AHHDR_FIELD(__name, __member)   HDR_FIELD(__name, struct ip_auth_hdr, __member)
 
#define ESPHDR_FIELD(__name, __member)   HDR_FIELD(__name, struct ip_esp_hdr, __member)
 
#define COMPHDR_FIELD(__name, __member)   HDR_FIELD(__name, struct ip_comp_hdr, __member)
 
#define ICMPHDR_FIELD(__name, __member)   HDR_FIELD(__name, struct icmphdr, __member)
 
#define ICMPHDR_TYPE(__name, __type, __member)   HDR_TYPE(__name, __type, struct icmphdr, __member)
 
#define UDPHDR_FIELD(__name, __member)   HDR_FIELD(__name, struct udphdr, __member)
 
#define TCPHDR_FIELD(__name, __member)   HDR_FIELD(__name, struct tcphdr, __member)
 
#define DCCPHDR_FIELD(__name, __member)   HDR_FIELD(__name, struct dccp_hdr, __member)
 
#define SCTPHDR_FIELD(__name, __member)   HDR_FIELD(__name, struct sctphdr, __member)
 
#define IPHDR_FIELD(__name, __member)   HDR_FIELD(__name, struct iphdr, __member)
 
#define IPHDR_ADDR(__name, __member)   HDR_TYPE(__name, &ipaddr_type, struct iphdr, __member)
 
#define ICMP6HDR_FIELD(__name, __member)   HDR_FIELD(__name, struct icmp6_hdr, __member)
 
#define ICMP6HDR_TYPE(__name, __type, __member)   HDR_TYPE(__name, __type, struct icmp6_hdr, __member)
 
#define IP6HDR_FIELD(__name,__member)   HDR_FIELD(__name, struct ipv6hdr, __member)
 
#define IP6HDR_ADDR(__name, __member)   HDR_TYPE(__name, &ip6addr_type, struct ipv6hdr, __member)
 
#define IP6HDR_PROTOCOL(__name, __member)   HDR_TYPE(__name, &inet_service_type, struct ipv6hdr, __member)
 
#define ARPHDR_TYPE(__name, __type, __member)   HDR_TYPE(__name, __type, struct arphdr, __member)
 
#define ARPHDR_FIELD(__name, __member)   HDR_FIELD(__name, struct arphdr, __member)
 
#define VLANHDR_BITFIELD(__name, __offset, __len)   HDR_BITFIELD(__name, &integer_type, __offset, __len)
 
#define VLANHDR_TYPE(__name, __type, __member)   HDR_TYPE(__name, __type, struct vlan_hdr, __member)
 
#define ETHHDR_TEMPLATE(__name, __dtype, __member)   HDR_TEMPLATE(__name, __dtype, struct ether_header, __member)
 
#define ETHHDR_TYPE(__name, __member)   ETHHDR_TEMPLATE(__name, &ethertype_type, __member)
 
#define ETHHDR_ADDR(__name, __member)
 

Functions

const struct proto_descproto_find_upper (const struct proto_desc *base, unsigned int num)
 proto_find_upper - find higher layer protocol description by protocol value linking it to the lower layer protocol More...
 
int proto_find_num (const struct proto_desc *base, const struct proto_desc *desc)
 proto_find_num - return protocol number linking two protocols together More...
 
int proto_dev_type (const struct proto_desc *desc, uint16_t *res)
 proto_dev_type - return arphrd type linking a device and a protocol together More...
 
const struct proto_descproto_dev_desc (uint16_t type)
 proto_dev_desc - return protocol description for an arphrd type More...
 
void proto_ctx_init (struct proto_ctx *ctx, unsigned int family)
 proto_ctx_init - initialize protocol context for a given hook family More...
 
void proto_ctx_update (struct proto_ctx *ctx, enum proto_bases base, const struct location *loc, const struct proto_desc *desc)
 proto_ctx_update: update protocol context for given protocol base More...
 

Variables

const char * proto_base_names []
 
const char * proto_base_tokens []
 
const struct proto_hdr_template proto_unknown_template
 
const struct proto_desc proto_unknown
 
const struct hook_proto_desc hook_proto_desc []
 
const struct proto_desc proto_ah
 
const struct proto_desc proto_esp
 
const struct proto_desc proto_comp
 
const struct proto_desc proto_icmp
 
const struct proto_desc proto_udp
 
const struct proto_desc proto_udplite
 
const struct proto_desc proto_tcp
 
const struct proto_desc proto_dccp
 
const struct proto_desc proto_sctp
 
const struct proto_desc proto_ip
 
const struct proto_desc proto_icmp6
 
const struct proto_desc proto_ip6
 
const struct proto_desc proto_inet
 
const struct proto_desc proto_inet_service
 
const struct proto_desc proto_arp
 
const struct proto_desc proto_vlan
 
const struct datatype etheraddr_type
 
const struct datatype ethertype_type
 
const struct proto_desc proto_eth
 

Macro Definition Documentation

#define AHHDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct ip_auth_hdr, __member)
#define ARPHDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct arphdr, __member)
#define ARPHDR_TYPE (   __name,
  __type,
  __member 
)    HDR_TYPE(__name, __type, struct arphdr, __member)
#define COMPHDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct ip_comp_hdr, __member)
#define DCCPHDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct dccp_hdr, __member)
#define ESPHDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct ip_esp_hdr, __member)
#define ETHHDR_ADDR (   __name,
  __member 
)
Value:
offsetof(struct ether_header, __member) * 8, \
field_sizeof(struct ether_header, __member) * 8)
const struct datatype etheraddr_type
Definition: proto.c:735
#define PROTO_HDR_TEMPLATE(__token, __dtype,__byteorder, __offset, __len)
Definition: proto.h:46
Definition: datatype.h:97
#define field_sizeof(t, f)
Return a pointer to a constant variable of a size smaller than the variable.
Definition: utils.h:69
#define offsetof(TYPE, MEMBER)
Definition: linux_list.h:7
#define ETHHDR_TEMPLATE (   __name,
  __dtype,
  __member 
)    HDR_TEMPLATE(__name, __dtype, struct ether_header, __member)
#define ETHHDR_TYPE (   __name,
  __member 
)    ETHHDR_TEMPLATE(__name, &ethertype_type, __member)
#define HDR_BITFIELD (   __name,
  __dtype,
  __offset,
  __len 
)
Value:
__offset, __len)
#define PROTO_HDR_TEMPLATE(__token, __dtype,__byteorder, __offset, __len)
Definition: proto.h:46
Definition: datatype.h:98
#define HDR_FIELD (   __name,
  __struct,
  __member 
)    HDR_TEMPLATE(__name, &integer_type, __struct, __member)
#define HDR_TEMPLATE (   __name,
  __dtype,
  __type,
  __member 
)
Value:
PROTO_HDR_TEMPLATE(__name, __dtype, \
offsetof(__type, __member) * 8, \
field_sizeof(__type, __member) * 8)
#define PROTO_HDR_TEMPLATE(__token, __dtype,__byteorder, __offset, __len)
Definition: proto.h:46
#define field_sizeof(t, f)
Return a pointer to a constant variable of a size smaller than the variable.
Definition: utils.h:69
#define offsetof(TYPE, MEMBER)
Definition: linux_list.h:7
Definition: datatype.h:98
#define HDR_TYPE (   __name,
  __dtype,
  __struct,
  __member 
)    HDR_TEMPLATE(__name, __dtype, __struct, __member)
#define ICMP6HDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct icmp6_hdr, __member)
#define ICMP6HDR_TYPE (   __name,
  __type,
  __member 
)    HDR_TYPE(__name, __type, struct icmp6_hdr, __member)
#define ICMPHDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct icmphdr, __member)
#define ICMPHDR_TYPE (   __name,
  __type,
  __member 
)    HDR_TYPE(__name, __type, struct icmphdr, __member)
#define INET_PROTOCOL (   __name,
  __struct,
  __member 
)    HDR_TYPE(__name, &inet_protocol_type, __struct, __member)
#define INET_SERVICE (   __name,
  __struct,
  __member 
)    HDR_TYPE(__name, &inet_service_type, __struct, __member)
#define IP6HDR_ADDR (   __name,
  __member 
)    HDR_TYPE(__name, &ip6addr_type, struct ipv6hdr, __member)
#define IP6HDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct ipv6hdr, __member)
#define IP6HDR_PROTOCOL (   __name,
  __member 
)    HDR_TYPE(__name, &inet_service_type, struct ipv6hdr, __member)
#define IPHDR_ADDR (   __name,
  __member 
)    HDR_TYPE(__name, &ipaddr_type, struct iphdr, __member)
#define IPHDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct iphdr, __member)
#define SCTPHDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct sctphdr, __member)
#define TCPHDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct tcphdr, __member)
#define UDPHDR_FIELD (   __name,
  __member 
)    HDR_FIELD(__name, struct udphdr, __member)
#define VLANHDR_BITFIELD (   __name,
  __offset,
  __len 
)    HDR_BITFIELD(__name, &integer_type, __offset, __len)
#define VLANHDR_TYPE (   __name,
  __type,
  __member 
)    HDR_TYPE(__name, __type, struct vlan_hdr, __member)

Function Documentation

void proto_ctx_init ( struct proto_ctx ctx,
unsigned int  family 
)

proto_ctx_init - initialize protocol context for a given hook family

: protocol context : hook family

References hook_proto_desc::base, hook_proto_desc::desc, proto_ctx::desc, proto_ctx::family, and proto_ctx::protocol.

void proto_ctx_update ( struct proto_ctx ctx,
enum proto_bases  base,
const struct location loc,
const struct proto_desc desc 
)

proto_ctx_update: update protocol context for given protocol base

: protocol context : protocol base : location of the relational expression definiting the context : protocol description for the given layer

References hook_proto_desc::base, hook_proto_desc::desc, proto_ctx::desc, proto_ctx::location, and proto_ctx::protocol.

const struct proto_desc* proto_dev_desc ( uint16_t  type)

proto_dev_desc - return protocol description for an arphrd type

: the arphrd type

References array_size, dev_proto_desc::desc, and NULL.

int proto_dev_type ( const struct proto_desc desc,
uint16_t *  res 
)

proto_dev_type - return arphrd type linking a device and a protocol together

: the protocol description : pointer to result

References array_size, and dev_proto_desc::type.

Referenced by payload_gen_dependency().

Here is the caller graph for this function:

int proto_find_num ( const struct proto_desc base,
const struct proto_desc desc 
)

proto_find_num - return protocol number linking two protocols together

: lower layer protocol description : upper layer protocol description

References array_size, proto_desc::desc, proto_desc::num, and proto_desc::protocols.

Referenced by payload_gen_dependency().

Here is the caller graph for this function:

const struct proto_desc* proto_find_upper ( const struct proto_desc base,
unsigned int  num 
)

proto_find_upper - find higher layer protocol description by protocol value linking it to the lower layer protocol

: lower layer protocol description : protocol value

References array_size, proto_desc::desc, NULL, proto_desc::num, and proto_desc::protocols.

Variable Documentation

const struct datatype etheraddr_type
Initial value:
= {
.type = TYPE_ETHERADDR,
.name = "ether_addr",
.desc = "Ethernet address",
.byteorder = BYTEORDER_HOST_ENDIAN,
.basetype = &lladdr_type,
}
#define BITS_PER_BYTE
Definition: utils.h:14
Definition: datatype.h:54
#define ETH_ALEN
Definition: if_ether.h:29
Definition: datatype.h:97
const struct datatype lladdr_type
Definition: datatype.c:369
const struct datatype ethertype_type
Initial value:
= {
.type = TYPE_ETHERTYPE,
.name = "ether_type",
.desc = "Ethernet protocol",
.byteorder = BYTEORDER_BIG_ENDIAN,
.size = 2 * BITS_PER_BYTE,
.basetype = &integer_type,
.basefmt = "0x%.4Zx",
.print = ethertype_print,
.sym_tbl = &ethertype_tbl,
}
#define BITS_PER_BYTE
Definition: utils.h:14
const struct datatype integer_type
Definition: datatype.c:294
const char * basefmt
Definition: datatype.h:139
Definition: datatype.h:55
Definition: datatype.h:98
Initial value:
= {
}
Definition: proto.h:19
Definition: nfproto.h:11
const struct proto_desc proto_arp
Definition: proto.c:689
const struct proto_desc proto_ip
Definition: proto.c:488
Definition: nfproto.h:13
#define HOOK_PROTO_DESC(__base, __desc)
Definition: proto.h:99
Definition: nfproto.h:14
const struct proto_desc proto_eth
Definition: proto.c:781
Definition: proto.h:18
Definition: netfilter.h:54
const struct proto_desc proto_inet
Definition: proto.c:618
Definition: nfproto.h:12
const struct proto_desc proto_ip6
Definition: proto.c:586
const struct proto_desc proto_ah
Initial value:
= {
.name = "ah",
.protocol_key = AHHDR_NEXTHDR,
.protocols = {
PROTO_LINK(IPPROTO_ESP, &proto_esp),
PROTO_LINK(IPPROTO_AH, &proto_ah),
PROTO_LINK(IPPROTO_COMP, &proto_comp),
PROTO_LINK(IPPROTO_UDP, &proto_udp),
PROTO_LINK(IPPROTO_TCP, &proto_tcp),
},
.templates = {
[AHHDR_NEXTHDR] = INET_PROTOCOL("nexthdr", struct ip_auth_hdr, nexthdr),
[AHHDR_HDRLENGTH] = AHHDR_FIELD("hdrlength", hdrlen),
[AHHDR_SPI] = AHHDR_FIELD("spi", spi),
[AHHDR_SEQUENCE] = AHHDR_FIELD("sequence", seq_no),
},
}
#define IPPROTO_DCCP
Definition: libct_proto_dccp.c:21
const struct proto_desc proto_ah
Definition: proto.c:213
const struct proto_desc proto_udp
Definition: proto.c:342
Definition: proto.h:225
Definition: headers.h:19
const struct proto_desc proto_dccp
Definition: proto.c:450
const struct proto_desc proto_sctp
Definition: proto.c:467
#define IPPROTO_SCTP
Definition: libct_proto_sctp.c:21
uint32_t reserved
Definition: ulogd_inppkt_UNIXSOCK.c:34
const struct proto_desc proto_tcp
Definition: proto.c:397
#define AHHDR_FIELD(__name, __member)
Definition: proto.c:210
#define INET_PROTOCOL(__name, __struct, __member)
Definition: proto.c:201
#define IPPROTO_UDPLITE
Definition: libct_proto_udplite.c:19
Definition: proto.h:227
const struct proto_desc proto_esp
Definition: proto.c:243
Definition: proto.h:224
const struct proto_desc proto_udplite
Definition: proto.c:353
const struct proto_desc proto_comp
Definition: proto.c:259
Definition: proto.h:228
Definition: proto.h:20
#define PROTO_LINK(__num, __desc)
Definition: proto.h:86
Definition: proto.h:226
const struct proto_desc proto_arp
Initial value:
= {
.name = "arp",
.templates = {
[ARPHDR_HRD] = ARPHDR_FIELD("htype", ar_hrd),
[ARPHDR_PRO] = ARPHDR_TYPE("ptype", &ethertype_type, ar_pro),
[ARPHDR_HLN] = ARPHDR_FIELD("hlen", ar_hln),
[ARPHDR_PLN] = ARPHDR_FIELD("plen", ar_pln),
[ARPHDR_OP] = ARPHDR_TYPE("operation", &arpop_type, ar_op),
},
}
Definition: proto.h:19
Definition: proto.h:168
const struct datatype ethertype_type
Definition: proto.c:759
#define ARPHDR_TYPE(__name, __type, __member)
Definition: proto.c:684
Definition: proto.h:165
Definition: proto.h:164
Definition: proto.h:166
#define ARPHDR_FIELD(__name, __member)
Definition: proto.c:686
Definition: proto.h:167
const char* proto_base_names[]
Initial value:
= {
[PROTO_BASE_INVALID] = "invalid",
[PROTO_BASE_LL_HDR] = "link layer",
[PROTO_BASE_NETWORK_HDR] = "network layer",
[PROTO_BASE_TRANSPORT_HDR] = "transport layer",
}
Definition: proto.h:19
Definition: proto.h:17
Definition: proto.h:18
Definition: proto.h:20

Referenced by payload_gen_dependency().

const char* proto_base_tokens[]
Initial value:
= {
[PROTO_BASE_INVALID] = "invalid",
}
Definition: proto.h:19
Definition: proto.h:17
Definition: proto.h:18
Definition: proto.h:20
const struct proto_desc proto_comp
Initial value:
= {
.name = "comp",
.protocol_key = COMPHDR_NEXTHDR,
.protocols = {
PROTO_LINK(IPPROTO_ESP, &proto_esp),
PROTO_LINK(IPPROTO_AH, &proto_ah),
PROTO_LINK(IPPROTO_COMP, &proto_comp),
PROTO_LINK(IPPROTO_UDP, &proto_udp),
PROTO_LINK(IPPROTO_TCP, &proto_tcp),
},
.templates = {
[COMPHDR_NEXTHDR] = INET_PROTOCOL("nexthdr", struct ip_comp_hdr, nexthdr),
[COMPHDR_CPI] = COMPHDR_FIELD("cpi", cpi),
},
}
#define IPPROTO_DCCP
Definition: libct_proto_dccp.c:21
Definition: headers.h:32
const struct proto_desc proto_ah
Definition: proto.c:213
const struct proto_desc proto_udp
Definition: proto.c:342
static int struct nlattr enum ipset_adt adt u32 u32 flags
Definition: ip_set_hash_gen.h:1157
#define COMPHDR_FIELD(__name, __member)
Definition: proto.c:256
const struct proto_desc proto_dccp
Definition: proto.c:450
const struct proto_desc proto_sctp
Definition: proto.c:467
#define IPPROTO_SCTP
Definition: libct_proto_sctp.c:21
const struct proto_desc proto_tcp
Definition: proto.c:397
#define INET_PROTOCOL(__name, __struct, __member)
Definition: proto.c:201
#define IPPROTO_UDPLITE
Definition: libct_proto_udplite.c:19
const struct proto_desc proto_esp
Definition: proto.c:243
Definition: proto.h:239
Definition: proto.h:240
const struct proto_desc proto_udplite
Definition: proto.c:353
const struct proto_desc proto_comp
Definition: proto.c:259
Definition: proto.h:241
Definition: proto.h:20
#define PROTO_LINK(__num, __desc)
Definition: proto.h:86
const struct proto_desc proto_dccp
Initial value:
= {
.name = "dccp",
.templates = {
[DCCPHDR_SPORT] = INET_SERVICE("sport", struct dccp_hdr, dccph_sport),
[DCCPHDR_DPORT] = INET_SERVICE("dport", struct dccp_hdr, dccph_dport),
[DCCPHDR_TYPE] = HDR_BITFIELD("type", &dccp_pkttype_type, 67, 4),
},
}
#define INET_SERVICE(__name, __struct, __member)
Definition: proto.c:203
Definition: proto.h:272
Definition: proto.h:271
Definition: headers.h:56
Definition: proto.h:270
#define HDR_BITFIELD(__name, __dtype,__offset, __len)
Definition: proto.c:195
Definition: proto.h:20
const struct proto_desc proto_esp
Initial value:
= {
.name = "esp",
.templates = {
[ESPHDR_SPI] = ESPHDR_FIELD("spi", spi),
[ESPHDR_SEQUENCE] = ESPHDR_FIELD("sequence", seq_no),
},
}
#define ESPHDR_FIELD(__name, __member)
Definition: proto.c:240
Definition: proto.h:233
Definition: proto.h:234
Definition: proto.h:20
const struct proto_desc proto_eth
Initial value:
= {
.name = "ether",
.protocol_key = ETHHDR_TYPE,
.protocols = {
},
.templates = {
[ETHHDR_DADDR] = ETHHDR_ADDR("daddr", ether_dhost),
[ETHHDR_SADDR] = ETHHDR_ADDR("saddr", ether_shost),
[ETHHDR_TYPE] = ETHHDR_TYPE("type", ether_type),
},
}
#define ETH_P_IP
Definition: if_ether.h:42
const struct proto_desc proto_arp
Definition: proto.c:689
const struct proto_desc proto_ip
Definition: proto.c:488
Definition: proto.h:149
#define ETHHDR_TYPE(__name, __member)
Definition: proto.c:773
const struct proto_desc proto_vlan
Definition: proto.c:712
Definition: proto.h:150
#define ETHHDR_ADDR(__name, __member)
Definition: proto.c:775
Definition: proto.h:18
#define __constant_htons(x)
Definition: chtons.h:12
#define ETH_P_IPV6
Definition: if_ether.h:61
#define ETH_P_ARP
Definition: if_ether.h:44
#define PROTO_LINK(__num, __desc)
Definition: proto.h:86
const struct proto_desc proto_ip6
Definition: proto.c:586
#define ETH_P_8021Q
Definition: if_ether.h:59

Referenced by payload_gen_dependency().

const struct proto_desc proto_icmp
Initial value:
= {
.name = "icmp",
.templates = {
[ICMPHDR_TYPE] = ICMPHDR_TYPE("type", &icmp_type_type, type),
[ICMPHDR_CODE] = ICMPHDR_FIELD("code", code),
[ICMPHDR_ID] = ICMPHDR_FIELD("id", un.echo.id),
[ICMPHDR_SEQ] = ICMPHDR_FIELD("sequence", un.echo.sequence),
[ICMPHDR_GATEWAY] = ICMPHDR_FIELD("gateway", un.gateway),
[ICMPHDR_MTU] = ICMPHDR_FIELD("mtu", un.frag.mtu),
},
}
#define ICMPHDR_TYPE(__name, __type, __member)
Definition: proto.c:317
struct expr
Definition: proto.h:193
Definition: proto.h:189
#define ICMPHDR_FIELD(__name, __member)
Definition: proto.c:315
Definition: proto.h:194
Definition: proto.h:191
__be32 checksum
Definition: ulogd_raw2packet_BASE.c:578
Definition: proto.h:192
Definition: proto.h:190
Definition: proto.h:20
const struct proto_desc proto_icmp6
Initial value:
= {
.name = "icmpv6",
.templates = {
[ICMP6HDR_TYPE] = ICMP6HDR_TYPE("type", &icmp6_type_type, icmp6_type),
[ICMP6HDR_CODE] = ICMP6HDR_FIELD("code", icmp6_code),
[ICMP6HDR_CHECKSUM] = ICMP6HDR_FIELD("checksum", icmp6_cksum),
[ICMP6HDR_PPTR] = ICMP6HDR_FIELD("parameter-problem", icmp6_pptr),
[ICMP6HDR_MTU] = ICMP6HDR_FIELD("packet-too-big", icmp6_mtu),
[ICMP6HDR_ID] = ICMP6HDR_FIELD("id", icmp6_id),
[ICMP6HDR_SEQ] = ICMP6HDR_FIELD("sequence", icmp6_seq),
[ICMP6HDR_MAXDELAY] = ICMP6HDR_FIELD("max-delay", icmp6_maxdelay),
},
}
#define ICMP6HDR_FIELD(__name, __member)
Definition: proto.c:555
Definition: proto.h:206
Definition: proto.h:200
Definition: proto.h:205
Definition: proto.h:201
Definition: proto.h:204
#define ICMP6HDR_TYPE(__name, __type, __member)
Definition: proto.c:557
Definition: proto.h:203
Definition: proto.h:20
Definition: proto.h:202
const struct proto_desc proto_inet
Initial value:
= {
.name = "inet",
.protocols = {
},
.templates = {
},
}
Definition: nfproto.h:11
const struct proto_desc proto_ip
Definition: proto.c:488
Definition: nf_tables.h:591
const struct datatype nfproto_type
Definition: datatype.c:250
#define PROTO_META_TEMPLATE(__token, __dtype, __key, __len)
Definition: proto.h:55
Definition: nfproto.h:14
Definition: proto.h:18
#define PROTO_LINK(__num, __desc)
Definition: proto.h:86
const struct proto_desc proto_ip6
Definition: proto.c:586

Referenced by payload_gen_dependency().

const struct proto_desc proto_inet_service
Initial value:
= {
.name = "inet-service",
.protocol_key = 0,
.protocols = {
PROTO_LINK(IPPROTO_ESP, &proto_esp),
PROTO_LINK(IPPROTO_AH, &proto_ah),
PROTO_LINK(IPPROTO_COMP, &proto_comp),
PROTO_LINK(IPPROTO_UDP, &proto_udp),
PROTO_LINK(IPPROTO_TCP, &proto_tcp),
},
.templates = {
},
}
#define IPPROTO_DCCP
Definition: libct_proto_dccp.c:21
const struct proto_desc proto_ah
Definition: proto.c:213
const struct proto_desc proto_udp
Definition: proto.c:342
Definition: nf_tables.h:592
const struct datatype inet_protocol_type
Definition: datatype.c:536
const struct proto_desc proto_dccp
Definition: proto.c:450
#define PROTO_META_TEMPLATE(__token, __dtype, __key, __len)
Definition: proto.h:55
const struct proto_desc proto_sctp
Definition: proto.c:467
#define IPPROTO_SCTP
Definition: libct_proto_sctp.c:21
const struct proto_desc proto_tcp
Definition: proto.c:397
#define IPPROTO_UDPLITE
Definition: libct_proto_udplite.c:19
const struct proto_desc proto_esp
Definition: proto.c:243
const struct proto_desc proto_udplite
Definition: proto.c:353
const struct proto_desc proto_comp
Definition: proto.c:259
Definition: proto.h:20
#define PROTO_LINK(__num, __desc)
Definition: proto.h:86

Referenced by payload_gen_dependency().

const struct proto_desc proto_ip
Initial value:
= {
.name = "ip",
.protocol_key = IPHDR_PROTOCOL,
.protocols = {
PROTO_LINK(IPPROTO_ICMP, &proto_icmp),
PROTO_LINK(IPPROTO_ESP, &proto_esp),
PROTO_LINK(IPPROTO_AH, &proto_ah),
PROTO_LINK(IPPROTO_COMP, &proto_comp),
PROTO_LINK(IPPROTO_UDP, &proto_udp),
PROTO_LINK(IPPROTO_TCP, &proto_tcp),
},
.templates = {
[IPHDR_VERSION] = HDR_BITFIELD("version", &integer_type, 0, 4),
[IPHDR_HDRLENGTH] = HDR_BITFIELD("hdrlength", &integer_type, 4, 4),
[IPHDR_TOS] = IPHDR_FIELD("tos", tos),
[IPHDR_LENGTH] = IPHDR_FIELD("length", tot_len),
[IPHDR_ID] = IPHDR_FIELD("id", id),
[IPHDR_FRAG_OFF] = IPHDR_FIELD("frag-off", frag_off),
[IPHDR_TTL] = IPHDR_FIELD("ttl", ttl),
[IPHDR_PROTOCOL] = INET_PROTOCOL("protocol", struct iphdr, protocol),
[IPHDR_CHECKSUM] = IPHDR_FIELD("checksum", check),
[IPHDR_SADDR] = IPHDR_ADDR("saddr", saddr),
[IPHDR_DADDR] = IPHDR_ADDR("daddr", daddr),
},
}
Definition: proto.h:19
#define IPPROTO_DCCP
Definition: libct_proto_dccp.c:21
const struct proto_desc proto_ah
Definition: proto.c:213
const struct datatype integer_type
Definition: datatype.c:294
const struct proto_desc proto_udp
Definition: proto.c:342
Definition: proto.h:179
Definition: proto.h:175
Definition: proto.h:177
Definition: proto.h:183
Definition: proto.h:173
#define IPHDR_FIELD(__name, __member)
Definition: proto.c:483
Definition: proto.h:180
const struct proto_desc proto_dccp
Definition: proto.c:450
const struct proto_desc proto_sctp
Definition: proto.c:467
#define IPPROTO_SCTP
Definition: libct_proto_sctp.c:21
Definition: proto.h:174
const struct proto_desc proto_tcp
Definition: proto.c:397
#define INET_PROTOCOL(__name, __struct, __member)
Definition: proto.c:201
#define IPPROTO_UDPLITE
Definition: libct_proto_udplite.c:19
const struct proto_desc proto_esp
Definition: proto.c:243
#define IPHDR_ADDR(__name, __member)
Definition: proto.c:485
Definition: proto.h:182
Definition: proto.h:181
Definition: proto.h:178
Definition: proto.h:176
const struct proto_desc proto_icmp
Definition: proto.c:320
const struct proto_desc proto_udplite
Definition: proto.c:353
const struct proto_desc proto_comp
Definition: proto.c:259
#define HDR_BITFIELD(__name, __dtype,__offset, __len)
Definition: proto.c:195
#define PROTO_LINK(__num, __desc)
Definition: proto.h:86

Referenced by ct_expr_update_type().

const struct proto_desc proto_ip6
Initial value:
= {
.name = "ip6",
.protocol_key = IP6HDR_NEXTHDR,
.protocols = {
PROTO_LINK(IPPROTO_ESP, &proto_esp),
PROTO_LINK(IPPROTO_AH, &proto_ah),
PROTO_LINK(IPPROTO_COMP, &proto_comp),
PROTO_LINK(IPPROTO_UDP, &proto_udp),
PROTO_LINK(IPPROTO_TCP, &proto_tcp),
PROTO_LINK(IPPROTO_ICMPV6, &proto_icmp6),
},
.templates = {
[IP6HDR_VERSION] = HDR_BITFIELD("version", &integer_type, 0, 4),
[IP6HDR_PRIORITY] = HDR_BITFIELD("priority", &integer_type, 4, 4),
[IP6HDR_FLOWLABEL] = IP6HDR_FIELD("flowlabel", flow_lbl),
[IP6HDR_LENGTH] = IP6HDR_FIELD("length", payload_len),
[IP6HDR_NEXTHDR] = INET_PROTOCOL("nexthdr", struct ipv6hdr, nexthdr),
[IP6HDR_HOPLIMIT] = IP6HDR_FIELD("hoplimit", hop_limit),
[IP6HDR_SADDR] = IP6HDR_ADDR("saddr", saddr),
[IP6HDR_DADDR] = IP6HDR_ADDR("daddr", daddr),
},
}
Definition: proto.h:19
#define IPPROTO_DCCP
Definition: libct_proto_dccp.c:21
const struct proto_desc proto_ah
Definition: proto.c:213
const struct datatype integer_type
Definition: datatype.c:294
const struct proto_desc proto_udp
Definition: proto.c:342
Definition: proto.h:213
Definition: headers.h:81
const struct proto_desc proto_icmp6
Definition: proto.c:560
Definition: proto.h:211
Definition: proto.h:214
const struct proto_desc proto_dccp
Definition: proto.c:450
Definition: proto.h:216
const struct proto_desc proto_sctp
Definition: proto.c:467
#define IPPROTO_SCTP
Definition: libct_proto_sctp.c:21
#define IP6HDR_ADDR(__name, __member)
Definition: proto.c:581
const struct proto_desc proto_tcp
Definition: proto.c:397
#define IP6HDR_FIELD(__name,__member)
Definition: proto.c:579
#define INET_PROTOCOL(__name, __struct, __member)
Definition: proto.c:201
Definition: proto.h:212
#define IPPROTO_UDPLITE
Definition: libct_proto_udplite.c:19
const struct proto_desc proto_esp
Definition: proto.c:243
Definition: proto.h:217
const struct proto_desc proto_udplite
Definition: proto.c:353
const struct proto_desc proto_comp
Definition: proto.c:259
Definition: proto.h:218
Definition: proto.h:215
#define HDR_BITFIELD(__name, __dtype,__offset, __len)
Definition: proto.c:195
#define PROTO_LINK(__num, __desc)
Definition: proto.h:86

Referenced by ct_expr_update_type().

const struct proto_desc proto_sctp
Initial value:
= {
.name = "sctp",
.templates = {
[SCTPHDR_SPORT] = INET_SERVICE("sport", struct sctphdr, source),
[SCTPHDR_DPORT] = INET_SERVICE("dport", struct sctphdr, dest),
},
}
#define INET_SERVICE(__name, __struct, __member)
Definition: proto.c:203
__be32 vtag
Definition: ulogd_raw2packet_BASE.c:577
#define SCTPHDR_FIELD(__name, __member)
Definition: proto.c:464
__be16 dest
Definition: ulogd_raw2packet_BASE.c:576
Definition: headers.h:74
Definition: proto.h:278
__be16 source
Definition: ulogd_raw2packet_BASE.c:575
Definition: proto.h:280
__be32 checksum
Definition: ulogd_raw2packet_BASE.c:578
Definition: proto.h:279
Definition: proto.h:277
Definition: proto.h:20
const struct proto_desc proto_tcp
Initial value:
= {
.name = "tcp",
.templates = {
[TCPHDR_SPORT] = INET_SERVICE("sport", struct tcphdr, source),
[TCPHDR_DPORT] = INET_SERVICE("dport", struct tcphdr, dest),
[TCPHDR_SEQ] = TCPHDR_FIELD("sequence", seq),
[TCPHDR_ACKSEQ] = TCPHDR_FIELD("ackseq", ack_seq),
[TCPHDR_DOFF] = {},
[TCPHDR_FLAGS] = HDR_BITFIELD("flags", &tcp_flag_type,
[TCPHDR_WINDOW] = TCPHDR_FIELD("window", window),
[TCPHDR_CHECKSUM] = TCPHDR_FIELD("checksum", check),
[TCPHDR_URGPTR] = TCPHDR_FIELD("urgptr", urg_ptr),
},
}
#define BITS_PER_BYTE
Definition: utils.h:14
Definition: proto.h:263
#define INET_SERVICE(__name, __struct, __member)
Definition: proto.c:203
Definition: proto.h:264
Definition: proto.h:259
Definition: proto.h:262
Definition: proto.h:260
__be16 dest
Definition: ulogd_raw2packet_BASE.c:576
#define TCPHDR_FIELD(__name, __member)
Definition: proto.c:394
Definition: proto.h:257
Definition: proto.h:261
__be16 source
Definition: ulogd_raw2packet_BASE.c:575
Definition: proto.h:256
Definition: proto.h:258
Definition: proto.h:265
#define HDR_BITFIELD(__name, __dtype,__offset, __len)
Definition: proto.c:195
Definition: proto.h:20
const struct proto_desc proto_udp
Initial value:
= {
.name = "udp",
.templates = {
[UDPHDR_SPORT] = INET_SERVICE("sport", struct udphdr, source),
[UDPHDR_DPORT] = INET_SERVICE("dport", struct udphdr, dest),
[UDPHDR_LENGTH] = UDPHDR_FIELD("length", len),
[UDPHDR_CHECKSUM] = UDPHDR_FIELD("checksum", check),
},
}
Definition: proto.h:246
#define INET_SERVICE(__name, __struct, __member)
Definition: proto.c:203
#define UDPHDR_FIELD(__name, __member)
Definition: proto.c:339
Definition: proto.h:250
Definition: proto.h:248
__be16 dest
Definition: ulogd_raw2packet_BASE.c:576
__be16 source
Definition: ulogd_raw2packet_BASE.c:575
Definition: proto.h:247
Definition: proto.h:20
int len
Definition: utils.c:56
const struct proto_desc proto_udplite
Initial value:
= {
.name = "udplite",
.templates = {
[UDPHDR_SPORT] = INET_SERVICE("sport", struct udphdr, source),
[UDPHDR_DPORT] = INET_SERVICE("dport", struct udphdr, dest),
[UDPHDR_CSUMCOV] = UDPHDR_FIELD("csumcov", len),
[UDPHDR_CHECKSUM] = UDPHDR_FIELD("checksum", check),
},
}
Definition: proto.h:246
#define INET_SERVICE(__name, __struct, __member)
Definition: proto.c:203
#define UDPHDR_FIELD(__name, __member)
Definition: proto.c:339
Definition: proto.h:250
__be16 dest
Definition: ulogd_raw2packet_BASE.c:576
__be16 source
Definition: ulogd_raw2packet_BASE.c:575
Definition: proto.h:249
Definition: proto.h:247
Definition: proto.h:20
int len
Definition: utils.c:56
const struct proto_desc proto_unknown
Initial value:
= {
.name = "unknown",
}
Definition: proto.h:17

Referenced by payload_expr_alloc().

const struct proto_hdr_template proto_unknown_template
Initial value:
=
const struct datatype invalid_type
Definition: datatype.c:193
#define PROTO_HDR_TEMPLATE(__token, __dtype,__byteorder, __offset, __len)
Definition: proto.h:46
Definition: datatype.h:96

Referenced by payload_expr_alloc().

const struct proto_desc proto_vlan
Initial value:
= {
.name = "vlan",
.protocol_key = VLANHDR_TYPE,
.protocols = {
},
.templates = {
[VLANHDR_VID] = VLANHDR_BITFIELD("id", 0, 12),
[VLANHDR_CFI] = VLANHDR_BITFIELD("cfi", 12, 1),
[VLANHDR_PCP] = VLANHDR_BITFIELD("pcp", 13, 3),
[VLANHDR_TYPE] = VLANHDR_TYPE("type", &ethertype_type, vlan_type),
},
}
const struct datatype ethertype_type
Definition: proto.c:759
Definition: proto.h:158
Definition: proto.h:157
#define ETH_P_IP
Definition: if_ether.h:42
const struct proto_desc proto_arp
Definition: proto.c:689
const struct proto_desc proto_ip
Definition: proto.c:488
#define VLANHDR_BITFIELD(__name, __offset, __len)
Definition: proto.c:707
#define VLANHDR_TYPE(__name, __type, __member)
Definition: proto.c:709
const struct proto_desc proto_vlan
Definition: proto.c:712
Definition: proto.h:18
#define __constant_htons(x)
Definition: chtons.h:12
Definition: proto.h:156
#define ETH_P_IPV6
Definition: if_ether.h:61
#define ETH_P_ARP
Definition: if_ether.h:44
#define PROTO_LINK(__num, __desc)
Definition: proto.h:86
const struct proto_desc proto_ip6
Definition: proto.c:586
#define ETH_P_8021Q
Definition: if_ether.h:59