MCPcopy Create free account
hub / github.com/secdev/scapy / delt

Method delt

scapy/route6.py:138–162  ·  view source on GitHub ↗

Ex: delt(dst="::/0") delt(dst="2001:db8:cafe:f000::/56") delt(dst="2001:db8:cafe:f000::/56", gw="2001:db8:deca::1")

(self, dst, gw=None)

Source from the content-addressed store, hash-verified

136 pass
137
138 def delt(self, dst, gw=None):
139 # type: (str, Optional[str]) -> None
140 """ Ex:
141 delt(dst="::/0")
142 delt(dst="2001:db8:cafe:f000::/56")
143 delt(dst="2001:db8:cafe:f000::/56", gw="2001:db8:deca::1")
144 """
145 tmp = dst + "/128"
146 dst, plen_b = tmp.split('/')[:2]
147 dst = in6_ptop(dst)
148 plen = int(plen_b)
149 to_del = [x for x in self.routes
150 if in6_ptop(x[0]) == dst and x[1] == plen]
151 if gw:
152 gw = in6_ptop(gw)
153 to_del = [x for x in self.routes if in6_ptop(x[2]) == gw]
154 if len(to_del) == 0:
155 warning("No matching route found")
156 elif len(to_del) > 1:
157 warning("Found more than one match. Aborting.")
158 else:
159 i = self.routes.index(to_del[0])
160 self.invalidate_cache()
161 self.remove_ipv6_iface(self.routes[i][3])
162 del self.routes[i]
163
164 def ifchange(self, iff, addr):
165 # type: (str, str) -> None

Callers

nothing calls this directly

Calls 4

invalidate_cacheMethod · 0.95
remove_ipv6_ifaceMethod · 0.95
in6_ptopFunction · 0.90
warningFunction · 0.90

Tested by

no test coverage detected