Changeset View
Changeset View
Standalone View
Standalone View
sys/netpfil/pf/pf.c
Show First 20 Lines • Show All 5,482 Lines • ▼ Show 20 Lines | if ((pd->pf_mtag == NULL && | ||||
((pd->pf_mtag = pf_get_mtag(*m)) == NULL)) || | ((pd->pf_mtag = pf_get_mtag(*m)) == NULL)) || | ||||
pd->pf_mtag->routed++ > 3) { | pd->pf_mtag->routed++ > 3) { | ||||
m0 = *m; | m0 = *m; | ||||
*m = NULL; | *m = NULL; | ||||
goto bad_locked; | goto bad_locked; | ||||
} | } | ||||
if (r->rt == PF_DUPTO) { | if (r->rt == PF_DUPTO) { | ||||
if ((m0 = m_dup(*m, M_NOWAIT)) == NULL) { | if ((pd->pf_mtag->flags & PF_DUPLICATED)) { | ||||
if (s == NULL) { | |||||
ifp = r->rpool.cur->kif ? | |||||
r->rpool.cur->kif->pfik_ifp : NULL; | |||||
} else { | |||||
ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; | |||||
PF_STATE_UNLOCK(s); | |||||
} | |||||
if (ifp == oifp) { | |||||
/* When the 2nd interface is not skipped */ | |||||
return; | |||||
} else { | |||||
m0 = *m; | |||||
*m = NULL; | |||||
goto bad; | |||||
} | |||||
} else { | |||||
pd->pf_mtag->flags |= PF_DUPLICATED; | |||||
if (((m0 = m_dup(*m, M_NOWAIT)) == NULL)) { | |||||
if (s) | if (s) | ||||
PF_STATE_UNLOCK(s); | PF_STATE_UNLOCK(s); | ||||
return; | return; | ||||
} | } | ||||
} | |||||
} else { | } else { | ||||
if ((r->rt == PF_REPLYTO) == (r->direction == dir)) { | if ((r->rt == PF_REPLYTO) == (r->direction == dir)) { | ||||
if (s) | if (s) | ||||
PF_STATE_UNLOCK(s); | PF_STATE_UNLOCK(s); | ||||
return; | return; | ||||
} | } | ||||
m0 = *m; | m0 = *m; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | if ((pd->pf_mtag == NULL && | ||||
((pd->pf_mtag = pf_get_mtag(*m)) == NULL)) || | ((pd->pf_mtag = pf_get_mtag(*m)) == NULL)) || | ||||
pd->pf_mtag->routed++ > 3) { | pd->pf_mtag->routed++ > 3) { | ||||
m0 = *m; | m0 = *m; | ||||
*m = NULL; | *m = NULL; | ||||
goto bad_locked; | goto bad_locked; | ||||
} | } | ||||
if (r->rt == PF_DUPTO) { | if (r->rt == PF_DUPTO) { | ||||
if ((m0 = m_dup(*m, M_NOWAIT)) == NULL) { | if ((pd->pf_mtag->flags & PF_DUPLICATED)) { | ||||
if (s == NULL) { | |||||
ifp = r->rpool.cur->kif ? | |||||
r->rpool.cur->kif->pfik_ifp : NULL; | |||||
} else { | |||||
ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; | |||||
PF_STATE_UNLOCK(s); | |||||
} | |||||
if (ifp == oifp) { | |||||
/* When the 2nd interface is not skipped */ | |||||
return; | |||||
kp: Why this check? Why not set the PF_DUPLICATED flag in the case we actually duplicate?
(Also… | |||||
Not Done Inline Actions
For me there are three different cases: the PF_DUPLICATED flag is used to check if we are in case 2 or in case 3.
I usually compare the if_index variables but you're right, we can compare oifp directly yannis.planus_alstomgroup.com: > Why this check? Why not set the PF_DUPLICATED flag in the case we actually duplicate?
For me… | |||||
} else { | |||||
m0 = *m; | |||||
*m = NULL; | |||||
goto bad; | |||||
} | |||||
} else { | |||||
pd->pf_mtag->flags |= PF_DUPLICATED; | |||||
if (((m0 = m_dup(*m, M_NOWAIT)) == NULL)) { | |||||
if (s) | if (s) | ||||
PF_STATE_UNLOCK(s); | PF_STATE_UNLOCK(s); | ||||
return; | return; | ||||
} | |||||
} | } | ||||
} else { | } else { | ||||
if ((r->rt == PF_REPLYTO) == (r->direction == dir)) { | if ((r->rt == PF_REPLYTO) == (r->direction == dir)) { | ||||
if (s) | if (s) | ||||
PF_STATE_UNLOCK(s); | PF_STATE_UNLOCK(s); | ||||
return; | return; | ||||
} | } | ||||
m0 = *m; | m0 = *m; | ||||
▲ Show 20 Lines • Show All 1,024 Lines • Show Last 20 Lines |
Why this check? Why not set the PF_DUPLICATED flag in the case we actually duplicate?
(Also, why not just oifp == s->rt_kif->pfik_ifp?)