summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/netinet/in.c27
-rw-r--r--sys/netinet/in.h4
-rw-r--r--sys/netinet/tcp_usrreq.c6
3 files changed, 10 insertions, 27 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index c601805930a..ac707dc4ed5 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.111 2014/11/24 12:43:54 mpi Exp $ */
+/* $OpenBSD: in.c,v 1.112 2014/11/25 15:35:10 mpi Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -876,36 +876,19 @@ in_scrubprefix(struct in_ifaddr *ia0)
}
/*
- * Return 1 if the address might be a local broadcast address.
+ * Return 1 if the address is a local broadcast address.
*/
int
-in_broadcast(struct in_addr in, struct ifnet *ifp, u_int rtableid)
+in_broadcast(struct in_addr in, u_int rtableid)
{
- struct ifnet *ifn, *if_first, *if_target;
+ struct ifnet *ifn;
struct ifaddr *ifa;
u_int rdomain;
rdomain = rtable_l2(rtableid);
- if (in.s_addr == INADDR_BROADCAST ||
- in.s_addr == INADDR_ANY)
- return 1;
-
- if (ifp == NULL) {
- if_first = TAILQ_FIRST(&ifnet);
- if_target = 0;
- } else {
- if_first = ifp;
- if_target = TAILQ_NEXT(ifp, if_list);
- }
-
#define ia (ifatoia(ifa))
- /*
- * Look through the list of addresses for a match
- * with a broadcast address.
- * If ifp is NULL, check against all the interfaces.
- */
- for (ifn = if_first; ifn != if_target; ifn = TAILQ_NEXT(ifn, if_list)) {
+ TAILQ_FOREACH(ifn, &ifnet, if_list) {
if (ifn->if_rdomain != rdomain)
continue;
if ((ifn->if_flags & IFF_BROADCAST) == 0)
diff --git a/sys/netinet/in.h b/sys/netinet/in.h
index 9976b6cdde9..d774a2fa330 100644
--- a/sys/netinet/in.h
+++ b/sys/netinet/in.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.h,v 1.109 2014/07/12 16:25:08 guenther Exp $ */
+/* $OpenBSD: in.h,v 1.110 2014/11/25 15:35:10 mpi Exp $ */
/* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
/*
@@ -782,7 +782,7 @@ extern int inetctlerrmap[];
extern struct ifqueue ipintrq; /* ip packet input queue */
extern struct in_addr zeroin_addr;
-int in_broadcast(struct in_addr, struct ifnet *, u_int);
+int in_broadcast(struct in_addr, u_int);
int in_canforward(struct in_addr);
int in_cksum(struct mbuf *, int);
int in4_cksum(struct mbuf *, u_int8_t, int, int);
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 0b827ff2610..dc5dbc07d76 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.121 2014/11/18 02:37:31 tedu Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.122 2014/11/25 15:35:10 mpi Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -275,9 +275,9 @@ tcp_usrreq(so, req, m, nam, control, p)
#endif /* INET6 */
{
if ((sin->sin_addr.s_addr == INADDR_ANY) ||
+ (sin->sin_addr.s_addr == INADDR_BROADCAST) ||
IN_MULTICAST(sin->sin_addr.s_addr) ||
- in_broadcast(sin->sin_addr, NULL,
- inp->inp_rtableid)) {
+ in_broadcast(sin->sin_addr, inp->inp_rtableid)) {
error = EINVAL;
break;
}