diff options
author | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2015-12-09 11:14:27 +0000 |
---|---|---|
committer | Alexander V. Chernikov <melifaro@FreeBSD.org> | 2015-12-09 11:14:27 +0000 |
commit | 9977be4a64ac795fda658d9806415f2a02b11cbb (patch) | |
tree | b51cf84b1ab953667c973fb841c08dd96b18b2c2 /sys/netinet/ip_options.c | |
parent | 907809bec0b0099f45bda6dfabdd0c0a197ec528 (diff) | |
download | src-test2-9977be4a64ac795fda658d9806415f2a02b11cbb.tar.gz src-test2-9977be4a64ac795fda658d9806415f2a02b11cbb.zip |
Notes
Diffstat (limited to 'sys/netinet/ip_options.c')
-rw-r--r-- | sys/netinet/ip_options.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/netinet/ip_options.c b/sys/netinet/ip_options.c index 6db9c91c278e..5daf653baa8a 100644 --- a/sys/netinet/ip_options.c +++ b/sys/netinet/ip_options.c @@ -290,15 +290,19 @@ dropit: * destination, use the incoming interface (should be * same). */ - if ((ia = (INA)ifa_ifwithaddr((SA)&ipaddr)) == NULL && - (ia = ip_rtaddr(ipaddr.sin_addr, M_GETFIB(m))) == NULL) { + if ((ia = (INA)ifa_ifwithaddr((SA)&ipaddr)) != NULL) { + memcpy(cp + off, &(IA_SIN(ia)->sin_addr), + sizeof(struct in_addr)); + ifa_free(&ia->ia_ifa); + } else if (fib4_lookup_nh_ext(M_GETFIB(m), + ipaddr.sin_addr, 0, 0, &nh_ext) == 0) { + memcpy(cp + off, &nh_ext.nh_src, + sizeof(struct in_addr)); + } else { type = ICMP_UNREACH; code = ICMP_UNREACH_HOST; goto bad; } - (void)memcpy(cp + off, &(IA_SIN(ia)->sin_addr), - sizeof(struct in_addr)); - ifa_free(&ia->ia_ifa); cp[IPOPT_OFFSET] += sizeof(struct in_addr); break; |