How to port old Network tools to glibc2 ======================================= (c) 1999 Mixter members.xoom.com/i0wnu First of all, this covers what you will need to convert if you intend to run it on LINUX. These fixes will enable the tools to compile under glibc, glibc2 and 2.2.x kernels. 1) Remove old includes. netinet/protocols.h is no longer needed. remove it. also, if you include the same file from the linux/, asm/, machine/, or netinet/ path, then remove everything except the netinet include. 2) Rename includes. netinet/ip_tcp.h becomes netinet/tcp.h netinet/ip_udp.h becomes netinet/udp.h netinet/ip_in.h becomes netinet/in.h if you had protocols.h removed, include in.h as well. 3) Replace the protocol defines. IP_TCP becomes IPPROTO_TCP IP_UDP becomes IPPROTO_UDP etc. 4) Change the headers. (Alternatively to this, you can try to compile with -D__FAVOR_BSD. Though it only works sometimes.) for iphdr's: comment out lines with ip_csum for each tcphdr structure: -------------------------- th_sport becomes source th_dport becomes dest th_seq becomes seq th_win becomes window th_chksum becomes check th_ack becomes ack_seq th_off is replaced with doff For the flags: #define TH_FIN 0x01 #define TH_SYN 0x02 #define TH_RST 0x04 #define TH_PUSH 0x08 #define TH_ACK 0x10 #define TH_URG 0x20 th_flags is replaced as follows: if set to TH_URG, remove the line and set element urg=1 the same is done with ack, psh, rst, syn, and fin flags. for each udphdr structure: -------------------------- uh_sport becomes source uh_dport becomes dest uh_ulen becomes len uh_sum becomes check 5) Compile, check for more errors, repeat steps 1-5 :) If you find any other checksum entries, just comment them out. The kernel/libs will fill in all the required checksums if youre lucky. ENJOY YOUR WORKING NUK3 T00LS! (erm i mean unharmful network applications :P) Mixter