summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/igmp.c6
-rw-r--r--sys/netinet/in.c41
-rw-r--r--sys/netinet/in_var.h6
-rw-r--r--sys/netinet/ip_carp.c6
-rw-r--r--sys/netinet/ip_input.c9
5 files changed, 29 insertions, 39 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
index 11201f04c8f..6ba84beaec9 100644
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: igmp.c,v 1.29 2009/12/15 13:28:23 jsing Exp $ */
+/* $OpenBSD: igmp.c,v 1.30 2010/01/13 01:26:28 henning Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
@@ -353,7 +353,7 @@ igmp_input(struct mbuf *m, ...)
if ((ip->ip_src.s_addr & IN_CLASSA_NET) == 0) {
IFP_TO_IA(ifp, ia);
if (ia)
- ip->ip_src.s_addr = ia->ia_subnet;
+ ip->ip_src.s_addr = ia->ia_net;
}
/*
@@ -421,7 +421,7 @@ igmp_input(struct mbuf *m, ...)
IFP_TO_IA(ifp, ia);
#endif
if (ia)
- ip->ip_src.s_addr = ia->ia_subnet;
+ ip->ip_src.s_addr = ia->ia_net;
}
/*
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 894803507a2..4a73c6cecaa 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.55 2009/11/03 10:59:04 claudio Exp $ */
+/* $OpenBSD: in.c,v 1.56 2010/01/13 01:26:28 henning Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -129,7 +129,7 @@ in_localaddr(struct in_addr in, u_int rdomain)
TAILQ_FOREACH(ia, &in_ifaddr, ia_list) {
if (ia->ia_ifp->if_rdomain != rdomain)
continue;
- if ((in.s_addr & ia->ia_subnetmask) == ia->ia_subnet)
+ if ((in.s_addr & ia->ia_netmask) == ia->ia_net)
return (1);
}
}
@@ -393,7 +393,7 @@ in_control(so, cmd, data, ifp)
return error;
case SIOCSIFNETMASK:
- ia->ia_subnetmask = ia->ia_sockmask.sin_addr.s_addr =
+ ia->ia_netmask = ia->ia_sockmask.sin_addr.s_addr =
ifra->ifra_addr.sin_addr.s_addr;
break;
@@ -413,7 +413,7 @@ in_control(so, cmd, data, ifp)
if (ifra->ifra_mask.sin_len) {
in_ifscrub(ifp, ia);
ia->ia_sockmask = ifra->ifra_mask;
- ia->ia_subnetmask = ia->ia_sockmask.sin_addr.s_addr;
+ ia->ia_netmask = ia->ia_sockmask.sin_addr.s_addr;
maskIsNew = 1;
}
if ((ifp->if_flags & IFF_POINTOPOINT) &&
@@ -716,24 +716,18 @@ in_ifinit(ifp, ia, sin, scrub)
in_ifscrub(ifp, ia);
ia->ia_ifa.ifa_addr = sintosa(&ia->ia_addr);
}
- if (IN_CLASSA(i))
- ia->ia_netmask = IN_CLASSA_NET;
- else if (IN_CLASSB(i))
- ia->ia_netmask = IN_CLASSB_NET;
- else
- ia->ia_netmask = IN_CLASSC_NET;
- /*
- * The subnet mask usually includes at least the standard network part,
- * but may may be smaller in the case of supernetting.
- * If it is set, we believe it.
- */
- if (ia->ia_subnetmask == 0) {
- ia->ia_subnetmask = ia->ia_netmask;
- ia->ia_sockmask.sin_addr.s_addr = ia->ia_subnetmask;
- } else
- ia->ia_netmask &= ia->ia_subnetmask;
+
+ if (ia->ia_netmask == 0) {
+ if (IN_CLASSA(i))
+ ia->ia_netmask = IN_CLASSA_NET;
+ else if (IN_CLASSB(i))
+ ia->ia_netmask = IN_CLASSB_NET;
+ else
+ ia->ia_netmask = IN_CLASSC_NET;
+ ia->ia_sockmask.sin_addr.s_addr = ia->ia_netmask;
+ }
+
ia->ia_net = i & ia->ia_netmask;
- ia->ia_subnet = i & ia->ia_subnetmask;
in_socktrim(&ia->ia_sockmask);
/*
* Add route for the network.
@@ -741,7 +735,7 @@ in_ifinit(ifp, ia, sin, scrub)
ia->ia_ifa.ifa_metric = ifp->if_metric;
if (ifp->if_flags & IFF_BROADCAST) {
ia->ia_broadaddr.sin_addr.s_addr =
- ia->ia_subnet | ~ia->ia_subnetmask;
+ ia->ia_net | ~ia->ia_netmask;
ia->ia_netbroadcast.s_addr =
ia->ia_net | ~ia->ia_netmask;
} else if (ifp->if_flags & IFF_LOOPBACK) {
@@ -937,8 +931,7 @@ in_broadcast(in, ifp)
/*
* Check for old-style (host 0) broadcast.
*/
- (in.s_addr == ia->ia_subnet ||
- in.s_addr == ia->ia_net))))
+ in.s_addr == ia->ia_net)))
return 1;
}
return (0);
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index dabb62d11c3..41c98afe532 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_var.h,v 1.13 2009/11/03 10:59:04 claudio Exp $ */
+/* $OpenBSD: in_var.h,v 1.14 2010/01/13 01:26:28 henning Exp $ */
/* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */
/*
@@ -47,11 +47,9 @@ struct in_ifaddr {
struct ifaddr ia_ifa; /* protocol-independent info */
#define ia_ifp ia_ifa.ifa_ifp
#define ia_flags ia_ifa.ifa_flags
- /* ia_{,sub}net{,mask} in host order */
+ /* ia_net{,mask} in host order */
u_int32_t ia_net; /* network number of interface */
u_int32_t ia_netmask; /* mask of net part */
- u_int32_t ia_subnet; /* subnet number, including net */
- u_int32_t ia_subnetmask; /* mask of subnet part */
struct in_addr ia_netbroadcast; /* to recognize net broadcasts */
TAILQ_ENTRY(in_ifaddr) ia_list; /* list of internet addresses */
struct sockaddr_in ia_addr; /* reserve space for interface name */
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index a1ca1ca173d..f00d0fdc613 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.173 2010/01/12 01:40:30 mpf Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.174 2010/01/13 01:26:28 henning Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -2001,8 +2001,8 @@ carp_set_addr(struct carp_softc *sc, struct sockaddr_in *sin)
ia->ia_ifp->if_type != IFT_CARP &&
(ia->ia_ifp->if_flags & IFF_MULTICAST) &&
ia->ia_ifp->if_rdomain == sc->sc_if.if_rdomain &&
- (sin->sin_addr.s_addr & ia->ia_subnetmask) ==
- ia->ia_subnet) {
+ (sin->sin_addr.s_addr & ia->ia_netmask) ==
+ ia->ia_net) {
if (!ia_if)
ia_if = ia;
}
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index aff88edb71e..85f0053d54d 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.174 2009/12/07 08:19:37 gollo Exp $ */
+/* $OpenBSD: ip_input.c,v 1.175 2010/01/13 01:26:28 henning Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -689,7 +689,7 @@ in_iawithaddr(struct in_addr ina, struct mbuf *m, u_int rdomain)
if ((ina.s_addr == ia->ia_addr.sin_addr.s_addr) ||
((ia->ia_ifp->if_flags & (IFF_LOOPBACK|IFF_LINK1)) ==
(IFF_LOOPBACK|IFF_LINK1) &&
- ia->ia_subnet == (ina.s_addr & ia->ia_subnetmask)))
+ ia->ia_net == (ina.s_addr & ia->ia_netmask)))
return ia;
if (((ip_directedbcast == 0) || (m && ip_directedbcast &&
ia->ia_ifp == m->m_pkthdr.rcvif)) &&
@@ -700,7 +700,6 @@ in_iawithaddr(struct in_addr ina, struct mbuf *m, u_int rdomain)
* Look for all-0's host part (old broadcast addr),
* either for subnet or net.
*/
- ina.s_addr == ia->ia_subnet ||
ina.s_addr == ia->ia_net) {
/* Make sure M_BCAST is set */
if (m)
@@ -1496,8 +1495,8 @@ ip_forward(m, srcrt)
!ip_weadvertise(satosin(rt_key(rt))->sin_addr.s_addr,
m->m_pkthdr.rdomain)) {
if (rt->rt_ifa &&
- (ip->ip_src.s_addr & ifatoia(rt->rt_ifa)->ia_subnetmask) ==
- ifatoia(rt->rt_ifa)->ia_subnet) {
+ (ip->ip_src.s_addr & ifatoia(rt->rt_ifa)->ia_netmask) ==
+ ifatoia(rt->rt_ifa)->ia_net) {
if (rt->rt_flags & RTF_GATEWAY)
dest = satosin(rt->rt_gateway)->sin_addr.s_addr;
else