| version 1.74, 1998/11/13 03:24:22 |
version 1.74.2.1, 1998/12/11 04:53:08 |
|
|
| /* |
/* |
| * 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. |
| */ |
*/ |
| |
s = splimp(); |
| INADDR_TO_IA(ip->ip_dst, ia); |
INADDR_TO_IA(ip->ip_dst, ia); |
| if (ia != NULL) goto ours; |
if (ia != NULL) { |
| |
ifa_delref(&ia->ia_ifa); |
| |
splx(s); |
| |
goto ours; |
| |
} |
| if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) { |
if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) { |
| for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first; |
for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first; |
| ifa != NULL; ifa = ifa->ifa_list.tqe_next) { |
ifa != NULL; ifa = ifa->ifa_list.tqe_next) { |
| if (ifa->ifa_addr->sa_family != AF_INET) continue; |
if (ifa->ifa_addr->sa_family != AF_INET) continue; |
| ia = ifatoia(ifa); |
ia = ifatoia(ifa); |
| |
/* |
| |
* Don't ifa_addref ia as we don't use it after |
| |
* we splx(s) below |
| |
*/ |
| 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) || |
| /* |
/* |
|
|
| * either for subnet or net. |
* either for subnet or net. |
| */ |
*/ |
| 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) { |
| |
splx(s); |
| goto ours; |
goto ours; |
| |
} |
| /* |
/* |
| * An interface with IP address zero accepts |
* An interface with IP address zero accepts |
| * all packets that arrive on that interface. |
* all packets that arrive on that interface. |
| */ |
*/ |
| if (in_nullhost(ia->ia_addr.sin_addr)) |
if (in_nullhost(ia->ia_addr.sin_addr)) { |
| |
splx(s); |
| goto ours; |
goto ours; |
| |
} |
| } |
} |
| } |
} |
| |
splx(s); |
| if (IN_MULTICAST(ip->ip_dst.s_addr)) { |
if (IN_MULTICAST(ip->ip_dst.s_addr)) { |
| struct in_multi *inm; |
struct in_multi *inm; |
| #ifdef MROUTING |
#ifdef MROUTING |
|
|
| * End of source route. Should be for us. |
* End of source route. Should be for us. |
| */ |
*/ |
| save_rte(cp, ip->ip_src); |
save_rte(cp, ip->ip_src); |
| |
ifa_delref(&ia->ia_ifa); |
| break; |
break; |
| } |
} |
| /* |
/* |
|
|
| */ |
*/ |
| bcopy((caddr_t)(cp + off), (caddr_t)&ipaddr.sin_addr, |
bcopy((caddr_t)(cp + off), (caddr_t)&ipaddr.sin_addr, |
| sizeof(ipaddr.sin_addr)); |
sizeof(ipaddr.sin_addr)); |
| |
ifa_delref(&ia->ia_ifa); |
| if (opt == IPOPT_SSRR) { |
if (opt == IPOPT_SSRR) { |
| #define INA struct in_ifaddr * |
#define INA struct in_ifaddr * |
| #define SA struct sockaddr * |
#define SA struct sockaddr * |
|
|
| * Let ip_intr's mcast routing check handle mcast pkts |
* Let ip_intr's mcast routing check handle mcast pkts |
| */ |
*/ |
| forward = !IN_MULTICAST(ip->ip_dst.s_addr); |
forward = !IN_MULTICAST(ip->ip_dst.s_addr); |
| |
ifa_delref(&ia->ia_ifa); |
| break; |
break; |
| |
|
| case IPOPT_RR: |
case IPOPT_RR: |
|
|
| bcopy((caddr_t)&ia->ia_addr.sin_addr, |
bcopy((caddr_t)&ia->ia_addr.sin_addr, |
| (caddr_t)(cp + off), sizeof(struct in_addr)); |
(caddr_t)(cp + off), sizeof(struct in_addr)); |
| cp[IPOPT_OFFSET] += sizeof(struct in_addr); |
cp[IPOPT_OFFSET] += sizeof(struct in_addr); |
| |
ifa_delref(&ia->ia_ifa); |
| break; |
break; |
| |
|
| case IPOPT_TS: |
case IPOPT_TS: |
|
|
| continue; |
continue; |
| bcopy((caddr_t)&ia->ia_addr.sin_addr, |
bcopy((caddr_t)&ia->ia_addr.sin_addr, |
| (caddr_t)sin, sizeof(struct in_addr)); |
(caddr_t)sin, sizeof(struct in_addr)); |
| |
ifa_delref(&ia->ia_ifa); |
| ipt->ipt_ptr += sizeof(struct in_addr); |
ipt->ipt_ptr += sizeof(struct in_addr); |
| break; |
break; |
| |
|
|
|
| goto bad; |
goto bad; |
| bcopy((caddr_t)sin, (caddr_t)&ipaddr.sin_addr, |
bcopy((caddr_t)sin, (caddr_t)&ipaddr.sin_addr, |
| sizeof(struct in_addr)); |
sizeof(struct in_addr)); |
| if (ifa_ifwithaddr((SA)&ipaddr) == 0) |
ia = (INA)ifa_ifwithaddr((SA)&ipaddr); |
| |
if (ia == 0) |
| continue; |
continue; |
| |
ifa_delref(&ia->ia_ifa); |
| ipt->ipt_ptr += sizeof(struct in_addr); |
ipt->ipt_ptr += sizeof(struct in_addr); |
| break; |
break; |
| |
|
|
|
| struct in_addr dst; |
struct in_addr dst; |
| { |
{ |
| register struct sockaddr_in *sin; |
register struct sockaddr_in *sin; |
| |
struct in_ifaddr *ia; |
| |
int s; |
| |
|
| sin = satosin(&ipforward_rt.ro_dst); |
sin = satosin(&ipforward_rt.ro_dst); |
| |
|
|
|
| } |
} |
| if (ipforward_rt.ro_rt == 0) |
if (ipforward_rt.ro_rt == 0) |
| return ((struct in_ifaddr *)0); |
return ((struct in_ifaddr *)0); |
| return (ifatoia(ipforward_rt.ro_rt->rt_ifa)); |
s = splimp(); |
| |
ia = (ifatoia(ipforward_rt.ro_rt->rt_ifa)); |
| |
ifa_addref(&ia->ia_ifa); |
| |
splx(s); |
| |
return ia; |
| } |
} |
| |
|
| /* |
/* |