Module Name:    src
Committed By:   christos
Date:           Sat Mar 28 14:16:52 UTC 2015

Modified Files:
        src/external/bsd/dhcpcd/dist: dhcp.c dhcp6.c ipv6nd.c

Log Message:
more htons uint16_t lossage


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/external/bsd/dhcpcd/dist/dhcp.c
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/dhcpcd/dist/dhcp6.c
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/dhcpcd/dist/ipv6nd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/dhcpcd/dist/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/dhcp.c:1.28 src/external/bsd/dhcpcd/dist/dhcp.c:1.29
--- src/external/bsd/dhcpcd/dist/dhcp.c:1.28	Thu Mar 26 06:26:37 2015
+++ src/external/bsd/dhcpcd/dist/dhcp.c	Sat Mar 28 10:16:52 2015
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp.c,v 1.28 2015/03/26 10:26:37 roy Exp $");
+ __RCSID("$NetBSD: dhcp.c,v 1.29 2015/03/28 14:16:52 christos Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -752,7 +752,7 @@ make_message(struct dhcp_message **messa
 		if (up < 0 || up > (time_t)UINT16_MAX)
 			dhcp->secs = htons((uint16_t)UINT16_MAX);
 		else
-			dhcp->secs = htons(up);
+			dhcp->secs = htons((uint16_t)up);
 	}
 	dhcp->xid = htonl(state->xid);
 	dhcp->cookie = htonl(MAGIC_COOKIE);
@@ -828,7 +828,7 @@ make_message(struct dhcp_message **messa
 			 * handle DHCP packets any bigger. */
 			mtu = MTU_MAX;
 		}
-		sz = htons(mtu);
+		sz = htons((uint16_t)mtu);
 		memcpy(p, &sz, 2);
 		p += 2;
 
