aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/ip_options.c
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2020-07-02 21:04:08 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2020-07-02 21:04:08 +0000
commit6ad7446c6f3ac5636428bc4064a48fb0b65905ae (patch)
treebca4738e23bdfd4958f3c6471b7f772535dc4d4c /sys/netinet/ip_options.c
parentf60b4812d88581ff7932e4d9d7a50ecccce0e727 (diff)
downloadsrc-6ad7446c6f3ac5636428bc4064a48fb0b65905ae.tar.gz
src-6ad7446c6f3ac5636428bc4064a48fb0b65905ae.zip
Complete conversions from fib<4|6>_lookup_nh_<basic|ext> to fib<4|6>_lookup().
fib[46]_lookup_nh_ represents pre-epoch generation of fib api, providing less guarantees over pointer validness and requiring on-stack data copying. With no callers remaining, remove fib[46]_lookup_nh_ functions. Submitted by: Neel Chauhan <neel AT neelc DOT org> Differential Revision: https://reviews.freebsd.org/D25445
Notes
Notes: svn path=/head/; revision=362900
Diffstat (limited to 'sys/netinet/ip_options.c')
-rw-r--r--sys/netinet/ip_options.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/netinet/ip_options.c b/sys/netinet/ip_options.c
index 92ce394d08ce..d49a8ba1125e 100644
--- a/sys/netinet/ip_options.c
+++ b/sys/netinet/ip_options.c
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_var.h>
#include <net/if_dl.h>
#include <net/route.h>
+#include <net/route/nhop.h>
#include <net/netisr.h>
#include <net/vnet.h>
@@ -107,7 +108,7 @@ ip_dooptions(struct mbuf *m, int pass)
int opt, optlen, cnt, off, code, type = ICMP_PARAMPROB, forward = 0;
struct in_addr *sin, dst;
uint32_t ntime;
- struct nhop4_extended nh_ext;
+ struct nhop_object *nh;
struct sockaddr_in ipaddr = { sizeof(ipaddr), AF_INET };
NET_EPOCH_ASSERT();
@@ -254,11 +255,12 @@ dropit:
sizeof(struct in_addr));
} else {
/* XXX MRT 0 for routing */
- if (fib4_lookup_nh_ext(M_GETFIB(m),
- ipaddr.sin_addr, 0, 0, &nh_ext) != 0)
+ nh = fib4_lookup(M_GETFIB(m), ipaddr.sin_addr,
+ 0, NHR_NONE, 0);
+ if (nh == NULL)
goto bad;
- memcpy(cp + off, &nh_ext.nh_src,
+ memcpy(cp + off, &(IA_SIN(nh->nh_ifa)->sin_addr),
sizeof(struct in_addr));
}
@@ -299,9 +301,9 @@ dropit:
if ((ia = (INA)ifa_ifwithaddr((SA)&ipaddr)) != NULL) {
memcpy(cp + off, &(IA_SIN(ia)->sin_addr),
sizeof(struct in_addr));
- } else if (fib4_lookup_nh_ext(M_GETFIB(m),
- ipaddr.sin_addr, 0, 0, &nh_ext) == 0) {
- memcpy(cp + off, &nh_ext.nh_src,
+ } else if ((nh = fib4_lookup(M_GETFIB(m),
+ ipaddr.sin_addr, 0, NHR_NONE, 0)) != NULL) {
+ memcpy(cp + off, &(IA_SIN(nh->nh_ifa)->sin_addr),
sizeof(struct in_addr));
} else {
type = ICMP_UNREACH;