From owner-freebsd-net Wed Oct 11 4:56:44 2000 Delivered-To: freebsd-net@freebsd.org Received: from rios.sitaranetworks.com (rios.sitaranetworks.com [199.103.141.78]) by hub.freebsd.org (Postfix) with ESMTP id 7908D37B66D; Wed, 11 Oct 2000 04:56:41 -0700 (PDT) Received: by rios.sitaranetworks.com with Internet Mail Service (5.5.2650.21) id <4W2Q4H2F>; Wed, 11 Oct 2000 08:00:19 -0400 Message-ID: <31269226357BD211979E00A0C9866DABE41202@rios.sitaranetworks.com> From: Charles Richmond To: 'Luigi Rizzo' , Archie Cobbs Cc: bmilekic@FreeBSD.ORG, freebsd-net@FreeBSD.ORG Subject: RE: ip_input.c patch Date: Wed, 11 Oct 2000 08:00:19 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > -----Original Message----- > From: Luigi Rizzo [mailto:luigi@info.iet.unipi.it] > Sent: Wednesday, October 11, 2000 1:29 AM > To: Archie Cobbs > Cc: bmilekic@FreeBSD.ORG; freebsd-net@FreeBSD.ORG > Subject: Re: ip_input.c patch > > > > Luigi Rizzo writes: > > > > Does this patch look appropriate to you? > > > > > > wouldn't it be better to just avoid the problem in the first place > > > by removing the conversion to host format and fixing the rest > > > of the code to handle things in net format ? > > > > Sounds OK to me.. maybe some asm() guru can come up with some > > fast functions for adding and subtracting byte-swapped values. > > don't think there is much need for that... ip_len and ip_off are > mostly or probably only used in ip_input() and there you just need > to fetch&swap a copy of the value into a local variable on entry > and use the local variable afterwards. Even better for ip_id which > is only used for equality comparisons... > Making local byte swapped copies and leaving the mbuf unchanged is IMHO the best. Things like BPF and other mbuf using code is forced to make unnecessary copies of the mbufs because of the race conditions engendered by the local ip_stack changing (potentially) shared mbufs on the fly. And lest anyone think that it is easy to tell if a packet is going to be local, there are situations where packets can be hijacked and the bpf_tap has no means of determining that the packet will be local. (Been there / done that / will write up our changes soon) Charles Richmond To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message