Date: Tue, 10 Jan 2006 15:06:58 +0200 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: SPYRIDON PAPADOPOULOS <SP373@student.apu.ac.uk> Cc: freebsd-questions@freebsd.org Subject: Re: ip_icmp.h strange problem Message-ID: <20060110130658.GC2240@flame.pc> In-Reply-To: <1136894631.20dec60SP373@student.apu.ac.uk> References: <1136894631.20dec60SP373@student.apu.ac.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <SP373@student.apu.ac.uk> 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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060110130658.GC2240>