1from pr2modules.bsd.pf_route import (bsdmsg, 2 if_msg, 3 rt_msg, 4 if_announcemsg, 5 ifa_msg) 6 7RTM_ADD = 0x1 # Add Route 8RTM_DELETE = 0x2 # Delete Route 9RTM_CHANGE = 0x3 # Change Metrics or flags 10RTM_GET = 0x4 # Report Metrics 11RTM_LOSING = 0x5 # Kernel Suspects Partitioning 12RTM_REDIRECT = 0x6 # Told to use different route 13RTM_MISS = 0x7 # Lookup failed on this address 14RTM_LOCK = 0x8 # Fix specified metrics 15RTM_RESOLVE = 0xb # Req to resolve dst to LL addr 16RTM_NEWADDR = 0xc # Address being added to iface 17RTM_DELADDR = 0xd # Address being removed from iface 18RTM_IFINFO = 0xe # Iface going up/down etc 19RTM_IFANNOUNCE = 0xf # Iface arrival/departure 20RTM_DESYNC = 0x10 # route socket buffer overflow 21RTM_INVALIDATE = 0x10 # Invalidate cache of L2 route 22RTM_BFD = 0x12 # bidirectional forwarding detection 23RTM_PROPOSAL = 0x13 # proposal for netconfigd 24 25 26class RTMSocketBase(object): 27 28 msg_map = {RTM_ADD: rt_msg, 29 RTM_DELETE: rt_msg, 30 RTM_CHANGE: rt_msg, 31 RTM_GET: rt_msg, 32 RTM_LOSING: rt_msg, 33 RTM_REDIRECT: rt_msg, 34 RTM_MISS: rt_msg, 35 RTM_LOCK: rt_msg, 36 RTM_RESOLVE: rt_msg, 37 RTM_NEWADDR: ifa_msg, 38 RTM_DELADDR: ifa_msg, 39 RTM_IFINFO: if_msg, 40 RTM_IFANNOUNCE: if_announcemsg, 41 RTM_DESYNC: bsdmsg, 42 RTM_INVALIDATE: bsdmsg, 43 RTM_BFD: bsdmsg, 44 RTM_PROPOSAL: bsdmsg} 45