libpcap  1.10.1
About: libpcap is a packet filter library used by tools like tcpdump.
  Fossies Dox: libpcap-1.10.1.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

gencode.c File Reference
#include <pcap-types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <setjmp.h>
#include <stdarg.h>
#include "pcap-int.h"
#include "extract.h"
#include "ethertype.h"
#include "nlpid.h"
#include "llc.h"
#include "gencode.h"
#include "ieee80211.h"
#include "atmuni31.h"
#include "sunatmpos.h"
#include "ppp.h"
#include "pcap/sll.h"
#include "pcap/ipnet.h"
#include "arcnet.h"
#include "grammar.h"
#include "scanner.h"
#include <netdb.h>
#include <pcap/namedb.h>
#include "nametoaddr.h"
Include dependency graph for gencode.c:

Go to the source code of this file.

Data Structures

struct  bpf_abs_offset
 
struct  chunk
 
struct  _compiler_state
 

Macros

#define offsetof(s, e)   ((size_t)&((s *)0)->e)
 
#define ETHERMTU   1500
 
#define IPPROTO_HOPOPTS   0
 
#define IPPROTO_ROUTING   43
 
#define IPPROTO_FRAGMENT   44
 
#define IPPROTO_DSTOPTS   60
 
#define IPPROTO_SCTP   132
 
#define GENEVE_PORT   6081
 
#define JMP(c)   ((c)|BPF_JMP|BPF_K)
 
#define PUSH_LINKHDR(cs, new_linktype, new_is_variable, new_constant_part, new_reg)
 
#define OFFSET_NOT_SET   0xffffffffU
 
#define NCHUNKS   16
 
#define CHUNK0SIZE   1024
 
#define SWAPLONG(y)   ((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff))
 
#define BSD_AFNUM_INET6_BSD   24 /* NetBSD, OpenBSD, BSD/OS, Npcap */
 
#define BSD_AFNUM_INET6_FREEBSD   28 /* FreeBSD */
 
#define BSD_AFNUM_INET6_DARWIN   30 /* macOS, iOS, other Darwin-based OSes */
 
#define IPPROTO_IGMP   2
 
#define IPPROTO_IGRP   9
 
#define IPPROTO_PIM   103
 
#define IPPROTO_VRRP   112
 
#define IPPROTO_CARP   112
 
#define IPPROTO_ICMPV6   58
 
#define IPPROTO_AH   51
 
#define IPPROTO_ESP   50
 
#define IPPROTO_NONE   59
 

Enumerations

enum  e_offrel {
  OR_PACKET , OR_LINKHDR , OR_PREVLINKHDR , OR_LLC ,
  OR_PREVMPLSHDR , OR_LINKTYPE , OR_LINKPL , OR_LINKPL_NOSNAP ,
  OR_TRAN_IPV4 , OR_TRAN_IPV6
}
 

Functions

void bpf_set_error (compiler_state_t *cstate, const char *fmt,...)
 
static void bpf_error (compiler_state_t *, const char *,...)
 
static int init_linktype (compiler_state_t *, pcap_t *)
 
static void init_regs (compiler_state_t *)
 
static int alloc_reg (compiler_state_t *)
 
static void free_reg (compiler_state_t *, int)
 
static void initchunks (compiler_state_t *cstate)
 
static void * newchunk_nolongjmp (compiler_state_t *cstate, size_t)
 
static void * newchunk (compiler_state_t *cstate, size_t)
 
static void freechunks (compiler_state_t *cstate)
 
static struct blocknew_block (compiler_state_t *cstate, int)
 
static struct slistnew_stmt (compiler_state_t *cstate, int)
 
static struct blockgen_retblk (compiler_state_t *cstate, int)
 
static void syntax (compiler_state_t *cstate)
 
static void backpatch (struct block *, struct block *)
 
static void merge (struct block *, struct block *)
 
static struct blockgen_cmp (compiler_state_t *, enum e_offrel, u_int, u_int, bpf_u_int32)
 
static struct blockgen_cmp_gt (compiler_state_t *, enum e_offrel, u_int, u_int, bpf_u_int32)
 
static struct blockgen_cmp_ge (compiler_state_t *, enum e_offrel, u_int, u_int, bpf_u_int32)
 
static struct blockgen_cmp_lt (compiler_state_t *, enum e_offrel, u_int, u_int, bpf_u_int32)
 
static struct blockgen_cmp_le (compiler_state_t *, enum e_offrel, u_int, u_int, bpf_u_int32)
 
static struct blockgen_mcmp (compiler_state_t *, enum e_offrel, u_int, u_int, bpf_u_int32, bpf_u_int32)
 
static struct blockgen_bcmp (compiler_state_t *, enum e_offrel, u_int, u_int, const u_char *)
 
static struct blockgen_ncmp (compiler_state_t *, enum e_offrel, u_int, u_int, bpf_u_int32, int, int, bpf_u_int32)
 
static struct slistgen_load_absoffsetrel (compiler_state_t *, bpf_abs_offset *, u_int, u_int)
 
static struct slistgen_load_a (compiler_state_t *, enum e_offrel, u_int, u_int)
 
static struct slistgen_loadx_iphdrlen (compiler_state_t *)
 
static struct blockgen_uncond (compiler_state_t *, int)
 
static struct blockgen_true (compiler_state_t *)
 
static struct blockgen_false (compiler_state_t *)
 
static struct blockgen_ether_linktype (compiler_state_t *, bpf_u_int32)
 
static struct blockgen_ipnet_linktype (compiler_state_t *, bpf_u_int32)
 
static struct blockgen_linux_sll_linktype (compiler_state_t *, bpf_u_int32)
 
static struct slistgen_load_prism_llprefixlen (compiler_state_t *)
 
static struct slistgen_load_avs_llprefixlen (compiler_state_t *)
 
static struct slistgen_load_radiotap_llprefixlen (compiler_state_t *)
 
static struct slistgen_load_ppi_llprefixlen (compiler_state_t *)
 
static void insert_compute_vloffsets (compiler_state_t *, struct block *)
 
static struct slistgen_abs_offset_varpart (compiler_state_t *, bpf_abs_offset *)
 
static bpf_u_int32 ethertype_to_ppptype (bpf_u_int32)
 
static struct blockgen_linktype (compiler_state_t *, bpf_u_int32)
 
static struct blockgen_snap (compiler_state_t *, bpf_u_int32, bpf_u_int32)
 
static struct blockgen_llc_linktype (compiler_state_t *, bpf_u_int32)
 
static struct blockgen_hostop (compiler_state_t *, bpf_u_int32, bpf_u_int32, int, bpf_u_int32, u_int, u_int)
 
static struct blockgen_ahostop (compiler_state_t *, const u_char *, int)
 
static struct blockgen_ehostop (compiler_state_t *, const u_char *, int)
 
