Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/dhcpcd/dist more htons uint16_t lossage
details: https://anonhg.NetBSD.org/src/rev/a94dcdec58e1
branches: trunk
changeset: 336956:a94dcdec58e1
user: christos <christos%NetBSD.org@localhost>
date: Sat Mar 28 14:16:52 2015 +0000
description:
more htons uint16_t lossage
diffstat:
external/bsd/dhcpcd/dist/dhcp.c | 10 +++++-----
external/bsd/dhcpcd/dist/dhcp6.c | 22 +++++++++++-----------
external/bsd/dhcpcd/dist/ipv6nd.c | 4 ++--
3 files changed, 18 insertions(+), 18 deletions(-)
diffs (164 lines):
diff -r 26f8d757ded0 -r a94dcdec58e1 external/bsd/dhcpcd/dist/dhcp.c
--- a/external/bsd/dhcpcd/dist/dhcp.c Sat Mar 28 14:09:58 2015 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp.c Sat Mar 28 14:16:52 2015 +0000
@@ -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 @@
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 @@
* 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 @@
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 @@
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;
diff -r 26f8d757ded0 -r a94dcdec58e1 external/bsd/dhcpcd/dist/dhcp6.c
--- a/external/bsd/dhcpcd/dist/dhcp6.c Sat Mar 28 14:09:58 2015 +0000
+++ b/external/bsd/dhcpcd/dist/dhcp6.c Sat Mar 28 14:16:52 2015 +0000
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 */
}
diff -r 26f8d757ded0 -r a94dcdec58e1 external/bsd/dhcpcd/dist/ipv6nd.c
--- a/external/bsd/dhcpcd/dist/ipv6nd.c Sat Mar 28 14:09:58 2015 +0000
+++ b/external/bsd/dhcpcd/dist/ipv6nd.c Sat Mar 28 14:16:52 2015 +0000
@@ -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 @@
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;
Home |
Main Index |
Thread Index |
Old Index