Skip to contentSkip to conversation

fixes for ipt_unclean.c

PATCH In review Harald Welte 2 participants 8 messages Oct 14, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fixes for ipt_unclean.c

Hi Dave!

Below are two fixes for the EXPERIMENTAL ipt_unclean.c

It fixes two bugs:

- packets with UDP sport == 0 are OK according to RFC768
- UDP checksum is optional (old code required packet to have a checksum)

Please apply, thanks.

net/ipv4/netfilter/ipt_unclean.c +1 -1
diff -uNr linux-2.4.19-vanilla/net/ipv4/netfilter/ipt_unclean.c linux/net/ipv4/netfilter/ipt_unclean.c
@@ -211,7 +211,7 @@
 
 	/* Bad checksum?  Don't print, just say it's unclean. */
 	/* FIXME: SRC ROUTE packets won't match checksum --RR */
-	if (!more_frags && !embedded
+	if (!more_frags && !embedded && udph->check
 	    && csum_tcpudp_magic(iph->saddr, iph->daddr, datalen, IPPROTO_UDP,
 				 csum_partial((char *)udph, datalen, 0)) != 0)
 		return 0;
net/ipv4/netfilter/ipt_unclean.c +3 -4
@@ -216,10 +216,9 @@
 				 csum_partial((char *)udph, datalen, 0)) != 0)
 		return 0;
 
-	/* CHECK: Ports can't be zero. */
-	if (!udph->source || !udph->dest) {
-		limpk("UDP zero ports %u/%u\n",
-		      ntohs(udph->source), ntohs(udph->dest));
+	/* CHECK: Destination port can't be zero. */
+	if (!udph->dest) {
+		limpk("UDP zero destination port\n");
 		return 0;
 	}
 
Signature · 5 lines
Live long and prosper
- Harald Welte / [email protected]               http://www.gnumonks.org/
============================================================================
"If this were a dictatorship, it'd be a heck of a lot easier, just so long
 as I'm the dictator."  --  George W. Bush Dec 18, 2000
#1 lore raw

From: Harald Welte <[email protected]>
Date: Mon, 14 Oct 2002 13:22:37 +0200

It fixes two bugs:

- packets with UDP sport == 0 are OK according to RFC768
- UDP checksum is optional (old code required packet to have a checksum)

Harald, at least the UDP checksum fix is already in Marcelo's 2.4.x tree.

Please recheck your patches against 2.4.20-pre10 which matches what I currently have for 2.4.x networking, thanks!

#2 lore raw
In reply to Harald Welte
Quoted 8 lines · Harald Welte

Hi Dave!

Below are two fixes for the EXPERIMENTAL ipt_unclean.c

It fixes two bugs:

- packets with UDP sport == 0 are OK according to RFC768
- UDP checksum is optional (old code required packet to have a checksum)

I've actually already sent you the UDP checksum fix. The UDP sport fix is new, though. Just ignore the one failing hunk, thanks.

Signature · 5 lines
Live long and prosper
- Harald Welte / [email protected]               http://www.gnumonks.org/
============================================================================
"If this were a dictatorship, it'd be a heck of a lot easier, just so long
 as I'm the dictator."  --  George W. Bush Dec 18, 2000
#3 lore raw

From: Harald Welte <[email protected]>
Date: Mon, 14 Oct 2002 13:26:20 +0200

I've actually already sent you the UDP checksum fix. The UDP sport fix is new, though. Just ignore the one failing hunk, thanks.

You need to resend it anyways as I've already deleted the original email sorry :(

#4 lore raw
Quoted 8 lines · David Miller

From: Harald Welte <[email protected]>
Date: Mon, 14 Oct 2002 13:26:20 +0200

I've actually already sent you the UDP checksum fix. The UDP sport fix is new, though. Just ignore the one failing hunk, thanks.

You need to resend it anyways as I've already deleted the original email sorry :(

No problem. Here it comes again.

net/ipv4/netfilter/ipt_unclean.c +3 -4
@@ -216,10 +216,9 @@
 				 csum_partial((char *)udph, datalen, 0)) != 0)
 		return 0;
 
-	/* CHECK: Ports can't be zero. */
-	if (!udph->source || !udph->dest) {
-		limpk("UDP zero ports %u/%u\n",
-		      ntohs(udph->source), ntohs(udph->dest));
+	/* CHECK: Destination port can't be zero. */
+	if (!udph->dest) {
+		limpk("UDP zero destination port\n");
 		return 0;
 	}
 
Signature · 5 lines
Live long and prosper
- Harald Welte / [email protected]               http://www.gnumonks.org/
============================================================================
"If this were a dictatorship, it'd be a heck of a lot easier, just so long
 as I'm the dictator."  --  George W. Bush Dec 18, 2000
#5 lore raw

From: Harald Welte <[email protected]>
Date: Mon, 14 Oct 2002 16:05:33 +0200

No problem. Here it comes again.

I would like to include this in my "critical" batch of netfilter fixes to Marcelo for 2.4.20-preX ok?

#6 lore raw
Quoted 7 lines · David Miller

From: Harald Welte <[email protected]>
Date: Mon, 14 Oct 2002 16:05:33 +0200

No problem. Here it comes again.

I would like to include this in my "critical" batch of netfilter fixes to Marcelo for 2.4.20-preX ok?

sure. no problem at all.

Signature · 5 lines
Live long and prosper
- Harald Welte / [email protected]               http://www.gnumonks.org/
============================================================================
"If this were a dictatorship, it'd be a heck of a lot easier, just so long
 as I'm the dictator."  --  George W. Bush Dec 18, 2000