Merit Network
Can't find what you're looking for? Search the Mail Archives.
  About Merit   Services   Network   Resources & Support   Network Research   News   Events   Home

Discussion Communities: Merit Network Email List Archives

OpenCALEA

Date Prev | Date Next | Date Index | Thread Index | Author Index | Historical
Re: [OpenCALEA] Debian compile problem

  • From: Jesse Norell
  • Date: Tue Mar 27 17:55:33 2007

Hello,

  Yeah, previously __FAVOR_BSD was defined, and I screwed that up
(though I thought I tested a build on debian); you can just:

--- common.h    (revision 8)
+++ common.h    (working copy)
@@ -38,6 +38,7 @@
 #include <stdarg.h>
 #include <time.h>
 #include <unistd.h>
+#define __FAVOR_BSD
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <netinet/ip.h>

or rename the structure members .. don't know which is better for
portability (I could test that on FreeBSD .. don't if the other
structure names work there or not (I don't see them in
netint/{tcp,udp}.h right offhand).





On Tue, 2007-03-27 at 16:53 -0400, Norman Brandinger wrote:
> I'm running debian and received the following compile errors:
> 
> tap.c: In function ‘process_packet’:
> tap.c:90: error: ‘struct udphdr’ has no member named ‘uh_sport’
> tap.c:91: error: ‘struct udphdr’ has no member named ‘uh_dport’
> tap.c:94: error: ‘struct tcphdr’ has no member named ‘th_sport’
> tap.c:95: error: ‘struct tcphdr’ has no member named ‘th_dport’
> 
> Applying the patch below has corrected the compile problem for me.
> 
> I suppose an alternate solution would be as follows:
> 
> In udp.h, the uh_sport/uh_dport definitions can be activated by defining 
> __FAVOR_BSD at compile time (ditto for tcp.h).
> 
> /usr/include/netinet/udp.h:
> ....
> /* UDP header as specified by RFC 768, August 1980. */
> #ifdef __FAVOR_BSD
> ....
> 
> Regards,
> Norm
> 
> 
> --- tap.c 2007-03-27 16:41:08.000000000 -0400
> +++ tap.c.new 2007-03-27 16:42:38.000000000 -0400
> @@ -87,12 +87,12 @@
> payload.dstIP = htonl(ip->ip_dst.s_addr);
> if ( ip->ip_p == IPPROTO_UDP ) {
> udp = ( struct udphdr* ) ( (u_char *)ip + (ip->ip_hl *4) );
> - payload.srcPort = htons(udp->uh_sport);
> - payload.dstPort = htons(udp->uh_dport);
> + payload.srcPort = htons(udp->source);
> + payload.dstPort = htons(udp->dest);
> } else if ( ip->ip_p == IPPROTO_TCP ) {
> tcp = ( struct tcphdr* ) ( (u_char *)ip + (ip->ip_hl *4) );
> - payload.srcPort = htons(tcp->th_sport);
> - payload.dstPort = htons(tcp->th_dport);
> + payload.srcPort = htons(tcp->source);
> + payload.dstPort = htons(tcp->dest);
> } else {
> payload.srcPort = 0;
> payload.dstPort = 0;
> 
-- 
Jesse Norell - jesse@kci.net
Kentec Communications, Inc.





Discussion Communities


About Merit | Services | Network | Resources & Support | Network Research
News | Events | Contact | Site Map | Merit Network Home


Merit Network, Inc.