-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch-addrconf.c
173 lines (152 loc) · 4.75 KB
/
patch-addrconf.c
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
--- addrconf.c.orig 2017-02-28 19:06:15 UTC
+++ addrconf.c
@@ -57,8 +57,10 @@
#include "config.h"
#include "common.h"
#include "timer.h"
+#include "dhcp6c.h"
#include "dhcp6c_ia.h"
#include "prefixconf.h"
+#include "addrconf.h"
TAILQ_HEAD(statefuladdr_list, statefuladdr);
struct iactl_na {
@@ -85,29 +87,24 @@ struct statefuladdr {
struct dhcp6_if *dhcpif;
};
-static struct statefuladdr *find_addr __P((struct statefuladdr_list *,
- struct dhcp6_statefuladdr *));
-static int remove_addr __P((struct statefuladdr *));
-static int isvalid_addr __P((struct iactl *));
-static u_int32_t duration_addr __P((struct iactl *));
-static void cleanup_addr __P((struct iactl *));
-static int renew_addr __P((struct iactl *, struct dhcp6_ia *,
- struct dhcp6_eventdata **, struct dhcp6_eventdata *));
-static void na_renew_data_free __P((struct dhcp6_eventdata *));
+static struct statefuladdr *find_addr(struct statefuladdr_list *,
+ struct dhcp6_statefuladdr *);
+static int remove_addr(struct statefuladdr *);
+static int isvalid_addr(struct iactl *);
+static uint32_t duration_addr(struct iactl *);
+static void cleanup_addr(struct iactl *);
+static int renew_addr(struct iactl *, struct dhcp6_ia *,
+ struct dhcp6_eventdata **, struct dhcp6_eventdata *);
+static void na_renew_data_free(struct dhcp6_eventdata *);
-static struct dhcp6_timer *addr_timo __P((void *));
+static struct dhcp6_timer *addr_timo(void *);
-static int na_ifaddrconf __P((ifaddrconf_cmd_t, struct statefuladdr *));
+static int na_ifaddrconf(ifaddrconf_cmd_t, struct statefuladdr *);
-extern struct dhcp6_timer *client6_timo __P((void *));
-
int
-update_address(ia, addr, dhcpifp, ctlp, callback)
- struct ia *ia;
- struct dhcp6_statefuladdr *addr;
- struct dhcp6_if *dhcpifp;
- struct iactl **ctlp;
- void (*callback)__P((struct ia *));
+update_address(struct ia *ia, struct dhcp6_statefuladdr *addr,
+ struct dhcp6_if *dhcpifp, struct iactl **ctlp,
+ void (*callback)(struct ia *))
{
struct iactl_na *iac_na = (struct iactl_na *)*ctlp;
struct statefuladdr *sa;
@@ -212,9 +209,7 @@ static struct statefuladdr *
}
static struct statefuladdr *
-find_addr(head, addr)
- struct statefuladdr_list *head;
- struct dhcp6_statefuladdr *addr;
+find_addr(struct statefuladdr_list *head, struct dhcp6_statefuladdr *addr)
{
struct statefuladdr *sa;
@@ -228,8 +223,7 @@ static int
}
static int
-remove_addr(sa)
- struct statefuladdr *sa;
+remove_addr(struct statefuladdr *sa)
{
int ret;
@@ -247,8 +241,7 @@ static int
}
static int
-isvalid_addr(iac)
- struct iactl *iac;
+isvalid_addr(struct iactl *iac)
{
struct iactl_na *iac_na = (struct iactl_na *)iac;
@@ -257,13 +250,12 @@ isvalid_addr(iac)
return (1);
}
-static u_int32_t
-duration_addr(iac)
- struct iactl *iac;
+static uint32_t
+duration_addr(struct iactl *iac)
{
struct iactl_na *iac_na = (struct iactl_na *)iac;
struct statefuladdr *sa;
- u_int32_t base = DHCP6_DURATION_INFINITE, pltime, passed;
+ uint32_t base = DHCP6_DURATION_INFINITE, pltime, passed;
time_t now;
/* Determine the smallest period until pltime expires. */
@@ -271,7 +263,7 @@ duration_addr(iac)
for (sa = TAILQ_FIRST(&iac_na->statefuladdr_head); sa;
sa = TAILQ_NEXT(sa, link)) {
passed = now > sa->updatetime ?
- (u_int32_t)(now - sa->updatetime) : 0;
+ (uint32_t)(now - sa->updatetime) : 0;
pltime = sa->addr.pltime > passed ?
sa->addr.pltime - passed : 0;
@@ -283,8 +275,7 @@ static void
}
static void
-cleanup_addr(iac)
- struct iactl *iac;
+cleanup_addr(struct iactl *iac)
{
struct iactl_na *iac_na = (struct iactl_na *)iac;
struct statefuladdr *sa;
@@ -298,10 +289,8 @@ static int
}
static int
-renew_addr(iac, iaparam, evdp, evd)
- struct iactl *iac;
- struct dhcp6_ia *iaparam;
- struct dhcp6_eventdata **evdp, *evd;
+renew_addr(struct iactl *iac, struct dhcp6_ia *iaparam,
+ struct dhcp6_eventdata **evdp, struct dhcp6_eventdata *evd)
{
struct iactl_na *iac_na = (struct iactl_na *)iac;
struct statefuladdr *sa;
@@ -337,8 +326,7 @@ static void
}
static void
-na_renew_data_free(evd)
- struct dhcp6_eventdata *evd;
+na_renew_data_free(struct dhcp6_eventdata *evd)
{
struct dhcp6_list *ial;
@@ -355,12 +343,11 @@ static struct dhcp6_timer *
}
static struct dhcp6_timer *
-addr_timo(arg)
- void *arg;
+addr_timo(void *arg)
{
struct statefuladdr *sa = (struct statefuladdr *)arg;
struct ia *ia;
- void (*callback)__P((struct ia *));
+ void (*callback)(struct ia *);
d_printf(LOG_DEBUG, FNAME, "address timeout for %s",
in6addr2str(&sa->addr.addr, 0));
@@ -379,9 +366,7 @@ static int
}
static int
-na_ifaddrconf(cmd, sa)
- ifaddrconf_cmd_t cmd;
- struct statefuladdr *sa;
+na_ifaddrconf(ifaddrconf_cmd_t cmd, struct statefuladdr *sa)
{
struct dhcp6_statefuladdr *addr;
struct sockaddr_in6 sin6;