I fixed some trivial minor bug and corrected some typos in the document.
I found that when i want to get the REAL IP.
The old version used on Ubuntu python's stdlib socket.gethostbyname return
127.0.0.1.
This patch I am using another way to get the real IP
Che-Wei Lin <http://about.me/linton.tw>, John Lin
Institute of Communication Engineering,
National Tsing Hua University
[image: 林哲緯 on about.me]
E-mail: [email protected]
Blog: blog.linton.tw
Mobile: +886-952-301-269
On Sun, Sep 7, 2014 at 3:01 PM, FUJITA Tomonori <
[email protected]> wrote:
> 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?
>
Che-Wei Lin <http://about.me/linton.tw>, John Lin
Institute of Communication Engineering,
National Tsing Hua University
[image: 林哲緯 on about.me]
E-mail: [email protected]
Blog: blog.linton.tw
Mobile: +886-952-301-269
On Sun, Sep 7, 2014 at 3:01 PM, FUJITA Tomonori <
[email protected]> wrote:
> 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