| version 1.44, 1997/01/11 05:21:10 |
version 1.44.4.1, 1997/03/12 21:24:42 |
|
|
| #include <net/if.h> |
#include <net/if.h> |
| #include <net/if_dl.h> |
#include <net/if_dl.h> |
| #include <net/route.h> |
#include <net/route.h> |
| |
#include <net/pfil.h> |
| |
|
| #include <netinet/in.h> |
#include <netinet/in.h> |
| #include <netinet/in_systm.h> |
#include <netinet/in_systm.h> |
|
|
| #include <netinet/ip_var.h> |
#include <netinet/ip_var.h> |
| #include <netinet/ip_icmp.h> |
#include <netinet/ip_icmp.h> |
| |
|
| #ifdef PFIL_HOOKS |
|
| #include <net/pfil.h> |
|
| #endif /* PFIL_HOOKS */ |
|
| |
|
| /* XXX should really put this in libkern.h */ |
/* XXX should really put this in libkern.h */ |
| #define offsetof(type, member) ((size_t)(&((type *)0)->member)) |
#define offsetof(type, member) ((size_t)(&((type *)0)->member)) |
| |
|
|
|
| #define IPSENDREDIRECTS 1 |
#define IPSENDREDIRECTS 1 |
| #endif |
#endif |
| #ifndef IPFORWSRCRT |
#ifndef IPFORWSRCRT |
| #define IPFORWSRCRT 1 /* allow source-routed packets */ |
#define IPFORWSRCRT 1 /* forward source-routed packets */ |
| |
#endif |
| |
#ifndef IPALLOWSRCRT |
| |
#define IPALLOWSRCRT 1 /* allow source-routed packets */ |
| #endif |
#endif |
| /* |
/* |
| * Note: DIRECTED_BROADCAST is handled this way so that previous |
* Note: DIRECTED_BROADCAST is handled this way so that previous |
| Line 99 int ipsendredirects = IPSENDREDIRECTS; |
|
| Line 99 int ipsendredirects = IPSENDREDIRECTS; |
|
| int ip_defttl = IPDEFTTL; |
int ip_defttl = IPDEFTTL; |
| int ip_forwsrcrt = IPFORWSRCRT; |
int ip_forwsrcrt = IPFORWSRCRT; |
| int ip_directedbcast = IPDIRECTEDBCAST; |
int ip_directedbcast = IPDIRECTEDBCAST; |
| |
int ip_allowsrcrt = IPALLOWSRCRT; |
| #ifdef DIAGNOSTIC |
#ifdef DIAGNOSTIC |
| int ipprintfs = 0; |
int ipprintfs = 0; |
| #endif |
#endif |
|
|
| */ |
*/ |
| case IPOPT_LSRR: |
case IPOPT_LSRR: |
| case IPOPT_SSRR: |
case IPOPT_SSRR: |
| |
if (ip_allowsrcrt == 0) { |
| |
type = ICMP_UNREACH; |
| |
code = ICMP_UNREACH_NET_PROHIB; |
| |
goto bad; |
| |
} |
| if ((off = cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { |
if ((off = cp[IPOPT_OFFSET]) < IPOPT_MINOFF) { |
| code = &cp[IPOPT_OFFSET] - (u_char *)ip; |
code = &cp[IPOPT_OFFSET] - (u_char *)ip; |
| goto bad; |
goto bad; |
| Line 1251 ip_sysctl(name, namelen, oldp, oldlenp, |
|
| Line 1257 ip_sysctl(name, namelen, oldp, oldlenp, |
|
| return (sysctl_int(oldp, oldlenp, newp, newlen, &ip_mtu)); |
return (sysctl_int(oldp, oldlenp, newp, newlen, &ip_mtu)); |
| #endif |
#endif |
| case IPCTL_FORWSRCRT: |
case IPCTL_FORWSRCRT: |
| /* |
/* Don't allow this to change in a secure environment. */ |
| * Don't allow this to change in a secure environment. |
|
| */ |
|
| if (securelevel > 0) |
if (securelevel > 0) |
| return (EPERM); |
return (sysctl_rdint(oldp, oldlenp, newp, |
| return (sysctl_int(oldp, oldlenp, newp, newlen, |
ip_forwsrcrt)); |
| &ip_forwsrcrt)); |
else |
| |
return (sysctl_int(oldp, oldlenp, newp, newlen, |
| |
&ip_forwsrcrt)); |
| case IPCTL_DIRECTEDBCAST: |
case IPCTL_DIRECTEDBCAST: |
| return (sysctl_int(oldp, oldlenp, newp, newlen, |
return (sysctl_int(oldp, oldlenp, newp, newlen, |
| &ip_directedbcast)); |
&ip_directedbcast)); |
| |
case IPCTL_ALLOWSRCRT: |
| |
return (sysctl_int(oldp, oldlenp, newp, newlen, |
| |
&ip_allowsrcrt)); |
| default: |
default: |
| return (EOPNOTSUPP); |
return (EOPNOTSUPP); |
| } |
} |