Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 Style, no functional change.
details: https://anonhg.NetBSD.org/src/rev/78aa9fa1cc98
branches: trunk
changeset: 359170:78aa9fa1cc98
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Feb 02 09:01:17 2018 +0000
description:
Style, no functional change.
diffstat:
sys/netinet6/ip6_mroute.c | 160 +++++++++++++++++++++++-----------------------
1 files changed, 80 insertions(+), 80 deletions(-)
diffs (truncated from 511 to 300 lines):
diff -r 56f5cf051b23 -r 78aa9fa1cc98 sys/netinet6/ip6_mroute.c
--- a/sys/netinet6/ip6_mroute.c Fri Feb 02 06:23:45 2018 +0000
+++ b/sys/netinet6/ip6_mroute.c Fri Feb 02 09:01:17 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip6_mroute.c,v 1.120 2018/02/02 06:23:45 maxv Exp $ */
+/* $NetBSD: ip6_mroute.c,v 1.121 2018/02/02 09:01:17 maxv Exp $ */
/* $KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $ */
/*
@@ -117,7 +117,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.120 2018/02/02 06:23:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_mroute.c,v 1.121 2018/02/02 09:01:17 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -162,8 +162,7 @@
static void phyint_send(struct ip6_hdr *, struct mif6 *, struct mbuf *);
static int set_pim6(int *);
-static int socket_send(struct socket *, struct mbuf *,
- struct sockaddr_in6 *);
+static int socket_send(struct socket *, struct mbuf *, struct sockaddr_in6 *);
static int register_send(struct ip6_hdr *, struct mif6 *, struct mbuf *);
/*
@@ -376,7 +375,8 @@
{
int error;
- if (so != ip6_mrouter) return EACCES;
+ if (so != ip6_mrouter)
+ return EACCES;
error = 0;
@@ -479,13 +479,13 @@
if (so->so_type != SOCK_RAW ||
so->so_proto->pr_protocol != IPPROTO_ICMPV6)
- return (EOPNOTSUPP);
+ return EOPNOTSUPP;
if (v != 1)
- return (ENOPROTOOPT);
+ return ENOPROTOOPT;
if (ip6_mrouter != NULL)
- return (EADDRINUSE);
+ return EADDRINUSE;
ip6_mrouter = so;
ip6_mrouter_ver = cmd;
@@ -591,7 +591,7 @@
if_detach(&multicast_register_if6);
reg_mif_num = (mifi_t)-1;
}
-
+
ip6_mrouter = NULL;
ip6_mrouter_ver = 0;
@@ -639,7 +639,6 @@
}
}
-
/*
* Add a mif to the mif table
*/
@@ -666,16 +665,14 @@
ifp = &multicast_register_if6;
if (reg_mif_num == (mifi_t)-1) {
- strlcpy(ifp->if_xname, "register_mif",
+ strlcpy(ifp->if_xname, "register_mif",
sizeof(ifp->if_xname));
ifp->if_flags |= IFF_LOOPBACK;
ifp->if_index = mifcp->mif6c_mifi;
reg_mif_num = mifcp->mif6c_mifi;
if_attach(ifp);
}
-
- } /* if REGISTER */
- else {
+ } else {
/* Make sure the interface supports multicast */
if ((ifp->if_flags & IFF_MULTICAST) == 0)
return EOPNOTSUPP;
@@ -869,7 +866,7 @@
m_freem(rte->m);
#ifdef UPCALL_TIMING
collate(&(rte->t));
-#endif /* UPCALL_TIMING */
+#endif
free(rte, M_MRTABLE);
rte = n;
}
@@ -916,8 +913,7 @@
}
if (rt == NULL) {
/* no upcall, so make a new entry */
- rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE,
- M_NOWAIT);
+ rt = malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT);
if (rt == NULL) {
splx(s);
return ENOBUFS;
@@ -1045,7 +1041,6 @@
* erroneous, in which case a non-zero return value tells the caller to
* discard it.
*/
-
int
ip6_mforward(struct ip6_hdr *ip6, struct ifnet *ifp, struct mbuf *m)
{
@@ -1106,23 +1101,21 @@
/* Entry exists, so forward if necessary */
if (rt) {
splx(s);
- return (ip6_mdq(m, ifp, rt));
+ return ip6_mdq(m, ifp, rt);
} else {
/*
- * If we don't have a route for packet's origin,
- * Make a copy of the packet &
- * send message to routing daemon
+ * If we don't have a route for packet's origin, make a copy
+ * of the packet and send message to routing daemon.
*/
struct mbuf *mb0;
struct rtdetq *rte;
u_long hash;
-/* int i, npkts;*/
+
#ifdef UPCALL_TIMING
struct timeval tp;
-
GET_TIME(tp);
-#endif /* UPCALL_TIMING */
+#endif
mrt6stat.mrt6s_no_route++;
#ifdef MRT6DEBUG
@@ -1136,13 +1129,13 @@
* Allocate mbufs early so that we don't do extra work if we
* are just going to fail anyway.
*/
- rte = (struct rtdetq *)malloc(sizeof(*rte), M_MRTABLE,
- M_NOWAIT);
+ rte = malloc(sizeof(*rte), M_MRTABLE, M_NOWAIT);
if (rte == NULL) {
splx(s);
return ENOBUFS;
}
mb0 = m_copy(m, 0, M_COPYALL);
+
/*
* Pullup packet header if needed before storing it,
* as other references may modify it in the meantime.
@@ -1172,14 +1165,14 @@
struct omrt6msg *oim;
/* no upcall, so make a new entry */
- rt = (struct mf6c *)malloc(sizeof(*rt), M_MRTABLE,
- M_NOWAIT);
+ rt = malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT);
if (rt == NULL) {
free(rte, M_MRTABLE);
m_freem(mb0);
splx(s);
return ENOBUFS;
}
+
/*
* Make a copy of the header to send to the user
* level process
@@ -1273,7 +1266,7 @@
struct rtdetq **p;
int npkts = 0;
- for (p = &rt->mf6c_stall; *p != NULL; p = &(*p)->next)
+ for (p = &rt->mf6c_stall; *p != NULL; p = &(*p)->next) {
if (++npkts > MAX_UPQ6) {
mrt6stat.mrt6s_upq_ovflw++;
free(rte, M_MRTABLE);
@@ -1281,6 +1274,7 @@
splx(s);
return 0;
}
+ }
/* Add this entry to the end of the queue */
*p = rte;
@@ -1291,7 +1285,7 @@
rte->ifp = ifp;
#ifdef UPCALL_TIMING
rte->t = tp;
-#endif /* UPCALL_TIMING */
+#endif
splx(s);
@@ -1368,6 +1362,18 @@
}
/*
+ * Macro to send packet on mif. Since RSVP packets don't get counted on
+ * input, they shouldn't get counted on output, so statistics keeping is
+ * separate.
+ */
+#define MC6_SEND(ip6, mifp, m) do { \
+ if ((mifp)->m6_flags & MIFF_REGISTER) \
+ register_send((ip6), (mifp), (m)); \
+ else \
+ phyint_send((ip6), (mifp), (m)); \
+} while (/*CONSTCOND*/ 0)
+
+/*
* Packet forwarding routine once entry in the cache is made
*/
static int
@@ -1381,19 +1387,6 @@
u_int32_t iszone, idzone, oszone, odzone;
int error = 0;
-/*
- * Macro to send packet on mif. Since RSVP packets don't get counted on
- * input, they shouldn't get counted on output, so statistics keeping is
- * separate.
- */
-
-#define MC6_SEND(ip6, mifp, m) do { \
- if ((mifp)->m6_flags & MIFF_REGISTER) \
- register_send((ip6), (mifp), (m)); \
- else \
- phyint_send((ip6), (mifp), (m)); \
-} while (/*CONSTCOND*/ 0)
-
/*
* Don't forward if it didn't arrive from the parent mif
* for its origin.
@@ -1411,13 +1404,14 @@
#endif
mrt6stat.mrt6s_wrong_if++;
rt->mf6c_wrong_if++;
+
/*
* If we are doing PIM processing, and we are forwarding
* packets on this interface, send a message to the
* routing daemon.
*/
/* have to make sure this is a valid mif */
- if (mifi < nummifs && mif6table[mifi].m6_ifp)
+ if (mifi < nummifs && mif6table[mifi].m6_ifp) {
if (pim6 && (m->m_flags & M_LOOP) == 0) {
/*
* Check the M_LOOP flag to avoid an
@@ -1485,10 +1479,12 @@
#endif
++mrt6stat.mrt6s_upq_sockfull;
return ENOBUFS;
- } /* if socket Q full */
- } /* if PIM */
+ }
+ }
+ }
+
return 0;
- } /* if wrong iif */
+ }
/* If I sourced this packet, it counts as output, else it was input. */
if (m->m_pkthdr.rcvif_index == 0) {
@@ -1511,9 +1507,9 @@
if ((error = in6_setscope(&src0, ifp, &iszone)) != 0 ||
(error = in6_setscope(&dst0, ifp, &idzone)) != 0) {
IP6_STATINC(IP6_STAT_BADSCOPE);
- return (error);
+ return error;
}
- for (mifp = mif6table, mifi = 0; mifi < nummifs; mifp++, mifi++)
+ for (mifp = mif6table, mifi = 0; mifi < nummifs; mifp++, mifi++) {
if (IF_ISSET(mifi, &rt->mf6c_ifset)) {
if (mif6table[mifi].m6_ifp == NULL)
continue;
@@ -1540,6 +1536,8 @@
mifp->m6_bytes_out += plen;
MC6_SEND(ip6, mifp, m);
}
+ }
+
return 0;
}
@@ -1556,6 +1554,7 @@
u_long linkmtu;
Home |
Main Index |
Thread Index |
Old Index