public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@linuxcare.com.au>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org, netfilter@us5.samba.org
Subject: [PATCH] ipt_TOS fix.
Date: Mon, 29 Jan 2001 18:55:56 +1100	[thread overview]
Message-ID: <E14N9AL-0003qv-00@halfway> (raw)

Linus, please apply v2.4.0.

ipt_TOS checksum calculations were completely broken, causing bad csum
packets.  Whoever implemented it didn't understand the code it was
copied from.

This fixes the problem (tested in userspace against all TOS changes).

Rusty.
--
Premature optmztion is rt of all evl. --DK

diff -urN -I \$.*\$ -X /tmp/kerndiff.ZtZl97 --minimal linux-2.4.0-official/net/ipv4/netfilter/ipt_TOS.c working-2.4.0/net/ipv4/netfilter/ipt_TOS.c
--- linux-2.4.0-official/net/ipv4/netfilter/ipt_TOS.c	Fri Apr 28 08:43:15 2000
+++ working-2.4.0/net/ipv4/netfilter/ipt_TOS.c	Mon Jan 29 18:40:37 2001
@@ -19,11 +19,11 @@
 	const struct ipt_tos_target_info *tosinfo = targinfo;
 
 	if ((iph->tos & IPTOS_TOS_MASK) != tosinfo->tos) {
-		u_int8_t diffs[2];
+		u_int16_t diffs[2];
 
-		diffs[0] = iph->tos;
+		diffs[0] = htons(iph->tos) ^ 0xFFFF;
 		iph->tos = (iph->tos & IPTOS_PREC_MASK) | tosinfo->tos;
-		diffs[1] = iph->tos;
+		diffs[1] = htons(iph->tos);
 		iph->check = csum_fold(csum_partial((char *)diffs,
 		                                    sizeof(diffs),
 		                                    iph->check^0xFFFF));
-
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/

                 reply	other threads:[~2001-01-29  7:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E14N9AL-0003qv-00@halfway \
    --to=rusty@linuxcare.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netfilter@us5.samba.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox