Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 173 additions & 0 deletions net/dhcp6/files/patch-addrconf.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 @@ update_address(ia, addr, dhcpifp, ctlp, callback)
}

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 @@ find_addr(head, addr)
}

static int
-remove_addr(sa)
- struct statefuladdr *sa;
+remove_addr(struct statefuladdr *sa)
{
int ret;

@@ -247,8 +241,7 @@ remove_addr(sa)
}

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 @@ duration_addr(iac)
}

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 @@ cleanup_addr(iac)
}

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 @@ renew_addr(iac, iaparam, evdp, evd)
}

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 @@ na_renew_data_free(evd)
}

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 @@ addr_timo(arg)
}

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;
17 changes: 17 additions & 0 deletions net/dhcp6/files/patch-addrconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- addrconf.h.orig 2017-02-28 19:06:15 UTC
+++ addrconf.h
@@ -29,7 +29,12 @@
* SUCH DAMAGE.
*/

+#ifndef _ADDRCONF_H_
+#define _ADDRCONF_H_
+
typedef enum { ADDR6S_ACTIVE, ADDR6S_RENEW, ADDR6S_REBIND} addr6state_t;

-extern int update_address __P((struct ia *, struct dhcp6_statefuladdr *,
- struct dhcp6_if *, struct iactl **, void (*)__P((struct ia *))));
+int update_address(struct ia *, struct dhcp6_statefuladdr *,
+ struct dhcp6_if *, struct iactl **, void (*)(struct ia *));
+
+#endif
138 changes: 138 additions & 0 deletions net/dhcp6/files/patch-auth.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
--- auth.c.orig 2017-02-28 19:06:15 UTC
+++ auth.c
@@ -66,10 +66,10 @@
#include <string.h>
#include <errno.h>

-#include <dhcp6.h>
-#include <config.h>
-#include <common.h>
-#include <auth.h>
+#include "dhcp6.h"
+#include "config.h"
+#include "common.h"
+#include "auth.h"

#define PADLEN 64
#define IPAD 0x36
@@ -78,9 +78,9 @@
#define HMACMD5_KEYLENGTH 64

typedef struct {
- u_int32_t buf[4];
- u_int32_t bytes[2];
- u_int32_t in[16];
+ uint32_t buf[4];
+ uint32_t bytes[2];
+ uint32_t in[16];
} md5_t;