static struct blockgen_fhostop (compiler_state_t *, const u_char *, int)
 
static struct blockgen_thostop (compiler_state_t *, const u_char *, int)
 
static struct blockgen_wlanhostop (compiler_state_t *, const u_char *, int)
 
static struct blockgen_ipfchostop (compiler_state_t *, const u_char *, int)
 
static struct blockgen_dnhostop (compiler_state_t *, bpf_u_int32, int)
 
static struct blockgen_mpls_linktype (compiler_state_t *, bpf_u_int32)
 
static struct blockgen_host (compiler_state_t *, bpf_u_int32, bpf_u_int32, int, int, int)
 
static struct blockgen_gateway (compiler_state_t *, const u_char *, struct addrinfo *, int, int)
 
static struct blockgen_ipfrag (compiler_state_t *)
 
static struct blockgen_portatom (compiler_state_t *, int, bpf_u_int32)
 
static struct blockgen_portrangeatom (compiler_state_t *, u_int, bpf_u_int32, bpf_u_int32)
 
static struct blockgen_portatom6 (compiler_state_t *, int, bpf_u_int32)
 
static struct blockgen_portrangeatom6 (compiler_state_t *, u_int, bpf_u_int32, bpf_u_int32)
 
static struct blockgen_portop (compiler_state_t *, u_int, u_int, int)
 
static struct blockgen_port (compiler_state_t *, u_int, int, int)
 
static struct blockgen_portrangeop (compiler_state_t *, u_int, u_int, bpf_u_int32, int)
 
static struct blockgen_portrange (compiler_state_t *, u_int, u_int, int, int)
 
struct blockgen_portop6 (compiler_state_t *, u_int, u_int, int)
 
static struct blockgen_port6 (compiler_state_t *, u_int, int, int)
 
static struct blockgen_portrangeop6 (compiler_state_t *, u_int, u_int, bpf_u_int32, int)
 
static struct blockgen_portrange6 (compiler_state_t *, u_int, u_int, int, int)
 
static int lookup_proto (compiler_state_t *, const char *, int)
 
static struct blockgen_protochain (compiler_state_t *, bpf_u_int32, int)
 
static struct blockgen_proto (compiler_state_t *, bpf_u_int32, int, int)
 
static struct slistxfer_to_x (compiler_state_t *, struct arth *)
 
static struct slistxfer_to_a (compiler_state_t *, struct arth *)
 
static struct blockgen_mac_multicast (compiler_state_t *, int)
 
static struct blockgen_len (compiler_state_t *, int, int)
 
static struct blockgen_check_802_11_data_frame (compiler_state_t *)
 
static struct blockgen_geneve_ll_check (compiler_state_t *cstate)
 
static struct blockgen_ppi_dlt_check (compiler_state_t *)
 
static struct blockgen_atmfield_code_internal (compiler_state_t *, int, bpf_u_int32, int, int)
 
static struct blockgen_atmtype_llc (compiler_state_t *)
 
static struct blockgen_msg_abbrev (compiler_state_t *, int type)
 
char * sdup (compiler_state_t *cstate, const char *s)
 
int pcap_compile (pcap_t *p, struct bpf_program *program, const char *buf, int optimize, bpf_u_int32 mask)
 
int pcap_compile_nopcap (int snaplen_arg, int linktype_arg, struct bpf_program *program, const char *buf, int optimize, bpf_u_int32 mask)
 
void pcap_freecode (struct bpf_program *program)
 
int finish_parse (compiler_state_t *cstate, struct block *p)
 
void gen_and (struct block *b0, struct block *b1)
 
void gen_or (struct block *b0, struct block *b1)
 
void gen_not (struct block *b)
 
static struct blockgen_loopback_linktype (compiler_state_t *cstate, bpf_u_int32 ll_proto)
 
static struct slistgen_load_802_11_header_len (compiler_state_t *cstate, struct slist *s, struct slist *snext)
 
static struct blockgen_prevlinkhdr_check (compiler_state_t *cstate)
 
static struct blockgen_llc_internal (compiler_state_t *cstate)
 
struct blockgen_llc (compiler_state_t *cstate)
 
struct blockgen_llc_i (compiler_state_t *cstate)
 
struct blockgen_llc_s (compiler_state_t *cstate)
 
struct blockgen_llc_u (compiler_state_t *cstate)
 
struct blockgen_llc_s_subtype (compiler_state_t *cstate, bpf_u_int32 subtype)
 
struct blockgen_llc_u_subtype (compiler_state_t *cstate, bpf_u_int32 subtype)
 
static struct blockgen_proto_abbrev_internal (compiler_state_t *cstate, int proto)
 
struct blockgen_proto_abbrev (compiler_state_t *cstate, int proto)
 
struct blockgen_scode (compiler_state_t *cstate, const char *name, struct qual q)
 
struct blockgen_mcode (compiler_state_t *cstate, const char *s1, const char *s2, bpf_u_int32 masklen, struct qual q)
 
struct blockgen_ncode (compiler_state_t *cstate, const char *s, bpf_u_int32 v, struct qual q)
 
struct blockgen_ecode (compiler_state_t *cstate, const char *s, struct qual q)
 
void sappend (struct slist *s0, struct slist *s1)
 
static struct arthgen_load_internal (compiler_state_t *cstate, int proto, struct arth *inst, bpf_u_int32 size)
 
struct arthgen_load (compiler_state_t *cstate, int proto, struct arth *inst, bpf_u_int32 size)
 
static struct blockgen_relation_internal (compiler_state_t *cstate, int code, struct arth *a0, struct arth *a1, int reversed)
 
struct blockgen_relation (compiler_state_t *cstate, int code, struct arth *a0, struct arth *a1, int reversed)
 
struct arthgen_loadlen (compiler_state_t *cstate)
 
static struct arthgen_loadi_internal (compiler_state_t *cstate, bpf_u_int32 val)
 
struct arthgen_loadi (compiler_state_t *cstate, bpf_u_int32 val)
 
struct arthgen_neg (compiler_state_t *cstate, struct arth *a_arg)
 
struct arthgen_arth (compiler_state_t *cstate, int code, struct arth *a0_arg, struct arth *a1)
 
struct blockgen_greater (compiler_state_t *cstate, int n)
 
struct blockgen_less (compiler_state_t *cstate, int n)
 
struct blockgen_byteop (compiler_state_t *cstate, int op, int idx, bpf_u_int32 val)
 
struct blockgen_broadcast (compiler_state_t *cstate, int proto)
 
struct blockgen_multicast (compiler_state_t *cstate, int proto)
 
struct blockgen_ifindex (compiler_state_t *cstate, int ifindex)
 
struct blockgen_inbound (compiler_state_t *cstate, int dir)
 
struct blockgen_pf_ifname (compiler_state_t *cstate, const char *ifname)
 
struct blockgen_pf_ruleset (compiler_state_t *cstate, char *ruleset)
 
