summaryrefslogtreecommitdiffstats
path: root/src/payload.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2015-08-04 12:29:50 +0200
committerFlorian Westphal <fw@strlen.de>2015-09-18 00:05:05 +0200
commit61ae81a313023e0b790594491bc030c06a3c0eab (patch)
tree83d304164963924301e13391e5f37c52e20625ad /src/payload.c
parent7ead4932f9ab00fdb8a2cc339b41ee2f5aee441e (diff)
payload: disable payload merge if offsets are not on byte boundary.
... because it doesn't work, we attempt to merge it into wrong place, we would have to merge the second value at a specific location. F.e. vlan hdr 4094 gives us 0xfe0f Merging in the CFI should yield 0xfe1f, but the constant merging doesn't know how to achive that; at the moment 'vlan id 4094' and 'vlan id 4094 vlan cfi 1' give same result -- 0xfe0f. For now just turn off the optimization step unless everything is byte divisible (the common case). Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/payload.c')
-rw-r--r--src/payload.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/payload.c b/src/payload.c
index 62f1d56d..880b5d0d 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -357,6 +357,10 @@ raw:
*/
bool payload_is_adjacent(const struct expr *e1, const struct expr *e2)
{
+ if (e1->payload.offset % BITS_PER_BYTE || e1->len % BITS_PER_BYTE ||
+ e2->payload.offset % BITS_PER_BYTE || e2->len % BITS_PER_BYTE)
+ return false;
+
if (e1->payload.base == e2->payload.base &&
e1->payload.offset + e1->len == e2->payload.offset)
return true;