Skip to contentSkip to conversation

Fix icmp_id setter and doc

PATCH Applied Phil Dibowitz 2 participants 2 messages Mar 16, 2007 – Mar 17, 2007 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix icmp_id setter and doc

ICMP ID is stored as a u_int16_t, but its setter function derefs it's arguement as a u_int8_t. Additionally the api "doc" claims it's a u8, when it's not.

This patch fixes both.

Signature · 9 lines
Phil Dibowitz                             [email protected]
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming
include/libnetfilter_conntrack/libnetfilter_conntrack.h renamed from include/libnetfilter_conntrack/libnetfilter_conntrack.h.orig +1 -1
@@ -359,7 +359,7 @@
 	ATTR_REPL_PORT_DST,		/* u16 bits */
 	ATTR_ICMP_TYPE = 12,		/* u8 bits */
 	ATTR_ICMP_CODE,			/* u8 bits */
-	ATTR_ICMP_ID,			/* u8 bits */
+	ATTR_ICMP_ID,			/* u16 bits */
 	ATTR_ORIG_L3PROTO,		/* u8 bits */
 	ATTR_REPL_L3PROTO = 16,		/* u8 bits */
 	ATTR_ORIG_L4PROTO,		/* u8 bits */
src/conntrack/setter.c renamed from src/conntrack/setter.c.orig +1 -1
@@ -79,7 +79,7 @@
 
 static void set_attr_icmp_id(struct nf_conntrack *ct, const void *value)
 {
-	ct->tuple[__DIR_ORIG].l4src.icmp.id = *((u_int8_t *) value);
+	ct->tuple[__DIR_ORIG].l4src.icmp.id = *((u_int16_t *) value);
 }
 
 static void set_attr_orig_l3proto(struct nf_conntrack *ct, const void *value)
#1 lore raw
Quoted 3 lines · Phil Dibowitz

ICMP ID is stored as a u_int16_t, but its setter function derefs it's arguement as a u_int8_t. Additionally the api "doc" claims it's a u8, when it's not.

Applied, thanks.