struct blockgen_pf_rnr (compiler_state_t *cstate, int rnr)
 
struct blockgen_pf_srnr (compiler_state_t *cstate, int srnr)
 
struct blockgen_pf_reason (compiler_state_t *cstate, int reason)
 
struct blockgen_pf_action (compiler_state_t *cstate, int action)
 
struct blockgen_p80211_type (compiler_state_t *cstate, bpf_u_int32 type, bpf_u_int32 mask)
 
struct blockgen_p80211_fcdir (compiler_state_t *cstate, bpf_u_int32 fcdir)
 
struct blockgen_acode (compiler_state_t *cstate, const char *s, struct qual q)
 
static struct blockgen_vlan_tpid_test (compiler_state_t *cstate)
 
static struct blockgen_vlan_vid_test (compiler_state_t *cstate, bpf_u_int32 vlan_num)
 
static struct blockgen_vlan_no_bpf_extensions (compiler_state_t *cstate, bpf_u_int32 vlan_num, int has_vlan_tag)
 
struct blockgen_vlan (compiler_state_t *cstate, bpf_u_int32 vlan_num, int has_vlan_tag)
 
struct blockgen_mpls (compiler_state_t *cstate, bpf_u_int32 label_num_arg, int has_label_num)
 
struct blockgen_pppoed (compiler_state_t *cstate)
 
struct blockgen_pppoes (compiler_state_t *cstate, bpf_u_int32 sess_num, int has_sess_num)
 
static struct blockgen_geneve_check (compiler_state_t *cstate, struct block *(*gen_portfn)(compiler_state_t *, u_int, int, int), enum e_offrel offrel, bpf_u_int32 vni, int has_vni)
 
static struct blockgen_geneve4 (compiler_state_t *cstate, bpf_u_int32 vni, int has_vni)
 
static struct blockgen_geneve6 (compiler_state_t *cstate, bpf_u_int32 vni, int has_vni)
 
static struct slistgen_geneve_offsets (compiler_state_t *cstate)
 
struct blockgen_geneve (compiler_state_t *cstate, bpf_u_int32 vni, int has_vni)
 
static struct blockgen_atmtype_metac (compiler_state_t *cstate)
 
static struct blockgen_atmtype_sc (compiler_state_t *cstate)
 
struct blockgen_atmfield_code (compiler_state_t *cstate, int atmfield, bpf_u_int32 jvalue, int jtype, int reverse)
 
struct blockgen_atmtype_abbrev (compiler_state_t *cstate, int type)
 
struct blockgen_mtp2type_abbrev (compiler_state_t *cstate, int type)
 
struct blockgen_mtp3field_code (compiler_state_t *cstate, int mtp3field, bpf_u_int32 jvalue_arg, int jtype, int reverse)
 
struct blockgen_atmmulti_abbrev (compiler_state_t *cstate, int type)
 

Variables

static const u_char abroadcast [] = { 0x0 }
 

Macro Definition Documentation

◆ BSD_AFNUM_INET6_BSD

#define BSD_AFNUM_INET6_BSD   24 /* NetBSD, OpenBSD, BSD/OS, Npcap */

Definition at line 3129 of file gencode.c.

◆ BSD_AFNUM_INET6_DARWIN

#define BSD_AFNUM_INET6_DARWIN   30 /* macOS, iOS, other Darwin-based OSes */

Definition at line 3131 of file gencode.c.

◆ BSD_AFNUM_INET6_FREEBSD

#define BSD_AFNUM_INET6_FREEBSD   28 /* FreeBSD */

Definition at line 3130 of file gencode.c.

◆ CHUNK0SIZE

#define CHUNK0SIZE   1024

Definition at line 243 of file gencode.c.

◆ ETHERMTU

#define ETHERMTU   1500

Definition at line 147 of file gencode.c.

◆ GENEVE_PORT

#define GENEVE_PORT   6081

Definition at line 165 of file gencode.c.

◆ IPPROTO_AH

#define IPPROTO_AH   51

◆ IPPROTO_CARP

#define IPPROTO_CARP   112

◆ IPPROTO_DSTOPTS

#define IPPROTO_DSTOPTS   60

Definition at line 159 of file gencode.c.

◆ IPPROTO_ESP

#define IPPROTO_ESP   50

◆ IPPROTO_FRAGMENT

#define IPPROTO_FRAGMENT   44

Definition at line 156 of file gencode.c.

◆ IPPROTO_HOPOPTS

#define IPPROTO_HOPOPTS   0

Definition at line 150 of file gencode.c.

◆ IPPROTO_ICMPV6

#define IPPROTO_ICMPV6   58

◆ IPPROTO_IGMP

#define IPPROTO_IGMP   2

◆ IPPROTO_IGRP

#define IPPROTO_IGRP   9

◆ IPPROTO_NONE

#define IPPROTO_NONE   59

◆ IPPROTO_PIM

#define IPPROTO_PIM   103

◆ IPPROTO_ROUTING

#define IPPROTO_ROUTING   43

Definition at line 153 of file gencode.c.

◆ IPPROTO_SCTP

#define IPPROTO_SCTP   132

Definition at line 162 of file gencode.c.

◆ IPPROTO_VRRP

#define IPPROTO_VRRP   112

◆ JMP

#define JMP (   c)    ((c)|BPF_JMP|BPF_K)

Definition at line 171 of file gencode.c.

◆ NCHUNKS

#define NCHUNKS   16

Definition at line 242 of file gencode.c.

◆ OFFSET_NOT_SET

#define OFFSET_NOT_SET   0xffffffffU

Definition at line 192 of file gencode.c.

◆ offsetof

#define offsetof (   s,
 
)    ((size_t)&((s *)0)->e)

Definition at line 91 of file gencode.c.

◆ PUSH_LINKHDR

#define PUSH_LINKHDR (   cs,
  new_linktype,
  new_is_variable,
  new_constant_part,
  new_reg 
)
Value:
{ \
(cs)->prevlinktype = (cs)->linktype; \
(cs)->off_prevlinkhdr = (cs)->off_linkhdr; \
(cs)->linktype = (new_linktype); \
(cs)->off_linkhdr.is_variable = (new_is_variable); \
(cs)->off_linkhdr.constant_part = (new_constant_part); \
(cs)->off_linkhdr.reg = (new_reg); \
(cs)->is_geneve = 0; \
}

Definition at line 178 of file gencode.c.

◆ SWAPLONG

#define SWAPLONG (   y)    ((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff))

Definition at line 1955 of file gencode.c.

Enumeration Type Documentation

◆ e_offrel

enum e_offrel
Enumerator
OR_PACKET 
OR_LINKHDR 
OR_PREVLINKHDR 
OR_LLC 
OR_PREVMPLSHDR 
OR_LINKTYPE 
OR_LINKPL 
OR_LINKPL_NOSNAP 
OR_TRAN_IPV4 
OR_TRAN_IPV6 

