Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Dec 2013 21:52:59 GMT
From:      Sven-Thorsten Dietrich <sven@vyatta.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/185148: Cleanup ip6_mroute.c
Message-ID:  <201312232152.rBNLqxvU046255@oldred.freebsd.org>
Resent-Message-ID: <201312232200.rBNM00NW074595@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312232152.rBNLqxvU046255>