Ticket: CM-27243
Reviewed By: CCR-9608
Testing Done: Unit tseting, PTM Smoke
Issue: Error messages "netlink: 8 bytes leftover after parsing attributes
in process `lldpd'"
Root cause: Root Cause: The length of the netlink message was not being set
properly for non-bridge family type messages. Same length was being used for
both type of messages even though bridge family type message has extra
attribute. This causes 8 extra bytes being left over in the non-bridge
family type netlink messages.
Fix: Calculating and setting the length separately for bridge and non-bridge
family type messages.
(cherry picked from commit
aac76966539bf932d5923b165762db370990bf94)
{
struct netlink_req req = {
.hdr = {
{
struct netlink_req req = {
.hdr = {
- .nlmsg_len = sizeof(struct netlink_req),
+ .nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
.nlmsg_type = type,
.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP,
.nlmsg_seq = seq,
.nlmsg_type = type,
.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP,
.nlmsg_seq = seq,
};
if (family == AF_BRIDGE) {
};
if (family == AF_BRIDGE) {
+ unsigned int len = RTA_LENGTH(sizeof(__u32));
/* request bridge vlan attributes */
req.ext_req.rta_type = IFLA_EXT_MASK;
/* request bridge vlan attributes */
req.ext_req.rta_type = IFLA_EXT_MASK;
- req.ext_req.rta_len = RTA_LENGTH(sizeof(__u32));
+ req.ext_req.rta_len = len;
req.ext_filter_mask = RTEXT_FILTER_BRVLAN;
req.ext_filter_mask = RTEXT_FILTER_BRVLAN;
+ req.hdr.nlmsg_len = NLMSG_ALIGN(req.hdr.nlmsg_len) + RTA_ALIGN(len);
+ iov.iov_len = req.hdr.nlmsg_len;
}
/* Send netlink message. This is synchronous but we are guaranteed
}
/* Send netlink message. This is synchronous but we are guaranteed