Definition at line 221 of file gencode.c.

Function Documentation

◆ alloc_reg()

◆ backpatch()

static void backpatch ( struct block list,
struct block target 
)
static

Definition at line 916 of file gencode.c.

References JF, JT, and block::sense.

Referenced by finish_parse(), gen_and(), and gen_or().

◆ bpf_error()

◆ bpf_set_error()

void bpf_set_error ( compiler_state_t cstate,
const char *  fmt,
  ... 
)

◆ ethertype_to_ppptype()

static bpf_u_int32 ethertype_to_ppptype ( bpf_u_int32  ll_proto)
static

◆ finish_parse()

◆ free_reg()

static void free_reg ( compiler_state_t cstate,
int  n 
)
static

Definition at line 7817 of file gencode.c.

References _compiler_state::regused.

Referenced by gen_arth(), gen_load_internal(), gen_protochain(), and gen_relation_internal().

◆ freechunks()

static void freechunks ( compiler_state_t cstate)
static

Definition at line 658 of file gencode.c.

References _compiler_state::chunks, chunk::m, and NCHUNKS.

Referenced by pcap_compile().

◆ gen_abs_offset_varpart()

static struct slist * gen_abs_offset_varpart ( compiler_state_t cstate,
bpf_abs_offset off 
)
static

◆ gen_acode()

◆ gen_ahostop()

static struct block * gen_ahostop ( compiler_state_t cstate,
const u_char *  eaddr,
int  dir 
)
static

◆ gen_and()

◆ gen_arth()

struct arth* gen_arth ( compiler_state_t cstate,
int  code,
struct arth a0_arg,
struct arth a1 
)

◆ gen_atmfield_code()

struct block* gen_atmfield_code ( compiler_state_t cstate,
int  atmfield,
bpf_u_int32  jvalue,
int  jtype,
int  reverse 
)

Definition at line 9621 of file gencode.c.

References gen_atmfield_code_internal(), and _compiler_state::top_ctx.

◆ gen_atmfield_code_internal()

◆ gen_atmmulti_abbrev()

◆ gen_atmtype_abbrev()

◆ gen_atmtype_llc()

static struct block * gen_atmtype_llc ( compiler_state_t cstate)
static

◆ gen_atmtype_metac()

static struct block* gen_atmtype_metac ( compiler_state_t cstate)
static

Definition at line 9589 of file gencode.c.

References A_VCI, A_VPI, BPF_JEQ, gen_and(), and gen_atmfield_code_internal().

Referenced by gen_atmmulti_abbrev(), and gen_atmtype_abbrev().

◆ gen_atmtype_sc()

static struct block* gen_atmtype_sc ( compiler_state_t cstate)
static

Definition at line 9600 of file gencode.c.

References A_VCI, A_VPI, BPF_JEQ, gen_and(), and gen_atmfield_code_internal().

Referenced by gen_atmmulti_abbrev(), and gen_atmtype_abbrev().

◆ gen_bcmp()

static struct block * gen_bcmp ( compiler_state_t cstate,
enum e_offrel  offrel,
u_int  offset,
u_int  size,
const u_char *  v 
)
static

◆ gen_broadcast()

◆ gen_byteop()

struct block* gen_byteop ( compiler_state_t cstate,
int  op,
int  idx,
bpf_u_int32  val 
)

◆ gen_check_802_11_data_frame()

static struct block * gen_check_802_11_data_frame ( compiler_state_t cstate)
static

◆ gen_cmp()

◆ gen_cmp_ge()

static struct block * gen_cmp_ge ( compiler_state_t cstate,
enum e_offrel  offrel,
u_int  offset,
u_int  size,
bpf_u_int32  v 
)
static

Definition at line 1048 of file gencode.c.

References BPF_JGE, gen_ncmp(), and block::offset.

Referenced by gen_multicast(), gen_portrangeatom(), and gen_portrangeatom6().

◆ gen_cmp_gt()

static struct block * gen_cmp_gt ( compiler_state_t cstate,
enum e_offrel  offrel,
u_int  offset,
u_int  size,
bpf_u_int32  v 
)
static

Definition at line 1041 of file gencode.c.

References BPF_JGT, gen_ncmp(), and block::offset.

Referenced by gen_byteop(), gen_ether_linktype(), and gen_llc_internal().

◆ gen_cmp_le()

static struct block * gen_cmp_le ( compiler_state_t cstate,
enum e_offrel  offrel,
u_int  offset,
u_int  size,
bpf_u_int32  v 
)
static

Definition at line 1062 of file gencode.c.

References BPF_JGT, gen_ncmp(), and block::offset.

Referenced by gen_portrangeatom(), and gen_portrangeatom6().

◆ gen_cmp_lt()

static struct block * gen_cmp_lt ( compiler_state_t cstate,
enum e_offrel  offrel,
u_int  offset,
u_int  size,
bpf_u_int32  v 
)
static

Definition at line 1055 of file gencode.c.

References BPF_JGE, gen_ncmp(), and block::offset.

Referenced by gen_byteop().

◆ gen_dnhostop()

static struct block * gen_dnhostop ( compiler_state_t cstate,
bpf_u_int32  addr,
int  dir 
)
static

◆ gen_ecode()

◆ gen_ehostop()

static struct block * gen_ehostop ( compiler_state_t cstate,
const u_char *  eaddr,
int  dir 
)
static

◆ gen_ether_linktype()

static struct block * gen_ether_linktype ( compiler_state_t cstate,
bpf_u_int32  ll_proto 
)
static

◆ gen_false()

static struct block * gen_false ( compiler_state_t cstate)
inlinestatic

Definition at line 1945 of file gencode.c.

References gen_uncond().

Referenced by gen_ipnet_linktype(), and gen_linktype().

◆ gen_fhostop()

static struct block * gen_fhostop ( compiler_state_t cstate,
const u_char *  eaddr,
int  dir 
)
static

◆ gen_gateway()

◆ gen_geneve()

◆ gen_geneve4()

static struct block* gen_geneve4 ( compiler_state_t cstate,
bpf_u_int32  vni,
int  has_vni 
)
static

◆ gen_geneve6()

◆ gen_geneve_check()

static struct block* gen_geneve_check ( compiler_state_t cstate,
struct block *(*)(compiler_state_t *, u_int, int, int)  gen_portfn,
enum e_offrel  offrel,
bpf_u_int32  vni,
int  has_vni 
)
static

Definition at line 9231 of file gencode.c.

References BPF_B, bpf_error(), BPF_W, gen_and(), gen_mcmp(), GENEVE_PORT, and Q_DST.

Referenced by gen_geneve4(), and gen_geneve6().

◆ gen_geneve_ll_check()

◆ gen_geneve_offsets()

◆ gen_greater()

struct block* gen_greater ( compiler_state_t cstate,
int  n 
)

