Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Style and remove unused macros. More to come.
details: https://anonhg.NetBSD.org/src/rev/b131c609b568
branches: trunk
changeset: 359340:b131c609b568
user: maxv <maxv%NetBSD.org@localhost>
date: Wed Feb 07 12:04:50 2018 +0000
description:
Style and remove unused macros. More to come.
diffstat:
sys/netinet/ip_mroute.c | 588 +++++++++++++++++++++++------------------------
1 files changed, 286 insertions(+), 302 deletions(-)
diffs (truncated from 775 to 300 lines):
diff -r fac1123b469c -r b131c609b568 sys/netinet/ip_mroute.c
--- a/sys/netinet/ip_mroute.c Wed Feb 07 11:42:57 2018 +0000
+++ b/sys/netinet/ip_mroute.c Wed Feb 07 12:04:50 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_mroute.c,v 1.149 2018/02/07 11:42:57 maxv Exp $ */
+/* $NetBSD: ip_mroute.c,v 1.150 2018/02/07 12:04:50 maxv Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -93,7 +93,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.149 2018/02/07 11:42:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.150 2018/02/07 12:04:50 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -156,9 +156,6 @@
struct socket *ip_mrouter = NULL;
int ip_mrtproto = IGMP_DVMRP; /* for netstat only */
-#define NO_RTE_FOUND 0x1
-#define RTE_FOUND 0x2
-
#define MFCHASH(a, g) \
((((a).s_addr >> 20) ^ ((a).s_addr >> 10) ^ (a).s_addr ^ \
((g).s_addr >> 20) ^ ((g).s_addr >> 10) ^ (g).s_addr) & mfchash)
@@ -168,7 +165,7 @@
u_char nexpire[MFCTBLSIZ];
struct vif viftable[MAXVIFS];
struct mrtstat mrtstat;
-u_int mrtdebug = 0; /* debug level */
+u_int mrtdebug = 0; /* debug level */
#define DEBUG_MFC 0x02
#define DEBUG_FORWARD 0x04
#define DEBUG_EXPIRE 0x08
@@ -177,7 +174,7 @@
#define VIFI_INVALID ((vifi_t) -1)
-u_int tbfdebug = 0; /* tbf debug level */
+u_int tbfdebug = 0; /* tbf debug level */
/* vif attachment using sys/netinet/ip_encap.c */
static void vif_input(struct mbuf *, int, int, void *);
@@ -245,28 +242,16 @@
#ifdef PIM
static int pim_register_send(struct ip *, struct vif *,
- struct mbuf *, struct mfc *);
+ struct mbuf *, struct mfc *);
static int pim_register_send_rp(struct ip *, struct vif *,
- struct mbuf *, struct mfc *);
+ struct mbuf *, struct mfc *);
static int pim_register_send_upcall(struct ip *, struct vif *,
- struct mbuf *, struct mfc *);
+ struct mbuf *, struct mfc *);
static struct mbuf *pim_register_prepare(struct ip *, struct mbuf *);
#endif
-/*
- * 'Interfaces' associated with decapsulator (so we can tell
- * packets that went through it from ones that get reflected
- * by a broken gateway). These interfaces are never linked into
- * the system ifnet list & no routes point to them. I.e., packets
- * can't be sent this way. They only exist as a placeholder for
- * multicast source verification.
- */
-#if 0
-struct ifnet multicast_decap_if[MAXVIFS];
-#endif
-
#define ENCAP_TTL 64
-#define ENCAP_PROTO IPPROTO_IPIP /* 4 */
+#define ENCAP_PROTO IPPROTO_IPIP
/* prototype IP hdr for encapsulated packets */
struct ip multicast_encap_iphdr = {
@@ -307,10 +292,9 @@
* data packet:
*
* struct pim_encap_hdr {
- * struct ip ip;
- * struct pim_encap_pimhdr pim;
+ * struct ip ip;
+ * struct pim_encap_pimhdr pim;
* }
- *
*/
struct pim_encap_pimhdr {
@@ -385,7 +369,7 @@
break;
}
- return (rt);
+ return rt;
}
/*
@@ -485,7 +469,7 @@
break;
}
}
- return (error);
+ return error;
}
/*
@@ -519,7 +503,7 @@
break;
}
}
- return (error);
+ return error;
}
/*
@@ -545,7 +529,7 @@
break;
}
- return (error);
+ return error;
}
/*
@@ -562,14 +546,14 @@
if (rt == NULL) {
splx(s);
req->pktcnt = req->bytecnt = req->wrong_if = 0xffffffff;
- return (EADDRNOTAVAIL);
+ return EADDRNOTAVAIL;
}
req->pktcnt = rt->mfc_pkt_cnt;
req->bytecnt = rt->mfc_byte_cnt;
req->wrong_if = rt->mfc_wrong_if;
splx(s);
- return (0);
+ return 0;
}
/*
@@ -581,14 +565,14 @@
vifi_t vifi = req->vifi;
if (vifi >= numvifs)
- return (EINVAL);
+ return EINVAL;
req->icount = viftable[vifi].v_pkt_in;
req->ocount = viftable[vifi].v_pkt_out;
req->ibytes = viftable[vifi].v_bytes_in;
req->obytes = viftable[vifi].v_bytes_out;
- return (0);
+ return 0;
}
/*
@@ -604,13 +588,13 @@
if (so->so_type != SOCK_RAW ||
so->so_proto->pr_protocol != IPPROTO_IGMP)
- return (EOPNOTSUPP);
+ return EOPNOTSUPP;
if (v != 1)
- return (EINVAL);
+ return EINVAL;
if (ip_mrouter != NULL)
- return (EADDRINUSE);
+ return EADDRINUSE;
ip_mrouter = so;
@@ -634,7 +618,7 @@
if (mrtdebug)
log(LOG_DEBUG, "ip_mrouter_init\n");
- return (0);
+ return 0;
}
/*
@@ -1850,7 +1834,7 @@
* The outer source must match the vif's remote peer address.
* For a multicast router with several tunnels, this is the
* only check that will fail on packets in other tunnels,
- * assuming the local address is the same.
+ * assuming the local address is the same.
*/
if (!in_hosteq(vifp->v_rmt_addr, ip.ip_src))
return 0;
@@ -2132,18 +2116,18 @@
static uint32_t
compute_bw_meter_flags(struct bw_upcall *req)
{
- uint32_t flags = 0;
-
- if (req->bu_flags & BW_UPCALL_UNIT_PACKETS)
- flags |= BW_METER_UNIT_PACKETS;
- if (req->bu_flags & BW_UPCALL_UNIT_BYTES)
- flags |= BW_METER_UNIT_BYTES;
- if (req->bu_flags & BW_UPCALL_GEQ)
- flags |= BW_METER_GEQ;
- if (req->bu_flags & BW_UPCALL_LEQ)
- flags |= BW_METER_LEQ;
-
- return flags;
+ uint32_t flags = 0;
+
+ if (req->bu_flags & BW_UPCALL_UNIT_PACKETS)
+ flags |= BW_METER_UNIT_PACKETS;
+ if (req->bu_flags & BW_UPCALL_UNIT_BYTES)
+ flags |= BW_METER_UNIT_BYTES;
+ if (req->bu_flags & BW_UPCALL_GEQ)
+ flags |= BW_METER_GEQ;
+ if (req->bu_flags & BW_UPCALL_LEQ)
+ flags |= BW_METER_LEQ;
+
+ return flags;
}
/*
@@ -2152,91 +2136,91 @@
static int
add_bw_upcall(struct bw_upcall *req)
{
- int s;
- struct mfc *mfc;
- struct timeval delta = { BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC,
+ int s;
+ struct mfc *mfc;
+ struct timeval delta = { BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC,
BW_UPCALL_THRESHOLD_INTERVAL_MIN_USEC };
- struct timeval now;
- struct bw_meter *x;
- uint32_t flags;
-
- if (!(mrt_api_config & MRT_MFC_BW_UPCALL))
- return EOPNOTSUPP;
-
- /* Test if the flags are valid */
- if (!(req->bu_flags & (BW_UPCALL_UNIT_PACKETS | BW_UPCALL_UNIT_BYTES)))
- return EINVAL;
- if (!(req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ)))
- return EINVAL;
- if ((req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ))
+ struct timeval now;
+ struct bw_meter *x;
+ uint32_t flags;
+
+ if (!(mrt_api_config & MRT_MFC_BW_UPCALL))
+ return EOPNOTSUPP;
+
+ /* Test if the flags are valid */
+ if (!(req->bu_flags & (BW_UPCALL_UNIT_PACKETS | BW_UPCALL_UNIT_BYTES)))
+ return EINVAL;
+ if (!(req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ)))
+ return EINVAL;
+ if ((req->bu_flags & (BW_UPCALL_GEQ | BW_UPCALL_LEQ))
== (BW_UPCALL_GEQ | BW_UPCALL_LEQ))
- return EINVAL;
-
- /* Test if the threshold time interval is valid */
- if (BW_TIMEVALCMP(&req->bu_threshold.b_time, &delta, <))
- return EINVAL;
-
- flags = compute_bw_meter_flags(req);
-
- /*
- * Find if we have already same bw_meter entry
- */
- s = splsoftnet();
- mfc = mfc_find(&req->bu_src, &req->bu_dst);
- if (mfc == NULL) {
+ return EINVAL;
+
+ /* Test if the threshold time interval is valid */
+ if (BW_TIMEVALCMP(&req->bu_threshold.b_time, &delta, <))
+ return EINVAL;
+
+ flags = compute_bw_meter_flags(req);
+
+ /*
+ * Find if we have already same bw_meter entry
+ */
+ s = splsoftnet();
+ mfc = mfc_find(&req->bu_src, &req->bu_dst);
+ if (mfc == NULL) {
+ splx(s);
+ return EADDRNOTAVAIL;
+ }
+ for (x = mfc->mfc_bw_meter; x != NULL; x = x->bm_mfc_next) {
+ if ((BW_TIMEVALCMP(&x->bm_threshold.b_time,
+ &req->bu_threshold.b_time, ==)) &&
Home |
Main Index |
Thread Index |
Old Index