Our multicast routing code is insert your adjective and for the most
part unused. We discussed with claudio@ during t2k13 to rewrite only
the parts that people currently use, any volunteer?
In the meantime, I'd like to kill the obviously unused parts of it. So
here's a first diff that remove the bandwidth monitoring interface.
Nothing use it in base and a quick search on codesearch.debian.net
reveals that only net/xorp picks it if it finds the defines.
Ok?
Index: netinet/ip_mroute.c
===
RCS file: /home/ncvs/src/sys/netinet/ip_mroute.c,v
retrieving revision 1.68
diff -u -p -r1.68 ip_mroute.c
--- netinet/ip_mroute.c 22 Jul 2014 11:06:10 - 1.68
+++ netinet/ip_mroute.c 13 Aug 2014 08:43:46 -
@@ -156,21 +156,6 @@ static void phyint_send(struct ip *, str
static void encap_send(struct ip *, struct vif *, struct mbuf *);
static void send_packet(struct vif *, struct mbuf *);
-/*
- * Bandwidth monitoring
- */
-static void free_bw_list(struct bw_meter *);
-static int add_bw_upcall(struct mbuf *);
-static int del_bw_upcall(struct mbuf *);
-static void bw_meter_receive_packet(struct bw_meter *, int , struct timeval *);
-static void bw_meter_prepare_upcall(struct bw_meter *, struct timeval *);
-static void bw_upcalls_send(void);
-static void schedule_bw_meter(struct bw_meter *, struct timeval *);
-static void unschedule_bw_meter(struct bw_meter *);
-static void bw_meter_process(void);
-static void expire_bw_upcalls_send(void *);
-static void expire_bw_meter_process(void *);
-
#ifdef PIM
static int pim_register_send(struct ip *, struct vif *,
struct mbuf *, struct mfc *);
@@ -211,28 +196,6 @@ struct ip multicast_encap_iphdr = {
0, /* checksum */
};
-/*
- * Bandwidth meter variables and constants
- */
-
-/*
- * Pending timeouts are stored in a hash table, the key being the
- * expiration time. Periodically, the entries are analysed and processed.
- */
-#define BW_METER_BUCKETS 1024
-static struct bw_meter *bw_meter_timers[BW_METER_BUCKETS];
-struct timeout bw_meter_ch;
-#define BW_METER_PERIOD 1000 /* periodical handling of bw meters (in ms) */
-
-/*
- * Pending upcalls are stored in a vector which is flushed when
- * full, or periodically
- */
-static struct bw_upcallbw_upcalls[BW_UPCALLS_MAX];
-static u_int bw_upcalls_n; /* # of pending upcalls */
-struct timeout bw_upcalls_ch;
-#define BW_UPCALLS_PERIOD 1000 /* periodical flush of bw upcalls (in ms) */
-
#ifdef PIM
struct pimstat pimstat;
@@ -305,8 +268,7 @@ static int pim_assert;
*/
static const u_int32_t mrt_api_support = (MRT_MFC_FLAGS_DISABLE_WRONGVIF |
MRT_MFC_FLAGS_BORDER_VIF |
- MRT_MFC_RP |
- MRT_MFC_BW_UPCALL);
+ MRT_MFC_RP);
static u_int32_t mrt_api_config = 0;
/*
@@ -389,12 +351,6 @@ ip_mrouter_set(struct socket *so, int op
case MRT_API_CONFIG:
error = set_api_config(*m);
break;
- case MRT_ADD_BW_UPCALL:
- error = add_bw_upcall(*m);
- break;
- case MRT_DEL_BW_UPCALL:
- error = del_bw_upcall(*m);
- break;
default:
error = ENOPROTOOPT;
break;
@@ -549,12 +505,6 @@ ip_mrouter_init(struct socket *so, struc
timeout_set(expire_upcalls_ch, expire_upcalls, NULL);
timeout_add_msec(expire_upcalls_ch, EXPIRE_TIMEOUT);
- timeout_set(bw_upcalls_ch, expire_bw_upcalls_send, NULL);
- timeout_add_msec(bw_upcalls_ch, BW_UPCALLS_PERIOD);
-
- timeout_set(bw_meter_ch, expire_bw_meter_process, NULL);
- timeout_add_msec(bw_meter_ch, BW_METER_PERIOD);
-
if (mrtdebug)
log(LOG_DEBUG, ip_mrouter_init\n);
@@ -586,8 +536,6 @@ ip_mrouter_done()
mrt_api_config = 0;
timeout_del(expire_upcalls_ch);
- timeout_del(bw_upcalls_ch);
- timeout_del(bw_meter_ch);
/*
* Free all multicast forwarding cache entries.
@@ -606,9 +554,6 @@ ip_mrouter_done()
free(mfchashtbl, M_MRTABLE, 0);
mfchashtbl = NULL;
- bw_upcalls_n = 0;
- memset(bw_meter_timers, 0, sizeof(bw_meter_timers));
-
/* Reset de-encapsulation cache. */
have_encap_tunnel = 0;
@@ -1015,8 +960,6 @@ expire_mfc(struct mfc *rt)
{
struct rtdetq *rte, *nrte;
- free_bw_list(rt-mfc_bw_meter);
-
for (rte = rt-mfc_stall; rte != NULL; rte = nrte) {
nrte = rte-next;
m_freem(rte-m);
@@ -1156,7 +1099,6 @@ add_mfc(struct mbuf *m)
init_mfc_params(rt, mfccp);
rt-mfc_expire = 0;
rt-mfc_stall = NULL;
-