thismodule = sys.modules[module]
for name in dir(thismodule):
if name.startswith("INET_DIAG_BC"):
- break
+ continue
if (name.startswith(prefix) and
not name.startswith(prefix + "F_") and
name.isupper() and getattr(thismodule, name) == value):
nlmsghdr = NLMsgHdr((length, command, flags, self.seq, self.pid))
# Send the request.
- self._Send(nlmsghdr.Pack() + msg.Pack() + attrs)
+ request = nlmsghdr.Pack() + msg.Pack() + attrs
+ self.MaybeDebugCommand(command, request)
+ self._Send(request)
# Keep reading netlink messages until we get a NLMSG_DONE.
out = []
def _Decode(self, command, msg, nla_type, nla_data):
"""Decodes netlink attributes to Python types."""
if msg.family == AF_INET or msg.family == AF_INET6:
- name = self._GetConstantName(__name__, nla_type, "INET_DIAG")
+ if isinstance(msg, InetDiagReqV2):
+ prefix = "INET_DIAG_REQ"
+ else:
+ prefix = "INET_DIAG"
+ name = self._GetConstantName(__name__, nla_type, prefix)
else:
# Don't know what this is. Leave it as an integer.
name = nla_type
data = TcpInfo(nla_data)
elif name == "INET_DIAG_SKMEMINFO":
data = SkMeminfo(nla_data)
+ elif name == "INET_DIAG_REQ_BYTECODE":
+ data = nla_data.encode("hex")
else:
data = nla_data