示例#1
0
 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
示例#2
0
 def PrintMessage(self, message):
   hdr = netlink.NLMsgHdr(message)
   print self.CommandToString(hdr.type, message)
示例#3
0
 def MaybeDebugMessage(self, message):
   hdr = netlink.NLMsgHdr(message)
   self.MaybeDebugCommand(hdr.type, message)