(self, iff, addr)
| 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 |
nothing calls this directly
no test coverage detected