Bug #40

PF routing broken

Added by joerg over 9 years ago. Updated over 8 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

Hi all,
I don't have time to fix this at the moment, but using e.g. dup-to in a
PF ruleset is hitting the serialiser assertion directly.

Joerg

History

#1 Updated by dillon over 9 years ago

:
:Hi all,
:I don't have time to fix this at the moment, but using e.g. dup-to in a
:PF ruleset is hitting the serialiser assertion directly.
:
:Joerg

Post a kernel backtrace. It should be easy to fix (but it may not make
it into the release since I am rolling the ISO tonight).

-Matt
Matthew Dillon
<>

#2 Updated by corecode over 9 years ago

Matthew Dillon wrote:
> :I don't have time to fix this at the moment, but using e.g. dup-to in a
> :PF ruleset is hitting the serialiser assertion directly.
> Post a kernel backtrace. It should be easy to fix (but it may not make
> it into the release since I am rolling the ISO tonight).

I had the pleasure to experience this with ipf+if_bridge today. Of
course the ruleset wasn't what i had intended, but yet this works with
oldbridge...

cheers
simon

#0 dumpsys () at /usr/src/sys/kern/kern_shutdown.c:527
#1 0xc01970f2 in boot (howto=256) at /usr/src/sys/kern/kern_shutdown.c:360
#2 0xc01975b6 in panic (fmt=0xc02d14bc "assertion: s->last_td !=
curthread in %s")
at /usr/src/sys/kern/kern_shutdown.c:673
#3 0xc019ecdb in lwkt_serialize_enter (s=0xc507b95c) at
/usr/src/sys/kern/lwkt_serialize.c:77
#4 0xc01f08ef in bridge_output_serialized (ifp=0xc507b540,
m=0xc5754b00, sa=0x0, rt=0x0)
at /usr/src/sys/net/bridge/if_bridge.c:1226
#5 0xc01f6bf0 in ether_output (ifp=0xc507b540, m=0xc5754b00,
dst=0xc0a0a450, rt=0xc5063190)
at /usr/src/sys/net/if_ethersubr.c:316
#6 0xc013d7f8 in ipfr_fastroute (m0=0xc5754b00, mpp=0xc50a5b84,
fin=0xc50a5ae4, fdp=0xc50034a4)
at /usr/src/sys/contrib/ipfilter/netinet/ip_fil.c:1847
#7 0xc0139f43 in fr_check (ip=0xc5779820, hlen=20, ifp=0xc507b2c0,
out=0, mp=0xc50a5b84)
at /usr/src/sys/contrib/ipfilter/netinet/fil.c:1379
#8 0xc013b718 in fr_check_wrapper (arg=0x0, mp=0x0, ifp=0x0, dir=1)
at /usr/src/sys/contrib/ipfilter/netinet/ip_fil.c:321
#9 0xc01f7dc1 in pfil_run_hooks (ph=0xc0323180, mp=0xc50a5c30,
ifp=0xc507b2c0, dir=1)
at /usr/src/sys/net/pfil.c:67
#10 0xc01f1e48 in bridge_pfil (mp=0xc50a5c30, bifp=0xc507b7c0,
ifp=0xc507b2c0, dir=1)
at /usr/src/sys/net/bridge/if_bridge.c:2213
#11 0xc01f0e81 in bridge_forward (sc=0xc507b7c0, m=0xc5754b00)
at /usr/src/sys/net/bridge/if_bridge.c:1443
#12 0xc01f1367 in bridge_input (ifp=0xc507b2c0, m=0xc5754b00)
at /usr/src/sys/net/bridge/if_bridge.c:1647
#13 0xc01f7435 in ether_input (ifp=0xc507b2c0, eh=0xc5779812, m=0xc5754b00)
at /usr/src/sys/net/if_ethersubr.c:618
#14 0xc01f7340 in ether_input_internal (ifp=0x0, m=0x0) at
/usr/src/sys/net/if_ethersubr.c:552
#15 0xc01651da in fxp_intr_body (sc=0xc507b2c0, statack=64 '@', count=-1)
at /usr/src/sys/dev/netif/fxp/if_fxp.c:1359
#16 0xc0165058 in fxp_intr (xsc=0xc507b2c0) at
/usr/src/sys/dev/netif/fxp/if_fxp.c:1231
#17 0xc019ee51 in lwkt_serialize_handler_call (s=0xc507b45c,
func=0xc0165002 <fxp_intr>, arg=0x0,
frame=0x0) at /usr/src/sys/kern/lwkt_serialize.c:145
#18 0xc017c044 in ithread_handler (arg=0xc) at
/usr/src/sys/kern/kern_intr.c:755
#19 0xc019d90b in lwkt_create (func=0, arg=0x0, tdp=0xc0310764,
template=0x0, tdflags=---Can't read
userspace from dump, or kernel process---

