Commit f3eb2093 authored by Phil Oester's avatar Phil Oester Committed by Patrick McHardy

[NETFILTER]: Add inversion to multiport match

Should add this to rev1 of multiport before 2.6.11 comes out.
Signed-off-by: default avatarPhil Oester <kernel@linuxace.com>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent a8435ac8
......@@ -25,5 +25,6 @@ struct ipt_multiport_v1
u_int8_t count; /* Number of ports */
u_int16_t ports[IPT_MULTI_PORTS]; /* Ports */
u_int8_t pflags[IPT_MULTI_PORTS]; /* Port flags */
u_int8_t invert; /* Invert flag */
};
#endif /*_IPT_MULTIPORT_H*/
......@@ -64,30 +64,31 @@ ports_match_v1(const struct ipt_multiport_v1 *minfo,
if (minfo->flags == IPT_MULTIPORT_SOURCE
&& src >= s && src <= e)
return 1;
return 1 ^ minfo->invert;
if (minfo->flags == IPT_MULTIPORT_DESTINATION
&& dst >= s && dst <= e)
return 1;
return 1 ^ minfo->invert;
if (minfo->flags == IPT_MULTIPORT_EITHER
&& ((dst >= s && dst <= e)
|| (src >= s && src <= e)))
return 1;
return 1 ^ minfo->invert;
} else {
/* exact port matching */
duprintf("src or dst matches with %d?\n", s);
if (minfo->flags == IPT_MULTIPORT_SOURCE
&& src == s)
return 1;
return 1 ^ minfo->invert;
if (minfo->flags == IPT_MULTIPORT_DESTINATION
&& dst == s)
return 1;
return 1 ^ minfo->invert;
if (minfo->flags == IPT_MULTIPORT_EITHER
&& (src == s || dst == s))
return 1;
return 1 ^ minfo->invert;
}
}
return 0;
return minfo->invert;
}
static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment