$NetBSD: patch-aq,v 1.1.1.1 2005/01/02 02:51:42 cube Exp $ --- pppd/ipv6cp.c.orig 2004-11-13 03:28:15.000000000 +0100 +++ pppd/ipv6cp.c @@ -151,6 +151,7 @@ */ #include +#include #include #include #include @@ -163,12 +164,17 @@ #include "pppd.h" #include "fsm.h" #include "ipcp.h" +#ifdef INET6 #include "ipv6cp.h" +#endif #include "magic.h" #include "pathnames.h" +#ifdef RCSID static const char rcsid[] = RCSID; +#endif +#ifdef INET6 /* global vars */ ipv6cp_options ipv6cp_wantoptions[NUM_PPP]; /* Options that we want to request */ ipv6cp_options ipv6cp_gotoptions[NUM_PPP]; /* Options that peer ack'd */ @@ -192,6 +198,7 @@ static int ipv6cp_reqci __P((fsm *, u_c static void ipv6cp_up __P((fsm *)); /* We're UP */ static void ipv6cp_down __P((fsm *)); /* We're DOWN */ static void ipv6cp_finished __P((fsm *)); /* Don't need lower layer */ +static char *llv6_ntoa __P((eui64_t)); fsm ipv6cp_fsm[NUM_PPP]; /* IPV6CP fsm structure */ @@ -328,9 +335,10 @@ setifaceid(argv) struct in6_addr addr; static int prio_local, prio_remote; +#define s6_addr32 __u6_addr.__u6_addr32 /* non-standard */ #define VALIDID(a) ( (((a).s6_addr32[0] == 0) && ((a).s6_addr32[1] == 0)) && \ (((a).s6_addr32[2] != 0) || ((a).s6_addr32[3] != 0)) ) - + arg = *argv; if ((comma = strchr(arg, ',')) == NULL) comma = arg + strlen(arg); @@ -395,13 +403,13 @@ printifaceid(opt, printer, arg) /* * Make a string representation of a network address. */ -char * +static char * llv6_ntoa(ifaceid) eui64_t ifaceid; { static char b[64]; - sprintf(b, "fe80::%s", eui64_ntoa(ifaceid)); + snprintf(b, sizeof(b), "fe80::%s", eui64_ntoa(ifaceid)); return b; } @@ -1406,9 +1414,10 @@ ipv6cp_script(script) char strspeed[32], strlocal[32], strremote[32]; char *argv[8]; - sprintf(strspeed, "%d", baud_rate); - strcpy(strlocal, llv6_ntoa(ipv6cp_gotoptions[0].ourid)); - strcpy(strremote, llv6_ntoa(ipv6cp_hisoptions[0].hisid)); + snprintf(strspeed, sizeof(strspeed), "%d", baud_rate); + strlcpy(strlocal, llv6_ntoa(ipv6cp_gotoptions[0].ourid), sizeof(strlocal)); + strlcpy(strremote, llv6_ntoa(ipv6cp_hisoptions[0].hisid), + sizeof(strremote)); argv[0] = script; argv[1] = ifname; @@ -1559,3 +1568,4 @@ ipv6_active_pkt(pkt, len) return 0; return 1; } +#endif