diff options
Diffstat (limited to 'sys/netinet/in_pcb.c')
-rw-r--r-- | sys/netinet/in_pcb.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 12c0b86cf54..b937c783dbf 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.298 2024/03/22 21:48:38 bluhm Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.299 2024/03/31 15:53:12 bluhm Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -904,23 +904,15 @@ in_pcblookup_local_lock(struct inpcbtable *table, const void *laddrp, struct rtentry * in_pcbrtentry(struct inpcb *inp) { - struct route *ro; - #ifdef INET6 if (ISSET(inp->inp_flags, INP_IPV6)) return in6_pcbrtentry(inp); #endif - ro = &inp->inp_route; - if (inp->inp_faddr.s_addr == INADDR_ANY) return (NULL); - if (route_cache(ro, &inp->inp_faddr, &inp->inp_laddr, - inp->inp_rtableid)) { - ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa, - &inp->inp_laddr.s_addr, ro->ro_tableid); - } - return (ro->ro_rt); + return (route_mpath(&inp->inp_route, &inp->inp_faddr, &inp->inp_laddr, + inp->inp_rtableid)); } /* @@ -934,7 +926,7 @@ in_pcbselsrc(struct in_addr *insrc, struct sockaddr_in *sin, struct inpcb *inp) { struct ip_moptions *mopts = inp->inp_moptions; - struct route *ro = &inp->inp_route; + struct rtentry *rt; const struct in_addr *laddr = &inp->inp_laddr; u_int rtableid = inp->inp_rtableid; struct sockaddr *ip4_source = NULL; @@ -979,17 +971,14 @@ in_pcbselsrc(struct in_addr *insrc, struct sockaddr_in *sin, * If route is known or can be allocated now, * our src addr is taken from the i/f, else punt. */ - if (route_cache(ro, &sin->sin_addr, NULL, rtableid)) { - /* No route yet, so try to acquire one */ - ro->ro_rt = rtalloc_mpath(&ro->ro_dstsa, NULL, ro->ro_tableid); - } + rt = route_mpath(&inp->inp_route, &sin->sin_addr, NULL, rtableid); /* * If we found a route, use the address * corresponding to the outgoing interface. */ - if (ro->ro_rt != NULL) - ia = ifatoia(ro->ro_rt->rt_ifa); + if (rt != NULL) + ia = ifatoia(rt->rt_ifa); /* * Use preferred source address if : @@ -997,8 +986,8 @@ in_pcbselsrc(struct in_addr *insrc, struct sockaddr_in *sin, * - preferred source address is set * - output interface is UP */ - if (ro->ro_rt && !(ro->ro_rt->rt_flags & RTF_LLINFO) && - !(ro->ro_rt->rt_flags & RTF_HOST)) { + if (rt != NULL && !(rt->rt_flags & RTF_LLINFO) && + !(rt->rt_flags & RTF_HOST)) { ip4_source = rtable_getsource(rtableid, AF_INET); if (ip4_source != NULL) { struct ifaddr *ifa; |