Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Oct 2000 08:00:19 -0400
From:      Charles Richmond <cmr@sitaranetworks.com>
To:        'Luigi Rizzo' <luigi@info.iet.unipi.it>, Archie Cobbs <archie@whistle.com>
Cc:        bmilekic@FreeBSD.ORG, freebsd-net@FreeBSD.ORG
Subject:   RE: ip_input.c patch
Message-ID:  <31269226357BD211979E00A0C9866DABE41202@rios.sitaranetworks.com>

next in thread | raw e-mail | index | archive | help


> -----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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?31269226357BD211979E00A0C9866DABE41202>