| version 1.56, 1998/01/28 02:36:10 |
version 1.57, 1998/02/13 18:21:44 |
| Line 113 extern struct protosw inetsw[]; |
|
| Line 113 extern struct protosw inetsw[]; |
|
| u_char ip_protox[IPPROTO_MAX]; |
u_char ip_protox[IPPROTO_MAX]; |
| int ipqmaxlen = IFQ_MAXLEN; |
int ipqmaxlen = IFQ_MAXLEN; |
| struct in_ifaddrhead in_ifaddr; |
struct in_ifaddrhead in_ifaddr; |
| |
struct in_ifaddrhashhead *in_ifaddrhashtbl; |
| struct ifqueue ipintrq; |
struct ifqueue ipintrq; |
| |
|
| /* |
/* |
|
|
| ip_id = time.tv_sec & 0xffff; |
ip_id = time.tv_sec & 0xffff; |
| ipintrq.ifq_maxlen = ipqmaxlen; |
ipintrq.ifq_maxlen = ipqmaxlen; |
| TAILQ_INIT(&in_ifaddr); |
TAILQ_INIT(&in_ifaddr); |
| |
in_ifaddrhashtbl = |
| |
hashinit(IN_IFADDR_HASH_SIZE, M_IFADDR, M_WAITOK, &in_ifaddrhash); |
| } |
} |
| |
|
| struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET }; |
struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET }; |
|
|
| register struct mbuf *m; |
register struct mbuf *m; |
| register struct ipq *fp; |
register struct ipq *fp; |
| register struct in_ifaddr *ia; |
register struct in_ifaddr *ia; |
| |
register struct ifaddr *ifa; |
| struct ipqent *ipqe; |
struct ipqent *ipqe; |
| int hlen = 0, mff, len, s; |
int hlen = 0, mff, len, s; |
| #ifdef PFIL_HOOKS |
#ifdef PFIL_HOOKS |
|
|
| /* |
/* |
| * Check our list of addresses, to see if the packet is for us. |
* Check our list of addresses, to see if the packet is for us. |
| */ |
*/ |
| for (ia = in_ifaddr.tqh_first; ia; ia = ia->ia_list.tqe_next) { |
INADDR_TO_IA(ip->ip_dst, ia); |
| if (in_hosteq(ip->ip_dst, ia->ia_addr.sin_addr)) |
if (ia != NULL) goto ours; |
| goto ours; |
if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) { |
| if (((ip_directedbcast == 0) || (ip_directedbcast && |
for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first; |
| ia->ia_ifp == m->m_pkthdr.rcvif)) && |
ifa != NULL; ifa = ifa->ifa_list.tqe_next) { |
| (ia->ia_ifp->if_flags & IFF_BROADCAST)) { |
if (ifa->ifa_addr->sa_family != AF_INET) continue; |
| |
ia = ifatoia(ifa); |
| if (in_hosteq(ip->ip_dst, ia->ia_broadaddr.sin_addr) || |
if (in_hosteq(ip->ip_dst, ia->ia_broadaddr.sin_addr) || |
| in_hosteq(ip->ip_dst, ia->ia_netbroadcast) || |
in_hosteq(ip->ip_dst, ia->ia_netbroadcast) || |
| /* |
/* |
|
|
| ip->ip_dst.s_addr == ia->ia_subnet || |
ip->ip_dst.s_addr == ia->ia_subnet || |
| ip->ip_dst.s_addr == ia->ia_net) |
ip->ip_dst.s_addr == ia->ia_net) |
| goto ours; |
goto ours; |
| |
/* |
| |
* An interface with IP address zero accepts |
| |
* all packets that arrive on that interface. |
| |
*/ |
| |
if (in_nullhost(ia->ia_addr.sin_addr)) |
| |
goto ours; |
| } |
} |
| /* |
|
| * An interface with IP address zero accepts |
|
| * all packets that arrive on that interface. |
|
| */ |
|
| if ((ia->ia_ifp == m->m_pkthdr.rcvif) && |
|
| in_nullhost(ia->ia_addr.sin_addr)) |
|
| goto ours; |
|
| } |
} |
| if (IN_MULTICAST(ip->ip_dst.s_addr)) { |
if (IN_MULTICAST(ip->ip_dst.s_addr)) { |
| struct in_multi *inm; |
struct in_multi *inm; |