Subject: ip.h and struct ip...
To: None <tech-net@netbsd.org>
From: Perry E. Metzger <perry@piermont.com>
List: tech-net
Date: 05/06/2000 15:41:23
Recent, er, issues involving ip.h have lead me to ask the following
question: why do we have a struct ip?

In all our drivers and other code, we very strongly DISCOURAGE the
idea of using structures hacked up with bitfields and alignment
options as in-core representations of stuff we shove out to devices or
the wire. This is the rule in almost all our code. We would kill
anyone for writing a SCSI driver that used structures and
bitfields. It is all way to dangerous because of compiler and MD
issues.

However, in our IP stack, we use a structure -- and even a structure
with bitfields and the need to do worry about packing -- as a
representation of the on the wire format.

I know this is tradition, but it strikes me as dangerous, and we've
seen the results of it several times. We've even been forced to solve
several recent bugs with manifestly GCC dependent goo in order to deal
with ugly problems. Should we be moving to a different paradigm more
like that we use everywhere else?

-- 
Perry Metzger		perry@piermont.com
--
"Ask not what your country can force other people to do for you..."