X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fplugins%2Fpppoe%2Fpppoe-discovery.c;h=10f51dc975dbd9df1a851ca056f586770e09aa8d;hb=HEAD;hp=e93d7812709afa847573caa795d5cbf96fe0e266;hpb=c2186b5bccdb4b8a38ae7956f1557e39ca4a4d9d;p=ppp.git diff --git a/pppd/plugins/pppoe/pppoe-discovery.c b/pppd/plugins/pppoe/pppoe-discovery.c index e93d781..5b1b2dc 100644 --- a/pppd/plugins/pppoe/pppoe-discovery.c +++ b/pppd/plugins/pppoe/pppoe-discovery.c @@ -10,7 +10,7 @@ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include @@ -21,42 +21,19 @@ #include #include #include +#include +#include +#include #include "pppoe.h" -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef HAVE_NETPACKET_PACKET_H -#include -#elif defined(HAVE_LINUX_IF_PACKET_H) -#include -#endif - -#ifdef HAVE_ASM_TYPES_H -#include -#endif - -#ifdef HAVE_SYS_IOCTL_H -#include -#endif - -#include -#include -#include - -#ifdef HAVE_NET_IF_ARP_H -#include -#endif - int debug; int got_sigterm; int pppoe_verbose; static FILE *debugFile; void -fatal(char *fmt, ...) +fatal(const char *fmt, ...) { va_list pvar; va_start(pvar, fmt); @@ -67,7 +44,7 @@ fatal(char *fmt, ...) } void -error(char *fmt, ...) +error(const char *fmt, ...) { va_list pvar; va_start(pvar, fmt); @@ -77,7 +54,7 @@ error(char *fmt, ...) } void -warn(char *fmt, ...) +warn(const char *fmt, ...) { va_list pvar; va_start(pvar, fmt); @@ -87,7 +64,7 @@ warn(char *fmt, ...) } void -info(char *fmt, ...) +info(const char *fmt, ...) { va_list pvar; va_start(pvar, fmt); @@ -149,6 +126,17 @@ get_time(struct timeval *tv) return gettimeofday(tv, NULL); } +int signaled(int signal) { + if (signal == SIGTERM) + return got_sigterm; + return 0; +} + +bool debug_on() +{ + return !!debug; +} + static void term_handler(int signum) { @@ -233,7 +221,7 @@ int main(int argc, char *argv[]) optarg, strerror(errno)); exit(1); } - fprintf(debugFile, "pppoe-discovery from pppd %s\n", VERSION); + fprintf(debugFile, "pppoe-discovery from pppd %s\n", PPPD_VERSION); break; case 'I': conn->ifName = xstrdup(optarg); @@ -295,5 +283,5 @@ usage(void) " -U -- Use Host-Unique to allow multiple PPPoE sessions.\n" " -W hexvalue -- Set the Host-Unique to the supplied hex string.\n" " -h -- Print usage information.\n"); - fprintf(stderr, "\npppoe-discovery from pppd " VERSION "\n"); + fprintf(stderr, "\npppoe-discovery from pppd " PPPD_VERSION "\n"); }