-/* $OpenBSD: in_pcb.c,v 1.265 2022/04/14 14:10:22 claudio Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.266 2022/05/15 09:12:20 dlg Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
int
in_pcbconnect(struct inpcb *inp, struct mbuf *nam)
{
- struct in_addr *ina = NULL;
+ struct in_addr ina;
struct sockaddr_in *sin;
int error;
return (error);
if (in_pcbhashlookup(inp->inp_table, sin->sin_addr, sin->sin_port,
- *ina, inp->inp_lport, inp->inp_rtableid) != NULL)
+ ina, inp->inp_lport, inp->inp_rtableid) != NULL)
return (EADDRINUSE);
KASSERT(inp->inp_laddr.s_addr == INADDR_ANY || inp->inp_lport);
if (error)
return (error);
if (in_pcbhashlookup(inp->inp_table, sin->sin_addr,
- sin->sin_port, *ina, inp->inp_lport,
+ sin->sin_port, ina, inp->inp_lport,
inp->inp_rtableid) != NULL) {
inp->inp_lport = 0;
return (EADDRINUSE);
}
}
- inp->inp_laddr = *ina;
+ inp->inp_laddr = ina;
}
inp->inp_faddr = sin->sin_addr;
inp->inp_fport = sin->sin_port;
* an entry to the caller for later use.
*/
int
-in_pcbselsrc(struct in_addr **insrc, struct sockaddr_in *sin,
+in_pcbselsrc(struct in_addr *insrc, struct sockaddr_in *sin,
struct inpcb *inp)
{
struct ip_moptions *mopts = inp->inp_moptions;
* If the socket(if any) is already bound, use that bound address
* unless it is INADDR_ANY or INADDR_BROADCAST.
*/
- if (laddr && laddr->s_addr != INADDR_ANY &&
+ if (laddr->s_addr != INADDR_ANY &&
laddr->s_addr != INADDR_BROADCAST) {
- *insrc = laddr;
+ *insrc = *laddr;
return (0);
}
return (EADDRNOTAVAIL);
}
- *insrc = &ia->ia_addr.sin_addr;
+ *insrc = ia->ia_addr.sin_addr;
if_put(ifp);
return (0);
}
struct ifaddr *ifa;
if ((ifa = ifa_ifwithaddr(ip4_source, rtableid)) !=
NULL && ISSET(ifa->ifa_ifp->if_flags, IFF_UP)) {
- *insrc = &satosin(ip4_source)->sin_addr;
+ *insrc = satosin(ip4_source)->sin_addr;
return (0);
}
}
if (ia == NULL)
return (EADDRNOTAVAIL);
- *insrc = &ia->ia_addr.sin_addr;
+ *insrc = ia->ia_addr.sin_addr;
return (0);
}
-/* $OpenBSD: in_pcb.h,v 1.128 2022/03/21 23:37:09 bluhm Exp $ */
+/* $OpenBSD: in_pcb.h,v 1.129 2022/05/15 09:12:20 dlg Exp $ */
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
/*
void in_setsockaddr(struct inpcb *, struct mbuf *);
int in_baddynamic(u_int16_t, u_int16_t);
int in_rootonly(u_int16_t, u_int16_t);
-int in_pcbselsrc(struct in_addr **, struct sockaddr_in *, struct inpcb *);
+int in_pcbselsrc(struct in_addr *, struct sockaddr_in *, struct inpcb *);
struct rtentry *
in_pcbrtentry(struct inpcb *);
-/* $OpenBSD: raw_ip.c,v 1.127 2022/03/23 17:22:28 bluhm Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.128 2022/05/15 09:12:20 dlg Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
}
if (ip->ip_src.s_addr == INADDR_ANY) {
- struct in_addr *laddr;
-
- error = in_pcbselsrc(&laddr, dst, inp);
+ error = in_pcbselsrc(&ip->ip_src, dst, inp);
if (error != 0)
return (error);
-
- ip->ip_src = *laddr;
}
#ifdef INET6
-/* $OpenBSD: udp_usrreq.c,v 1.277 2022/03/21 23:37:09 bluhm Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.278 2022/05/15 09:12:20 dlg Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
u_int32_t ipsecflowinfo = 0;
struct sockaddr_in src_sin;
int len = m->m_pkthdr.len;
- struct in_addr *laddr;
+ struct in_addr laddr;
int error = 0;
#ifdef DIAGNOSTIC
(error =
in_pcbaddrisavail(inp, &src_sin, 0, curproc)))
goto release;
- laddr = &src_sin.sin_addr;
+ laddr = src_sin.sin_addr;
}
} else {
if (inp->inp_faddr.s_addr == INADDR_ANY) {
error = ENOTCONN;
goto release;
}
- laddr = &inp->inp_laddr;
+ laddr = inp->inp_laddr;
}
/*
bzero(ui->ui_x1, sizeof ui->ui_x1);
ui->ui_pr = IPPROTO_UDP;
ui->ui_len = htons((u_int16_t)len + sizeof (struct udphdr));
- ui->ui_src = *laddr;
+ ui->ui_src = laddr;
ui->ui_dst = sin ? sin->sin_addr : inp->inp_faddr;
ui->ui_sport = inp->inp_lport;
ui->ui_dport = sin ? sin->sin_port : inp->inp_fport;