summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2002-09-13 06:24:27 +0000
committersobomax <sobomax@FreeBSD.org>2002-09-13 06:24:27 +0000
commit671ab71ae0d88f09553e46463e776041bc0db863 (patch)
treee38450e2a703b49ec9f6252e0397a117d05d9c14 /sys/net
parent44b216d9353b8b1e6f5e87db67b08724cc32eb4f (diff)
downloadFreeBSD-src-671ab71ae0d88f09553e46463e776041bc0db863.zip
FreeBSD-src-671ab71ae0d88f09553e46463e776041bc0db863.tar.gz
Restore original behaviour of recursion preventer.
Submitted by: sumikawa
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_gif.c11
-rw-r--r--sys/net/if_gif.h1
2 files changed, 7 insertions, 5 deletions
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index c5da47c..784c687 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -201,7 +201,6 @@ gif_clone_create(ifc, unit)
sc->gif_if.if_output = gif_output;
sc->gif_if.if_type = IFT_GIF;
sc->gif_if.if_snd.ifq_maxlen = IFQ_MAXLEN;
- sc->called = 0;
if_attach(&sc->gif_if);
bpfattach(&sc->gif_if, DLT_NULL, sizeof(u_int));
if (ng_gif_attach_p != NULL)
@@ -341,6 +340,7 @@ gif_output(ifp, m, dst, rt)
{
struct gif_softc *sc = (struct gif_softc*)ifp;
int error = 0;
+ static int called = 0; /* XXX: MUTEX */
#ifdef MAC
error = mac_check_ifnet_transmit(ifp, m);
@@ -353,11 +353,14 @@ gif_output(ifp, m, dst, rt)
/*
* gif may cause infinite recursion calls when misconfigured.
* We'll prevent this by introducing upper limit.
+ * XXX: this mechanism may introduce another problem about
+ * mutual exclusion of the variable CALLED, especially if we
+ * use kernel thread.
*/
- if (++(sc->called) > max_gif_nesting) {
+ if (++called > max_gif_nesting) {
log(LOG_NOTICE,
"gif_output: recursively called too many times(%d)\n",
- sc->called);
+ called);
m_freem(m);
error = EIO; /* is there better errno? */
goto end;
@@ -414,7 +417,7 @@ gif_output(ifp, m, dst, rt)
}
end:
- sc->called = 0; /* reset recursion counter */
+ called = 0; /* reset recursion counter */
if (error)
ifp->if_oerrors++;
return error;
diff --git a/sys/net/if_gif.h b/sys/net/if_gif.h
index 51e28db..1d02348 100644
--- a/sys/net/if_gif.h
+++ b/sys/net/if_gif.h
@@ -69,7 +69,6 @@ struct gif_softc {
const struct encaptab *encap_cookie4;
const struct encaptab *encap_cookie6;
void *gif_netgraph; /* ng_gif(4) netgraph node info */
- int called; /* anti foot-shooter */
LIST_ENTRY(gif_softc) gif_link; /* all gif's are linked */
};
OpenPOWER on IntegriCloud