MCPcopy Index your code
hub / github.com/secdev/scapy / make_route

Method make_route

scapy/route6.py:90–113  ·  view source on GitHub ↗

Internal function : create a route for 'dst' via 'gw'.

(self,
                   dst,  # type: str
                   gw=None,  # type: Optional[str]
                   dev=None,  # type: Optional[str]
                   )

Source from the content-addressed store, hash-verified

88 # parameters. We only have a 'dst' parameter that accepts 'prefix' and
89 # 'prefix/prefixlen' values.
90 def make_route(self,
91 dst, # type: str
92 gw=None, # type: Optional[str]
93 dev=None, # type: Optional[str]
94 ):
95 # type: (...) -> Tuple[str, int, str, str, List[str], int]
96 """Internal function : create a route for 'dst' via 'gw'.
97 """
98 prefix, plen_b = (dst.split("/") + ["128"])[:2]
99 plen = int(plen_b)
100
101 if gw is None:
102 gw = "::"
103 if dev is None:
104 dev, ifaddr_uniq, x = self.route(gw)
105 ifaddr = [ifaddr_uniq]
106 else:
107 lifaddr = in6_getifaddr()
108 devaddrs = (x for x in lifaddr if x[2] == dev)
109 ifaddr = construct_source_candidate_set(prefix, plen, devaddrs)
110
111 self.ipv6_ifaces.add(dev)
112
113 return (prefix, plen, gw, dev, ifaddr, 1)
114
115 def add(self, *args, **kargs):
116 # type: (*Any, **Any) -> None

Callers 1

addMethod · 0.95

Calls 4

routeMethod · 0.95
in6_getifaddrFunction · 0.90
addMethod · 0.45

Tested by

no test coverage detected