def GetRoutes(self, dest, oif, mark, uid, iif=None): version = csocket.AddressVersion(dest) prefixlen = {4: 32, 6: 128}[version] self._Route(version, RTPROT_STATIC, RTM_GETROUTE, 0, dest, prefixlen, None, oif, mark, uid, iif=iif) data = self._Recv() # The response will either be an error or a list of routes. if netlink.NLMsgHdr(data).type == netlink.NLMSG_ERROR: self._ParseAck(data) routes = self._GetMsgList(RTMsg, data, False) return routes
def PrintMessage(self, message): hdr = netlink.NLMsgHdr(message) print self.CommandToString(hdr.type, message)
def MaybeDebugMessage(self, message): hdr = netlink.NLMsgHdr(message) self.MaybeDebugCommand(hdr.type, message)