diff options
| author | Andre Oppermann <andre@FreeBSD.org> | 2005-08-21 12:29:39 +0000 |
|---|---|---|
| committer | Andre Oppermann <andre@FreeBSD.org> | 2005-08-21 12:29:39 +0000 |
| commit | a0866c8d4e955257b45404ca7dec08c4a3148fa8 (patch) | |
| tree | 5fbd6fde492a110cfdb67a2d754b0f85559e8b8d /sys/netinet | |
| parent | fb533d55c69fb83f97686fb3733b8e53b54beb40 (diff) | |
Notes
Diffstat (limited to 'sys/netinet')
| -rw-r--r-- | sys/netinet/ip_icmp.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 6d1670f6ea8c..0cba59417385 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -110,6 +110,11 @@ static char reply_src[IFNAMSIZ]; SYSCTL_STRING(_net_inet_icmp, OID_AUTO, reply_src, CTLFLAG_RW, &reply_src, IFNAMSIZ, "icmp reply source for non-local packets."); +static int icmp_rfi = 0; +SYSCTL_INT(_net_inet_icmp, OID_AUTO, reply_from_interface, CTLFLAG_RW, + &icmp_rfi, 0, "ICMP reply from incoming interface for " + "non-local packets"); + /* * ICMP broadcast echo sysctl */ @@ -624,6 +629,20 @@ icmp_reflect(m) } } /* + * If the packet was transiting through us, use the address of + * the interface the packet came through in. If that interface + * doesn't have a suitable IP address, the normal selection + * criteria apply. + */ + if (icmp_rfi && m->m_pkthdr.rcvif != NULL) { + TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family != AF_INET) + continue; + ia = ifatoia(ifa); + goto match; + } + } + /* * If the incoming packet was not addressed directly to us, use * designated interface for icmp replies specified by sysctl * net.inet.icmp.reply_src (default not set). Otherwise continue |
