From: Guus Sliepen Date: Fri, 18 Jul 2003 12:16:24 +0000 (+0000) Subject: Even more missing definitions. X-Git-Tag: import-tinc-1.1~785^2~159 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=b0a4f7b5551cae6fb5af2eb4bcb0dfb3443f7d89;p=meshlink Even more missing definitions. --- diff --git a/lib/Makefile.am b/lib/Makefile.am index 35e1baf6..9fd96180 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -# $Id: Makefile.am,v 1.2.4.12 2003/07/07 11:50:52 guus Exp $ +# $Id: Makefile.am,v 1.2.4.13 2003/07/18 12:16:23 guus Exp $ noinst_LIBRARIES = libvpn.a @@ -10,6 +10,6 @@ libvpn_a_SOURCES = xmalloc.c pidfile.c utils.c getopt.c getopt1.c list.c avl_tre libvpn_a_LIBADD = @LIBOBJS@ @ALLOCA@ libvpn_a_DEPENDENCIES = $(libvpn_a_LIBADD) -noinst_HEADERS = xalloc.h pidfile.h utils.h getopt.h list.h avl_tree.h dropin.h fake-getaddrinfo.h fake-getnameinfo.h fake-gai-errnos.h gettext.h ipv6.h +noinst_HEADERS = xalloc.h pidfile.h utils.h getopt.h list.h avl_tree.h dropin.h fake-getaddrinfo.h fake-getnameinfo.h fake-gai-errnos.h gettext.h ipv6.h ipv4.h ethernet.h EXTRA_DIST = diff --git a/lib/ethernet.h b/lib/ethernet.h new file mode 100644 index 00000000..98e70478 --- /dev/null +++ b/lib/ethernet.h @@ -0,0 +1,75 @@ +/* + ethernet.h -- missing Ethernet related definitions + Copyright (C) 2003 Ivo Timmermans + 2003 Guus Sliepen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: ethernet.h,v 1.1.2.1 2003/07/18 12:16:23 guus Exp $ +*/ + +#ifndef __TINC_ETHERNET_H__ +#define __TINC_ETHERNET_H__ + +#ifndef ETH_ALEN +#define ETH_ALEN 6 +#endif + +#ifndef ARPHRD_ETHER +#define ARPHRD_ETHER 1 +#endif + +#ifndef ETHERTYPE_IP +#define ETHERTYPE_IP 0x0800 +#endif + +#ifndef HAVE_NET_IF_ARP_H + +struct arphdr { + unsigned short int ar_hrd; + unsigned short int ar_pro; + unsigned char ar_hln; + unsigned char ar_pln; + unsigned short int ar_op; +}; + +#define ARPOP_REQUEST 1 +#define ARPOP_REPLY 2 +#define ARPOP_RREQUEST 3 +#define ARPOP_RREPLY 4 +#define ARPOP_InREQUEST 8 +#define ARPOP_InREPLY 9 +#define ARPOP_NAK 10 + +#endif + +#ifndef HAVE_NETINET_IF_ETHER_H + +struct ether_arp { + struct arphdr ea_hdr; + uint8_t arp_sha[ETH_ALEN]; + uint8_t arp_spa[4]; + uint8_t arp_tha[ETH_ALEN]; + uint8_t arp_tpa[4]; +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +#endif + +#endif /* __TINC_ETHERNET_H__ */ diff --git a/lib/ipv4.h b/lib/ipv4.h new file mode 100644 index 00000000..ec3c5115 --- /dev/null +++ b/lib/ipv4.h @@ -0,0 +1,136 @@ +/* + ipv4.h -- missing IPv4 related definitions + Copyright (C) 2003 Ivo Timmermans + 2003 Guus Sliepen + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id: ipv4.h,v 1.1.2.1 2003/07/18 12:16:23 guus Exp $ +*/ + +#ifndef __TINC_IPV4_H__ +#define __TINC_IPV4_H__ + +#ifndef AF_INET +#define AF_INET 2 +#endif + +#ifndef IPPROTO_ICMP +#define IPPROTO_ICMP 1 +#endif + +#ifndef ICMP_DEST_UNREACH +#define ICMP_DEST_UNREACH 3 +#endif + +#ifndef ICMP_NET_UNKNOWN +#define ICMP_NET_UNKNOWN 6 +#endif + +#ifndef ICMP_NET_UNREACH +#define ICMP_NET_UNREACH 0 +#endif + +#ifndef IP_MSS +#define IP_MSS 576 +#endif + +#ifndef HAVE_NETINET_IP_H + +struct ip { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int ip_hl:4; + unsigned int ip_v:4; +#else + unsigned int ip_v:4; + unsigned int ip_hl:4; +#endif + uint8_t ip_tos; + u_short ip_len; + u_short ip_id; + u_short ip_off; +#define IP_RF 0x8000 +#define IP_DF 0x4000 +#define IP_MF 0x2000 +#define IP_OFFMASK 0x1fff + uint8_t ip_ttl; + uint8_t ip_p; + u_short ip_sum; + struct in_addr ip_src, ip_dst; +}; + +#endif + +#ifndef HAVE_NETINET_IP_ICMP_H + +struct icmp { + uint8_t icmp_type; + uint8_t icmp_code; + uint16_t icmp_cksum; + union { + u_char ih_pptr; + struct in_addr ih_gwaddr; + struct ih_idseq { + uint16_t icd_id; + uint16_t icd_seq; + } ih_idseq; + uint32_t ih_void; + + + struct ih_pmtu { + uint16_t ipm_void; + uint16_t ipm_nextmtu; + } ih_pmtu; + + struct ih_rtradv { + uint8_t irt_num_addrs; + uint8_t irt_wpa; + uint16_t irt_lifetime; + } ih_rtradv; + } icmp_hun; +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void +#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void +#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu +#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs +#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa +#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime + union { + struct { + uint32_t its_otime; + uint32_t its_rtime; + uint32_t its_ttime; + } id_ts; + struct { + struct ip idi_ip; + } id_ip; + uint32_t id_mask; + uint8_t id_data[1]; + } icmp_dun; +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_radv icmp_dun.id_radv +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data +}; + +#endif + +#endif /* __TINC_IPV4_H__ */ diff --git a/src/net.h b/src/net.h index 43371adb..28dd4eaf 100644 --- a/src/net.h +++ b/src/net.h @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: net.h,v 1.9.4.64 2003/07/17 15:06:26 guus Exp $ + $Id: net.h,v 1.9.4.65 2003/07/18 12:16:24 guus Exp $ */ #ifndef __TINC_NET_H__ @@ -25,6 +25,8 @@ #include +#include "ipv6.h" + #ifdef ENABLE_JUMBOGRAMS #define MTU 9014 /* 9000 bytes payload + 14 bytes ethernet header */ #else diff --git a/src/route.c b/src/route.c index 3d9b28bd..a6f6e463 100644 --- a/src/route.c +++ b/src/route.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: route.c,v 1.1.2.59 2003/07/17 15:06:27 guus Exp $ + $Id: route.c,v 1.1.2.60 2003/07/18 12:16:24 guus Exp $ */ #include "system.h" @@ -44,6 +44,9 @@ #include "avl_tree.h" #include "connection.h" #include "device.h" +#include "ethernet.h" +#include "ipv4.h" +#include "ipv6.h" #include "logger.h" #include "net.h" #include "protocol.h"