Definition at line 7837 of file gencode.c.

References BPF_JGE, gen_len(), and _compiler_state::top_ctx.

◆ gen_host()

◆ gen_hostop()

static struct block * gen_hostop ( compiler_state_t cstate,
bpf_u_int32  addr,
bpf_u_int32  mask,
int  dir,
bpf_u_int32  ll_proto,
u_int  src_off,
u_int  dst_off 
)
static

◆ gen_ifindex()

◆ gen_inbound()

◆ gen_ipfchostop()

static struct block * gen_ipfchostop ( compiler_state_t cstate,
const u_char *  eaddr,
int  dir 
)
static

◆ gen_ipfrag()

static struct block * gen_ipfrag ( compiler_state_t cstate)
static

◆ gen_ipnet_linktype()

static struct block * gen_ipnet_linktype ( compiler_state_t cstate,
bpf_u_int32  ll_proto 
)
static

Definition at line 2175 of file gencode.c.

References BPF_B, ETHERTYPE_IP, ETHERTYPE_IPV6, gen_cmp(), gen_false(), IPH_AF_INET, IPH_AF_INET6, and OR_LINKTYPE.

Referenced by gen_linktype().

◆ gen_len()

static struct block * gen_len ( compiler_state_t cstate,
int  jmp,
int  n 
)
static

Definition at line 7823 of file gencode.c.

References BPF_LD, BPF_LEN, JMP, stmt::k, new_block(), new_stmt(), slist::s, block::s, and block::stmts.

Referenced by gen_greater(), and gen_less().

◆ gen_less()

struct block* gen_less ( compiler_state_t cstate,
int  n 
)

Definition at line 7853 of file gencode.c.

References BPF_JGT, gen_len(), gen_not(), and _compiler_state::top_ctx.

◆ gen_linktype()

static struct block * gen_linktype ( compiler_state_t cstate,
bpf_u_int32  ll_proto 
)
static

Definition at line 3141 of file gencode.c.

References A_PROTOTYPE, ARCTYPE_ARP, ARCTYPE_ARP_OLD, ARCTYPE_ATALK, ARCTYPE_INET6, ARCTYPE_IP, ARCTYPE_IP_OLD, ARCTYPE_REVARP, BPF_B, bpf_error(), BPF_H, BPF_JEQ, _compiler_state::bpf_pcap, BPF_W, BSD_AFNUM_INET6_BSD, BSD_AFNUM_INET6_DARWIN, BSD_AFNUM_INET6_FREEBSD, bpf_abs_offset::constant_part, DLT_ARCNET, DLT_ARCNET_LINUX, DLT_ATM_CLIP, DLT_ATM_RFC1483, DLT_AX25_KISS, DLT_BACNET_MS_TP, DLT_BLUETOOTH_HCI_H4, DLT_BLUETOOTH_HCI_H4_WITH_PHDR, DLT_C_HDLC, DLT_CAN20B, DLT_CAN_SOCKETCAN, DLT_DOCSIS, DLT_EN10MB, DLT_ENC, DLT_ERF, DLT_FDDI, DLT_FRELAY, DLT_IEEE802, DLT_IEEE802_11, DLT_IEEE802_11_RADIO, DLT_IEEE802_11_RADIO_AVS, DLT_IEEE802_15_4, DLT_IEEE802_15_4_LINUX, DLT_IEEE802_15_4_NOFCS, DLT_IEEE802_15_4_NONASK_PHY, DLT_IEEE802_15_4_TAP, DLT_IEEE802_16_MAC_CPS_RADIO, DLT_IP_OVER_FC, DLT_IPMB_KONTRON, DLT_IPMB_LINUX, DLT_IPNET, DLT_IPV4, DLT_IPV6, DLT_JUNIPER_ATM1, DLT_JUNIPER_ATM2, DLT_JUNIPER_ATM_CEMIC, DLT_JUNIPER_CHDLC, DLT_JUNIPER_ES, DLT_JUNIPER_ETHER, DLT_JUNIPER_FIBRECHANNEL, DLT_JUNIPER_FRELAY, DLT_JUNIPER_GGSN, DLT_JUNIPER_ISM, DLT_JUNIPER_MFR, DLT_JUNIPER_MLFR, DLT_JUNIPER_MLPPP, DLT_JUNIPER_MONITOR, DLT_JUNIPER_PPP, DLT_JUNIPER_PPPOE, DLT_JUNIPER_PPPOE_ATM, DLT_JUNIPER_SERVICES, DLT_JUNIPER_SRX_E2E, DLT_JUNIPER_ST, DLT_JUNIPER_VP, DLT_JUNIPER_VS, DLT_LINUX_IRDA, DLT_LINUX_LAPD, DLT_LINUX_SLL, DLT_LOOP, DLT_LTALK, DLT_MFR, DLT_MTP2, DLT_MTP2_WITH_PHDR, DLT_NETANALYZER, DLT_NETANALYZER_TRANSPARENT, DLT_NFLOG, DLT_NULL, DLT_PFLOG, DLT_PFSYNC, DLT_PPI, DLT_PPP, DLT_PPP_BSDOS, DLT_PPP_ETHER, DLT_PPP_PPPD, DLT_PPP_SERIAL, DLT_PRISM_HEADER, DLT_RAIF1, DLT_RAW, DLT_SITA, DLT_SLIP, DLT_SLIP_BSDOS, DLT_SUNATM, DLT_USB_FREEBSD, DLT_USB_LINUX, DLT_USB_LINUX_MMAPPED, DLT_USBPCAP, ETHERTYPE_ARP, ETHERTYPE_ATALK, ETHERTYPE_IP, ETHERTYPE_IPV6, ETHERTYPE_REVARP, ethertype_to_ppptype(), gen_and(), gen_atmfield_code_internal(), gen_check_802_11_data_frame(), gen_cmp(), gen_ether_linktype(), gen_false(), gen_ipnet_linktype(), gen_linux_sll_linktype(), gen_llc_linktype(), gen_loopback_linktype(), gen_mcmp(), gen_mpls_linktype(), gen_or(), gen_prevlinkhdr_check(), gen_true(), _compiler_state::is_geneve, ISO10589_ISIS, ISO8473_CLNP, ISO9542_ESIS, _compiler_state::label_stack_depth, _compiler_state::linktype, LLCSAP_ISONS, _compiler_state::off_linktype, OFFSET_NOT_SET, offsetof, OR_LINKHDR, OR_LINKTYPE, pcap_datalink_val_to_description_or_dlt(), PPP_IP, PPP_VJC, PPP_VJNC, PT_LLC, and pcap::rfile.

Referenced by gen_broadcast(), gen_dnhostop(), gen_hostop(), gen_mpls(), gen_multicast(), gen_port(), gen_port6(), gen_portrange(), gen_portrange6(), gen_pppoed(), gen_pppoes(), gen_proto(), gen_proto_abbrev_internal(), gen_protochain(), and gen_vlan_tpid_test().

