Closed shotahino closed 3 years ago
I believe this is attempting to compute the offset at the next word boundary. This is incorrect.
https://github.com/christgau/wsdd/blob/master/test/netlink_monitor.py#L65
if h_type != RTM_NEWADDR and h_type != RTM_DELADDR: offset += ((msg_len + 1) // NLM_HDR_ALIGNTO) * NLM_HDR_ALIGNTO # print('not interested in message type ', h_type) # print('new offset: ', offset) continue
if msg_len is 1, offset would be incremented by 0. This is incorrect. We would want to increment the offset by 4 so the next offset is word aligned.
msg_len
The correct way to increment the offset would be
offset += ((msg_len + NLM_HDR_ALIGNTO - 1) // NLM_HDR_ALIGNTO) * NLM_HDR_ALIGNTO
The same bug is also in https://github.com/christgau/wsdd/blob/master/test/netlink_monitor.py#L92
D'oh! You're right. This might be the reason for #59. Will fix it.
Thanks a lot for pointing that one out!
I believe this is attempting to compute the offset at the next word boundary. This is incorrect.
https://github.com/christgau/wsdd/blob/master/test/netlink_monitor.py#L65
if
msg_len
is 1, offset would be incremented by 0. This is incorrect. We would want to increment the offset by 4 so the next offset is word aligned.The correct way to increment the offset would be
The same bug is also in https://github.com/christgau/wsdd/blob/master/test/netlink_monitor.py#L92