version 1.305, 2013/06/08 13:50:22 |
version 1.308, 2013/06/29 21:06:58 |
Line 96 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 96 __KERNEL_RCSID(0, "$NetBSD$"); |
|
#include "opt_inet.h" |
#include "opt_inet.h" |
#include "opt_compat_netbsd.h" |
#include "opt_compat_netbsd.h" |
#include "opt_gateway.h" |
#include "opt_gateway.h" |
#include "opt_pfil_hooks.h" |
|
#include "opt_ipsec.h" |
#include "opt_ipsec.h" |
#include "opt_mrouting.h" |
#include "opt_mrouting.h" |
#include "opt_mbuftrace.h" |
#include "opt_mbuftrace.h" |
|
|
|
|
percpu_t *ipstat_percpu; |
percpu_t *ipstat_percpu; |
|
|
#ifdef PFIL_HOOKS |
pfil_head_t *inet_pfil_hook; |
struct pfil_head inet_pfil_hook; |
|
#endif |
|
|
|
struct pool inmulti_pool; |
struct pool inmulti_pool; |
|
|
|
|
ipflow_init(ip_hashsize); |
ipflow_init(ip_hashsize); |
#endif |
#endif |
|
|
#ifdef PFIL_HOOKS |
|
/* Register our Packet Filter hook. */ |
/* Register our Packet Filter hook. */ |
inet_pfil_hook.ph_type = PFIL_TYPE_AF; |
inet_pfil_hook = pfil_head_create(PFIL_TYPE_AF, (void *)AF_INET); |
inet_pfil_hook.ph_af = AF_INET; |
KASSERT(inet_pfil_hook != NULL); |
i = pfil_head_register(&inet_pfil_hook); |
|
if (i != 0) |
|
printf("ip_init: WARNING: unable to register pfil hook, " |
|
"error %d\n", i); |
|
#endif /* PFIL_HOOKS */ |
|
|
|
#ifdef MBUFTRACE |
#ifdef MBUFTRACE |
MOWNER_ATTACH(&ip_tx_mowner); |
MOWNER_ATTACH(&ip_tx_mowner); |
Line 531 ip_input(struct mbuf *m) |
|
Line 522 ip_input(struct mbuf *m) |
|
*/ |
*/ |
m->m_flags |= M_CANFASTFWD; |
m->m_flags |= M_CANFASTFWD; |
|
|
#ifdef PFIL_HOOKS |
|
/* |
/* |
* Run through list of hooks for input packets. If there are any |
* Run through list of hooks for input packets. If there are any |
* filters which require that additional packets in the flow are |
* filters which require that additional packets in the flow are |
Line 552 ip_input(struct mbuf *m) |
|
Line 542 ip_input(struct mbuf *m) |
|
struct in_addr odst; |
struct in_addr odst; |
|
|
odst = ip->ip_dst; |
odst = ip->ip_dst; |
if (pfil_run_hooks(&inet_pfil_hook, &m, m->m_pkthdr.rcvif, |
if (pfil_run_hooks(inet_pfil_hook, &m, m->m_pkthdr.rcvif, |
PFIL_IN) != 0) |
PFIL_IN) != 0) |
return; |
return; |
if (m == NULL) |
if (m == NULL) |
Line 575 ip_input(struct mbuf *m) |
|
Line 565 ip_input(struct mbuf *m) |
|
*/ |
*/ |
srcrt = (odst.s_addr != ip->ip_dst.s_addr); |
srcrt = (odst.s_addr != ip->ip_dst.s_addr); |
} |
} |
#endif /* PFIL_HOOKS */ |
|
|
|
#ifdef ALTQ |
#ifdef ALTQ |
/* XXX Temporary until ALTQ is changed to use a pfil hook */ |
/* XXX Temporary until ALTQ is changed to use a pfil hook */ |
Line 1405 ip_savecontrol(struct inpcb *inp, struct |
|
Line 1394 ip_savecontrol(struct inpcb *inp, struct |
|
if (*mp) |
if (*mp) |
mp = &(*mp)->m_next; |
mp = &(*mp)->m_next; |
} |
} |
|
if (inp->inp_flags & INP_RECVPKTINFO) { |
|
struct in_pktinfo ipi; |
|
ipi.ipi_addr = ip->ip_src; |
|
ipi.ipi_ifindex = m->m_pkthdr.rcvif->if_index; |
|
*mp = sbcreatecontrol((void *) &ipi, |
|
sizeof(ipi), IP_RECVPKTINFO, IPPROTO_IP); |
|
if (*mp) |
|
mp = &(*mp)->m_next; |
|
} |
|
if (inp->inp_flags & INP_PKTINFO) { |
|
struct in_pktinfo ipi; |
|
ipi.ipi_addr = ip->ip_dst; |
|
ipi.ipi_ifindex = m->m_pkthdr.rcvif->if_index; |
|
*mp = sbcreatecontrol((void *) &ipi, |
|
sizeof(ipi), IP_PKTINFO, IPPROTO_IP); |
|
if (*mp) |
|
mp = &(*mp)->m_next; |
|
} |
#ifdef notyet |
#ifdef notyet |
/* |
/* |
* XXX |
* XXX |