From owner-freebsd-questions@FreeBSD.ORG Tue Jan 10 13:08:29 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BD7C516A41F for ; Tue, 10 Jan 2006 13:08:29 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from rosebud.otenet.gr (rosebud.otenet.gr [195.170.0.94]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1197A43D48 for ; Tue, 10 Jan 2006 13:08:28 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from flame.pc (aris.bedc.ondsl.gr [62.103.39.226]) by rosebud.otenet.gr (8.13.4/8.13.4/Debian-8) with SMTP id k0AD8Q6g030342; Tue, 10 Jan 2006 15:08:26 +0200 Received: by flame.pc (Postfix, from userid 1001) id F13CC115C1; Tue, 10 Jan 2006 15:06:58 +0200 (EET) Date: Tue, 10 Jan 2006 15:06:58 +0200 From: Giorgos Keramidas To: SPYRIDON PAPADOPOULOS Message-ID: <20060110130658.GC2240@flame.pc> References: <1136894631.20dec60SP373@student.apu.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1136894631.20dec60SP373@student.apu.ac.uk> Cc: freebsd-questions@freebsd.org Subject: Re: ip_icmp.h strange problem X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2006 13:08:29 -0000 Format recovered. Please read http://www.lemis.com/email.html to see why the original format of the message was in dire need of recovery. On 2006-01-10 12:03, SPYRIDON PAPADOPOULOS wrote: > Hi, > > I am include ip_icmp.h to a program. The icmp struct in there is > exactly the same with the one on: > http://fxr.watson.org/fxr/source/netinet/ip_icmp.h?v=TRUSTEDBSD-AUDIT3 > (this is just the first exactly the same struct i found online) > I am using FreeBSD 5.4-RELEASE #1 > > I have already included header files like tcp.h, ip.h, udp.h etc in my > program. > > Now when i am trying to compile my program with the command: > #gcc -o capTool capTool0.1 -lpcap > > it gives me syntax errors, where n_short values appear: lines: 60, 61, > 67, 68 and 89 (in my ip_icmp.h). > 71, 72, 78, 79 and 100 (on the online one). > > After changing the first four to "u_short ..." it compiles properly... NO! When you are an application's programmer YOU DON'T EDIT THE SYSTEM HEADERS. Ever! What you missed in this particular case was to include in_systm.h before icmp.h, as you can see below: % keramida@flame:/home/keramida$ grep n_short /usr/include/*/* % /usr/include/netinet/in_systm.h:typedef u_int16_t n_short; \ % /* short as received from the net */ % /usr/include/netinet/ip_icmp.h: n_short icd_id; % /usr/include/netinet/ip_icmp.h: n_short icd_seq; % /usr/include/netinet/ip_icmp.h: n_short ipm_void; % /usr/include/netinet/ip_icmp.h: n_short ipm_nextmtu; % keramida@flame:/home/keramida$ > This also happened with some value in ip.h. However i am not sure > which one now, because i changed it and it worked immediately (so i > didn't even note what exactly i changed..and since it worked to be > honest i didn't mind) > the problem is with the value in line 89: > n_time its_otime; /* Originate */ > > even if i change that to: > u_time its_otime; /* Originate */ > it still gives me syntax error before "n_time" or "u_time" > > Can anyone help and explain briefly - if possible - how is this > happening? I cannot believe that the n_* values are wrong, but are > working when changing them to u_*. Changing them where? Not in the system headers I hope. > I like getting involved with the system header files...but it doesn't > really look appropriate to me ;o), or it is? You are headed down the wrong path. You are not supposed to 'get involved' with the /usr/include files by manually making changes to them. If you know what you are doing, the right place to make changes is /usr/src, and then a build & install cycle.