1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00

Merge pull request #7902 from yuwata/fix-warning-by-clang

network: small fixes
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-01-17 20:17:23 +11:00 committed by GitHub
commit 9b1f89bcb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View File

@ -96,9 +96,8 @@ int dhcp6_option_append(uint8_t **buf, size_t *buflen, uint16_t code,
int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia) { int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia) {
uint16_t len; uint16_t len;
be32_t *iaid;
uint8_t *ia_hdr; uint8_t *ia_hdr;
size_t ia_buflen, ia_addrlen = 0; size_t iaid_offset, ia_buflen, ia_addrlen = 0;
DHCP6Address *addr; DHCP6Address *addr;
int r; int r;
@ -107,12 +106,12 @@ int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia) {
switch (ia->type) { switch (ia->type) {
case SD_DHCP6_OPTION_IA_NA: case SD_DHCP6_OPTION_IA_NA:
len = DHCP6_OPTION_IA_NA_LEN; len = DHCP6_OPTION_IA_NA_LEN;
iaid = &ia->ia_na.id; iaid_offset = offsetof(DHCP6IA, ia_na);
break; break;
case SD_DHCP6_OPTION_IA_TA: case SD_DHCP6_OPTION_IA_TA:
len = DHCP6_OPTION_IA_TA_LEN; len = DHCP6_OPTION_IA_TA_LEN;
iaid = &ia->ia_ta.id; iaid_offset = offsetof(DHCP6IA, ia_ta);
break; break;
default: default:
@ -128,7 +127,7 @@ int dhcp6_option_append_ia(uint8_t **buf, size_t *buflen, DHCP6IA *ia) {
*buf += sizeof(DHCP6Option); *buf += sizeof(DHCP6Option);
*buflen -= sizeof(DHCP6Option); *buflen -= sizeof(DHCP6Option);
memcpy(*buf, iaid, len); memcpy(*buf, (char*) ia + iaid_offset, len);
*buf += len; *buf += len;
*buflen -= len; *buflen -= len;

View File

@ -79,7 +79,7 @@ static void ipvlan_init(NetDev *n) {
assert(m); assert(m);
m->mode = _NETDEV_IPVLAN_MODE_INVALID; m->mode = _NETDEV_IPVLAN_MODE_INVALID;
m->mode = _NETDEV_IPVLAN_FLAGS_INVALID; m->flags = _NETDEV_IPVLAN_FLAGS_INVALID;
} }
const NetDevVTable ipvlan_vtable = { const NetDevVTable ipvlan_vtable = {

View File

@ -1357,7 +1357,7 @@ int manager_dhcp6_prefix_remove_all(Manager *m, Link *link) {
struct in6_addr *addr; struct in6_addr *addr;
assert_return(m, -EINVAL); assert_return(m, -EINVAL);
assert_return(l, -EINVAL); assert_return(link, -EINVAL);
HASHMAP_FOREACH_KEY(l, addr, m->dhcp6_prefixes, i) { HASHMAP_FOREACH_KEY(l, addr, m->dhcp6_prefixes, i) {
if (l != link) if (l != link)