Hello,
On Mon, Jan 04, 2021 at 01:57:24PM +0100, Alexander Bluhm wrote:
> On Mon, Jan 04, 2021 at 11:46:16AM +0100, Alexandr Nedvedicky wrote:
> > > let's put this in and then i'll have a look. ok by me.
> > bluhm's diff is fine with me.
>
> Refactoring is commited, here is the remaining kernel diff after merge.
>
> bluhm
>
</snip>
> Index: net/pf.c
> ===================================================================
> RCS file: /cvs/src/sys/net/pf.c,v
> retrieving revision 1.1097
> diff -u -p -r1.1097 pf.c
> --- net/pf.c 4 Jan 2021 12:48:27 -0000 1.1097
> +++ net/pf.c 4 Jan 2021 12:52:02 -0000
> @@ -1122,12 +1122,6 @@ pf_find_state(struct pf_pdesc *pd, struc
> }
>
> *state = s;
> - if (pd->dir == PF_OUT && s->rt_kif != NULL && s->rt_kif != pd->kif &&
> - ((s->rule.ptr->rt == PF_ROUTETO &&
> - s->rule.ptr->direction == PF_OUT) ||
> - (s->rule.ptr->rt == PF_REPLYTO &&
> - s->rule.ptr->direction == PF_IN)))
> - return (PF_PASS);
>
> return (PF_MATCH);
> }
I've sent OK to dlg for the chunk above. I think it's worth to have this
fix in separate changeset.
you refactoring diff requires a minor finishing touch to keep the
stuff compiling:
----8<-------8<-------8<-------8<-------8<------------8<----
diff --git a/sys/net/pf.c b/sys/net/pf.c
index b8766df1686..3f9f5b13add 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -3428,16 +3428,13 @@ pf_set_rt_ifp(struct pf_state *s, struct pf_addr
*saddr, sa_family_t af,
struct pf_rule *r = s->rule.ptr;
int rv;
- s->rt_kif = NULL;
if (!r->rt)
return (0);
rv = pf_map_addr(af, r, saddr, &s->rt_addr, NULL, sns,
&r->route, PF_SN_ROUTE);
- if (rv == 0) {
- s->rt_kif = r->route.kif;
+ if (rv == 0)
s->natrule.ptr = r;
- }
return (rv);
}
----8<-------8<-------8<-------8<-------8<------------8<----
thanks and
regards
sashan