From: Russell Howe Subject: Re: Small mrouted improvements To: tech@openbsd.org Date: Sat, 18 Jul 2026 08:46:25 +0100 On Wed, Jul 15, 2026 at 04:39:11PM +0200, Alexander Bluhm wrote: > On Sun, Jun 28, 2026 at 12:48:34PM +0100, Russell Howe wrote: > > I saw a couple of opportunities to improve mrouted's output. > > > > First, if SIOCGETVIFCNT fails, it's useful to know the error code and > > which vif it failed for: > > > > I have commited this part. Thanks! > > Second, when logging the ratelimit for a multicast peer, include the > > units. > > > > Man page says unit is kilo bit per second. > Kernel feature was removed here: > https://github.com/openbsd/src/commit/9500e0064b973fbd2fac185909ed03e90413f2e2 > > Would it be better to remove the remains of rate limit in the daemon? Indeed it would. Tunnel support was also removed, so I'll prep a patch for that too. Whitespace in the mrouted source is a bit all over the place, with a mix of tabs and spaces somewhat at random - do we want to do anything about that? Here's the removal of ratelimit support: diff --git usr.sbin/mrouted/cfparse.y usr.sbin/mrouted/cfparse.y index d8872cfb9ca..f5b81aff53d 100644 --- usr.sbin/mrouted/cfparse.y +++ usr.sbin/mrouted/cfparse.y @@ -87,7 +87,7 @@ int numbounds = 0; /* Number of named boundaries */ %token CACHE_LIFETIME PRUNING %token PHYINT TUNNEL NAME %token DISABLE IGMPV1 SRCRT -%token METRIC THRESHOLD RATE_LIMIT BOUNDARY NETMASK ALTNET +%token METRIC THRESHOLD BOUNDARY NETMASK ALTNET %token BOOLEAN %token NUMBER %token STRING @@ -171,7 +171,6 @@ stmt : error v = &uvifs[numvifs]; v->uv_flags = VIFF_TUNNEL; v->uv_metric = DEFAULT_METRIC; - v->uv_rate_limit= DEFAULT_TUN_RATE_LIMIT; v->uv_threshold = DEFAULT_THRESHOLD; v->uv_lcl_addr = $2; v->uv_rmt_addr = $3; @@ -192,9 +191,8 @@ stmt : error tunnelmods { logit(LOG_INFO, 0, - "installing tunnel from %s to %s as vif #%u - rate=%d", - inet_fmt($2, s1), inet_fmt($3, s2), - numvifs, v->uv_rate_limit); + "installing tunnel from %s to %s as vif #%u", + inet_fmt($2, s1), inet_fmt($3, s2), numvifs); ++numvifs; } @@ -286,15 +284,6 @@ mod : THRESHOLD NUMBER { if ($2 < 1 || $2 > 255) warn("Expected number after metric keyword, ignored"); - } - | RATE_LIMIT NUMBER { if ($2 > MAX_RATE_LIMIT) - fatal("Invalid rate_limit %d",$2); - v->uv_rate_limit = $2; - } - | RATE_LIMIT { - - warn("Expected number after rate_limit keyword, ignored"); - } | BOUNDARY bound { @@ -463,8 +452,6 @@ yylex(void) return METRIC; if (!strcmp(q,"threshold")) return THRESHOLD; - if (!strcmp(q,"rate_limit")) - return RATE_LIMIT; if (!strcmp(q,"srcrt") || !strcmp(q,"sourceroute")) return SRCRT; if (!strcmp(q,"boundary")) diff --git usr.sbin/mrouted/config.c usr.sbin/mrouted/config.c index 9ba913f577f..d66bfbe5e34 100644 --- usr.sbin/mrouted/config.c +++ usr.sbin/mrouted/config.c @@ -88,7 +88,6 @@ config_vifs_from_kernel(void) v = &uvifs[numvifs]; v->uv_flags = 0; v->uv_metric = DEFAULT_METRIC; - v->uv_rate_limit = DEFAULT_PHY_RATE_LIMIT; v->uv_threshold = DEFAULT_THRESHOLD; v->uv_lcl_addr = addr; v->uv_rmt_addr = 0; @@ -101,9 +100,9 @@ config_vifs_from_kernel(void) v->uv_acl = NULL; v->uv_addrs = NULL; - logit(LOG_INFO,0,"installing %s (%s on subnet %s) as vif #%u - rate=%d", + logit(LOG_INFO,0,"installing %s (%s on subnet %s) as vif #%u", v->uv_name, inet_fmt(addr, s1), inet_fmts(subnet, mask, s2), - numvifs, v->uv_rate_limit); + numvifs); ++numvifs; diff --git usr.sbin/mrouted/dvmrp.h usr.sbin/mrouted/dvmrp.h index 18cc3732a34..7f168e9a397 100644 --- usr.sbin/mrouted/dvmrp.h +++ usr.sbin/mrouted/dvmrp.h @@ -163,10 +163,6 @@ #define DEFAULT_METRIC 1 /* default subnet/tunnel metric */ #define DEFAULT_THRESHOLD 1 /* default subnet/tunnel threshold */ -#define MAX_RATE_LIMIT 100000 /* max rate limit */ -#define DEFAULT_PHY_RATE_LIMIT 0 /* default phyint rate limit */ -#define DEFAULT_TUN_RATE_LIMIT 500 /* default tunnel rate limit */ - #define DEFAULT_CACHE_LIFETIME 300 /* kernel route entry discard time */ #define GRAFT_TIMEOUT_VAL 5 /* retransmission time for grafts */ diff --git usr.sbin/mrouted/kern.c usr.sbin/mrouted/kern.c index 2c0154d3276..ff9d195283b 100644 --- usr.sbin/mrouted/kern.c +++ usr.sbin/mrouted/kern.c @@ -123,7 +123,7 @@ void k_add_vif(vifi_t vifi, struct uvif *v) vc.vifc_vifi = vifi; vc.vifc_flags = v->uv_flags & VIFF_KERNEL_FLAGS; vc.vifc_threshold = v->uv_threshold; - vc.vifc_rate_limit = v->uv_rate_limit; + vc.vifc_rate_limit = 0; vc.vifc_lcl_addr.s_addr = v->uv_lcl_addr; vc.vifc_rmt_addr.s_addr = v->uv_rmt_addr; diff --git usr.sbin/mrouted/mrouted.8 usr.sbin/mrouted/mrouted.8 index 8463f2e508f..f45d1a6f544 100644 --- usr.sbin/mrouted/mrouted.8 +++ usr.sbin/mrouted/mrouted.8 @@ -154,7 +154,6 @@ There are five types of configuration commands: .Op Cm disable .br .Op Cm metric Ar m -.Op Cm rate_limit Ar b .Op Cm threshold Ar t .It .Cm pruning @@ -169,7 +168,6 @@ There are five types of configuration commands: .Ar boundary-name | scoped-addr Ns / Ns Ar mask-len .Oc .Op Cm metric Ar m -.Op Cm rate_limit Ar b .Op Cm threshold Ar t .El .Pp @@ -253,12 +251,6 @@ Metrics should be kept as small as possible, because .Nm cannot route along paths with a sum of metrics greater than 31. .Pp -.Cm rate_limit -allows the network administrator to specify a -certain bandwidth in Kbits/second which would be allocated to multicast -traffic. -It defaults to 500Kbps on tunnels, and 0 (unlimited) on physical interfaces. -.Pp .Cm threshold is the minimum IP time-to-live required for a multicast datagram to be forwarded to the given interface or tunnel. @@ -309,10 +301,7 @@ phyint 172.16.12.38 boundary EE altnet 172.16.15.0/26 phyint atm0 disable # # This is an internal tunnel to another EE subnet. -# Remove the default tunnel rate limit, since this -# tunnel is over Ethernets. tunnel 192.168.5.4 192.168.55.101 metric 1 threshold 1 - rate_limit 0 # # This is our tunnel to the outside world. # Careful with those boundaries, Eugene. diff --git usr.sbin/mrouted/vif.c usr.sbin/mrouted/vif.c index d8ae8805b0d..6cf97c93b18 100644 --- usr.sbin/mrouted/vif.c +++ usr.sbin/mrouted/vif.c @@ -1265,11 +1265,11 @@ dump_vifs(FILE *fp) "\nVirtual Interface Table\n%s", "Vif Name Local-Address "); fprintf(fp, - "M Thr Rate Flags\n"); + "M Thr Flags\n"); for (vifi = 0, v = uvifs; vifi < numvifs; vifi++, v++) { - fprintf(fp, "%2u %6s %-15s %6s: %-18s %2u %3u %5u ", + fprintf(fp, "%2u %6s %-15s %6s: %-18s %2u %3u ", vifi, v->uv_name, inet_fmt(v->uv_lcl_addr, s1), @@ -1280,8 +1280,7 @@ dump_vifs(FILE *fp) inet_fmt(v->uv_rmt_addr, s2) : inet_fmts(v->uv_subnet, v->uv_subnetmask, s3), v->uv_metric, - v->uv_threshold, - v->uv_rate_limit); + v->uv_threshold); if (v->uv_flags & VIFF_ONEWAY) fprintf(fp, " one-way"); if (v->uv_flags & VIFF_DOWN) fprintf(fp, " down"); diff --git usr.sbin/mrouted/vif.h usr.sbin/mrouted/vif.h index bb3a0f05b06..21bfe0453af 100644 --- usr.sbin/mrouted/vif.h +++ usr.sbin/mrouted/vif.h @@ -19,7 +19,6 @@ struct uvif { u_short uv_flags; /* VIFF_ flags defined below */ u_char uv_metric; /* cost of this vif */ - u_int uv_rate_limit; /* rate limit on this vif */ u_char uv_threshold; /* min ttl required to forward on vif */ u_int32_t uv_lcl_addr; /* local address of this vif */ u_int32_t uv_rmt_addr; /* remote end-point addr (tunnels only) */ -- Russell Howe rhowe@siksai.co.uk