2
0
mirror of https://opendev.org/x/pyghmi synced 2026-03-28 13:53:30 +00:00

Allow bind address to be specified

This change allows IpmiServer objects to be created with bind addresses
other than ::. It is useful when multiple BMC processes are running on a
single server, with each bound to a different nic.

Change-Id: Ice82bf788269a31819e4495e15b9ce19a1dd057b
This commit is contained in:
Steve Baker
2015-11-02 15:31:31 +13:00
parent df19985878
commit 035dfb2fa4

View File

@@ -230,7 +230,7 @@ class IpmiServer(object):
#authentication type fixed to ipmi2, ipmi1 forbidden
# 0b10000000
def __init__(self, authdata, port=623, bmcuuid=None):
def __init__(self, authdata, port=623, bmcuuid=None, address='::'):
"""Create a new ipmi bmc instance.
:param authdata: A dict or object with .get() to provide password
@@ -239,6 +239,8 @@ class IpmiServer(object):
reasonable subset.
:param port: The default port number to bind to. Defaults to the
standard 623
:param address: The IPv6 address to bind to. Defaults to '::' (all
zeroes)
"""
self.revision = 0
self.deviceid = 0
@@ -263,7 +265,7 @@ class IpmiServer(object):
self.kg = None
self.timeout = 60
self.serversocket = ipmisession.Session._assignsocket(
('::', port, 0, 0))
(address, port, 0, 0))
ipmisession.Session.bmc_handlers[self.serversocket] = self
def send_auth_cap(self, myaddr, mylun, clientaddr, clientlun, sockaddr):