summaryrefslogtreecommitdiff
path: root/net/pppd/patches/patch-aq
blob: 2556bbfe3a5ffe09f8e966c34b57085e6353ff03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
$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 <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <netdb.h>
@@ -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