From 68f4ca711593416d0defd81199b176ba604c6cb1 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 29 Sep 2013 18:06:13 +0200 Subject: [PATCH] Modernize the build system. Recent versions of autoconf and automake were giving a lot of warnings. This is sort of a backport of similar build system changes from the 1.1 banch: - Fix all autoconf/automake warnings. - Merge lib/ into src/. - Don't use symlinks for device.c any more, but use automake conditionals. - Use explicit paths to local header files. - Get rid of alloca.c/malloc.c/memcmp.c/realloc.c. --- Makefile.am | 19 +- configure.in => configure.ac | 51 ++-- doc/Makefile.am | 2 +- lib/Makefile.am | 14 - lib/alloca.c | 494 -------------------------------- lib/malloc.c | 39 --- lib/memcmp.c | 395 ------------------------- lib/realloc.c | 44 --- src/Makefile.am | 93 ++++-- {lib => src}/avl_tree.c | 0 {lib => src}/avl_tree.h | 0 src/bsd/device.c | 18 +- src/cygwin/device.c | 18 +- {lib => src}/dropin.c | 0 {lib => src}/dropin.h | 0 {lib => src}/ethernet.h | 0 {lib => src}/fake-gai-errnos.h | 0 {lib => src}/fake-getaddrinfo.c | 0 {lib => src}/fake-getaddrinfo.h | 0 {lib => src}/fake-getnameinfo.c | 0 {lib => src}/fake-getnameinfo.h | 0 {lib => src}/getopt.c | 2 +- {lib => src}/getopt.h | 0 {lib => src}/getopt1.c | 2 +- src/graph.c | 2 +- have.h => src/have.h | 0 {lib => src}/ipv4.h | 0 {lib => src}/ipv6.h | 0 src/linux/device.c | 16 +- {lib => src}/list.c | 0 {lib => src}/list.h | 0 src/mingw/device.c | 18 +- {lib => src}/pidfile.c | 0 {lib => src}/pidfile.h | 0 src/solaris/device.c | 15 +- {lib => src}/splay_tree.c | 0 {lib => src}/splay_tree.h | 0 system.h => src/system.h | 2 +- {lib => src}/utils.c | 0 {lib => src}/utils.h | 0 {lib => src}/xalloc.h | 0 {lib => src}/xmalloc.c | 2 +- 42 files changed, 141 insertions(+), 1105 deletions(-) rename configure.in => configure.ac (82%) delete mode 100644 lib/Makefile.am delete mode 100644 lib/alloca.c delete mode 100644 lib/malloc.c delete mode 100644 lib/memcmp.c delete mode 100644 lib/realloc.c rename {lib => src}/avl_tree.c (100%) rename {lib => src}/avl_tree.h (100%) rename {lib => src}/dropin.c (100%) rename {lib => src}/dropin.h (100%) rename {lib => src}/ethernet.h (100%) rename {lib => src}/fake-gai-errnos.h (100%) rename {lib => src}/fake-getaddrinfo.c (100%) rename {lib => src}/fake-getaddrinfo.h (100%) rename {lib => src}/fake-getnameinfo.c (100%) rename {lib => src}/fake-getnameinfo.h (100%) rename {lib => src}/getopt.c (99%) rename {lib => src}/getopt.h (100%) rename {lib => src}/getopt1.c (99%) rename have.h => src/have.h (100%) rename {lib => src}/ipv4.h (100%) rename {lib => src}/ipv6.h (100%) rename {lib => src}/list.c (100%) rename {lib => src}/list.h (100%) rename {lib => src}/pidfile.c (100%) rename {lib => src}/pidfile.h (100%) rename {lib => src}/splay_tree.c (100%) rename {lib => src}/splay_tree.h (100%) rename system.h => src/system.h (98%) rename {lib => src}/utils.c (100%) rename {lib => src}/utils.h (100%) rename {lib => src}/xalloc.h (100%) rename {lib => src}/xmalloc.c (99%) diff --git a/Makefile.am b/Makefile.am index 4ef1181..b09f531 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,26 +2,11 @@ AUTOMAKE_OPTIONS = gnu -SUBDIRS = m4 lib src doc +SUBDIRS = m4 src doc ACLOCAL_AMFLAGS = -I m4 -EXTRA_DIST = have.h system.h COPYING.README README.android +EXTRA_DIST = COPYING.README README.android ChangeLog: git log > ChangeLog - -deb: - dpkg-buildpackage -rfakeroot - -rpm: dist - cp $(distdir).tar.gz /usr/src/redhat/SOURCES/ - cp redhat/tinc.spec /usr/src/redhat/SOURCES/ - cd /usr/src/redhat/SOURCES/ && rpm -bb tinc.spec - -release: - rm -f ChangeLog - $(MAKE) ChangeLog - echo "Please edit the NEWS file now..." - /usr/bin/editor NEWS - $(MAKE) dist diff --git a/configure.in b/configure.ac similarity index 82% rename from configure.in rename to configure.ac index af78ad8..212ca88 100644 --- a/configure.in +++ b/configure.ac @@ -1,9 +1,9 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT +AC_INIT([tinc], [1.0.22]) AC_CONFIG_SRCDIR([src/tincd.c]) -AM_INIT_AUTOMAKE(tinc, 1.0.22) +AM_INIT_AUTOMAKE([1.11 check-news std-options subdir-objects nostdinc -Wall]) AC_CONFIG_HEADERS([config.h]) AM_MAINTAINER_MODE @@ -17,8 +17,6 @@ dnl Checks for programs. AC_PROG_CC_C99 AC_PROG_CPP AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_RANLIB dnl Check and set OS @@ -26,45 +24,45 @@ AC_CANONICAL_HOST case $host_os in *linux*) + linux=true AC_DEFINE(HAVE_LINUX, 1, [Linux]) - [ rm -f src/device.c; ln -sf linux/device.c src/device.c ] ;; *freebsd*) + bsd=true AC_DEFINE(HAVE_FREEBSD, 1, [FreeBSD]) - [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ] ;; *darwin*) + bsd=true AC_DEFINE(HAVE_DARWIN, 1, [Darwin (MacOS/X)]) - [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ] ;; *solaris*) + solaris=true AC_DEFINE(HAVE_SOLARIS, 1, [Solaris/SunOS]) - [ rm -f src/device.c; ln -sf solaris/device.c src/device.c ] ;; *openbsd*) + bsd=true AC_DEFINE(HAVE_OPENBSD, 1, [OpenBSD]) - [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ] ;; *netbsd*) + bsd=true AC_DEFINE(HAVE_NETBSD, 1, [NetBSD]) - [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ] ;; *dragonfly*) + bsd=true AC_DEFINE(HAVE_DRAGONFLY, 1, [DragonFly]) - [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ] ;; *bsd*) + bsd=true AC_MSG_WARN("Unknown BSD variant, tinc might not compile or work!") AC_DEFINE(HAVE_BSD, 1, [Unknown BSD variant]) - [ rm -f src/device.c; ln -sf bsd/device.c src/device.c ] ;; *cygwin*) + cygwin=true AC_DEFINE(HAVE_CYGWIN, 1, [Cygwin]) - [ rm -f src/device.c; ln -sf cygwin/device.c src/device.c ] ;; *mingw*) + mingw=true AC_DEFINE(HAVE_MINGW, 1, [MinGW]) - [ rm -f src/device.c; cp -f src/mingw/device.c src/device.c ] LIBS="$LIBS -lws2_32 -lgdi32 -lcrypt32" ;; *) @@ -113,6 +111,11 @@ AC_ARG_WITH(windows2000, ] ) +AM_CONDITIONAL(LINUX, test "$linux" = true) +AM_CONDITIONAL(BSD, test "$bsd" = true) +AM_CONDITIONAL(SOLARIS, test "$solaris" = true) +AM_CONDITIONAL(MINGW, test "$mingw" = true) +AM_CONDITIONAL(CYGWIN, test "$cygwin" = true) AM_CONDITIONAL(UML, test "$uml" = true) AM_CONDITIONAL(VDE, test "$vde" = true) AM_CONDITIONAL(TUNEMU, test "$tunemu" = true) @@ -134,13 +137,13 @@ dnl We do this in multiple stages, because unlike Linux all the other operating AC_HEADER_STDC AC_CHECK_HEADERS([stdbool.h syslog.h sys/file.h sys/ioctl.h sys/mman.h sys/param.h sys/resource.h sys/socket.h sys/time.h time.h sys/uio.h sys/wait.h netdb.h arpa/inet.h dirent.h]) AC_CHECK_HEADERS([net/if.h net/if_types.h linux/if_tun.h net/if_tun.h net/tun/if_tun.h net/if_tap.h net/tap/if_tap.h net/ethernet.h net/if_arp.h netinet/in_systm.h netinet/in.h netinet/in6.h netpacket/packet.h], - [], [], [#include "have.h"] + [], [], [#include "src/have.h"] ) AC_CHECK_HEADERS([netinet/if_ether.h netinet/ip.h netinet/ip6.h], - [], [], [#include "have.h"] + [], [], [#include "src/have.h"] ) AC_CHECK_HEADERS([netinet/tcp.h netinet/ip_icmp.h netinet/icmp6.h], - [], [], [#include "have.h"] + [], [], [#include "src/have.h"] ) dnl Checks for typedefs, structures, and compiler characteristics. @@ -154,18 +157,14 @@ AC_STRUCT_TM tinc_ATTRIBUTE(__malloc__) AC_CHECK_TYPES([socklen_t, struct ether_header, struct arphdr, struct ether_arp, struct in_addr, struct addrinfo, struct ip, struct icmp, struct in6_addr, struct sockaddr_in6, struct ip6_hdr, struct icmp6_hdr, struct nd_neighbor_solicit, struct nd_opt_hdr], , , - [#include "have.h"] + [#include "src/have.h"] ) dnl Checks for library functions. -AC_FUNC_MEMCMP -AC_FUNC_ALLOCA AC_TYPE_SIGNAL AC_CHECK_FUNCS([asprintf daemon fchmod flock ftime fork get_current_dir_name gettimeofday mlockall pselect putenv random select strdup strerror strsignal strtol system unsetenv usleep vsyslog writev], - [], [], [#include "have.h"] + [], [], [#include "src/have.h"] ) -AC_FUNC_MALLOC -AC_FUNC_REALLOC dnl Support for SunOS @@ -177,7 +176,7 @@ AC_CHECK_FUNC(gethostbyname, [], [ ]) AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo], - [], [], [#include "have.h"] + [], [], [#include "src/have.h"] ) AC_CACHE_SAVE @@ -196,8 +195,6 @@ AC_ARG_ENABLE(jumbograms, ] ) -AC_SUBST(INCLUDES) - -AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile lib/Makefile m4/Makefile]) +AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile m4/Makefile]) AC_OUTPUT diff --git a/doc/Makefile.am b/doc/Makefile.am index 7c49d84..8e854bc 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -6,7 +6,7 @@ man_MANS = tincd.8 tinc.conf.5 EXTRA_DIST = tincinclude.texi.in tincd.8.in tinc.conf.5.in sample-config.tar.gz -CLEANFILES = *.html tinc.info tincd.8 tinc.conf.5 tincinclude.texi +CLEANFILES = *.html tincd.8 tinc.conf.5 tincinclude.texi # Use `ginstall' in the definition of man_MANS to avoid # confusion with the `install' target. The install rule transforms `ginstall' diff --git a/lib/Makefile.am b/lib/Makefile.am deleted file mode 100644 index 734bb64..0000000 --- a/lib/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -## Process this file with automake to produce Makefile.in - -noinst_LIBRARIES = libvpn.a - -INCLUDES = @INCLUDES@ -I. -I$(top_builddir) - -libvpn_a_SOURCES = xmalloc.c pidfile.c utils.c getopt.c getopt1.c list.c avl_tree.c dropin.c fake-getaddrinfo.c fake-getnameinfo.c - -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 ipv6.h ipv4.h ethernet.h - -EXTRA_DIST = diff --git a/lib/alloca.c b/lib/alloca.c deleted file mode 100644 index 10e5d65..0000000 --- a/lib/alloca.c +++ /dev/null @@ -1,494 +0,0 @@ -/* alloca.c -- allocate automatically reclaimed memory - (Mostly) portable public-domain implementation -- D A Gwyn - - This implementation of the PWB library alloca function, - which is used to allocate space off the run-time stack so - that it is automatically reclaimed upon procedure exit, - was inspired by discussions with J. Q. Johnson of Cornell. - J.Otto Tennant contributed the Cray support. - - There are some preprocessor constants that can - be defined when compiling for your specific system, for - improved efficiency; however, the defaults should be okay. - - The general concept of this implementation is to keep - track of all alloca-allocated blocks, and reclaim any - that are found to be deeper in the stack than the current - invocation. This heuristic does not reclaim storage as - soon as it becomes invalid, but it will do so eventually. - - As a special case, alloca(0) reclaims storage without - allocating any. It is a good idea to use alloca(0) in - your main control loop, etc. to force garbage collection. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef emacs -# include "blockinput.h" -#endif - -/* If compiling with GCC 2, this file's not needed. */ -#if !defined (__GNUC__) || __GNUC__ < 2 - -/* If someone has defined alloca as a macro, - there must be some other way alloca is supposed to work. */ -# ifndef alloca - -# ifdef emacs -# ifdef static -/* actually, only want this if static is defined as "" - -- this is for usg, in which emacs must undefine static - in order to make unexec workable - */ -# ifndef STACK_DIRECTION -you -lose --- must know STACK_DIRECTION at compile-time -# endif /* STACK_DIRECTION undefined */ -# endif /* static */ -# endif /* emacs */ - -/* If your stack is a linked list of frames, you have to - provide an "address metric" ADDRESS_FUNCTION macro. */ - -# if defined (CRAY) && defined (CRAY_STACKSEG_END) -long i00afunc (); -# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) -# else -# define ADDRESS_FUNCTION(arg) &(arg) -# endif - -# if __STDC__ -typedef void *pointer; -# else -typedef char *pointer; -# endif - -# ifndef NULL -# define NULL 0 -# endif - -/* Different portions of Emacs need to call different versions of - malloc. The Emacs executable needs alloca to call xmalloc, because - ordinary malloc isn't protected from input signals. On the other - hand, the utilities in lib-src need alloca to call malloc; some of - them are very simple, and don't have an xmalloc routine. - - Non-Emacs programs expect this to call xmalloc. - - Callers below should use malloc. */ - -# ifndef emacs -# define malloc xmalloc -# endif -extern pointer malloc (); - -/* Define STACK_DIRECTION if you know the direction of stack - growth for your system; otherwise it will be automatically - deduced at run-time. - - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ - -# ifndef STACK_DIRECTION -# define STACK_DIRECTION 0 /* Direction unknown. */ -# endif - -# if STACK_DIRECTION != 0 - -# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ - -# else /* STACK_DIRECTION == 0; need run-time code. */ - -static int stack_dir; /* 1 or -1 once known. */ -# define STACK_DIR stack_dir - -static void -find_stack_direction () -{ - static char *addr = NULL; /* Address of first `dummy', once known. */ - auto char dummy; /* To get stack address. */ - - if (addr == NULL) - { /* Initial entry. */ - addr = ADDRESS_FUNCTION (dummy); - - find_stack_direction (); /* Recurse once. */ - } - else - { - /* Second entry. */ - if (ADDRESS_FUNCTION (dummy) > addr) - stack_dir = 1; /* Stack grew upward. */ - else - stack_dir = -1; /* Stack grew downward. */ - } -} - -# endif /* STACK_DIRECTION == 0 */ - -/* An "alloca header" is used to: - (a) chain together all alloca'ed blocks; - (b) keep track of stack depth. - - It is very important that sizeof(header) agree with malloc - alignment chunk size. The following default should work okay. */ - -# ifndef ALIGN_SIZE -# define ALIGN_SIZE sizeof(double) -# endif - -typedef union hdr -{ - char align[ALIGN_SIZE]; /* To force sizeof(header). */ - struct - { - union hdr *next; /* For chaining headers. */ - char *deep; /* For stack depth measure. */ - } h; -} header; - -static header *last_alloca_header = NULL; /* -> last alloca header. */ - -/* Return a pointer to at least SIZE bytes of storage, - which will be automatically reclaimed upon exit from - the procedure that called alloca. Originally, this space - was supposed to be taken from the current stack frame of the - caller, but that method cannot be made to work for some - implementations of C, for example under Gould's UTX/32. */ - -pointer -alloca (size) - unsigned size; -{ - auto char probe; /* Probes stack depth: */ - register char *depth = ADDRESS_FUNCTION (probe); - -# if STACK_DIRECTION == 0 - if (STACK_DIR == 0) /* Unknown growth direction. */ - find_stack_direction (); -# endif - - /* Reclaim garbage, defined as all alloca'd storage that - was allocated from deeper in the stack than currently. */ - - { - register header *hp; /* Traverses linked list. */ - -# ifdef emacs - BLOCK_INPUT; -# endif - - for (hp = last_alloca_header; hp != NULL;) - if ((STACK_DIR > 0 && hp->h.deep > depth) - || (STACK_DIR < 0 && hp->h.deep < depth)) - { - register header *np = hp->h.next; - - free ((pointer) hp); /* Collect garbage. */ - - hp = np; /* -> next header. */ - } - else - break; /* Rest are not deeper. */ - - last_alloca_header = hp; /* -> last valid storage. */ - -# ifdef emacs - UNBLOCK_INPUT; -# endif - } - - if (size == 0) - return NULL; /* No allocation required. */ - - /* Allocate combined header + user data storage. */ - - { - register pointer new = malloc (sizeof (header) + size); - /* Address of header. */ - - ((header *) new)->h.next = last_alloca_header; - ((header *) new)->h.deep = depth; - - last_alloca_header = (header *) new; - - /* User storage begins just after header. */ - - return (pointer) ((char *) new + sizeof (header)); - } -} - -# if defined (CRAY) && defined (CRAY_STACKSEG_END) - -# ifdef DEBUG_I00AFUNC -# include -# endif - -# ifndef CRAY_STACK -# define CRAY_STACK -# ifndef CRAY2 -/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ -struct stack_control_header - { - long shgrow:32; /* Number of times stack has grown. */ - long shaseg:32; /* Size of increments to stack. */ - long shhwm:32; /* High water mark of stack. */ - long shsize:32; /* Current size of stack (all segments). */ - }; - -/* The stack segment linkage control information occurs at - the high-address end of a stack segment. (The stack - grows from low addresses to high addresses.) The initial - part of the stack segment linkage control information is - 0200 (octal) words. This provides for register storage - for the routine which overflows the stack. */ - -struct stack_segment_linkage - { - long ss[0200]; /* 0200 overflow words. */ - long sssize:32; /* Number of words in this segment. */ - long ssbase:32; /* Offset to stack base. */ - long:32; - long sspseg:32; /* Offset to linkage control of previous - segment of stack. */ - long:32; - long sstcpt:32; /* Pointer to task common address block. */ - long sscsnm; /* Private control structure number for - microtasking. */ - long ssusr1; /* Reserved for user. */ - long ssusr2; /* Reserved for user. */ - long sstpid; /* Process ID for pid based multi-tasking. */ - long ssgvup; /* Pointer to multitasking thread giveup. */ - long sscray[7]; /* Reserved for Cray Research. */ - long ssa0; - long ssa1; - long ssa2; - long ssa3; - long ssa4; - long ssa5; - long ssa6; - long ssa7; - long sss0; - long sss1; - long sss2; - long sss3; - long sss4; - long sss5; - long sss6; - long sss7; - }; - -# else /* CRAY2 */ -/* The following structure defines the vector of words - returned by the STKSTAT library routine. */ -struct stk_stat - { - long now; /* Current total stack size. */ - long maxc; /* Amount of contiguous space which would - be required to satisfy the maximum - stack demand to date. */ - long high_water; /* Stack high-water mark. */ - long overflows; /* Number of stack overflow ($STKOFEN) calls. */ - long hits; /* Number of internal buffer hits. */ - long extends; /* Number of block extensions. */ - long stko_mallocs; /* Block allocations by $STKOFEN. */ - long underflows; /* Number of stack underflow calls ($STKRETN). */ - long stko_free; /* Number of deallocations by $STKRETN. */ - long stkm_free; /* Number of deallocations by $STKMRET. */ - long segments; /* Current number of stack segments. */ - long maxs; /* Maximum number of stack segments so far. */ - long pad_size; /* Stack pad size. */ - long current_address; /* Current stack segment address. */ - long current_size; /* Current stack segment size. This - number is actually corrupted by STKSTAT to - include the fifteen word trailer area. */ - long initial_address; /* Address of initial segment. */ - long initial_size; /* Size of initial segment. */ - }; - -/* The following structure describes the data structure which trails - any stack segment. I think that the description in 'asdef' is - out of date. I only describe the parts that I am sure about. */ - -struct stk_trailer - { - long this_address; /* Address of this block. */ - long this_size; /* Size of this block (does not include - this trailer). */ - long unknown2; - long unknown3; - long link; /* Address of trailer block of previous - segment. */ - long unknown5; - long unknown6; - long unknown7; - long unknown8; - long unknown9; - long unknown10; - long unknown11; - long unknown12; - long unknown13; - long unknown14; - }; - -# endif /* CRAY2 */ -# endif /* not CRAY_STACK */ - -# ifdef CRAY2 -/* Determine a "stack measure" for an arbitrary ADDRESS. - I doubt that "lint" will like this much. */ - -static long -i00afunc (long *address) -{ - struct stk_stat status; - struct stk_trailer *trailer; - long *block, size; - long result = 0; - - /* We want to iterate through all of the segments. The first - step is to get the stack status structure. We could do this - more quickly and more directly, perhaps, by referencing the - $LM00 common block, but I know that this works. */ - - STKSTAT (&status); - - /* Set up the iteration. */ - - trailer = (struct stk_trailer *) (status.current_address - + status.current_size - - 15); - - /* There must be at least one stack segment. Therefore it is - a fatal error if "trailer" is null. */ - - if (trailer == 0) - abort (); - - /* Discard segments that do not contain our argument address. */ - - while (trailer != 0) - { - block = (long *) trailer->this_address; - size = trailer->this_size; - if (block == 0 || size == 0) - abort (); - trailer = (struct stk_trailer *) trailer->link; - if ((block <= address) && (address < (block + size))) - break; - } - - /* Set the result to the offset in this segment and add the sizes - of all predecessor segments. */ - - result = address - block; - - if (trailer == 0) - { - return result; - } - - do - { - if (trailer->this_size <= 0) - abort (); - result += trailer->this_size; - trailer = (struct stk_trailer *) trailer->link; - } - while (trailer != 0); - - /* We are done. Note that if you present a bogus address (one - not in any segment), you will get a different number back, formed - from subtracting the address of the first block. This is probably - not what you want. */ - - return (result); -} - -# else /* not CRAY2 */ -/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. - Determine the number of the cell within the stack, - given the address of the cell. The purpose of this - routine is to linearize, in some sense, stack addresses - for alloca. */ - -static long -i00afunc (long address) -{ - long stkl = 0; - - long size, pseg, this_segment, stack; - long result = 0; - - struct stack_segment_linkage *ssptr; - - /* Register B67 contains the address of the end of the - current stack segment. If you (as a subprogram) store - your registers on the stack and find that you are past - the contents of B67, you have overflowed the segment. - - B67 also points to the stack segment linkage control - area, which is what we are really interested in. */ - - stkl = CRAY_STACKSEG_END (); - ssptr = (struct stack_segment_linkage *) stkl; - - /* If one subtracts 'size' from the end of the segment, - one has the address of the first word of the segment. - - If this is not the first segment, 'pseg' will be - nonzero. */ - - pseg = ssptr->sspseg; - size = ssptr->sssize; - - this_segment = stkl - size; - - /* It is possible that calling this routine itself caused - a stack overflow. Discard stack segments which do not - contain the target address. */ - - while (!(this_segment <= address && address <= stkl)) - { -# ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); -# endif - if (pseg == 0) - break; - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - this_segment = stkl - size; - } - - result = address - this_segment; - - /* If you subtract pseg from the current end of the stack, - you get the address of the previous stack segment's end. - This seems a little convoluted to me, but I'll bet you save - a cycle somewhere. */ - - while (pseg != 0) - { -# ifdef DEBUG_I00AFUNC - fprintf (stderr, "%011o %011o\n", pseg, size); -# endif - stkl = stkl - pseg; - ssptr = (struct stack_segment_linkage *) stkl; - size = ssptr->sssize; - pseg = ssptr->sspseg; - result += size; - } - return (result); -} - -# endif /* not CRAY2 */ -# endif /* CRAY */ - -# endif /* no alloca */ -#endif /* not GCC version 2 */ diff --git a/lib/malloc.c b/lib/malloc.c deleted file mode 100644 index 2a996d4..0000000 --- a/lib/malloc.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Work around bug on some systems where malloc (0) fails. - Copyright (C) 1997 Free Software Foundation, Inc. - - 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, 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., Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - -/* written by Jim Meyering */ - -#if HAVE_CONFIG_H -# include -#endif -#undef malloc - -#include - -char *malloc (); - -/* Allocate an N-byte block of memory from the heap. - If N is zero, allocate a 1-byte block. */ - -char * -rpl_malloc (n) - size_t n; -{ - if (n == 0) - n = 1; - return malloc (n); -} diff --git a/lib/memcmp.c b/lib/memcmp.c deleted file mode 100644 index 9104994..0000000 --- a/lib/memcmp.c +++ /dev/null @@ -1,395 +0,0 @@ -/* Copyright (C) 1991, 1993, 1995, 1997, 1998 Free Software Foundation, Inc. - Contributed by Torbjorn Granlund (tege@sics.se). - - NOTE: The canonical source of this file is maintained with the GNU C Library. - Bugs can be reported to bug-glibc@prep.ai.mit.edu. - - 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, 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., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#ifdef HAVE_INTTYPES_H -#include -#endif - -#undef __ptr_t -#if defined __cplusplus || (defined __STDC__ && __STDC__) -# define __ptr_t void * -#else /* Not C++ or ANSI C. */ -# undef const -# define const -# define __ptr_t char * -#endif /* C++ or ANSI C. */ - -#ifndef __P -# if defined __GNUC__ || (defined __STDC__ && __STDC__) -# define __P(args) args -# else -# define __P(args) () -# endif /* GCC. */ -#endif /* Not __P. */ - -#if defined HAVE_STRING_H || defined _LIBC -# include -#endif - -#undef memcmp - -#ifdef _LIBC - -# include - -#else /* Not in the GNU C library. */ - -# include - -/* Type to use for aligned memory operations. - This should normally be the biggest type supported by a single load - and store. Must be an unsigned type. */ -# define op_t unsigned long int -# define OPSIZ (sizeof(op_t)) - -/* Threshold value for when to enter the unrolled loops. */ -# define OP_T_THRES 16 - -/* Type to use for unaligned operations. */ -typedef unsigned char byte; - -# ifndef WORDS_BIGENDIAN -# define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2))) -# else -# define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2))) -# endif - -#endif /* In the GNU C library. */ - -#ifdef WORDS_BIGENDIAN -# define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1) -#else -# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b)) -#endif - -/* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */ - -/* The strategy of this memcmp is: - - 1. Compare bytes until one of the block pointers is aligned. - - 2. Compare using memcmp_common_alignment or - memcmp_not_common_alignment, regarding the alignment of the other - block after the initial byte operations. The maximum number of - full words (of type op_t) are compared in this way. - - 3. Compare the few remaining bytes. */ - -#ifndef WORDS_BIGENDIAN -/* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine. - A and B are known to be different. - This is needed only on little-endian machines. */ - -static int memcmp_bytes __P((op_t, op_t)); - -# ifdef __GNUC__ -__inline -# endif -static int -memcmp_bytes (a, b) - op_t a, b; -{ - intptr_t srcp1 = (intptr_t) &a; - intptr_t srcp2 = (intptr_t) &b; - op_t a0, b0; - - do - { - a0 = ((byte *) srcp1)[0]; - b0 = ((byte *) srcp2)[0]; - srcp1 += 1; - srcp2 += 1; - } - while (a0 == b0); - return a0 - b0; -} -#endif - -static int memcmp_common_alignment __P((intptr_t, intptr_t, size_t)); - -/* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t' - objects (not LEN bytes!). Both SRCP1 and SRCP2 should be aligned for - memory operations on `op_t's. */ -#ifdef __GNUC__ -__inline -#endif -static int -memcmp_common_alignment (srcp1, srcp2, len) - intptr_t srcp1; - intptr_t srcp2; - size_t len; -{ - op_t a0, a1; - op_t b0, b1; - - switch (len % 4) - { - default: /* Avoid warning about uninitialized local variables. */ - case 2: - a0 = ((op_t *) srcp1)[0]; - b0 = ((op_t *) srcp2)[0]; - srcp1 -= 2 * OPSIZ; - srcp2 -= 2 * OPSIZ; - len += 2; - goto do1; - case 3: - a1 = ((op_t *) srcp1)[0]; - b1 = ((op_t *) srcp2)[0]; - srcp1 -= OPSIZ; - srcp2 -= OPSIZ; - len += 1; - goto do2; - case 0: - if (OP_T_THRES <= 3 * OPSIZ && len == 0) - return 0; - a0 = ((op_t *) srcp1)[0]; - b0 = ((op_t *) srcp2)[0]; - goto do3; - case 1: - a1 = ((op_t *) srcp1)[0]; - b1 = ((op_t *) srcp2)[0]; - srcp1 += OPSIZ; - srcp2 += OPSIZ; - len -= 1; - if (OP_T_THRES <= 3 * OPSIZ && len == 0) - goto do0; - /* Fall through. */ - } - - do - { - a0 = ((op_t *) srcp1)[0]; - b0 = ((op_t *) srcp2)[0]; - if (a1 != b1) - return CMP_LT_OR_GT (a1, b1); - - do3: - a1 = ((op_t *) srcp1)[1]; - b1 = ((op_t *) srcp2)[1]; - if (a0 != b0) - return CMP_LT_OR_GT (a0, b0); - - do2: - a0 = ((op_t *) srcp1)[2]; - b0 = ((op_t *) srcp2)[2]; - if (a1 != b1) - return CMP_LT_OR_GT (a1, b1); - - do1: - a1 = ((op_t *) srcp1)[3]; - b1 = ((op_t *) srcp2)[3]; - if (a0 != b0) - return CMP_LT_OR_GT (a0, b0); - - srcp1 += 4 * OPSIZ; - srcp2 += 4 * OPSIZ; - len -= 4; - } - while (len != 0); - - /* This is the right position for do0. Please don't move - it into the loop. */ - do0: - if (a1 != b1) - return CMP_LT_OR_GT (a1, b1); - return 0; -} - -static int memcmp_not_common_alignment __P((intptr_t, intptr_t, size_t)); - -/* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN - `op_t' objects (not LEN bytes!). SRCP2 should be aligned for memory - operations on `op_t', but SRCP1 *should be unaligned*. */ -#ifdef __GNUC__ -__inline -#endif -static int -memcmp_not_common_alignment (srcp1, srcp2, len) - intptr_t srcp1; - intptr_t srcp2; - size_t len; -{ - op_t a0, a1, a2, a3; - op_t b0, b1, b2, b3; - op_t x; - int shl, shr; - - /* Calculate how to shift a word read at the memory operation - aligned srcp1 to make it aligned for comparison. */ - - shl = 8 * (srcp1 % OPSIZ); - shr = 8 * OPSIZ - shl; - - /* Make SRCP1 aligned by rounding it down to the beginning of the `op_t' - it points in the middle of. */ - srcp1 &= -OPSIZ; - - switch (len % 4) - { - default: /* Avoid warning about uninitialized local variables. */ - case 2: - a1 = ((op_t *) srcp1)[0]; - a2 = ((op_t *) srcp1)[1]; - b2 = ((op_t *) srcp2)[0]; - srcp1 -= 1 * OPSIZ; - srcp2 -= 2 * OPSIZ; - len += 2; - goto do1; - case 3: - a0 = ((op_t *) srcp1)[0]; - a1 = ((op_t *) srcp1)[1]; - b1 = ((op_t *) srcp2)[0]; - srcp2 -= 1 * OPSIZ; - len += 1; - goto do2; - case 0: - if (OP_T_THRES <= 3 * OPSIZ && len == 0) - return 0; - a3 = ((op_t *) srcp1)[0]; - a0 = ((op_t *) srcp1)[1]; - b0 = ((op_t *) srcp2)[0]; - srcp1 += 1 * OPSIZ; - goto do3; - case 1: - a2 = ((op_t *) srcp1)[0]; - a3 = ((op_t *) srcp1)[1]; - b3 = ((op_t *) srcp2)[0]; - srcp1 += 2 * OPSIZ; - srcp2 += 1 * OPSIZ; - len -= 1; - if (OP_T_THRES <= 3 * OPSIZ && len == 0) - goto do0; - /* Fall through. */ - } - - do - { - a0 = ((op_t *) srcp1)[0]; - b0 = ((op_t *) srcp2)[0]; - x = MERGE(a2, shl, a3, shr); - if (x != b3) - return CMP_LT_OR_GT (x, b3); - - do3: - a1 = ((op_t *) srcp1)[1]; - b1 = ((op_t *) srcp2)[1]; - x = MERGE(a3, shl, a0, shr); - if (x != b0) - return CMP_LT_OR_GT (x, b0); - - do2: - a2 = ((op_t *) srcp1)[2]; - b2 = ((op_t *) srcp2)[2]; - x = MERGE(a0, shl, a1, shr); - if (x != b1) - return CMP_LT_OR_GT (x, b1); - - do1: - a3 = ((op_t *) srcp1)[3]; - b3 = ((op_t *) srcp2)[3]; - x = MERGE(a1, shl, a2, shr); - if (x != b2) - return CMP_LT_OR_GT (x, b2); - - srcp1 += 4 * OPSIZ; - srcp2 += 4 * OPSIZ; - len -= 4; - } - while (len != 0); - - /* This is the right position for do0. Please don't move - it into the loop. */ - do0: - x = MERGE(a2, shl, a3, shr); - if (x != b3) - return CMP_LT_OR_GT (x, b3); - return 0; -} - -int -rpl_memcmp (s1, s2, len) - const __ptr_t s1; - const __ptr_t s2; - size_t len; -{ - op_t a0; - op_t b0; - intptr_t srcp1 = (intptr_t) s1; - intptr_t srcp2 = (intptr_t) s2; - op_t res; - - if (len >= OP_T_THRES) - { - /* There are at least some bytes to compare. No need to test - for LEN == 0 in this alignment loop. */ - while (srcp2 % OPSIZ != 0) - { - a0 = ((byte *) srcp1)[0]; - b0 = ((byte *) srcp2)[0]; - srcp1 += 1; - srcp2 += 1; - res = a0 - b0; - if (res != 0) - return res; - len -= 1; - } - - /* SRCP2 is now aligned for memory operations on `op_t'. - SRCP1 alignment determines if we can do a simple, - aligned compare or need to shuffle bits. */ - - if (srcp1 % OPSIZ == 0) - res = memcmp_common_alignment (srcp1, srcp2, len / OPSIZ); - else - res = memcmp_not_common_alignment (srcp1, srcp2, len / OPSIZ); - if (res != 0) - return res; - - /* Number of bytes remaining in the interval [0..OPSIZ-1]. */ - srcp1 += len & -OPSIZ; - srcp2 += len & -OPSIZ; - len %= OPSIZ; - } - - /* There are just a few bytes to compare. Use byte memory operations. */ - while (len != 0) - { - a0 = ((byte *) srcp1)[0]; - b0 = ((byte *) srcp2)[0]; - srcp1 += 1; - srcp2 += 1; - res = a0 - b0; - if (res != 0) - return res; - len -= 1; - } - - return 0; -} - -#ifdef weak_alias -# undef bcmp -weak_alias (memcmp, bcmp) -#endif diff --git a/lib/realloc.c b/lib/realloc.c deleted file mode 100644 index 4971b28..0000000 --- a/lib/realloc.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Work around bug on some systems where realloc (NULL, 0) fails. - Copyright (C) 1997 Free Software Foundation, Inc. - - 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, 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., Foundation, - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - -/* written by Jim Meyering */ - -#if HAVE_CONFIG_H -# include -#endif -#undef realloc - -#include - -char *malloc (); -char *realloc (); - -/* Change the size of an allocated block of memory P to N bytes, - with error checking. If N is zero, change it to 1. If P is NULL, - use malloc. */ - -char * -rpl_realloc (p, n) - char *p; - size_t n; -{ - if (n == 0) - n = 1; - if (p == 0) - return malloc (n); - return realloc (p, n); -} diff --git a/src/Makefile.am b/src/Makefile.am index cd44eb6..937800d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,44 +2,85 @@ sbin_PROGRAMS = tincd -EXTRA_DIST = linux/device.c bsd/device.c solaris/device.c cygwin/device.c mingw/device.c mingw/common.h +tincd_SOURCES = \ + have.h \ + system.h \ + avl_tree.c avl_tree.h \ + conf.c conf.h \ + connection.c connection.h \ + device.h \ + dropin.c dropin.h \ + dummy_device.c \ + edge.c edge.h \ + ethernet.h \ + event.c event.h \ + fake-gai-errnos.h \ + fake-getaddrinfo.c fake-getaddrinfo.h \ + fake-getnameinfo.c fake-getnameinfo.h \ + getopt.c getopt.h \ + getopt1.c \ + graph.c graph.h \ + ipv4.h \ + ipv6.h \ + list.c list.h \ + logger.c logger.h \ + meta.c meta.h \ + multicast_device.c \ + net.c net.h \ + net_packet.c \ + net_setup.c \ + net_socket.c \ + netutl.c netutl.h \ + node.c node.h \ + pidfile.c pidfile.h \ + process.c process.h \ + protocol.c protocol.h \ + protocol_auth.c \ + protocol_edge.c \ + protocol_misc.c \ + protocol_key.c \ + protocol_subnet.c \ + raw_socket_device.c \ + route.c route.h \ + subnet.c subnet.h \ + tincd.c \ + utils.c utils.h \ + xalloc.h \ + xmalloc.c -tincd_SOURCES = conf.c connection.c edge.c event.c graph.c logger.c meta.c net.c net_packet.c net_setup.c \ - net_socket.c netutl.c node.c process.c protocol.c protocol_auth.c protocol_edge.c protocol_misc.c \ - protocol_key.c protocol_subnet.c route.c subnet.c tincd.c \ - dummy_device.c raw_socket_device.c multicast_device.c - -if UML -tincd_SOURCES += uml_device.c -endif - -if VDE -tincd_SOURCES += vde_device.c +if LINUX +tincd_SOURCES += linux/device.c endif +if BSD +tincd_SOURCES += bsd/device.c if TUNEMU -tincd_SOURCES += bsd/tunemu.c +tincd_SOURCES += bsd/tunemu.c bsd/tunemu.h +endif endif -nodist_tincd_SOURCES = device.c +if SOLARIS +tincd_SOURCES += solaris/device.c +endif -DEFAULT_INCLUDES = +if MINGW +tincd_SOURCES += mingw/device.c mingw/common.h +endif -INCLUDES = @INCLUDES@ -I$(top_builddir) -I$(top_srcdir)/lib +if CYGWIN +tincd_SOURCES += cygwin/device.c +endif -noinst_HEADERS = conf.h connection.h device.h edge.h event.h graph.h logger.h meta.h net.h netutl.h node.h process.h \ - protocol.h route.h subnet.h bsd/tunemu.h +if UML +tincd_SOURCES += uml_device.c +endif -LIBS = @LIBS@ +if VDE +tincd_SOURCES += vde_device.c +endif if TUNEMU LIBS += -lpcap endif -tincd_LDADD = \ - $(top_builddir)/lib/libvpn.a - -AM_CFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" - -dist-hook: - rm -f `find . -type l` +AM_CPPFLAGS = -DCONFDIR=\"$(sysconfdir)\" -DLOCALSTATEDIR=\"$(localstatedir)\" diff --git a/lib/avl_tree.c b/src/avl_tree.c similarity index 100% rename from lib/avl_tree.c rename to src/avl_tree.c diff --git a/lib/avl_tree.h b/src/avl_tree.h similarity index 100% rename from lib/avl_tree.h rename to src/avl_tree.h diff --git a/src/bsd/device.c b/src/bsd/device.c index efb80a8..f584355 100644 --- a/src/bsd/device.c +++ b/src/bsd/device.c @@ -19,18 +19,18 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "system.h" +#include "../system.h" -#include "conf.h" -#include "device.h" -#include "logger.h" -#include "net.h" -#include "route.h" -#include "utils.h" -#include "xalloc.h" +#include "../conf.h" +#include "../device.h" +#include "../logger.h" +#include "../net.h" +#include "../route.h" +#include "../utils.h" +#include "../xalloc.h" #ifdef ENABLE_TUNEMU -#include "bsd/tunemu.h" +#include "tunemu.h" #endif #define DEFAULT_TUN_DEVICE "/dev/tun0" diff --git a/src/cygwin/device.c b/src/cygwin/device.c index 4365399..b582a6a 100644 --- a/src/cygwin/device.c +++ b/src/cygwin/device.c @@ -18,20 +18,20 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "system.h" +#include "../system.h" #include #include -#include "conf.h" -#include "device.h" -#include "logger.h" -#include "net.h" -#include "route.h" -#include "utils.h" -#include "xalloc.h" +#include "../conf.h" +#include "../device.h" +#include "../logger.h" +#include "../net.h" +#include "../route.h" +#include "../utils.h" +#include "../xalloc.h" -#include "mingw/common.h" +#include "../mingw/common.h" int device_fd = -1; static HANDLE device_handle = INVALID_HANDLE_VALUE; diff --git a/lib/dropin.c b/src/dropin.c similarity index 100% rename from lib/dropin.c rename to src/dropin.c diff --git a/lib/dropin.h b/src/dropin.h similarity index 100% rename from lib/dropin.h rename to src/dropin.h diff --git a/lib/ethernet.h b/src/ethernet.h similarity index 100% rename from lib/ethernet.h rename to src/ethernet.h diff --git a/lib/fake-gai-errnos.h b/src/fake-gai-errnos.h similarity index 100% rename from lib/fake-gai-errnos.h rename to src/fake-gai-errnos.h diff --git a/lib/fake-getaddrinfo.c b/src/fake-getaddrinfo.c similarity index 100% rename from lib/fake-getaddrinfo.c rename to src/fake-getaddrinfo.c diff --git a/lib/fake-getaddrinfo.h b/src/fake-getaddrinfo.h similarity index 100% rename from lib/fake-getaddrinfo.h rename to src/fake-getaddrinfo.h diff --git a/lib/fake-getnameinfo.c b/src/fake-getnameinfo.c similarity index 100% rename from lib/fake-getnameinfo.c rename to src/fake-getnameinfo.c diff --git a/lib/fake-getnameinfo.h b/src/fake-getnameinfo.h similarity index 100% rename from lib/fake-getnameinfo.h rename to src/fake-getnameinfo.h diff --git a/lib/getopt.c b/src/getopt.c similarity index 99% rename from lib/getopt.c rename to src/getopt.c index a6782ed..d63887e 100644 --- a/lib/getopt.c +++ b/src/getopt.c @@ -31,7 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #endif #ifdef HAVE_CONFIG_H -#include +#include "../config.h" #endif #if !defined (__STDC__) || !__STDC__ diff --git a/lib/getopt.h b/src/getopt.h similarity index 100% rename from lib/getopt.h rename to src/getopt.h diff --git a/lib/getopt1.c b/src/getopt1.c similarity index 99% rename from lib/getopt1.c rename to src/getopt1.c index 86545f2..19605a5 100644 --- a/lib/getopt1.c +++ b/src/getopt1.c @@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #ifdef HAVE_CONFIG_H -#include +#include "../config.h" #endif #include "getopt.h" diff --git a/src/graph.c b/src/graph.c index a15e5c7..edea91b 100644 --- a/src/graph.c +++ b/src/graph.c @@ -45,7 +45,7 @@ #include "system.h" #include "avl_tree.h" -#include "config.h" +#include "conf.h" #include "connection.h" #include "device.h" #include "edge.h" diff --git a/have.h b/src/have.h similarity index 100% rename from have.h rename to src/have.h diff --git a/lib/ipv4.h b/src/ipv4.h similarity index 100% rename from lib/ipv4.h rename to src/ipv4.h diff --git a/lib/ipv6.h b/src/ipv6.h similarity index 100% rename from lib/ipv6.h rename to src/ipv6.h diff --git a/src/linux/device.c b/src/linux/device.c index 3c60901..d418aaf 100644 --- a/src/linux/device.c +++ b/src/linux/device.c @@ -18,7 +18,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "system.h" +#include "../system.h" #ifdef HAVE_LINUX_IF_TUN_H #include @@ -27,13 +27,13 @@ #define DEFAULT_DEVICE "/dev/tap0" #endif -#include "conf.h" -#include "device.h" -#include "logger.h" -#include "net.h" -#include "route.h" -#include "utils.h" -#include "xalloc.h" +#include "../conf.h" +#include "../device.h" +#include "../logger.h" +#include "../net.h" +#include "../route.h" +#include "../utils.h" +#include "../xalloc.h" typedef enum device_type_t { DEVICE_TYPE_ETHERTAP, diff --git a/lib/list.c b/src/list.c similarity index 100% rename from lib/list.c rename to src/list.c diff --git a/lib/list.h b/src/list.h similarity index 100% rename from lib/list.h rename to src/list.h diff --git a/src/mingw/device.c b/src/mingw/device.c index 6705108..56203d4 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -18,20 +18,20 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "system.h" +#include "../system.h" #include #include -#include "conf.h" -#include "device.h" -#include "logger.h" -#include "net.h" -#include "route.h" -#include "utils.h" -#include "xalloc.h" +#include "../conf.h" +#include "../device.h" +#include "../logger.h" +#include "../net.h" +#include "../route.h" +#include "../utils.h" +#include "../xalloc.h" -#include "mingw/common.h" +#include "common.h" int device_fd = -1; static HANDLE device_handle = INVALID_HANDLE_VALUE; diff --git a/lib/pidfile.c b/src/pidfile.c similarity index 100% rename from lib/pidfile.c rename to src/pidfile.c diff --git a/lib/pidfile.h b/src/pidfile.h similarity index 100% rename from lib/pidfile.h rename to src/pidfile.h diff --git a/src/solaris/device.c b/src/solaris/device.c index 26121e2..77a4361 100644 --- a/src/solaris/device.c +++ b/src/solaris/device.c @@ -18,19 +18,18 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - -#include "system.h" +#include "../system.h" #include #include #include -#include "conf.h" -#include "device.h" -#include "logger.h" -#include "net.h" -#include "utils.h" -#include "xalloc.h" +#include "../conf.h" +#include "../device.h" +#include "../logger.h" +#include "../net.h" +#include "../utils.h" +#include "../xalloc.h" #define DEFAULT_DEVICE "/dev/tun" diff --git a/lib/splay_tree.c b/src/splay_tree.c similarity index 100% rename from lib/splay_tree.c rename to src/splay_tree.c diff --git a/lib/splay_tree.h b/src/splay_tree.h similarity index 100% rename from lib/splay_tree.h rename to src/splay_tree.h diff --git a/system.h b/src/system.h similarity index 98% rename from system.h rename to src/system.h index dfb4c6d..e173426 100644 --- a/system.h +++ b/src/system.h @@ -21,7 +21,7 @@ #ifndef __TINC_SYSTEM_H__ #define __TINC_SYSTEM_H__ -#include "config.h" +#include "../config.h" #include "have.h" diff --git a/lib/utils.c b/src/utils.c similarity index 100% rename from lib/utils.c rename to src/utils.c diff --git a/lib/utils.h b/src/utils.h similarity index 100% rename from lib/utils.h rename to src/utils.h diff --git a/lib/xalloc.h b/src/xalloc.h similarity index 100% rename from lib/xalloc.h rename to src/xalloc.h diff --git a/lib/xmalloc.c b/src/xmalloc.c similarity index 99% rename from lib/xmalloc.c rename to src/xmalloc.c index 58f2bce..1e40017 100644 --- a/lib/xmalloc.c +++ b/src/xmalloc.c @@ -16,7 +16,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #if HAVE_CONFIG_H -# include +# include "../config.h" #endif #include -- 2.25.1