From: ogawa.yasufumi@lab.ntt.co.jp
To: ferruh.yigit@intel.com, spp@dpdk.org, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 2/2] spp-ctl: change to bind IP address to SPP procs
Date: Fri, 9 Nov 2018 16:25:49 +0900 [thread overview]
Message-ID: <1541748349-15538-3-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1541748349-15538-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
Spp-ctl creates a socket with address `localhost` for SPP processes.
However, it should be able to change for some cases. For instance, SPP
container process requires to access spp-ctl running on host. It cannot
find spp-ctl from inside of container if the address is `localhost`.
This update is to change binding IP address to be found.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/spp-ctl/spp_ctl.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/spp-ctl/spp_ctl.py b/src/spp-ctl/spp_ctl.py
index a22d589..0576ae1 100644
--- a/src/spp-ctl/spp_ctl.py
+++ b/src/spp-ctl/spp_ctl.py
@@ -26,6 +26,7 @@ class Controller(object):
def __init__(self, host, pri_port, sec_port, api_port):
self.web_server = spp_webapi.WebServer(self, host, api_port)
self.procs = {}
+ self.ip_addr = host
self.init_connection(pri_port, sec_port)
def start(self):
@@ -34,14 +35,14 @@ class Controller(object):
def init_connection(self, pri_port, sec_port):
self.pri_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.pri_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- self.pri_sock.bind(('127.0.0.1', pri_port))
+ self.pri_sock.bind((self.ip_addr, pri_port))
self.pri_sock.listen(1)
self.primary_listen_thread = eventlet.greenthread.spawn(
self.accept_primary)
self.sec_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sec_sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- self.sec_sock.bind(('127.0.0.1', sec_port))
+ self.sec_sock.bind((self.ip_addr, sec_port))
self.sec_sock.listen(1)
self.secondary_listen_thread = eventlet.greenthread.spawn(
self.accept_secondary)
@@ -142,7 +143,7 @@ class Controller(object):
return procs
def do_exit(self, proc_type, proc_id):
- removed_id = None # remove proc info of ID from self.procs
+ removed_id = None # remove proc info of ID from self.procs
for proc in self.procs.values():
if proc.type == proc_type and proc.id == proc_id:
removed_id = proc.id
--
2.7.4
prev parent reply other threads:[~2018-11-09 7:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-09 7:25 [spp] [PATCH 0/2] Update of SPP Container ogawa.yasufumi
2018-11-09 7:25 ` [spp] [PATCH 1/2] tools/sppc: fix bug of creating env file ogawa.yasufumi
2018-11-09 7:25 ` ogawa.yasufumi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1541748349-15538-3-git-send-email-ogawa.yasufumi@lab.ntt.co.jp \
--to=ogawa.yasufumi@lab.ntt.co.jp \
--cc=ferruh.yigit@intel.com \
--cc=spp@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).