summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-06-22 14:28:59 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-06-22 14:28:59 +0000
commitf42d8b99248945a02177adb0c2d42667133940d2 (patch)
treec835e56b3625e78d18a911fc368d9c403ffc733a /sys
parentcd65ba11166aadcf84cf8c227662024ae1126d75 (diff)
KNF
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.c4
-rw-r--r--sys/net/if_bridge.c37
-rw-r--r--sys/net/if_gre.c129
-rw-r--r--sys/net/if_vlan.c6
4 files changed, 84 insertions, 92 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 480da5060d9..29154351c49 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.46 2001/06/15 03:38:33 itojun Exp $ */
+/* $OpenBSD: if.c,v 1.47 2001/06/22 14:28:58 deraadt Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -613,7 +613,7 @@ if_up(ifp)
#ifdef notyet
/* this has no effect on IP, and will kill all ISO connections XXX */
for (ifa = ifp->if_addrlist.tqh_first; ifa != 0;
- ifa = ifa->ifa_list.tqe_next)
+ ifa = ifa->ifa_list.tqe_next)
pfctlinput(PRC_IFUP, ifa->ifa_addr);
#endif
rt_ifmsg(ifp);
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index e13e96a31c8..46dec024a4c 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.60 2001/06/15 03:38:33 itojun Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.61 2001/06/22 14:28:58 deraadt Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -268,7 +268,7 @@ bridge_ioctl(ifp, cmd, data)
}
#if NGIF > 0
else if (ifs->if_type == IFT_GIF) {
- /* Nothing needed */
+ /* Nothing needed */
}
#endif /* NGIF */
else {
@@ -924,9 +924,9 @@ bridgeintr_frame(sc, m)
}
if ((ifl->bif_flags & IFBIF_STP) &&
- ((ifl->bif_state == BSTP_IFSTATE_BLOCKING) ||
- (ifl->bif_state == BSTP_IFSTATE_LISTENING) ||
- (ifl->bif_state == BSTP_IFSTATE_DISABLED))) {
+ (ifl->bif_state == BSTP_IFSTATE_BLOCKING ||
+ ifl->bif_state == BSTP_IFSTATE_LISTENING ||
+ ifl->bif_state == BSTP_IFSTATE_DISABLED)) {
m_freem(m);
return;
}
@@ -945,12 +945,9 @@ bridgeintr_frame(sc, m)
*/
if ((ifl->bif_flags & IFBIF_LEARNING) &&
(eh.ether_shost[0] & 1) == 0 &&
- !(eh.ether_shost[0] == 0 &&
- eh.ether_shost[1] == 0 &&
- eh.ether_shost[2] == 0 &&
- eh.ether_shost[3] == 0 &&
- eh.ether_shost[4] == 0 &&
- eh.ether_shost[5] == 0))
+ !(eh.ether_shost[0] == 0 && eh.ether_shost[1] == 0 &&
+ eh.ether_shost[2] == 0 && eh.ether_shost[3] == 0 &&
+ eh.ether_shost[4] == 0 && eh.ether_shost[5] == 0))
bridge_rtupdate(sc, src, src_if, 0, IFBAF_DYNAMIC);
if ((ifl->bif_flags & IFBIF_STP) &&
@@ -1053,7 +1050,7 @@ bridgeintr_frame(sc, m)
}
if ((ifl->bif_flags & IFBIF_STP) &&
(ifl->bif_state == BSTP_IFSTATE_DISABLED ||
- ifl->bif_state == BSTP_IFSTATE_BLOCKING)) {
+ ifl->bif_state == BSTP_IFSTATE_BLOCKING)) {
m_freem(m);
return;
}
@@ -1132,8 +1129,8 @@ bridge_input(ifp, eh, m)
*/
if ((ifl->bif_flags & IFBIF_STP) &&
((ifl->bif_state == BSTP_IFSTATE_BLOCKING) ||
- (ifl->bif_state == BSTP_IFSTATE_LISTENING) ||
- (ifl->bif_state == BSTP_IFSTATE_DISABLED)))
+ (ifl->bif_state == BSTP_IFSTATE_LISTENING) ||
+ (ifl->bif_state == BSTP_IFSTATE_DISABLED)))
return (m);
/*
@@ -1178,8 +1175,8 @@ bridge_input(ifp, eh, m)
*/
if ((ifl->bif_flags & IFBIF_STP) &&
((ifl->bif_state == BSTP_IFSTATE_BLOCKING) ||
- (ifl->bif_state == BSTP_IFSTATE_LISTENING) ||
- (ifl->bif_state == BSTP_IFSTATE_DISABLED)))
+ (ifl->bif_state == BSTP_IFSTATE_LISTENING) ||
+ (ifl->bif_state == BSTP_IFSTATE_DISABLED)))
return (m);
@@ -1252,7 +1249,7 @@ bridge_broadcast(sc, ifp, eh, m)
if ((p->bif_flags & IFBIF_STP) &&
(p->bif_state == BSTP_IFSTATE_BLOCKING ||
- p->bif_state == BSTP_IFSTATE_DISABLED))
+ p->bif_state == BSTP_IFSTATE_DISABLED))
continue;
if ((p->bif_flags & IFBIF_DISCOVER) == 0 &&
@@ -1770,10 +1767,8 @@ bridge_blocknonip(eh, m)
llc.llc_snap.org_code[0] == 0 &&
llc.llc_snap.org_code[1] == 0 &&
llc.llc_snap.org_code[2] == 0 &&
- (etype == ETHERTYPE_ARP ||
- etype == ETHERTYPE_REVARP ||
- etype == ETHERTYPE_IP ||
- etype == ETHERTYPE_IPV6)) {
+ (etype == ETHERTYPE_ARP || etype == ETHERTYPE_REVARP ||
+ etype == ETHERTYPE_IP || etype == ETHERTYPE_IPV6)) {
return (0);
}
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 00fca76d4ac..e7a07d162e6 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_gre.c,v 1.12 2001/06/05 23:43:45 maja Exp $ */
+/* $OpenBSD: if_gre.c,v 1.13 2001/06/22 14:28:58 deraadt Exp $ */
/* $NetBSD: if_gre.c,v 1.9 1999/10/25 19:18:11 drochner Exp $ */
/*
@@ -94,9 +94,9 @@
#endif /* GRE_RECURSION_LIMIT */
#define GREMTU 1450 /* XXX this is below the standard MTU of
- 1500 Bytes, allowing for headers,
+ 1500 Bytes, allowing for headers,
but we should possibly do path mtu discovery
- before changing if state to up to find the
+ before changing if state to up to find the
correct value */
#define LINK_MASK (IFF_LINK0|IFF_LINK1|IFF_LINK2)
@@ -132,7 +132,7 @@ greattach(n)
sc->sc_if.if_type = IFT_OTHER;
sc->sc_if.if_addrlen = 4;
sc->sc_if.if_hdrlen = 24; /* IP + GRE */
- sc->sc_if.if_mtu = GREMTU;
+ sc->sc_if.if_mtu = GREMTU;
sc->sc_if.if_flags = IFF_POINTOPOINT|IFF_MULTICAST;
sc->sc_if.if_output = gre_output;
sc->sc_if.if_ioctl = gre_ioctl;
@@ -153,7 +153,7 @@ greattach(n)
}
}
-/*
+/*
* The output routine. Takes a packet and encapsulates it in the protocol
* given by sc->g_proto. See also RFC 1701 and RFC 2004.
*/
@@ -184,8 +184,8 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
#endif
if (sc->g_proto == IPPROTO_MOBILE) {
- if (ip_mobile_allow == 0) {
- IF_DROP(&ifp->if_snd);
+ if (ip_mobile_allow == 0) {
+ IF_DROP(&ifp->if_snd);
m_freem(m);
recursions = 0;
return (EACCES);
@@ -199,22 +199,20 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
* Make sure the complete IP header (with options)
* is in the first mbuf.
*/
- if (m->m_len < sizeof(struct ip))
- {
- m = m_pullup(m, sizeof(struct ip));
- if (m == NULL) {
+ if (m->m_len < sizeof(struct ip)) {
+ m = m_pullup(m, sizeof(struct ip));
+ if (m == NULL) {
IF_DROP(&ifp->if_snd);
recursions = 0;
return (ENOBUFS);
- }
- else
- inp = mtod(m, struct ip *);
+ } else
+ inp = mtod(m, struct ip *);
if (m->m_len < inp->ip_hl << 2) {
- m = m_pullup(m,
- sizeof(inp->ip_hl << 2));
+ m = m_pullup(m,
+ sizeof(inp->ip_hl << 2));
if (m == NULL) {
- IF_DROP(&ifp->if_snd);
+ IF_DROP(&ifp->if_snd);
recursions = 0;
return (ENOBUFS);
}
@@ -266,7 +264,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
m->m_len -= inp->ip_hl << 2;
bcopy((caddr_t) inp, mtod(m0, caddr_t),
- sizeof(struct ip));
+ sizeof(struct ip));
m0->m_next = m;
m = m0;
@@ -274,8 +272,8 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
m->m_data -= msiz;
m->m_len += msiz;
m->m_pkthdr.len += msiz;
- bcopy(inp, mtod(m, caddr_t),
- inp->ip_hl << 2);
+ bcopy(inp, mtod(m, caddr_t),
+ inp->ip_hl << 2);
}
/* Copy Mobility header */
@@ -290,8 +288,8 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
return (EINVAL);
}
} else if (sc->g_proto == IPPROTO_GRE) {
- if (gre_allow == 0) {
- IF_DROP(&ifp->if_snd);
+ if (gre_allow == 0) {
+ IF_DROP(&ifp->if_snd);
m_freem(m);
recursions = 0;
return (EACCES);
@@ -299,10 +297,10 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
switch(dst->sa_family) {
case AF_INET:
- if (m->m_len < sizeof(struct ip)) {
- m = m_pullup(m, sizeof(struct ip));
+ if (m->m_len < sizeof(struct ip)) {
+ m = m_pullup(m, sizeof(struct ip));
if (m == NULL) {
- IF_DROP(&ifp->if_snd);
+ IF_DROP(&ifp->if_snd);
recursions = 0;
return (ENOBUFS);
}
@@ -336,7 +334,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
recursions = 0;
return (error);
}
-
+
if (m == NULL) {
IF_DROP(&ifp->if_snd);
recursions = 0;
@@ -355,7 +353,7 @@ gre_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
if (sc->g_proto != IPPROTO_MOBILE) {
gh->gi_src = sc->g_src;
gh->gi_dst = sc->g_dst;
- ((struct ip *) gh)->ip_hl = (sizeof(struct ip)) >> 2;
+ ((struct ip *) gh)->ip_hl = (sizeof(struct ip)) >> 2;
((struct ip *) gh)->ip_ttl = ip_defttl;
((struct ip *) gh)->ip_tos = inp->ip_tos;
gh->gi_len = m->m_pkthdr.len;
@@ -384,17 +382,17 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
struct sockaddr_in si;
struct sockaddr *sa = NULL;
int error = 0;
- struct proc *prc = curproc; /* XXX */
+ struct proc *prc = curproc; /* XXX */
s = splimp();
switch(cmd) {
- case SIOCSIFADDR:
- case SIOCSIFDSTADDR:
- /*
- * set tunnel endpoints in case that we "only"
- * have ip over ip encapsulation. This allows to
- * set tunnel endpoints with ifconfig.
- */
+ case SIOCSIFADDR:
+ case SIOCSIFDSTADDR:
+ /*
+ * set tunnel endpoints in case that we "only"
+ * have ip over ip encapsulation. This allows to
+ * set tunnel endpoints with ifconfig.
+ */
if (ifa->ifa_addr->sa_family == AF_INET) {
sa = ifa->ifa_addr;
sc->g_src = (satosin(sa))->sin_addr;
@@ -402,7 +400,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if ((sc->g_src.s_addr != INADDR_ANY) &&
(sc->g_dst.s_addr != INADDR_ANY)) {
if (sc->route.ro_rt != 0) {
- /* free old route */
+ /* free old route */
RTFREE(sc->route.ro_rt);
sc->route.ro_rt = (struct rtentry *) 0;
}
@@ -420,7 +418,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
break;
case SIOCSIFFLAGS:
- if ((sc->g_dst.s_addr == INADDR_ANY) ||
+ if ((sc->g_dst.s_addr == INADDR_ANY) ||
(sc->g_src.s_addr == INADDR_ANY))
ifp->if_flags &= ~IFF_UP;
@@ -454,9 +452,9 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
}
break;
case GRESPROTO:
- /* Check for superuser */
- if ((error = suser(prc->p_ucred, &prc->p_acflag)) != 0)
- break;
+ /* Check for superuser */
+ if ((error = suser(prc->p_ucred, &prc->p_acflag)) != 0)
+ break;
sc->g_proto = ifr->ifr_flags;
switch (sc->g_proto) {
@@ -477,14 +475,14 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break;
case GRESADDRS:
case GRESADDRD:
- /* Check for superuser */
- if ((error = suser(prc->p_ucred, &prc->p_acflag)) != 0)
- break;
+ /* Check for superuser */
+ if ((error = suser(prc->p_ucred, &prc->p_acflag)) != 0)
+ break;
/*
- * set tunnel endpoints, compute a less specific route
- * to the remote end and mark if as up
- */
+ * set tunnel endpoints, compute a less specific route
+ * to the remote end and mark if as up
+ */
sa = &ifr->ifr_addr;
if (cmd == GRESADDRS )
sc->g_src = (satosin(sa))->sin_addr;
@@ -493,7 +491,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if ((sc->g_src.s_addr != INADDR_ANY) &&
(sc->g_dst.s_addr != INADDR_ANY)) {
if (sc->route.ro_rt != 0) {
- /* free old route */
+ /* free old route */
RTFREE(sc->route.ro_rt);
sc->route.ro_rt = (struct rtentry *) 0;
}
@@ -527,12 +525,12 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
return (error);
}
-/*
+/*
* computes a route to our destination that is not the one
* which would be taken by ip_output(), as this one will loop back to
* us. If the interface is p2p as a--->b, then a routing entry exists
* If we now send a packet to b (e.g. ping b), this will come down here
- * gets src=a, dst=b tacked on and would from ip_ouput() sent back to
+ * gets src=a, dst=b tacked on and would from ip_ouput() sent back to
* if_gre.
* Goal here is to compute a route to b that is less specific than
* a-->b. We know that this one exists as in normal operation we have
@@ -546,7 +544,7 @@ gre_compute_route(struct gre_softc *sc)
u_int32_t a, b, c;
ro = &sc->route;
-
+
bzero(ro, sizeof(struct route));
((struct sockaddr_in *) &ro->ro_dst)->sin_addr = sc->g_dst;
ro->ro_dst.sa_family = AF_INET;
@@ -554,10 +552,10 @@ gre_compute_route(struct gre_softc *sc)
/*
* toggle last bit, so our interface is not found, but a less
- * specific route. I'd rather like to specify a shorter mask,
+ * specific route. I'd rather like to specify a shorter mask,
* but this is not possible. Should work though. XXX
* there is a simpler way ...
- */
+ */
if ((sc->sc_if.if_flags & IFF_LINK1) == 0) {
a = ntohl(sc->g_dst.s_addr);
b = a & 0x01;
@@ -577,43 +575,42 @@ gre_compute_route(struct gre_softc *sc)
* not allow people to link GRE tunnels.
*/
if (ro->ro_rt->rt_ifp == &sc->sc_if) {
- RTFREE(ro->ro_rt);
- ro->ro_rt = (struct rtentry *) 0;
+ RTFREE(ro->ro_rt);
+ ro->ro_rt = (struct rtentry *) 0;
return;
}
/*
- * now change it back - else ip_output will just drop
- * the route and search one to this interface ...
- */
+ * now change it back - else ip_output will just drop
+ * the route and search one to this interface ...
+ */
if ((sc->sc_if.if_flags & IFF_LINK1) == 0)
((struct sockaddr_in *) &ro->ro_dst)->sin_addr = sc->g_dst;
}
/*
- * do a checksum of a buffer - much like in_cksum, which operates on
- * mbufs.
+ * do a checksum of a buffer - much like in_cksum, which operates on
+ * mbufs.
*/
-
u_short
gre_in_cksum(u_short *p, u_int len)
{
- u_int sum = 0;
+ u_int sum = 0;
int nwords = len >> 1;
-
+
while (nwords-- != 0)
sum += *p++;
-
+
if (len & 1) {
union {
u_short w;
- u_char c[2];
+ u_char c[2];
} u;
u.c[0] = *(u_char *) p;
u.c[1] = 0;
sum += u.w;
- }
-
+ }
+
/* end-around-carry */
sum = (sum >> 16) + (sum & 0xffff);
sum += (sum >> 16);
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 222393bc6d1..20894ba9b4c 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.17 2001/05/27 11:58:25 angelos Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.18 2001/06/22 14:28:58 deraadt Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
*
@@ -136,7 +136,7 @@ int vlan_setmulti(struct ifnet *ifp)
while (enm != NULL) {
mc = malloc(sizeof(struct vlan_mc_entry), M_DEVBUF, M_NOWAIT);
bcopy(enm->enm_addrlo,
- (void *) &mc->mc_addr, ETHER_ADDR_LEN);
+ (void *) &mc->mc_addr, ETHER_ADDR_LEN);
SLIST_INSERT_HEAD(&sc->vlan_mc_listhead, mc, mc_entries);
error = ether_addmulti(ifr_p, &sc->ifv_ac);
if (error)
@@ -548,7 +548,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
sa = (struct sockaddr *) &ifr->ifr_data;
bcopy(((struct arpcom *)ifp->if_softc)->ac_enaddr,
- (caddr_t) sa->sa_data, ETHER_ADDR_LEN);
+ (caddr_t) sa->sa_data, ETHER_ADDR_LEN);
}
break;