FreeBSD kernel IPv4 code
accf_http.c File Reference
#include <sys/cdefs.h>
#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_http.c:

Go to the source code of this file.

Macros

#define ACCEPT_FILTER_MOD
 
#define DPRINT(fmt, args...)
 
#define STRSETUP(sptr, slen, str)
 
#define NCHRS   3
 

Functions

 __FBSDID ("$FreeBSD$")
 
static int sohashttpget (struct socket *so, void *arg, int waitflag)
 
static int soparsehttpvers (struct socket *so, void *arg, int waitflag)
 
static int soishttpconnected (struct socket *so, void *arg, int waitflag)
 
static int mbufstrcmp (struct mbuf *m, struct mbuf *npkt, int offset, char *cmp)
 
static int mbufstrncmp (struct mbuf *m, struct mbuf *npkt, int offset, int max, char *cmp)
 
static int sbfull (struct sockbuf *sb)
 
 ACCEPT_FILTER_DEFINE (accf_http, "httpready", sohashttpget, NULL, NULL, 1)
 
static SYSCTL_NODE (_net_inet_accf, OID_AUTO, http, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "HTTP accept filter")
 
 SYSCTL_INT (_net_inet_accf_http, OID_AUTO, parsehttpversion, CTLFLAG_RW, &parse_http_version, 1, "Parse http version so that non 1.x requests work")
 

Variables

static int parse_http_version = 1
 

Macro Definition Documentation

◆ ACCEPT_FILTER_MOD

#define ACCEPT_FILTER_MOD

Definition at line 33 of file accf_http.c.

◆ DPRINT

#define DPRINT (   fmt,
  args... 
)

Definition at line 74 of file accf_http.c.

◆ NCHRS

#define NCHRS   3

Definition at line 276 of file accf_http.c.

◆ STRSETUP

#define STRSETUP (   sptr,
  slen,
  str 
)
Value:
do { \
sptr = str; \
slen = sizeof(str) - 1; \
} while(0)

Definition at line 145 of file accf_http.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ ACCEPT_FILTER_DEFINE()

ACCEPT_FILTER_DEFINE ( accf_http  ,
"httpready"  ,
sohashttpget  ,
NULL  ,
NULL  ,
 
)

◆ mbufstrcmp()

static int mbufstrcmp ( struct mbuf *  m,
struct mbuf *  npkt,
int  offset,
char *  cmp 
)
static

Definition at line 93 of file accf_http.c.

Referenced by sohashttpget(), and soparsehttpvers().

Here is the caller graph for this function:

◆ mbufstrncmp()

static int mbufstrncmp ( struct mbuf *  m,
struct mbuf *  npkt,
int  offset,
int  max,
char *  cmp 
)
static

Definition at line 122 of file accf_http.c.

Referenced by sohashttpget(), and soparsehttpvers().

Here is the caller graph for this function:

◆ sbfull()

static int sbfull ( struct sockbuf *  sb)
static

Definition at line 78 of file accf_http.c.

References DPRINT.

Referenced by sohashttpget(), soishttpconnected(), and soparsehttpvers().

Here is the caller graph for this function:

◆ sohashttpget()

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

Definition at line 152 of file accf_http.c.

References DPRINT, mbufstrcmp(), mbufstrncmp(), parse_http_version, sbfull(), soishttpconnected(), soparsehttpvers(), and STRSETUP.

Here is the call graph for this function:

◆ soishttpconnected()

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

Definition at line 279 of file accf_http.c.

References DPRINT, NCHRS, sbfull(), and soishttpconnected().

Referenced by sohashttpget(), soishttpconnected(), and soparsehttpvers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ soparsehttpvers()

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

Definition at line 200 of file accf_http.c.

References DPRINT, mbufstrcmp(), mbufstrncmp(), sbfull(), soishttpconnected(), and soparsehttpvers().

Referenced by sohashttpget(), and soparsehttpvers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SYSCTL_INT()

SYSCTL_INT ( _net_inet_accf_http  ,
OID_AUTO  ,
parsehttpversion  ,
CTLFLAG_RW  ,
parse_http_version,
,
"Parse http version so that non 1.x requests work"   
)

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _net_inet_accf  ,
OID_AUTO  ,
http  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"HTTP accept filter"   
)
static

Variable Documentation

◆ parse_http_version

int parse_http_version = 1
static

Definition at line 59 of file accf_http.c.

Referenced by sohashttpget().