Changeset View
Changeset View
Standalone View
Standalone View
sys/netpfil/pf/pf.c
Show First 20 Lines • Show All 1,587 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static bool | static bool | ||||
pf_isforlocal(struct mbuf *m, int af) | pf_isforlocal(struct mbuf *m, int af) | ||||
{ | { | ||||
switch (af) { | switch (af) { | ||||
#ifdef INET | #ifdef INET | ||||
case AF_INET: { | case AF_INET: { | ||||
struct rm_priotracker in_ifa_tracker; | struct ip *ip = mtod(m, struct ip *); | ||||
struct ip *ip; | |||||
struct in_ifaddr *ia = NULL; | |||||
ip = mtod(m, struct ip *); | return (in_localip(ip->ip_dst)); | ||||
IN_IFADDR_RLOCK(&in_ifa_tracker); | |||||
LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) { | |||||
if (IA_SIN(ia)->sin_addr.s_addr == ip->ip_dst.s_addr) { | |||||
IN_IFADDR_RUNLOCK(&in_ifa_tracker); | |||||
return (true); | |||||
} | |||||
} | |||||
IN_IFADDR_RUNLOCK(&in_ifa_tracker); | |||||
break; | |||||
} | } | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
case AF_INET6: { | case AF_INET6: { | ||||
struct ip6_hdr *ip6; | struct ip6_hdr *ip6; | ||||
struct in6_ifaddr *ia; | struct in6_ifaddr *ia; | ||||
ip6 = mtod(m, struct ip6_hdr *); | ip6 = mtod(m, struct ip6_hdr *); | ||||
ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); | ia = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */, false); | ||||
▲ Show 20 Lines • Show All 5,761 Lines • Show Last 20 Lines |