typedef struct {
@@ -88,22 +88,21 @@ typedef struct {
unsigned char key[HMACMD5_KEYLENGTH];
} hmacmd5_t;

-static void hmacmd5_init __P((hmacmd5_t *, const unsigned char *,
- unsigned int));
-static void hmacmd5_invalidate __P((hmacmd5_t *));
-static void hmacmd5_update __P((hmacmd5_t *, const unsigned char *,
- unsigned int));
-static void hmacmd5_sign __P((hmacmd5_t *, unsigned char *));
-static int hmacmd5_verify __P((hmacmd5_t *, unsigned char *));
+static void hmacmd5_init(hmacmd5_t *, const unsigned char *,
+ unsigned int);
+static void hmacmd5_invalidate(hmacmd5_t *);
+static void hmacmd5_update(hmacmd5_t *, const unsigned char *,
+ unsigned int);
+static void hmacmd5_sign(hmacmd5_t *, unsigned char *);
+static int hmacmd5_verify(hmacmd5_t *, unsigned char *);

-static void md5_init __P((md5_t *));
-static void md5_invalidate __P((md5_t *));
-static void md5_final __P((md5_t *, unsigned char *));
-static void md5_update __P((md5_t *, const unsigned char *, unsigned int));
+static void md5_init(md5_t *);
+static void md5_invalidate(md5_t *);
+static void md5_final(md5_t *, unsigned char *);
+static void md5_update(md5_t *, const unsigned char *, unsigned int);

int
-dhcp6_validate_key(key)
- struct keyinfo *key;
+dhcp6_validate_key(struct keyinfo *key)
{
time_t now;

@@ -120,11 +119,8 @@ dhcp6_validate_key(key)
}

int
-dhcp6_calc_mac(buf, len, proto, alg, off, key)
- char *buf;
- size_t len, off;
- int proto, alg;
- struct keyinfo *key;
+dhcp6_calc_mac(char *buf, size_t len, int proto __attribute__((__unused__)), int alg,
+ size_t off, struct keyinfo *key)
{
hmacmd5_t ctx;
unsigned char digest[MD5_DIGESTLENGTH];
@@ -152,12 +148,8 @@ dhcp6_calc_mac(buf, len, proto, alg, off, key)
}

int
-dhcp6_verify_mac(buf, len, proto, alg, off, key)
- char *buf;
- ssize_t len;
- int proto, alg;
- size_t off;
- struct keyinfo *key;
+dhcp6_verify_mac(char *buf, ssize_t len, int proto __attribute__((__unused__)),
+ int alg, size_t off, struct keyinfo *key)
{
hmacmd5_t ctx;
unsigned char digest[MD5_DIGESTLENGTH];
@@ -168,7 +160,7 @@ dhcp6_verify_mac(buf, len, proto, alg, off, key)
if (alg != DHCP6_AUTHALG_HMACMD5)
return (-1);

- if (off + MD5_DIGESTLENGTH > len)
+ if (off + MD5_DIGESTLENGTH > (size_t)len)
return (-1);

/*
@@ -287,12 +279,12 @@ hmacmd5_verify(hmacmd5_t *ctx, unsigned char *digest)
*/

static void
-byteSwap(u_int32_t *buf, unsigned words)
+byteSwap(uint32_t *buf, unsigned words)
{
unsigned char *p = (unsigned char *)buf;

do {
- *buf++ = (u_int32_t)((unsigned)p[3] << 8 | p[2]) << 16 |
+ *buf++ = (uint32_t)((unsigned)p[3] << 8 | p[2]) << 16 |
((unsigned)p[1] << 8 | p[0]);
p += 4;
} while (--words);
@@ -338,8 +330,8 @@ md5_invalidate(md5_t *ctx)
* the data and converts bytes into longwords for this routine.
*/
static void
-transform(u_int32_t buf[4], u_int32_t const in[16]) {
- register u_int32_t a, b, c, d;
+transform(uint32_t buf[4], uint32_t const in[16]) {
+ register uint32_t a, b, c, d;

a = buf[0];
b = buf[1];
@@ -427,7 +419,7 @@ transform(u_int32_t buf[4], u_int32_t const in[16]) {
static void
md5_update(md5_t *ctx, const unsigned char *buf, unsigned int len)
{
- u_int32_t t;
+ uint32_t t;

/* Update byte count */

36 changes: 36 additions & 0 deletions net/dhcp6/files/patch-auth.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--- auth.h.orig 2017-02-28 19:06:15 UTC
+++ auth.h
@@ -28,15 +28,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+#ifndef _AUTH_H_
+#define _AUTH_H_

-#ifdef __sun__
-#define __P(x) x
-#ifndef U_INT32_T_DEFINED
-#define U_INT32_T_DEFINED
-typedef uint32_t u_int32_t;
-#endif
-#endif
-
#define MD5_DIGESTLENGTH 16

/* secret key information for delayed authentication */
@@ -53,8 +47,10 @@ struct keyinfo {
time_t expire; /* expiration time (0 means forever) */
};

-extern int dhcp6_validate_key __P((struct keyinfo *));
-extern int dhcp6_calc_mac __P((char *, size_t, int, int, size_t,
- struct keyinfo *));
-extern int dhcp6_verify_mac __P((char *, ssize_t, int, int, size_t,
- struct keyinfo *));
+int dhcp6_validate_key(struct keyinfo *);
+int dhcp6_calc_mac(char *, size_t, int, int, size_t,
+ struct keyinfo *);
+int dhcp6_verify_mac(char *, ssize_t, int, int, size_t,
+ struct keyinfo *);
+
+#endif
11 changes: 11 additions & 0 deletions net/dhcp6/files/patch-base64.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- base64.c.orig 2017-02-28 19:06:15 UTC
+++ base64.c
@@ -67,6 +67,8 @@ typedef struct {
char *dstend; /* End of the buffer */
} base64_decode_ctx_t;

+int base64_decodestring(const char *, char *, size_t);
+
static int
mem_tobuffer(base64_decode_ctx_t *ctx, void *base, unsigned int length)
{
13 changes: 13 additions & 0 deletions net/dhcp6/files/patch-base64.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- base64.h.orig 2017-02-28 19:06:15 UTC
+++ base64.h
@@ -29,4 +29,9 @@
* SUCH DAMAGE.
*/

-extern int base64_decodestring __P((const char *, char *, size_t));
+#ifndef _BASE64_H_
+#define _BASE64_H_
+
+int base64_decodestring(const char *, char *, size_t);
+
+#endif
Loading