kern/185148: Cleanup ip6_mroute.c

Sven-Thorsten Dietrich sven at vyatta.com
Mon Dec 23 22:00:00 UTC 2013


>Number:         185148
>Category:       kern
>Synopsis:       Cleanup ip6_mroute.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 23 22:00:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Sven-Thorsten Dietrich
>Release:        HEAD
>Organization:
Vyatta
>Environment:
N/A
>Description:
The ip6_mforward function has unnecessary nesting.

The first few lines check if a route exists, and if so, forward and return.

The remaining 200 lines of the function are devoted to handling up calls to the route daemon.

There is no need for the indentation.

Rework the code from:

if (rt) {
 		MFC6_UNLOCK();
 		return (ip6_mdq(m, ifp, rt));
} else {
/* 200 lines of necessary indentation */
}

TO:

if (rt) {
 		MFC6_UNLOCK();
 		return (ip6_mdq(m, ifp, rt));
}

/* same 200 lines without the extra tab */

There is no change in functionality and this patch doesn't attempt to join line-breaks.
(to retain clarity -- do that later)
>How-To-Repeat:

>Fix:
apply patch

Patch attached with submission follows:

Subject: Don't count table lookups from add_mfc.
Signed-off-by: Sven-Thorsten Dietrich <thebigcorporation at gmail.com>

Index: sys/netinet6/ip6_mroute.c
===================================================================
--- sys/netinet6/ip6_mroute.c	(revision 256126)
+++ sys/netinet6/ip6_mroute.c	(working copy)
@@ -275,7 +275,6 @@
 #define MF6CFIND(o, g, rt) do { \
 	struct mf6c *_rt = mf6ctable[MF6CHASH(o,g)]; \
 	rt = NULL; \
-	MRT6STAT_INC(mrt6s_mfc_lookups); \
 	while (_rt) { \
 		if (IN6_ARE_ADDR_EQUAL(&_rt->mf6c_origin.sin6_addr, &(o)) && \
 		    IN6_ARE_ADDR_EQUAL(&_rt->mf6c_mcastgrp.sin6_addr, &(g)) && \
@@ -1124,6 +1123,7 @@
 	/*
 	 * Determine forwarding mifs from the forwarding cache table
 	 */
+	MRT6STAT_INC(mrt6s_mfc_lookups);
 	MF6CFIND(ip6->ip6_src, ip6->ip6_dst, rt);
 
 	/* Entry exists, so forward if necessary */


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list