#3 Updated by dillon over 9 years ago

:I had the pleasure to experience this with ipf+if_bridge today. Of
:course the ruleset wasn't what i had intended, but yet this works with
:oldbridge...
:
:cheers
: simon

Please try this patch. This patch releases the serializer on
ifp before calling any IPF functions. Before it was only conditionally
releasing the serializer in certain cases.

-Matt

Index: if_bridge.c
===================================================================
RCS file: /cvs/src/sys/net/bridge/if_bridge.c,v
retrieving revision 1.4
diff -u -r1.4 if_bridge.c
--- if_bridge.c 14 Jan 2006 11:05:17 -0000 1.4
+++ if_bridge.c 17 Jan 2006 20:12:28 -0000
@@ -1391,6 +1391,12 @@
eh = mtod(m, struct ether_header *);

/*
+ * Various ifp's are used below, release the serializer for
+ * the bridge ifp so other ifp serializers can be acquired.
+ */
+ lwkt_serialize_exit(ifp->if_serializer);
+
+ /*
* If the interface is learning, and the source
* address is valid and not multicast, record
* the address.
@@ -1409,7 +1415,7 @@
if ((bif->bif_flags & IFBIF_STP) != 0 &&
bif->bif_state == BSTP_IFSTATE_LEARNING) {
m_freem(m);
- return;
+ goto done;
}

/*
@@ -1425,7 +1431,7 @@
dst_if = bridge_rtlookup(sc, eh->ether_dhost);
if (src_if == dst_if) {
m_freem(m);
- return;
+ goto done;
}
} else {
/* ...forward it to all interfaces. */
@@ -1440,16 +1446,14 @@
#endif
) {
if (bridge_pfil(&m, ifp, src_if, PFIL_IN) != 0)
- return;
+ goto done;
if (m == NULL)
- return;
+ goto done;
}

if (dst_if == NULL) {
- lwkt_serialize_exit(ifp->if_serializer);
bridge_broadcast(sc, src_if, m, 1);
- lwkt_serialize_enter(ifp->if_serializer);
- return;
+ goto done;
}

/*
@@ -1458,13 +1462,13 @@
*/
if ((dst_if->if_flags & IFF_RUNNING) == 0) {
m_freem(m);
- return;
+ goto done;
}
bif = bridge_lookup_member_if(sc, dst_if);
if (bif == NULL) {
/* Not a member of the bridge (anymore?) */
m_freem(m);
- return;
+ goto done;
}

if (bif->bif_flags & IFBIF_STP) {
@@ -1472,7 +1476,7 @@
case BSTP_IFSTATE_DISABLED:
case BSTP_IFSTATE_BLOCKING:
m_freem(m);
- return;
+ goto done;
}
}

@@ -1482,12 +1486,17 @@
#endif
) {
if (bridge_pfil(&m, sc->sc_ifp, dst_if, PFIL_OUT) != 0)
- return;
+ goto done;
if (m == NULL)
- return;
+ goto done;
}
- lwkt_serialize_exit(ifp->if_serializer);
bridge_enqueue(sc, dst_if, m);
+
+ /*
+ * ifp's serializer was held on entry and is expected to be held
+ * on return.
+ */
+done:
lwkt_serialize_enter(ifp->if_serializer);
}

Also available in: Atom PDF