From owner-freebsd-net@FreeBSD.ORG Wed May 31 18:54:50 2006 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9714816A892 for ; Wed, 31 May 2006 18:54:50 +0000 (UTC) (envelope-from emil@ekon-bg.com) Received: from mail.ekon-bg.com (digsys35-217.pip.digsys.bg [193.68.217.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 753E443D66 for ; Wed, 31 May 2006 18:54:44 +0000 (GMT) (envelope-from emil@ekon-bg.com) Received: from localhost (localhost [127.0.0.1]) by mail.ekon-bg.com (Postfix) with ESMTP id 91843B50D2 for ; Wed, 31 May 2006 21:43:16 +0300 (EEST) Received: from mail.ekon-bg.com ([127.0.0.1]) by localhost (mail.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 10025-02 for ; Wed, 31 May 2006 21:43:11 +0300 (EEST) Received: from [84.238.188.138] (unknown [84.238.188.138]) by mail.ekon-bg.com (Postfix) with ESMTP id CA0D4B50BB for ; Wed, 31 May 2006 21:43:10 +0300 (EEST) From: Emil Kondayan Organization: EKON 91 To: freebsd-net@freebsd.org Date: Wed, 31 May 2006 21:57:03 -0700 User-Agent: KMail/1.9.1 References: <200605291103.k4TB38uo097477@freefall.freebsd.org> In-Reply-To: <200605291103.k4TB38uo097477@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200605312157.04027.emil@ekon-bg.com> X-Virus-Scanned: by amavisd-new at ekon-bg.com Subject: Question about netinet/ip.h X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 May 2006 18:54:54 -0000 Can someone tell me why "ip_hl" and "ip_v" are of type "u_int" when the structure is packed and they only fill a byte? And my second question:do these "#define ..." directives allocate space in the structure? struct ip { #if BYTE_ORDER == LITTLE_ENDIAN u_int ip_hl:4, /* header length */ ip_v:4; /* version */ #endif #if BYTE_ORDER == BIG_ENDIAN u_int ip_v:4, /* version */ ip_hl:4; /* header length */ #endif u_char ip_tos; /* type of service */ u_short ip_len; /* total length */ u_short ip_id; /* identification */ u_short ip_off; /* fragment offset field */ #define IP_RF 0x8000 /* reserved fragment flag */ #define IP_DF 0x4000 /* dont fragment flag */ #define IP_MF 0x2000 /* more fragments flag */ #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ u_char ip_ttl; /* time to live */ u_char ip_p; /* protocol */ u_short ip_sum; /* checksum */ struct in_addr ip_src,ip_dst; /* source and dest address */ } __packed;