◆ gen_linux_sll_linktype()

◆ gen_llc()

struct block* gen_llc ( compiler_state_t cstate)

Definition at line 3738 of file gencode.c.

References gen_llc_internal(), and _compiler_state::top_ctx.

◆ gen_llc_i()

◆ gen_llc_internal()

◆ gen_llc_linktype()

static struct block * gen_llc_linktype ( compiler_state_t cstate,
bpf_u_int32  ll_proto 
)
static

◆ gen_llc_s()

struct block* gen_llc_s ( compiler_state_t cstate)

◆ gen_llc_s_subtype()

struct block* gen_llc_s_subtype ( compiler_state_t cstate,
bpf_u_int32  subtype 
)

◆ gen_llc_u()

struct block* gen_llc_u ( compiler_state_t cstate)

◆ gen_llc_u_subtype()

struct block* gen_llc_u_subtype ( compiler_state_t cstate,
bpf_u_int32  subtype 
)

◆ gen_load()

struct arth* gen_load ( compiler_state_t cstate,
int  proto,
struct arth inst,
bpf_u_int32  size 
)

Definition at line 7567 of file gencode.c.

References gen_load_internal(), and _compiler_state::top_ctx.

◆ gen_load_802_11_header_len()

◆ gen_load_a()

◆ gen_load_absoffsetrel()

static struct slist * gen_load_absoffsetrel ( compiler_state_t cstate,
bpf_abs_offset abs_offset,
u_int  offset,
u_int  size 
)
static

◆ gen_load_avs_llprefixlen()

static struct slist * gen_load_avs_llprefixlen ( compiler_state_t cstate)
static

◆ gen_load_internal()

◆ gen_load_ppi_llprefixlen()

static struct slist * gen_load_ppi_llprefixlen ( compiler_state_t cstate)
static

◆ gen_load_prism_llprefixlen()

◆ gen_load_radiotap_llprefixlen()

static struct slist * gen_load_radiotap_llprefixlen ( compiler_state_t cstate)
static

◆ gen_loadi()

struct arth* gen_loadi ( compiler_state_t cstate,
bpf_u_int32  val 
)

Definition at line 7685 of file gencode.c.

References gen_loadi_internal(), and _compiler_state::top_ctx.

◆ gen_loadi_internal()

static struct arth* gen_loadi_internal ( compiler_state_t cstate,
bpf_u_int32  val 
)
static

Definition at line 7664 of file gencode.c.

References alloc_reg(), BPF_IMM, BPF_LD, BPF_ST, stmt::k, new_stmt(), newchunk(), slist::next, reg, arth::regno, slist::s, and arth::s.

Referenced by gen_inbound(), and gen_loadi().

◆ gen_loadlen()

struct arth* gen_loadlen ( compiler_state_t cstate)

◆ gen_loadx_iphdrlen()

◆ gen_loopback_linktype()

static struct block* gen_loopback_linktype ( compiler_state_t cstate,
bpf_u_int32  ll_proto 
)
static

◆ gen_mac_multicast()

static struct block * gen_mac_multicast ( compiler_state_t cstate,
int  offset 
)
static

Definition at line 7999 of file gencode.c.

References BPF_B, BPF_JSET, gen_load_a(), JMP, stmt::k, new_block(), OR_LINKHDR, slist::s, block::s, and block::stmts.

Referenced by gen_multicast().

◆ gen_mcmp()

◆ gen_mcode()

struct block* gen_mcode ( compiler_state_t cstate,
const char *  s1,
const char *  s2,
bpf_u_int32  masklen,
struct qual  q 
)

◆ gen_mpls()

◆ gen_mpls_linktype()

static struct block * gen_mpls_linktype ( compiler_state_t cstate,
bpf_u_int32  ll_proto 
)
static

Definition at line 4876 of file gencode.c.

References BPF_B, bpf_error(), ETHERTYPE_IP, ETHERTYPE_IPV6, gen_and(), gen_mcmp(), and OR_LINKPL.

Referenced by gen_linktype().

◆ gen_msg_abbrev()

static struct block * gen_msg_abbrev ( compiler_state_t cstate,
int  type 
)
static

◆ gen_mtp2type_abbrev()

◆ gen_mtp3field_code()

struct block* gen_mtp3field_code ( compiler_state_t cstate,
int  mtp3field,
bpf_u_int32  jvalue_arg,
int  jtype,
int  reverse 
)

◆ gen_multicast()

◆ gen_ncmp()

static struct block * gen_ncmp ( compiler_state_t cstate,
enum e_offrel  offrel,
u_int  offset,
u_int  size,
bpf_u_int32  mask,
int  jtype,
int  reverse,
bpf_u_int32  v 
)
static

◆ gen_ncode()

◆ gen_neg()

struct arth* gen_neg ( compiler_state_t cstate,
struct arth a_arg 
)

◆ gen_not()

◆ gen_or()

◆ gen_p80211_fcdir()

◆ gen_p80211_type()

◆ gen_pf_action()

struct block* gen_pf_action ( compiler_state_t cstate,
int  action 
)

Definition at line 8622 of file gencode.c.

References bpf_error(), and _compiler_state::top_ctx.

◆ gen_pf_ifname()

struct block* gen_pf_ifname ( compiler_state_t cstate,
const char *  ifname 
)

Definition at line 8552 of file gencode.c.

References bpf_error(), and _compiler_state::top_ctx.

◆ gen_pf_reason()

struct block* gen_pf_reason ( compiler_state_t cstate,
int  reason 
)

Definition at line 8608 of file gencode.c.

References bpf_error(), and _compiler_state::top_ctx.

◆ gen_pf_rnr()

struct block* gen_pf_rnr ( compiler_state_t cstate,
int  rnr 
)

Definition at line 8580 of file gencode.c.

References bpf_error(), and _compiler_state::top_ctx.

◆ gen_pf_ruleset()

struct block* gen_pf_ruleset ( compiler_state_t cstate,
char *  ruleset 
)

Definition at line 8566 of file gencode.c.

References bpf_error(), and _compiler_state::top_ctx.

◆ gen_pf_srnr()

struct block* gen_pf_srnr ( compiler_state_t cstate,
int  srnr 
)

Definition at line 8594 of file gencode.c.

References bpf_error(), and _compiler_state::top_ctx.

◆ gen_port()

static struct block * gen_port ( compiler_state_t cstate,
u_int  port,
int  ip_proto,
int  dir 
)
static

◆ gen_port6()

static struct block * gen_port6 ( compiler_state_t cstate,
u_int  port,
int  ip_proto,
int  dir 
)
static

◆ gen_portatom()

static struct block * gen_portatom ( compiler_state_t cstate,
int  off,
bpf_u_int32  v 
)
static

Definition at line 5583 of file gencode.c.

