Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/raw_ip.c
Show First 20 Lines • Show All 563 Lines • ▼ Show 20 Lines | |||||
rip_ctloutput(struct socket *so, struct sockopt *sopt) | rip_ctloutput(struct socket *so, struct sockopt *sopt) | ||||
{ | { | ||||
struct inpcb *inp = sotoinpcb(so); | struct inpcb *inp = sotoinpcb(so); | ||||
int error, optval; | int error, optval; | ||||
if (sopt->sopt_level != IPPROTO_IP) { | if (sopt->sopt_level != IPPROTO_IP) { | ||||
if ((sopt->sopt_level == SOL_SOCKET) && | if ((sopt->sopt_level == SOL_SOCKET) && | ||||
(sopt->sopt_name == SO_SETFIB)) { | (sopt->sopt_name == SO_SETFIB)) { | ||||
INP_WLOCK(inp); | |||||
inp->inp_inc.inc_fibnum = so->so_fibnum; | inp->inp_inc.inc_fibnum = so->so_fibnum; | ||||
INP_WUNLOCK(inp); | |||||
return (0); | return (0); | ||||
} | } | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
error = 0; | error = 0; | ||||
switch (sopt->sopt_dir) { | switch (sopt->sopt_dir) { | ||||
case SOPT_GET: | case SOPT_GET: | ||||
switch (sopt->sopt_name) { | switch (sopt->sopt_name) { | ||||
case IP_HDRINCL: | case IP_HDRINCL: | ||||
INP_WLOCK(inp); | |||||
optval = inp->inp_flags & INP_HDRINCL; | optval = inp->inp_flags & INP_HDRINCL; | ||||
INP_WUNLOCK(inp); | |||||
error = sooptcopyout(sopt, &optval, sizeof optval); | error = sooptcopyout(sopt, &optval, sizeof optval); | ||||
break; | break; | ||||
case IP_FW3: /* generic ipfw v.3 functions */ | case IP_FW3: /* generic ipfw v.3 functions */ | ||||
case IP_FW_ADD: /* ADD actually returns the body... */ | case IP_FW_ADD: /* ADD actually returns the body... */ | ||||
case IP_FW_GET: | case IP_FW_GET: | ||||
case IP_FW_TABLE_GETSIZE: | case IP_FW_TABLE_GETSIZE: | ||||
case IP_FW_TABLE_LIST: | case IP_FW_TABLE_LIST: | ||||
Show All 40 Lines | rip_ctloutput(struct socket *so, struct sockopt *sopt) | ||||
case SOPT_SET: | case SOPT_SET: | ||||
switch (sopt->sopt_name) { | switch (sopt->sopt_name) { | ||||
case IP_HDRINCL: | case IP_HDRINCL: | ||||
error = sooptcopyin(sopt, &optval, sizeof optval, | error = sooptcopyin(sopt, &optval, sizeof optval, | ||||
sizeof optval); | sizeof optval); | ||||
if (error) | if (error) | ||||
break; | break; | ||||
INP_WLOCK(inp); | |||||
if (optval) | if (optval) | ||||
inp->inp_flags |= INP_HDRINCL; | inp->inp_flags |= INP_HDRINCL; | ||||
else | else | ||||
inp->inp_flags &= ~INP_HDRINCL; | inp->inp_flags &= ~INP_HDRINCL; | ||||
INP_WUNLOCK(inp); | |||||
break; | break; | ||||
case IP_FW3: /* generic ipfw v.3 functions */ | case IP_FW3: /* generic ipfw v.3 functions */ | ||||
case IP_FW_ADD: | case IP_FW_ADD: | ||||
case IP_FW_DEL: | case IP_FW_DEL: | ||||
case IP_FW_FLUSH: | case IP_FW_FLUSH: | ||||
case IP_FW_ZERO: | case IP_FW_ZERO: | ||||
case IP_FW_RESETLOG: | case IP_FW_RESETLOG: | ||||
▲ Show 20 Lines • Show All 482 Lines • Show Last 20 Lines |