Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
src: Minor stylistic changes, add XXX and fix typo. No functiona...
details: https://anonhg.NetBSD.org/src/rev/7491a788964f
branches: trunk
changeset: 317936:7491a788964f
user: maxv <maxv%NetBSD.org@localhost>
date: Mon Apr 09 11:05:59 2018 +0000
description:
Minor stylistic changes, add XXX and fix typo. No functional change.
diffstat:
sys/net/if_ethersubr.c | 64 +++++++++++++++++++++++++------------------------
1 files changed, 33 insertions(+), 31 deletions(-)
diffs (225 lines):
diff -r 1b48974a1072 -r 7491a788964f sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c Mon Apr 09 10:32:32 2018 +0000
+++ b/sys/net/if_ethersubr.c Mon Apr 09 11:05:59 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ethersubr.c,v 1.260 2018/02/13 15:21:59 maxv Exp $ */
+/* $NetBSD: if_ethersubr.c,v 1.261 2018/04/09 11:05:59 maxv Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.260 2018/02/13 15:21:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.261 2018/04/09 11:05:59 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -142,7 +142,6 @@
#include <netinet6/nd6.h>
#endif
-
#include "carp.h"
#if NCARP > 0
#include <netinet/ip_carp.h>
@@ -170,15 +169,14 @@
static int bigpktpps_count;
static kmutex_t bigpktpps_lock __cacheline_aligned;
-
const uint8_t etherbroadcastaddr[ETHER_ADDR_LEN] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
const uint8_t ethermulticastaddr_slowprotocols[ETHER_ADDR_LEN] =
{ 0x01, 0x80, 0xc2, 0x00, 0x00, 0x02 };
#define senderr(e) { error = (e); goto bad;}
-static int ether_output(struct ifnet *, struct mbuf *,
- const struct sockaddr *, const struct rtentry *);
+static int ether_output(struct ifnet *, struct mbuf *,
+ const struct sockaddr *, const struct rtentry *);
/*
* Ethernet output routine.
@@ -238,11 +236,11 @@
#ifdef INET
case AF_INET:
- if (m->m_flags & M_BCAST)
+ if (m->m_flags & M_BCAST) {
memcpy(edst, etherbroadcastaddr, sizeof(edst));
- else if (m->m_flags & M_MCAST)
+ } else if (m->m_flags & M_MCAST) {
ETHER_MAP_IP_MULTICAST(&satocsin(dst)->sin_addr, edst);
- else {
+ } else {
error = arpresolve(ifp, rt, m, dst, edst, sizeof(edst));
if (error)
return (error == EWOULDBLOCK) ? 0 : error;
@@ -255,9 +253,9 @@
case AF_ARP:
ah = mtod(m, struct arphdr *);
- if (m->m_flags & M_BCAST)
+ if (m->m_flags & M_BCAST) {
memcpy(edst, etherbroadcastaddr, sizeof(edst));
- else {
+ } else {
void *tha = ar_tha(ah);
if (tha == NULL) {
@@ -286,16 +284,16 @@
#ifdef INET6
case AF_INET6:
- if (m->m_flags & M_BCAST)
+ if (m->m_flags & M_BCAST) {
memcpy(edst, etherbroadcastaddr, sizeof(edst));
- else if (m->m_flags & M_MCAST) {
+ } else if (m->m_flags & M_MCAST) {
ETHER_MAP_IPV6_MULTICAST(&satocsin6(dst)->sin6_addr,
edst);
} else {
error = nd6_resolve(ifp, rt, m, dst, edst,
sizeof(edst));
- if (error != 0)
- return error == EWOULDBLOCK ? 0 : error;
+ if (error)
+ return (error == EWOULDBLOCK) ? 0 : error;
}
etype = htons(ETHERTYPE_IPV6);
break;
@@ -313,7 +311,7 @@
printf("aarpresolve failed\n");
#endif
KERNEL_UNLOCK_ONE(NULL);
- return (0);
+ return 0;
}
/*
@@ -376,7 +374,7 @@
default:
printf("%s: can't handle af%d\n", ifp->if_xname,
- dst->sa_family);
+ dst->sa_family);
senderr(EAFNOSUPPORT);
}
@@ -414,11 +412,12 @@
/* Note: etype is already in network byte order. */
memcpy(&eh->ether_type, &etype, sizeof(eh->ether_type));
memcpy(eh->ether_dhost, edst, sizeof(edst));
- if (hdrcmplt)
+ if (hdrcmplt) {
memcpy(eh->ether_shost, esrc, sizeof(eh->ether_shost));
- else
+ } else {
memcpy(eh->ether_shost, CLLADDR(ifp->if_sadl),
sizeof(eh->ether_shost));
+ }
#if NCARP > 0
if (ifp0 != ifp && ifp0->if_type == IFT_CARP) {
@@ -428,9 +427,9 @@
#endif
if ((error = pfil_run_hooks(ifp->if_pfil, &m, ifp, PFIL_OUT)) != 0)
- return (error);
+ return error;
if (m == NULL)
- return (0);
+ return 0;
#if NBRIDGE > 0
/*
@@ -462,7 +461,7 @@
bad:
if (m)
m_freem(m);
- return (error);
+ return error;
}
#ifdef ALTQ
@@ -470,6 +469,9 @@
* This routine is a slight hack to allow a packet to be classified
* if the Ethernet headers are present. It will go away when ALTQ's
* classification engine understands link headers.
+ *
+ * XXX: We may need to do m_pullups here. First to ensure struct ether_header
+ * is indeed contiguous, then to read the LLC and so on.
*/
void
altq_etherclassify(struct ifaltq *ifq, struct mbuf *m)
@@ -612,7 +614,7 @@
ETHER_MAX_FRAME(ifp, etype, m->m_flags & M_HASFCS)) {
mutex_enter(&bigpktpps_lock);
if (ppsratecheck(&bigpktppslim_last, &bigpktpps_count,
- bigpktppslim)) {
+ bigpktppslim)) {
printf("%s: discarding oversize frame (len=%d)\n",
ifp->if_xname, m->m_pkthdr.len);
}
@@ -652,8 +654,8 @@
#if NCARP > 0
if (__predict_false(ifp->if_carp && ifp->if_type != IFT_CARP)) {
/*
- * clear M_PROMISC, in case the packets comes from a
- * vlan
+ * Clear M_PROMISC, in case the packet comes from a
+ * vlan.
*/
m->m_flags &= ~M_PROMISC;
if (carp_input(m, (uint8_t *)&eh->ether_shost,
@@ -665,7 +667,7 @@
if ((m->m_flags & (M_BCAST | M_MCAST | M_PROMISC)) == 0 &&
(ifp->if_flags & IFF_PROMISC) != 0 &&
memcmp(CLLADDR(ifp->if_sadl), eh->ether_dhost,
- ETHER_ADDR_LEN) != 0) {
+ ETHER_ADDR_LEN) != 0) {
m->m_flags |= M_PROMISC;
}
@@ -757,7 +759,7 @@
uint8_t subtype;
KASSERTMSG((m->m_pkthdr.len >= sizeof(*eh) + sizeof(subtype)),
- "too short slow protocol packet");
+ "too short slow protocol packet");
m_copydata(m, sizeof(*eh), sizeof(subtype), &subtype);
switch (subtype) {
@@ -775,7 +777,7 @@
return;
}
break;
-#endif /* NAGR > 0 */
+#endif
default:
if (subtype == 0 || subtype > 10) {
@@ -897,7 +899,7 @@
ETHERTYPE_AARP) {
m_adj(m, sizeof(struct ether_header)
+ sizeof(struct llc));
- aarpinput(ifp, m); /* XXX */
+ aarpinput(ifp, m); /* XXX queue? */
return;
}
@@ -1191,10 +1193,10 @@
{
#ifdef INET
const struct sockaddr_in *sin;
-#endif /* INET */
+#endif
#ifdef INET6
const struct sockaddr_in6 *sin6;
-#endif /* INET6 */
+#endif
switch (sa->sa_family) {
Home |
Main Index |
Thread Index |
Old Index