References BPF_H, gen_cmp(), and OR_TRAN_IPV4.

Referenced by gen_portop().

◆ gen_portatom6()

static struct block * gen_portatom6 ( compiler_state_t cstate,
int  off,
bpf_u_int32  v 
)
static

Definition at line 5589 of file gencode.c.

References BPF_H, gen_cmp(), and OR_TRAN_IPV6.

Referenced by gen_portop6().

◆ gen_portop()

static struct block * gen_portop ( compiler_state_t cstate,
u_int  port,
u_int  proto,
int  dir 
)
static

◆ gen_portop6()

struct block * gen_portop6 ( compiler_state_t cstate,
u_int  port,
u_int  proto,
int  dir 
)

Definition at line 5706 of file gencode.c.

References BPF_B, gen_and(), gen_cmp(), gen_or(), gen_portatom6(), OR_LINKPL, port, Q_AND, Q_DEFAULT, Q_DST, Q_OR, and Q_SRC.

Referenced by gen_port6().

◆ gen_portrange()

static struct block * gen_portrange ( compiler_state_t cstate,
u_int  port1,
u_int  port2,
int  ip_proto,
int  dir 
)
static

Definition at line 5867 of file gencode.c.

References ETHERTYPE_IP, gen_and(), gen_linktype(), gen_or(), gen_portrangeop(), IPPROTO_SCTP, and PROTO_UNDEF.

Referenced by gen_ncode(), and gen_scode().

◆ gen_portrange6()

static struct block * gen_portrange6 ( compiler_state_t cstate,
u_int  port1,
u_int  port2,
int  ip_proto,
int  dir 
)
static

Definition at line 5964 of file gencode.c.

References ETHERTYPE_IPV6, gen_and(), gen_linktype(), gen_or(), gen_portrangeop6(), IPPROTO_SCTP, and PROTO_UNDEF.

Referenced by gen_ncode(), and gen_scode().

◆ gen_portrangeatom()

static struct block * gen_portrangeatom ( compiler_state_t cstate,
u_int  off,
bpf_u_int32  v1,
bpf_u_int32  v2 
)
static

Definition at line 5776 of file gencode.c.

References BPF_H, gen_and(), gen_cmp_ge(), gen_cmp_le(), and OR_TRAN_IPV4.

Referenced by gen_portrangeop().

◆ gen_portrangeatom6()

static struct block * gen_portrangeatom6 ( compiler_state_t cstate,
u_int  off,
bpf_u_int32  v1,
bpf_u_int32  v2 
)
static

Definition at line 5899 of file gencode.c.

References BPF_H, gen_and(), gen_cmp_ge(), gen_cmp_le(), and OR_TRAN_IPV6.

Referenced by gen_portrangeop6().

◆ gen_portrangeop()

static struct block * gen_portrangeop ( compiler_state_t cstate,
u_int  port1,
u_int  port2,
bpf_u_int32  proto,
int  dir 
)
static

◆ gen_portrangeop6()

static struct block * gen_portrangeop6 ( compiler_state_t cstate,
u_int  port1,
u_int  port2,
bpf_u_int32  proto,
int  dir 
)
static

Definition at line 5924 of file gencode.c.

References BPF_B, gen_and(), gen_cmp(), gen_or(), gen_portrangeatom6(), OR_LINKPL, Q_AND, Q_DEFAULT, Q_DST, Q_OR, and Q_SRC.

Referenced by gen_portrange6().

◆ gen_ppi_dlt_check()

static struct block * gen_ppi_dlt_check ( compiler_state_t cstate)
static

◆ gen_pppoed()

struct block* gen_pppoed ( compiler_state_t cstate)

Definition at line 9156 of file gencode.c.

References ETHERTYPE_PPPOED, gen_linktype(), and _compiler_state::top_ctx.

◆ gen_pppoes()

◆ gen_prevlinkhdr_check()

◆ gen_proto()

◆ gen_proto_abbrev()

struct block* gen_proto_abbrev ( compiler_state_t cstate,
int  proto 
)

Definition at line 5545 of file gencode.c.

References gen_proto_abbrev_internal(), and _compiler_state::top_ctx.

◆ gen_proto_abbrev_internal()

◆ gen_protochain()

◆ gen_relation()

struct block* gen_relation ( compiler_state_t cstate,
int  code,
struct arth a0,
struct arth a1,
int  reversed 
)

Definition at line 7625 of file gencode.c.

References gen_relation_internal(), and _compiler_state::top_ctx.

◆ gen_relation_internal()

static struct block* gen_relation_internal ( compiler_state_t cstate,
int  code,
struct arth a0,
struct arth a1,
int  reversed 
)
static

◆ gen_retblk()

static struct block * gen_retblk ( compiler_state_t cstate,
int  v 
)
static

Definition at line 709 of file gencode.c.

References BPF_K, BPF_RET, stmt::k, new_block(), and block::s.

Referenced by finish_parse(), and pcap_compile().

◆ gen_scode()

◆ gen_snap()

static struct block * gen_snap ( compiler_state_t cstate,
bpf_u_int32  orgcode,
bpf_u_int32  ptype 
)
static

Definition at line 3647 of file gencode.c.

References gen_bcmp(), LLCSAP_SNAP, and OR_LLC.

Referenced by gen_ether_linktype(), gen_linux_sll_linktype(), and gen_llc_linktype().

◆ gen_thostop()

static struct block * gen_thostop ( compiler_state_t cstate,
const u_char *  eaddr,
int  dir 
)
static

◆ gen_true()

static struct block * gen_true ( compiler_state_t cstate)
inlinestatic

Definition at line 1939 of file gencode.c.

References gen_uncond().

Referenced by gen_geneve(), gen_linktype(), and gen_llc_internal().

◆ gen_uncond()

static struct block * gen_uncond ( compiler_state_t cstate,
int  rsense 
)
static

Definition at line 1925 of file gencode.c.

References BPF_IMM, BPF_JEQ, BPF_LD, JMP, stmt::k, new_block(), new_stmt(), slist::s, and block::stmts.

Referenced by gen_false(), and gen_true().

◆ gen_vlan()

◆ gen_vlan_no_bpf_extensions()

static struct block* gen_vlan_no_bpf_extensions ( compiler_state_t cstate,
bpf_u_int32  vlan_num,
int  has_vlan_tag 
)
static

◆ gen_vlan_tpid_test()

static struct block* gen_vlan_tpid_test ( compiler_state_t cstate)
static

◆ gen_vlan_vid_test()

static struct block* gen_vlan_vid_test ( compiler_state_t cstate,
bpf_u_int32  vlan_num 
)
static

Definition at line 8803 of file gencode.c.

References bpf_error(), BPF_H, gen_mcmp(), and OR_LINKPL.

Referenced by gen_vlan_no_bpf_extensions().

◆ gen_wlanhostop()

◆ init_linktype()

