(argv)
| 22 | |
| 23 | |
| 24 | def main(argv): |
| 25 | if len(argv) != 3: |
| 26 | exit(1) |
| 27 | pubip = argv[1] |
| 28 | prinet = argv[2] |
| 29 | pubdev = get_device(pubip) |
| 30 | if pubdev == "": |
| 31 | exit(1) |
| 32 | list = execute("ip -o -f inet addr show %s | awk '/scope global/ {print $4}'" % pubdev) |
| 33 | if len(list) != 1: |
| 34 | exit(1) |
| 35 | pubnet = list[0] |
| 36 | csroute = CsRoute() |
| 37 | csroute.add_table(pubdev) |
| 38 | csrule = CsRule(pubdev) |
| 39 | csrule.addRule("from %s to %s" % (pubnet, prinet)) |
| 40 | cmd = "%s dev %s table %s" % (prinet, pubdev, csroute.get_tablename(pubdev)) |
| 41 | csroute.set_route(cmd) |
| 42 | |
| 43 | |
| 44 | if __name__ == '__main__': |
no test coverage detected