From 15ddafb8fba50509e263d5107ebe653042dd0ac7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 25 Mar 2016 13:20:25 -0400 Subject: [PATCH] Allow skipping retrieval of gateway mac addresses As a network configuration item, gateway mac addresses are rarely used. However, some devices consider such a request an attempt to do arp, and will slow their response trying to fill in a field that no one cares about. Allow calling code to disable fetching of this frequently problematic data. Change-Id: Ia9b434e2a74983d822c91d5248815a0312942c15 --- pyghmi/ipmi/command.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index fdbcc76f..62c9d741 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -716,12 +716,13 @@ class Command(object): cmddata = bytearray((channel, 12)) + socket.inet_aton(ipv4_gateway) self.xraw_command(netfn=0xc, command=1, data=cmddata) - def get_net_configuration(self, channel=None): + def get_net_configuration(self, channel=None, gateway_macs=True): """Get network configuration data Retrieve network configuration from the target :param channel: Channel to configure, defaults to None for 'autodetect' + :param gateway_macs: Whether to retrieve mac addresses for gateways :returns: A dictionary of network configuration data """ if channel is None: @@ -744,10 +745,11 @@ class Command(object): channel, 4)] retdata['mac_address'] = self._fetch_lancfg_param(channel, 5) retdata['ipv4_gateway'] = self._fetch_lancfg_param(channel, 12) - retdata['ipv4_gateway_mac'] = self._fetch_lancfg_param(channel, 13) retdata['ipv4_backup_gateway'] = self._fetch_lancfg_param(channel, 14) - retdata['ipv4_backup_gateway_mac'] = self._fetch_lancfg_param(channel, - 15) + if gateway_macs: + retdata['ipv4_gateway_mac'] = self._fetch_lancfg_param(channel, 13) + retdata['ipv4_backup_gateway_mac'] = self._fetch_lancfg_param( + channel, 15) self.oem_init() self._oem.add_extra_net_configuration(retdata) return retdata