static int init_linktype ( compiler_state_t cstate,
pcap_t p 
)
static

Definition at line 1142 of file gencode.c.

References bpf_set_error(), bpf_abs_offset::constant_part, DLT_APPLE_IP_OVER_IEEE1394, DLT_ARCNET, DLT_ARCNET_LINUX, DLT_ATM_CLIP, DLT_ATM_RFC1483, DLT_AX25_KISS, DLT_BACNET_MS_TP, DLT_C_HDLC, DLT_EN10MB, DLT_ENC, DLT_ERF, DLT_FDDI, DLT_FRELAY, DLT_IEEE802, DLT_IEEE802_11, DLT_IEEE802_11_RADIO, DLT_IEEE802_11_RADIO_AVS, DLT_IP_OVER_FC, DLT_IPNET, DLT_IPV4, DLT_IPV6, DLT_JUNIPER_ATM1, DLT_JUNIPER_ATM2, DLT_JUNIPER_ATM_CEMIC, DLT_JUNIPER_CHDLC, DLT_JUNIPER_ES, DLT_JUNIPER_ETHER, DLT_JUNIPER_FIBRECHANNEL, DLT_JUNIPER_FRELAY, DLT_JUNIPER_GGSN, DLT_JUNIPER_ISM, DLT_JUNIPER_MFR, DLT_JUNIPER_MLFR, DLT_JUNIPER_MLPPP, DLT_JUNIPER_MONITOR, DLT_JUNIPER_PPP, DLT_JUNIPER_PPPOE, DLT_JUNIPER_PPPOE_ATM, DLT_JUNIPER_SERVICES, DLT_JUNIPER_SRX_E2E, DLT_JUNIPER_ST, DLT_JUNIPER_VP, DLT_JUNIPER_VS, DLT_LINUX_SLL, DLT_LINUX_SLL2, DLT_LOOP, DLT_LTALK, DLT_MATCHING_MAX, DLT_MATCHING_MIN, DLT_MFR, DLT_MTP2, DLT_MTP2_WITH_PHDR, DLT_NETANALYZER, DLT_NETANALYZER_TRANSPARENT, DLT_NULL, DLT_PFLOG, DLT_PFSYNC, DLT_PPI, DLT_PPP, DLT_PPP_BSDOS, DLT_PPP_ETHER, DLT_PPP_PPPD, DLT_PPP_SERIAL, DLT_PRISM_HEADER, DLT_RAW, DLT_SLIP, DLT_SLIP_BSDOS, DLT_SUNATM, DLT_SYMANTEC_FIREWALL, pcap::fddipad, _compiler_state::is_atm, _compiler_state::is_geneve, bpf_abs_offset::is_variable, _compiler_state::is_vlan_vloffset, _compiler_state::label_stack_depth, _compiler_state::linktype, _compiler_state::off_dpc, _compiler_state::off_li, _compiler_state::off_li_hsl, _compiler_state::off_linkhdr, _compiler_state::off_linkpl, _compiler_state::off_linktype, _compiler_state::off_nl, _compiler_state::off_nl_nosnap, _compiler_state::off_opc, _compiler_state::off_outermostlinkhdr, _compiler_state::off_payload, _compiler_state::off_prevlinkhdr, _compiler_state::off_proto, _compiler_state::off_sio, _compiler_state::off_sls, _compiler_state::off_vci, _compiler_state::off_vpi, OFFSET_NOT_SET, _compiler_state::outermostlinktype, pcap_datalink(), _compiler_state::pcap_fddipad, _compiler_state::prevlinktype, PROTO_POS, bpf_abs_offset::reg, SUNATM_PKT_BEGIN_POS, SUNATM_VCI_POS, SUNATM_VPI_POS, and _compiler_state::vlan_stack_depth.

Referenced by pcap_compile().

◆ init_regs()

static void init_regs ( compiler_state_t cstate)
static

Definition at line 7786 of file gencode.c.

References _compiler_state::curreg, and _compiler_state::regused.

Referenced by pcap_compile().

◆ initchunks()

static void initchunks ( compiler_state_t cstate)
static

Definition at line 593 of file gencode.c.

References _compiler_state::chunks, _compiler_state::cur_chunk, chunk::m, chunk::n_left, and NCHUNKS.

Referenced by pcap_compile().

◆ insert_compute_vloffsets()

◆ lookup_proto()

static int lookup_proto ( compiler_state_t cstate,
const char *  name,
int  proto 
)
static

◆ merge()

static void merge ( struct block b0,
struct block b1 
)
static

Definition at line 937 of file gencode.c.

References JF, and JT.

Referenced by gen_and(), gen_or(), and snf_findalldevs().

◆ new_block()

◆ new_stmt()

◆ newchunk()

static void * newchunk ( compiler_state_t cstate,
size_t  n 
)
static

Definition at line 645 of file gencode.c.

References newchunk_nolongjmp(), and _compiler_state::top_ctx.

Referenced by gen_loadi_internal(), gen_loadlen(), new_block(), and new_stmt().

◆ newchunk_nolongjmp()

static void * newchunk_nolongjmp ( compiler_state_t cstate,
size_t  n 
)
static

◆ pcap_compile()

◆ pcap_compile_nopcap()

int pcap_compile_nopcap ( int  snaplen_arg,
int  linktype_arg,
struct bpf_program program,
const char *  buf,
int  optimize,
bpf_u_int32  mask 
)

Definition at line 880 of file gencode.c.

References pcap_close(), pcap_compile(), and pcap_open_dead().

◆ pcap_freecode()

◆ sappend()

◆ sdup()

char* sdup ( compiler_state_t cstate,
const char *  s 
)

Definition at line 674 of file gencode.c.

References newchunk_nolongjmp(), and pcap_strlcpy().

◆ syntax()

static void syntax ( compiler_state_t cstate)
inlinestatic

Definition at line 718 of file gencode.c.

References bpf_error().

Referenced by gen_ncode(), and gen_scode().

◆ xfer_to_a()

static struct slist * xfer_to_a ( compiler_state_t cstate,
struct arth a 
)
static

Definition at line 7274 of file gencode.c.

References BPF_LD, BPF_MEM, stmt::k, new_stmt(), arth::regno, and slist::s.

Referenced by gen_arth(), gen_load_internal(), gen_neg(), and gen_relation_internal().

◆ xfer_to_x()

static struct slist * xfer_to_x ( compiler_state_t cstate,
struct arth a 
)
static

Definition at line 7264 of file gencode.c.

References BPF_LDX, BPF_MEM, stmt::k, new_stmt(), arth::regno, and slist::s.

Referenced by gen_arth(), gen_load_internal(), and gen_relation_internal().

Variable Documentation

◆ abroadcast

const u_char abroadcast[] = { 0x0 }
static

Definition at line 7924 of file gencode.c.

Referenced by gen_broadcast(), and gen_multicast().