Index | Thread | Search

From:
Jan Klemkow <jan@openbsd.org>
Subject:
ip_mroute: remove unused parameter
To:
tech@openbsd.org
Date:
Sun, 18 May 2025 04:55:34 +0200

Download raw body.

Thread
Hi,

This diff removed unused origin parameter from mfc_find().  The
simplification of mfc_find() in revision 1.106 renamed the paramter o to
origin, but also removed every usage.

The IPv6 multicast code has more of this issues and comes in another
diff.

ok?

bye,
Jan

Index: netinet/ip_mroute.c
===================================================================
RCS file: /cvs/src/sys/netinet/ip_mroute.c,v
diff -u -p -r1.145 ip_mroute.c
--- netinet/ip_mroute.c	9 May 2025 14:43:47 -0000	1.145
+++ netinet/ip_mroute.c	18 May 2025 02:16:09 -0000
@@ -103,8 +103,7 @@ int		ip_mrtproto = IGMP_DVMRP;    /* for
 
 struct cpumem *mrtcounters;
 
-struct rtentry	*mfc_find(struct ifnet *, struct in_addr *,
-    struct in_addr *, unsigned int);
+struct rtentry	*mfc_find(struct ifnet *, struct in_addr *, unsigned int);
 int get_sg_cnt(unsigned int, struct sioc_sg_req *);
 int get_vif_cnt(unsigned int, struct sioc_vif_req *);
 int mrt_rtwalk_mfcsysctl(struct rtentry *, void *, unsigned int);
@@ -140,14 +139,13 @@ static const u_int32_t mrt_api_support =
 static u_int32_t mrt_api_config = 0;
 
 /*
- * Find a route for a given origin IP address and Multicast group address
+ * Find a route for a given Multicast group address.
  * Type of service parameter to be added in the future!!!
  * Statistics are updated by the caller if needed (mrts_mfc_lookups and
  * mrts_mfc_misses)
  */
 struct rtentry *
-mfc_find(struct ifnet *ifp, struct in_addr *origin, struct in_addr *group,
-    unsigned int rtableid)
+mfc_find(struct ifnet *ifp, struct in_addr *group, unsigned int rtableid)
 {
 	struct rtentry		*rt;
 	struct sockaddr_in	 msin;
@@ -308,7 +306,7 @@ get_sg_cnt(unsigned int rtableid, struct
 	struct rtentry *rt;
 	struct mfc *mfc;
 
-	rt = mfc_find(NULL, &req->src, &req->grp, rtableid);
+	rt = mfc_find(NULL, &req->grp, rtableid);
 	if (rt == NULL) {
 		req->pktcnt = req->bytecnt = req->wrong_if = 0xffffffff;
 		return (EADDRNOTAVAIL);
@@ -923,8 +921,7 @@ update_mfc_params(struct mfcctl2 *mfccp,
 		if ((ifp = if_lookupbyvif(i, rtableid)) == NULL)
 			continue;
 
-		rt = mfc_find(ifp, &mfccp->mfcc_origin,
-		    &mfccp->mfcc_mcastgrp, rtableid);
+		rt = mfc_find(ifp, &mfccp->mfcc_mcastgrp, rtableid);
 
 		/* vif not configured or removed. */
 		if (mfccp->mfcc_ttls[i] == 0) {
@@ -978,8 +975,7 @@ update_mfc_params(struct mfcctl2 *mfccp,
 	}
 
 	/* We already have a route, nothing to do here. */
-	if ((rt = mfc_find(ifp, &mfccp->mfcc_origin,
-	    &mfccp->mfcc_mcastgrp, rtableid)) != NULL) {
+	if ((rt = mfc_find(ifp, &mfccp->mfcc_mcastgrp, rtableid)) != NULL) {
 		rtfree(rt);
 		return;
 	}
@@ -1080,8 +1076,7 @@ del_mfc(struct socket *so, struct mbuf *
 	DPRINTF("origin %#08X group %#08X rtableid %d",
 	    mfcctl2.mfcc_origin.s_addr, mfcctl2.mfcc_mcastgrp.s_addr, rtableid);
 
-	while ((rt = mfc_find(NULL, &mfcctl2.mfcc_origin,
-	    &mfcctl2.mfcc_mcastgrp, rtableid)) != NULL) {
+	while ((rt = mfc_find(NULL, &mfcctl2.mfcc_mcastgrp, rtableid)) != NULL) {
 		mrt_mcast_del(rt, rtableid);
 		rtfree(rt);
 	}
@@ -1160,7 +1155,7 @@ ip_mforward(struct mbuf *m, struct ifnet
 	 * Determine forwarding vifs from the forwarding cache table
 	 */
 	mrtstat_inc(mrts_mfc_lookups);
-	rt = mfc_find(NULL, &ip->ip_src, &ip->ip_dst, rtableid);
+	rt = mfc_find(NULL, &ip->ip_dst, rtableid);
 
 	/* Entry exists, so forward if necessary */
 	if (rt != NULL) {
@@ -1376,7 +1371,7 @@ rt_mcast_add(struct ifnet *ifp, struct s
 
 	mrt_count[rtableid]++;
 
-	return (mfc_find(ifp, NULL, &satosin(group)->sin_addr, rtableid));
+	return (mfc_find(ifp, &satosin(group)->sin_addr, rtableid));
 }
 
 void