From d72f83602e9173940102c718974025e16b873657 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 21 Apr 2017 20:56:47 +0100 Subject: [PATCH] ipif: set interface names Signed-off-by: Ian Jackson --- README.config | 12 +++++++++--- hippotat | 6 ++++++ hippotatd | 3 +++ hippotatlib/__init__.py | 4 +++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/README.config b/README.config index 9c0e4fe..81f791d 100644 --- a/README.config +++ b/README.config @@ -42,9 +42,9 @@ Exceptional settings: Command to run to create and communicate with local network interface. Passed to sh -c. Must speak SLIP on stdin/stdout. The following additional interpolations aare substituted: - %(local)s %(peer)s %(rnet)s - on server - on client + %(local)s %(peer)s %(rnet)s %(ifname)s + on server + on client ["userv root ipif %(local)s,%(peer)s,%(mtu)s,slip %(rnets)s"] On server: applies to all clients; not looked up in @@ -116,6 +116,12 @@ Ordinary settings, used by both, not client-specific: mtu Must match exactly. (UNCHECKED) [1500 bytes] + ifname_server + Virtual interface name on the server. [shippo%d] + ifname_client + Virtual interface name on the client. [hippo%d] + Any %d is interpolated (by the kernel). + Ordinary settings, used by client only: http_timeout_grace diff --git a/hippotat b/hippotat index 18cd14e..379a184 100755 --- a/hippotat +++ b/hippotat @@ -254,6 +254,12 @@ def process_cfg(_opts, putative_servers, putative_clients): c.max_queue_time = srch(cfg.getint, 'max_queue_time') c.vroutes = srch(cfg.get, 'vroutes') + def cfg_get_raw(*args, **kwargs): + return cfg.get(*args, raw=True, **kwargs) + + try: c.ifname = srch(cfg_get_raw, 'ifname_client') + except NoOptionError: pass + try: c.url = srch(cfg.get,'url') except NoOptionError: cfg_process_saddrs(c, ss) diff --git a/hippotatd b/hippotatd index fe10eec..666fc1b 100755 --- a/hippotatd +++ b/hippotatd @@ -320,6 +320,9 @@ def process_cfg(_opts, putative_servers, putative_clients): c.vrelay = search break + try: c.ifname = cfg.get(c.server, 'ifname_server', raw=True) + except NoOptionError: pass + cfg_process_ipif(c, [c.server, 'DEFAULT'], (('local','vaddr'), diff --git a/hippotatlib/__init__.py b/hippotatlib/__init__.py index 16bba81..2a2a8ee 100644 --- a/hippotatlib/__init__.py +++ b/hippotatlib/__init__.py @@ -136,9 +136,11 @@ max_batch_up = 4000 http_retry = 5 port = 80 vroutes = '' +ifname_client = hippo%%d +ifname_server = shippo%%d #[server] or [] overrides -ipif = userv root ipif %(local)s,%(peer)s,%(mtu)s,slip %(rnets)s +ipif = userv root ipif %(local)s,%(peer)s,%(mtu)s,slip,%(ifname)s %(rnets)s # relating to virtual network mtu = 1500 -- 2.11.0