summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2014-05-07 08:26:39 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2014-05-07 08:26:39 +0000
commit5431aabbb1265f4a7832cebaf3696510a86092ab (patch)
treef0ee63e2d3bc9068e312c717900410b9c4ff5064 /sys/netinet
parentf42bbc1efedba08990ee2a1be6e7cd53b3cab676 (diff)
Remove the last hacks concerning the global list of IPv4 addresses in the
source address selection logic. These hacks were only relevant for the NFS diskless boot code in order to pick the local broadcast address of the only configured interface. So, be explicit and set this address directly. Tested by florian@, ok henning@, beck@, chrisz@
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_pcb.c23
-rw-r--r--sys/netinet/ip_input.c8
2 files changed, 5 insertions, 26 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 7a08d386c81..ec4d707d3bd 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.154 2014/04/18 10:48:29 jca Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.155 2014/05/07 08:26:38 mpi Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -230,8 +230,6 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p)
return in6_pcbbind(inp, nam, p);
#endif /* INET6 */
- if (TAILQ_EMPTY(&in_ifaddr))
- return (EADDRNOTAVAIL);
if (inp->inp_lport || inp->inp_laddr.s_addr != INADDR_ANY)
return (EINVAL);
if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0 &&
@@ -781,17 +779,6 @@ in_selectsrc(struct in_addr **insrc, struct sockaddr_in *sin,
struct sockaddr_in *sin2;
struct in_ifaddr *ia = NULL;
- if (!TAILQ_EMPTY(&in_ifaddr)) {
- if (sin->sin_addr.s_addr == INADDR_ANY)
- sin->sin_addr =
- TAILQ_FIRST(&in_ifaddr)->ia_addr.sin_addr;
- else if (sin->sin_addr.s_addr == INADDR_BROADCAST &&
- (TAILQ_FIRST(&in_ifaddr)->ia_ifp->if_flags & IFF_BROADCAST) &&
- TAILQ_FIRST(&in_ifaddr)->ia_broadaddr.sin_addr.s_addr)
- sin->sin_addr =
- TAILQ_FIRST(&in_ifaddr)->ia_broadaddr.sin_addr;
- }
-
/*
* If the source address is not specified but the socket(if any)
* is already bound, use the bound address.
@@ -850,11 +837,9 @@ in_selectsrc(struct in_addr **insrc, struct sockaddr_in *sin,
*/
if (ro->ro_rt && ro->ro_rt->rt_ifp)
ia = ifatoia(ro->ro_rt->rt_ifa);
- if (ia == NULL) {
- ia = TAILQ_FIRST(&in_ifaddr);
- if (ia == NULL)
- return (EADDRNOTAVAIL);
- }
+
+ if (ia == NULL)
+ return (EADDRNOTAVAIL);
*insrc = &ia->ia_addr.sin_addr;
return (0);
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 3570648998b..c24403dae0b 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.231 2014/04/21 12:22:26 henning Exp $ */
+/* $OpenBSD: ip_input.c,v 1.232 2014/05/07 08:26:38 mpi Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -238,12 +238,6 @@ ipv4_input(struct mbuf *m)
ifp = m->m_pkthdr.rcvif;
- /*
- * If no IP addresses have been set yet but the interfaces
- * are receiving, can't do anything with incoming packets yet.
- */
- if (TAILQ_EMPTY(&in_ifaddr))
- goto bad;
ipstat.ips_total++;
if (m->m_len < sizeof (struct ip) &&
(m = m_pullup(m, sizeof (struct ip))) == NULL) {