Subject: Re: ip->ip_len signed?
To: Tim Newsham <newsham@aloha.net>
From: Curt Sampson <curt@portal.ca>
List: tech-kern
Date: 10/25/1996 06:41:54
The answer appears in the comment just above that struct in ip.h:

 * We declare ip_len and ip_off to be short, rather than u_short
 * pragmatically since otherwise unsigned comparisons can result
 * against negative integers quite easily, and fail in subtle ways.

cjs

Curt Sampson    curt@portal.ca		Info at http://www.portal.ca/
Internet Portal Services, Inc.	
Vancouver, BC   (604) 257-9400		De gustibus, aut bene aut nihil.

On Thu, 24 Oct 1996, Tim Newsham wrote:

> Date: Thu, 24 Oct 1996 15:58:56 -1000 (HST)
> From: Tim Newsham <newsham@aloha.net>
> To: tech-kern@NetBSD.ORG
> Subject: ip->ip_len signed?
> 
> 
> Hi,
> 
>    I noticed this in an include file and it struck me
> as odd:
> 
>   struct ip {
>      ...
>      int16_t ip_len;
>      ...
>    }
> 
> why is the length field signed?
> 
>                                     Tim N.
> 
>