@@ -1545,7 +1545,7 @@ dhcp_makeudppacket(size_t *sz, const uin
 
 	udp->uh_sport = htons(DHCP_CLIENT_PORT);
 	udp->uh_dport = htons(DHCP_SERVER_PORT);
-	udp->uh_ulen = htons(sizeof(*udp) + length);
+	udp->uh_ulen = htons((uint16_t)(sizeof(*udp) + length));
 	ip->ip_len = udp->uh_ulen;
 	udp->uh_sum = checksum(udpp, sizeof(*udpp));
 
@@ -1553,7 +1553,7 @@ dhcp_makeudppacket(size_t *sz, const uin
 	ip->ip_hl = sizeof(*ip) >> 2;
 	ip->ip_id = (uint16_t)arc4random_uniform(UINT16_MAX);
 	ip->ip_ttl = IPDEFTTL;
-	ip->ip_len = htons(sizeof(*ip) + sizeof(*udp) + length);
+	ip->ip_len = htons((uint16_t)(sizeof(*ip) + sizeof(*udp) + length));
 	ip->ip_sum = checksum(ip, sizeof(*ip));
 
 	*sz = sizeof(*ip) + sizeof(*udp) + length;

Index: src/external/bsd/dhcpcd/dist/dhcp6.c
diff -u src/external/bsd/dhcpcd/dist/dhcp6.c:1.10 src/external/bsd/dhcpcd/dist/dhcp6.c:1.11
--- src/external/bsd/dhcpcd/dist/dhcp6.c:1.10	Thu Mar 26 06:26:37 2015
+++ src/external/bsd/dhcpcd/dist/dhcp6.c	Sat Mar 28 10:16:52 2015
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: dhcp6.c,v 1.10 2015/03/26 10:26:37 roy Exp $");
+ __RCSID("$NetBSD: dhcp6.c,v 1.11 2015/03/28 14:16:52 christos Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -191,7 +191,7 @@ dhcp6_makevendor(struct dhcp6_option *o,
 
 	if (o) {
 		o->code = htons(D6_OPTION_VENDOR_CLASS);
-		o->len = htons(len);
+		o->len = htons((uint16_t)len);
 		p = D6_OPTION_DATA(o);
 		u32 = htonl(ifo->vivco_en ? ifo->vivco_en : DHCPCD_IANA_PEN);
 		memcpy(p, &u32, sizeof(u32));
@@ -201,14 +201,14 @@ dhcp6_makevendor(struct dhcp6_option *o,
 			    i < ifo->vivco_len;
 			    i++, vivco++)
 			{
-				u16 = htons(vivco->len);
+				u16 = htons((uint16_t)vivco->len);
 				memcpy(p, &u16, sizeof(u16));
 				p += sizeof(u16);
 				memcpy(p, vivco->data, vivco->len);
 				p += vivco->len;
 			}
 		} else if (vlen) {
-			u16 = htons(vlen);
+			u16 = htons((uint16_t)vlen);
 			memcpy(p, &u16, sizeof(u16));
 			p += sizeof(u16);
 			memcpy(p, vendor, (size_t)vlen);
@@ -313,7 +313,7 @@ dhcp6_updateelapsed(struct interface *if
 	up = uptime() - state->start_uptime;
 	if (up < 0 || up > (time_t)UINT16_MAX)
 		up = (time_t)UINT16_MAX;
-	u16 = htons(up);
+	u16 = htons((uint16_t)up);
 	memcpy(D6_OPTION_DATA(o), &u16, sizeof(u16));
 	return 0;
 }
@@ -734,7 +734,7 @@ dhcp6_makemessage(struct interface *ifp)
 
 	o = D6_FIRST_OPTION(state->send);
 	o->code = htons(D6_OPTION_CLIENTID);
-	o->len = htons(ifp->ctx->duid_len);
+	o->len = htons((uint16_t)ifp->ctx->duid_len);
 	memcpy(D6_OPTION_DATA(o), ifp->ctx->duid, ifp->ctx->duid_len);
 
 	if (si) {
@@ -818,7 +818,7 @@ dhcp6_makemessage(struct interface *ifp)
 
 				u32 = (uint32_t)(ntohs(o->len) + sizeof(*so)
 				    + ntohs(so->len));
-				o->len = htons(u32);
+				o->len = htons((uint16_t)u32);
 			} else {
 				so->code = htons(D6_OPTION_IA_ADDR);
 				so->len = sizeof(ap->addr) +
@@ -855,7 +855,7 @@ dhcp6_makemessage(struct interface *ifp)
 			l = encode_rfc1035(hostname, p + 1);
 			if (l == 0)
 				*p = D6_FQDN_NONE;
-			o->len = htons(l + 1);
+			o->len = htons((uint16_t)(l + 1));
 		}
 
 		if ((ifo->auth.options & DHCPCD_AUTH_SENDREQUIRE) !=
@@ -889,7 +889,7 @@ dhcp6_makemessage(struct interface *ifp)
 				    has_option_mask(ifo->requestmask6,
 				        opt->option)))
 				{
-					u16 = htons(opt->option);
+					u16 = htons((uint16_t)opt->option);
 					memcpy(p, &u16, sizeof(u16));
 					p += sizeof(u16);
 					o->len = (uint16_t)(o->len + sizeof(u16));
@@ -904,7 +904,7 @@ dhcp6_makemessage(struct interface *ifp)
 				    has_option_mask(ifo->requestmask6,
 				        opt->option)))
 				{
-					u16 = htons(opt->option);
+					u16 = htons((uint16_t)opt->option);
 					memcpy(p, &u16, sizeof(u16));
 					p += sizeof(u16);
 					o->len = (uint16_t)(o->len + sizeof(u16));
@@ -923,7 +923,7 @@ dhcp6_makemessage(struct interface *ifp)
 	if (ifo->auth.options & DHCPCD_AUTH_SEND && auth_len != 0) {
 		o = D6_NEXT_OPTION(o);
 		o->code = htons(D6_OPTION_AUTH);
-		o->len = htons(auth_len);
+		o->len = htons((uint16_t)auth_len);
 		/* data will be filled at send message time */
 	}
 

Index: src/external/bsd/dhcpcd/dist/ipv6nd.c
diff -u src/external/bsd/dhcpcd/dist/ipv6nd.c:1.21 src/external/bsd/dhcpcd/dist/ipv6nd.c:1.22
--- src/external/bsd/dhcpcd/dist/ipv6nd.c:1.21	Thu Mar 26 06:26:37 2015
+++ src/external/bsd/dhcpcd/dist/ipv6nd.c	Sat Mar 28 10:16:52 2015
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
- __RCSID("$NetBSD: ipv6nd.c,v 1.21 2015/03/26 10:26:37 roy Exp $");
+ __RCSID("$NetBSD: ipv6nd.c,v 1.22 2015/03/28 14:16:52 christos Exp $");
 
 /*
  * dhcpcd - DHCP client daemon
@@ -1460,7 +1460,7 @@ ipv6nd_handlena(struct dhcpcd_ctx *dctx,
 	struct ipv6_ctx *ctx = dctx->ipv6;
 	struct nd_neighbor_advert *nd_na;
 	struct ra *rap;
-	int is_router, is_solicited;
+	uint32_t is_router, is_solicited;
 	char buf[INET6_ADDRSTRLEN];
 	const char *taddr;
 

Reply via email to