On Sat, 6 Sep 2014 23:22:19 +0800
Che-Wei Lin <[email protected]> wrote:
> diff --git a/ryu/lib/snortlib.py b/ryu/lib/snortlib.py
> index 2773585..57ee986 100644
> --- a/ryu/lib/snortlib.py
> +++ b/ryu/lib/snortlib.py
> @@ -41,14 +41,21 @@ class SnortLib(app_manager.RyuApp):
> self.config = {'unixsock': True}
> self._set_logger()
>
> + def get_host_ip(self):
> + """On Ubuntu Python's stdlib socket.gethostbyname()
> + returns 127.0.0.1 for some reason"""
> + s = hub.socket.socket(hub.socket.AF_INET, hub.socket.SOCK_DGRAM)
> + s.connect(('8.8.8.8', 53))
> + return s.getsockname()[0]
> +
> def set_config(self, config):
> assert isinstance(config, dict)
> self.config = config
>
> def start_socket_server(self):
> if not self.config.get('unixsock'):
> - self.config['ip'] = hub.socket.gethostbyname(hub.socket.
> - gethostname())
> + self.config['ip'] = self.get_host_ip()
> +
What you are trying to do here?
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel