version 1.27, 1996/01/16 04:17:37 |
version 1.30, 1996/03/16 23:53:58 |
|
|
#include <sys/errno.h> |
#include <sys/errno.h> |
#include <sys/time.h> |
#include <sys/time.h> |
#include <sys/kernel.h> |
#include <sys/kernel.h> |
|
#include <sys/proc.h> |
|
|
|
#include <vm/vm.h> |
|
#include <sys/sysctl.h> |
|
|
#include <net/if.h> |
#include <net/if.h> |
#include <net/route.h> |
#include <net/route.h> |
|
|
} |
} |
ip = mtod(m, struct ip *); |
ip = mtod(m, struct ip *); |
} |
} |
if (ip->ip_sum = in_cksum(m, hlen)) { |
if ((ip->ip_sum = in_cksum(m, hlen)) != 0) { |
ipstat.ips_badsum++; |
ipstat.ips_badsum++; |
goto bad; |
goto bad; |
} |
} |
|
|
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 * |
if ((ia = (INA)ifa_ifwithdstaddr((SA)&ipaddr)) == 0) |
ia = (INA)ifa_ifwithladdr((SA)&ipaddr); |
ia = (INA)ifa_ifwithnet((SA)&ipaddr); |
|
} else |
} else |
ia = ip_rtaddr(ipaddr.sin_addr); |
ia = ip_rtaddr(ipaddr.sin_addr); |
if (ia == 0) { |
if (ia == 0) { |
|
|
*(mtod(m, struct in_addr *)) = *p--; |
*(mtod(m, struct in_addr *)) = *p--; |
#ifdef DIAGNOSTIC |
#ifdef DIAGNOSTIC |
if (ipprintfs) |
if (ipprintfs) |
printf(" hops %lx", ntohl(mtod(m, struct in_addr *)->s_addr)); |
printf(" hops %x", ntohl(mtod(m, struct in_addr *)->s_addr)); |
#endif |
#endif |
|
|
/* |
/* |
|
|
while (p >= ip_srcrt.route) { |
while (p >= ip_srcrt.route) { |
#ifdef DIAGNOSTIC |
#ifdef DIAGNOSTIC |
if (ipprintfs) |
if (ipprintfs) |
printf(" %lx", ntohl(q->s_addr)); |
printf(" %x", ntohl(q->s_addr)); |
#endif |
#endif |
*q++ = *p--; |
*q++ = *p--; |
} |
} |
|
|
*q = ip_srcrt.dst; |
*q = ip_srcrt.dst; |
#ifdef DIAGNOSTIC |
#ifdef DIAGNOSTIC |
if (ipprintfs) |
if (ipprintfs) |
printf(" %lx\n", ntohl(q->s_addr)); |
printf(" %x\n", ntohl(q->s_addr)); |
#endif |
#endif |
return (m); |
return (m); |
} |
} |
Line 1004 ip_forward(m, srcrt) |
|
Line 1007 ip_forward(m, srcrt) |
|
register struct ip *ip = mtod(m, struct ip *); |
register struct ip *ip = mtod(m, struct ip *); |
register struct sockaddr_in *sin; |
register struct sockaddr_in *sin; |
register struct rtentry *rt; |
register struct rtentry *rt; |
int error, type = 0, code; |
int error, type = 0, code = 0; |
struct mbuf *mcopy; |
struct mbuf *mcopy; |
n_long dest; |
n_long dest; |
struct ifnet *destifp; |
struct ifnet *destifp; |
Line 1012 ip_forward(m, srcrt) |
|
Line 1015 ip_forward(m, srcrt) |
|
dest = 0; |
dest = 0; |
#ifdef DIAGNOSTIC |
#ifdef DIAGNOSTIC |
if (ipprintfs) |
if (ipprintfs) |
printf("forward: src %x dst %x ttl %x\n", ip->ip_src, |
printf("forward: src %x dst %x ttl %x\n", |
ip->ip_dst, ip->ip_ttl); |
ip->ip_src.s_addr, ip->ip_dst.s_addr, ip->ip_ttl); |
#endif |
#endif |
if (m->m_flags & M_BCAST || in_canforward(ip->ip_dst) == 0) { |
if (m->m_flags & M_BCAST || in_canforward(ip->ip_dst) == 0) { |
ipstat.ips_cantforward++; |
ipstat.ips_cantforward++; |
Line 1076 ip_forward(m, srcrt) |
|
Line 1079 ip_forward(m, srcrt) |
|
code = ICMP_REDIRECT_HOST; |
code = ICMP_REDIRECT_HOST; |
#ifdef DIAGNOSTIC |
#ifdef DIAGNOSTIC |
if (ipprintfs) |
if (ipprintfs) |
printf("redirect (%d) to %lx\n", code, (u_int32_t)dest); |
printf("redirect (%d) to %x\n", code, (u_int32_t)dest); |
#endif |
#endif |
} |
} |
} |
} |
Line 1139 ip_sysctl(name, namelen, oldp, oldlenp, |
|
Line 1142 ip_sysctl(name, namelen, oldp, oldlenp, |
|
void *newp; |
void *newp; |
size_t newlen; |
size_t newlen; |
{ |
{ |
int temp; |
|
|
|
/* All sysctl names at this level are terminal. */ |
/* All sysctl names at this level are terminal. */ |
if (namelen != 1) |
if (namelen != 1) |
return (ENOTDIR); |
return (ENOTDIR); |