[PATCH] wrong SNAT behaviour in kernels 2.2.X

From: willy tarreau (wtarreau@yahoo.fr)
Date: Wed Sep 13 2000 - 09:45:43 EST


Hi Alexey,

I recently came across a rather strange thing using
source NAT with ip rule : if the packets to be
translated are matched ONLY by <fwmark>, and no
<from prefix> is specified, the resulting address will
be the original one ORed with the new desired one.
This
is because the <srcmask> field is NULL, and the
<srcmap> simply reflects the <to prefix>. Thus, it
prevents NAT from being done from fwmark alone, which
is correct from what "ip rule help" states.

Since having an srcmask of 0 is obviously non-sense,
I've slightly patched the code to make it use exactly
the <to prefix> as new source addr in case of a zero
mask. The one-liner patch is attached here.

I know several people who use it as-is on their
firewalls because they didn't find any other way to do
so, and I think this should and could be applied to
2.2.18 with no risk at all.

Regards,

Willy

___________________________________________________________
Do You Yahoo!?
Achetez, vendez! À votre prix! Sur http://encheres.yahoo.fr


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Sep 15 2000 - 21:00:21 EST