Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/ip_icmp.c
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | SYSCTL_INT(_net_inet_icmp, OID_AUTO, drop_redirect, CTLFLAG_VNET | CTLFLAG_RW, | ||||
"Ignore ICMP redirects"); | "Ignore ICMP redirects"); | ||||
VNET_DEFINE_STATIC(int, log_redirect) = 0; | VNET_DEFINE_STATIC(int, log_redirect) = 0; | ||||
#define V_log_redirect VNET(log_redirect) | #define V_log_redirect VNET(log_redirect) | ||||
SYSCTL_INT(_net_inet_icmp, OID_AUTO, log_redirect, CTLFLAG_VNET | CTLFLAG_RW, | SYSCTL_INT(_net_inet_icmp, OID_AUTO, log_redirect, CTLFLAG_VNET | CTLFLAG_RW, | ||||
&VNET_NAME(log_redirect), 0, | &VNET_NAME(log_redirect), 0, | ||||
"Log ICMP redirects to the console"); | "Log ICMP redirects to the console"); | ||||
VNET_DEFINE_STATIC(int, redirtimeout) = 60 * 10; /* 10 minutes */ | |||||
#define V_redirtimeout VNET(redirtimeout) | |||||
SYSCTL_INT(_net_inet_icmp, OID_AUTO, redirtimeout, CTLFLAG_VNET | CTLFLAG_RW, | |||||
&VNET_NAME(redirtimeout), 0, | |||||
"Delay in seconds before expiring redirect route"); | |||||
VNET_DEFINE_STATIC(char, reply_src[IFNAMSIZ]); | VNET_DEFINE_STATIC(char, reply_src[IFNAMSIZ]); | ||||
#define V_reply_src VNET(reply_src) | #define V_reply_src VNET(reply_src) | ||||
SYSCTL_STRING(_net_inet_icmp, OID_AUTO, reply_src, CTLFLAG_VNET | CTLFLAG_RW, | SYSCTL_STRING(_net_inet_icmp, OID_AUTO, reply_src, CTLFLAG_VNET | CTLFLAG_RW, | ||||
&VNET_NAME(reply_src), IFNAMSIZ, | &VNET_NAME(reply_src), IFNAMSIZ, | ||||
"ICMP reply source for non-local packets"); | "ICMP reply source for non-local packets"); | ||||
VNET_DEFINE_STATIC(int, icmp_rfi) = 0; | VNET_DEFINE_STATIC(int, icmp_rfi) = 0; | ||||
#define V_icmp_rfi VNET(icmp_rfi) | #define V_icmp_rfi VNET(icmp_rfi) | ||||
▲ Show 20 Lines • Show All 546 Lines • ▼ Show 20 Lines | if (icmpprintfs) { | ||||
printf("redirect dst %s to %s\n", | printf("redirect dst %s to %s\n", | ||||
inet_ntoa_r(icp->icmp_ip.ip_dst, dstbuf), | inet_ntoa_r(icp->icmp_ip.ip_dst, dstbuf), | ||||
inet_ntoa_r(icp->icmp_gwaddr, gwbuf)); | inet_ntoa_r(icp->icmp_gwaddr, gwbuf)); | ||||
} | } | ||||
#endif | #endif | ||||
icmpsrc.sin_addr = icp->icmp_ip.ip_dst; | icmpsrc.sin_addr = icp->icmp_ip.ip_dst; | ||||
for ( fibnum = 0; fibnum < rt_numfibs; fibnum++) { | for ( fibnum = 0; fibnum < rt_numfibs; fibnum++) { | ||||
in_rtredirect((struct sockaddr *)&icmpsrc, | rtredirect_fib((struct sockaddr *)&icmpsrc, | ||||
(struct sockaddr *)&icmpdst, | (struct sockaddr *)&icmpdst, | ||||
(struct sockaddr *)0, RTF_GATEWAY | RTF_HOST, | RTF_GATEWAY | RTF_HOST, (struct sockaddr *)&icmpgw, | ||||
(struct sockaddr *)&icmpgw, fibnum); | V_redirtimeout, fibnum); | ||||
} | } | ||||
pfctlinput(PRC_REDIRECT_HOST, (struct sockaddr *)&icmpsrc); | pfctlinput(PRC_REDIRECT_HOST, (struct sockaddr *)&icmpsrc); | ||||
break; | break; | ||||
/* | /* | ||||
* No kernel processing for the following; | * No kernel processing for the following; | ||||
* just fall through to send to raw listener. | * just fall through to send to raw listener. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 354 Lines • Show Last 20 Lines |