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

Method ifchange

scapy/route.py:131–147  ·  view source on GitHub ↗
(self, iff, addr)

Source from the content-addressed store, hash-verified

129 raise ValueError("No matching route found!")
130
131 def ifchange(self, iff, addr):
132 # type: (str, str) -> None
133 self.invalidate_cache()
134 the_addr, the_msk_b = (addr.split("/") + ["32"])[:2]
135 the_msk = itom(int(the_msk_b))
136 the_rawaddr = atol(the_addr)
137 the_net = the_rawaddr & the_msk
138
139 for i, route in enumerate(self.routes):
140 net, msk, gw, iface, addr, metric = route
141 if iff != iface:
142 continue
143 if gw == '0.0.0.0':
144 self.routes[i] = (the_net, the_msk, gw, iface, the_addr, metric) # noqa: E501
145 else:
146 self.routes[i] = (net, msk, gw, iface, the_addr, metric)
147 conf.netcache.flush()
148
149 def ifdel(self, iff):
150 # type: (str) -> None

Callers

nothing calls this directly

Calls 4

invalidate_cacheMethod · 0.95
itomFunction · 0.90
atolFunction · 0.90
flushMethod · 0.45

Tested by

no test coverage detected