chiark / gitweb /
sd-rtnl: message - fix clang compile warning
[elogind.git] / src / libsystemd / sd-rtnl / rtnl-message.c
index 4c746f9d8afe9294233af1777f572b3145d62413..5265184098c32c2e37b1d9715c984f5ef58791da 100644 (file)
@@ -920,10 +920,11 @@ int rtnl_message_parse(sd_rtnl_message *m,
         for (; RTA_OK(rta, rt_len); rta = RTA_NEXT(rta, rt_len)) {
                 type = rta->rta_type;
 
-                if (type > max) {
-                        log_debug("rtnl: message parse - ignore out of range attribute type");
+                /* if the kernel is newer than the headers we used
+                   when building, we ignore out-of-range attributes
+                 */
+                if (type > max)
                         continue;
-                }
 
                 if (tb[type])
                         log_debug("rtnl: message parse - overwriting repeated attribute");
@@ -1084,7 +1085,8 @@ int sd_rtnl_message_rewind(sd_rtnl_message *m) {
                                        &m->rta_offset_tb[m->n_containers],
                                        &m->rta_tb_size[m->n_containers],
                                        type_system->max,
-                                       (char*)NLMSG_DATA(m->hdr) + NLMSG_ALIGN(type->size),
+                                       (struct rtattr*)((uint8_t*)NLMSG_DATA(m->hdr) +
+                                                        NLMSG_ALIGN(type->size)),
                                        NLMSG_PAYLOAD(m->hdr, type->size));
                 if (r < 0)
                         return r;