def setDefault(self, gw, dst = "0.0.0.0", mask = "0.0.0.0"): # We must delete previous default gateway and route entry set for gateway # or we will end up with multiple entries self.deleteDefault() self.delete(gw) try: csapi.changeroute(SIOCADDRT, gw, dst, mask) except: pass
def setDefaultRoute(self, gw, dst="0.0.0.0", mask="0.0.0.0"): """ Set the default gateway. To do this we must delete the previous default gateway and the route entry set for gw, if any, or we will end up with multiple entries """ self.delDefaultRoute() self.delRoute(gw) try: csapi.changeroute(self.SIOCADDRT, gw, dst, mask) except: pass
def setDefaultRoute(self, gw, dst = "0.0.0.0", mask = "0.0.0.0"): """ Set the default gateway. To do this we must delete the previous default gateway and the route entry set for gw, if any, or we will end up with multiple entries """ self.delDefaultRoute() self.delRoute(gw) try: csapi.changeroute(self.SIOCADDRT, gw, dst, mask) except: pass
def delete(self, gw, dst = "0.0.0.0", mask = "0.0.0.0"): try: csapi.changeroute(SIOCDELRT, gw, dst, mask) except: pass
def delRoute(self, gw, dst="0.0.0.0", mask="0.0.0.0"): """ Delete a route entry from kernel routing table """ try: csapi.changeroute(self.SIOCDELRT, gw, dst, mask) except: pass
def delRoute(self, gw, dst = "0.0.0.0", mask = "0.0.0.0"): """ Delete a route entry from kernel routing table """ try: csapi.changeroute(self.SIOCDELRT, gw, dst, mask) except: pass