| version 1.26, 1996/01/15 21:11:55 |
version 1.27, 1996/01/16 04:17:37 |
|
|
| #ifndef IPFORWSRCRT |
#ifndef IPFORWSRCRT |
| #define IPFORWSRCRT 1 /* allow source-routed packets */ |
#define IPFORWSRCRT 1 /* allow source-routed packets */ |
| #endif |
#endif |
| |
/* |
| |
* Note: DIRECTED_BROADCAST is handled this way so that previous |
| |
* configuration using this option will Just Work. |
| |
*/ |
| |
#ifndef IPDIRECTEDBCAST |
| |
#ifdef DIRECTED_BROADCAST |
| |
#define IPDIRECTEDBCAST 1 |
| |
#else |
| |
#define IPDIRECTEDBCAST 0 |
| |
#endif /* DIRECTED_BROADCAST */ |
| |
#endif /* IPDIRECTEDBCAST */ |
| int ipforwarding = IPFORWARDING; |
int ipforwarding = IPFORWARDING; |
| int ipsendredirects = IPSENDREDIRECTS; |
int ipsendredirects = IPSENDREDIRECTS; |
| int ip_defttl = IPDEFTTL; |
int ip_defttl = IPDEFTTL; |
| int ip_forwsrcrt = IPFORWSRCRT; |
int ip_forwsrcrt = IPFORWSRCRT; |
| |
int ip_directedbcast = IPDIRECTEDBCAST; |
| #ifdef DIAGNOSTIC |
#ifdef DIAGNOSTIC |
| int ipprintfs = 0; |
int ipprintfs = 0; |
| #endif |
#endif |
|
|
| for (ia = in_ifaddr.tqh_first; ia; ia = ia->ia_list.tqe_next) { |
for (ia = in_ifaddr.tqh_first; ia; ia = ia->ia_list.tqe_next) { |
| if (ip->ip_dst.s_addr == ia->ia_addr.sin_addr.s_addr) |
if (ip->ip_dst.s_addr == ia->ia_addr.sin_addr.s_addr) |
| goto ours; |
goto ours; |
| if ( |
if (((ip_directedbcast == 0) || (ip_directedbcast && |
| #ifdef DIRECTED_BROADCAST |
ia->ia_ifp == m->m_pkthdr.rcvif)) && |
| ia->ia_ifp == m->m_pkthdr.rcvif && |
|
| #endif |
|
| (ia->ia_ifp->if_flags & IFF_BROADCAST)) { |
(ia->ia_ifp->if_flags & IFF_BROADCAST)) { |
| if (ip->ip_dst.s_addr == ia->ia_broadaddr.sin_addr.s_addr || |
if (ip->ip_dst.s_addr == ia->ia_broadaddr.sin_addr.s_addr || |
| ip->ip_dst.s_addr == ia->ia_netbroadcast.s_addr || |
ip->ip_dst.s_addr == ia->ia_netbroadcast.s_addr || |
| Line 1071 ip_forward(m, srcrt) |
|
| Line 1081 ip_forward(m, srcrt) |
|
| } |
} |
| } |
} |
| |
|
| error = ip_output(m, (struct mbuf *)0, &ipforward_rt, IP_FORWARDING |
error = ip_output(m, (struct mbuf *)0, &ipforward_rt, |
| #ifdef DIRECTED_BROADCAST |
(IP_FORWARDING | (ip_directedbcast ? IP_ALLOWBROADCAST : 0)), 0); |
| | IP_ALLOWBROADCAST |
|
| #endif |
|
| , 0); |
|
| if (error) |
if (error) |
| ipstat.ips_cantforward++; |
ipstat.ips_cantforward++; |
| else { |
else { |
| Line 1158 ip_sysctl(name, namelen, oldp, oldlenp, |
|
| Line 1165 ip_sysctl(name, namelen, oldp, oldlenp, |
|
| return (EPERM); |
return (EPERM); |
| return (sysctl_int(oldp, oldlenp, newp, newlen, |
return (sysctl_int(oldp, oldlenp, newp, newlen, |
| &ip_forwsrcrt)); |
&ip_forwsrcrt)); |
| |
case IPCTL_DIRECTEDBCAST: |
| |
return (sysctl_int(oldp, oldlenp, newp, newlen, |
| |
&ip_directedbcast)); |
| default: |
default: |
| return (EOPNOTSUPP); |
return (EOPNOTSUPP); |
| } |
} |