FreeBSD kernel IPv4 code
accf_dns.c File Reference
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/mbuf.h>
#include <sys/module.h>
#include <sys/signalvar.h>
#include <sys/sysctl.h>
#include <sys/socketvar.h>
Include dependency graph for accf_dns.c:

Go to the source code of this file.

Data Structures

struct  packet
 

Macros

#define ACCEPT_FILTER_MOD
 
#define DNS_OK   0
 
#define DNS_WAIT   -1
 
#define DNS_RUN   -2
 
#define GET8(p, val)
 
#define GET16(p, val)
 

Functions

static int sohasdns (struct socket *so, void *arg, int waitflag)
 
 ACCEPT_FILTER_DEFINE (accf_dns, "dnsready", sohasdns, NULL, NULL, 1)
 
static int skippacket (struct sockbuf *sb)
 

Macro Definition Documentation

◆ ACCEPT_FILTER_MOD

#define ACCEPT_FILTER_MOD

Definition at line 31 of file accf_dns.c.

◆ DNS_OK

#define DNS_OK   0

Definition at line 54 of file accf_dns.c.

◆ DNS_RUN

#define DNS_RUN   -2

Definition at line 56 of file accf_dns.c.

◆ DNS_WAIT

#define DNS_WAIT   -1

Definition at line 55 of file accf_dns.c.

◆ GET16

#define GET16 (   p,
  val 
)
Value:
do { \
unsigned int v0, v1; \
GET8(p, v0); \
GET8(p, v1); \
val = v0 * 0x100 + v1; \
} while (0)

Definition at line 95 of file accf_dns.c.

◆ GET8

#define GET8 (   p,
  val 
)
Value:
do { \
if (p->offset < p->moff) \
return DNS_RUN; \
while (p->offset >= p->moff + p->m->m_len) { \
p->moff += p->m->m_len; \
p->m = p->m->m_next; \
if (p->m == NULL) { \
p->m = p->n; \
p->n = p->m->m_nextpkt; \
} \
if (p->m == NULL) \
return DNS_WAIT; \
} \
val = *(mtod(p->m, unsigned char *) + (p->offset - p->moff)); \
p->offset++; \
} while (0)
#define DNS_WAIT
Definition: accf_dns.c:55
#define DNS_RUN
Definition: accf_dns.c:56

Definition at line 78 of file accf_dns.c.

Function Documentation

◆ ACCEPT_FILTER_DEFINE()

ACCEPT_FILTER_DEFINE ( accf_dns  ,
"dnsready"  ,
sohasdns  ,
NULL  ,
NULL  ,
 
)

◆ skippacket()

static int skippacket ( struct sockbuf *  sb)
static

Definition at line 103 of file accf_dns.c.

References DNS_OK, DNS_WAIT, GET16, packet::len, packet::m, packet::moff, packet::n, and packet::offset.

Referenced by sohasdns().

Here is the caller graph for this function:

◆ sohasdns()

static int sohasdns ( struct socket *  so,
void *  arg,
int  waitflag 
)
static

Definition at line 62 of file accf_dns.c.

References DNS_WAIT, and skippacket().

Here is the call graph for this function: