summaryrefslogtreecommitdiff
path: root/util/ilan.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/ilan.c')
-rw-r--r--util/ilan.c137
1 files changed, 49 insertions, 88 deletions
diff --git a/util/ilan.c b/util/ilan.c
index e54233f..a6e91a3 100644
--- a/util/ilan.c
+++ b/util/ilan.c
@@ -306,7 +306,7 @@ extern char *get_sensor_type_desc (uchar stype); /*from ievents.c */
* Global variables
*/
static char * progname = "ilan";
-static char * progver = "3.07";
+static char * progver = "3.08";
static char fdebug = 0;
static char fipmilan = 0;
static char fIPMI10 = 0; /* =1 if IPMI v1.0 or less */
@@ -1894,7 +1894,7 @@ GetFirstIP (uchar * ipaddr, uchar * macadr, char *ipname, char fdbg)
}
/*
- * Set BMC MAC corresponding to current BMC IP address (Windows).
+ * Get BMC MAC corresponding to current BMC IP address (Windows).
*/
int
GetLocalIPByMAC (uchar * macadr)
@@ -2431,9 +2431,9 @@ GetBmcEthDevice (uchar lan_parm, uchar * pchan)
lan_ch = (uchar) j; /*set lan channel for GetLanEntry */
ret = GetLanEntry (5 /*MAC_ADDRESS_LAN_PARAM */ , 0, &LanRecord);
if (ret != 0) {
- lan_ch = (uchar) jlan; /*restore lan_ch */
- printf ("GetBmcEthDevice: GetLanEntry failed\n");
- return devnum;
+ lan_ch = (uchar) jlan; /*restore lan_ch */
+ printf ("GetBmcEthDevice: GetLanEntry(5) failed\n");
+ return devnum;
}
else {
pb = &LanRecord.data[0];
@@ -4425,7 +4425,7 @@ main(int argc, char **argv)
if ((fsetarp == 0) && ostype == OS_WINDOWS)
arp_ctl = 0x03; /*grat arp & arp resp enabled */
- ret = GetDeviceID (&LanRecord);
+ ret = ipmi_getdeviceid((uchar *)&LanRecord,16,fdebug);
if (ret != 0) {
goto do_exit;
}
@@ -4434,29 +4434,20 @@ main(int argc, char **argv)
ipmi_maj = LanRecord.data[4] & 0x0f;
ipmi_min = LanRecord.data[4] >> 4;
show_devid (LanRecord.data[2], LanRecord.data[3], ipmi_maj, ipmi_min);
- if (ipmi_maj == 0)
- fIPMI10 = 1;
- else if (ipmi_maj == 1 && ipmi_min < 5)
- fIPMI10 = 1;
- else
- fIPMI10 = 0; /* >= IPMI 1.5 is ok */
- if (ipmi_maj >= 2)
- fIPMI20 = 1;
- if (fIPMI20)
- show_users = 5;
- else
- show_users = 3;
+ if (ipmi_maj == 0) fIPMI10 = 1; /* IPMI 1.0 is limited */
+ else if (ipmi_maj == 1 && ipmi_min < 5) fIPMI10 = 1;
+ else fIPMI10 = 0; /* >= IPMI 1.5 is ok */
+ if (ipmi_maj >= 2) fIPMI20 = 1; /* IPMI 2.0 has more */
+ if (fIPMI20) show_users = 5;
+ else show_users = 3;
if (fIPMI10) {
printf ("This IPMI v%d.%d system does not support PEF records.\n",
ipmi_maj, ipmi_min);
/* Wont handle PEF, but continue and look for BMC LAN anyway */
- // fIPMI10 = 1;
- // ipmi_close_();
- // exit(1);
}
prod_id = LanRecord.data[9] + (LanRecord.data[10] << 8);
vend_id = LanRecord.data[6] + (LanRecord.data[7] << 8)
- + (LanRecord.data[8] << 16);
+ + (LanRecord.data[8] << 16);
/* check Device ID response for Manufacturer ID = 0x0322 (NSC) */
if (vend_id == VENDOR_NSC) { /* NSC = 0x000322 */
fmBMC = 1; /*NSC miniBMC */
@@ -4999,8 +4990,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
} /*end for */
}
} /*end if not fIPMI10 */
@@ -5345,8 +5335,10 @@ main(int argc, char **argv)
// else lan_access = 0x04; /*Admin*/
if (!fIPMI10) { /* Get SOL params */
ret = GetSerialOverLan (lan_ch, 0, 0);
- if (ret != 0)
- printf ("GetSOL error %d\n", ret);
+ if (ret != 0) {
+ printf ("GetSOL error %d, %s\n", ret, decode_rv(ret));
+ ret = 0; /*does not fail entire command*/
+ }
}
for (i = 1; i <= show_users; i++)
GetUser ((uchar) i, lan_ch);
@@ -5421,8 +5413,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
if (lan_user != 0) {
j = DisableUser (lan_user, lan_ch); /*disable this lan user */
@@ -5431,8 +5422,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = j;
}
- else
- ngood++;
+ else ngood++;
}
LanRecord.data[0] = 0x01; /* static IP address source */
ret = SetLanEntry (4, &LanRecord, 1);
@@ -5441,8 +5431,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
/* clear the BMC IP address */
memset (&LanRecord, 0, 4);
ret = SetLanEntry (3, &LanRecord, 4);
@@ -5451,8 +5440,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
/* clear the gateway IP address */
memset (&LanRecord, 0, 4);
ret = SetLanEntry (12, &LanRecord, 4);
@@ -5461,8 +5449,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
/* clear the gateway MAC address */
memset (&LanRecord, 0, 6);
ret = SetLanEntry (13, &LanRecord, 6);
@@ -5471,8 +5458,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
else if (fdisableSOL) {
ret = SetupSerialOverLan (0); /*disable */
@@ -5481,8 +5467,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
else { /*fenable */
uchar chanctl;
@@ -5497,8 +5482,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
ret = SetChanAcc (lan_ch, 0x40, chanctl);
if (fdebug)
printf ("SetChanAcc(lan/nonvol), ret = %d\n", ret);
@@ -5506,8 +5490,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
if (flansecure) {
j = DisableUser (0, lan_ch); /*disable the default null user */
printf ("DisableUser(0), ret = %d\n", j);
@@ -5518,8 +5501,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
if (fdisable && (vend_id == VENDOR_SUPERMICROX
|| vend_id == VENDOR_SUPERMICRO)) {
@@ -5555,8 +5537,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
/* Get the values to use from Linux eth0, etc. */
ret = Get_IPMac_Addr ();
@@ -5569,8 +5550,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
if (MacIsValid (rgmymac)) {
memcpy (&LanRecord, rgmymac, 6);
ret = SetLanEntry (5, &LanRecord, 6);
@@ -5584,8 +5564,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
}
@@ -5611,8 +5590,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
}
else { /* use static IP */
@@ -5639,8 +5617,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
memcpy (&LanRecord, rgmyip, 4);
ret = SetLanEntry (3, &LanRecord, 4);
printf ("SetLanEntry(3), ret = %d\n", ret);
@@ -5648,8 +5625,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
if (MacIsValid (rgmymac)) {
memcpy (&LanRecord, rgmymac, 6);
ret = SetLanEntry (5, &LanRecord, 6);
@@ -5668,8 +5644,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
}
if (!SubnetIsValid (rgsubnet)) /* not specified, use previous */
@@ -5681,8 +5656,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
if (vend_id != VENDOR_PEPPERCON) {
/* may want to check bparm7 here */
LanRecord.data[0] = parm7[0]; /*IPv4 header, TTL */
@@ -5694,8 +5668,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
/* if lan_ch == 3, gcm gets error setting grat arp (ccode=0xCD) */
if (lan_ch != gcm_ch) { /*skip if gcm */
@@ -5707,8 +5680,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
LanRecord.data[0] = arp_interval; /*grat arp interval */
ret = SetLanEntry (11, &LanRecord, 1);
@@ -5725,8 +5697,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
}
else { /* error, don't continue */
@@ -5775,8 +5746,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
if (!MacIsValid (rggwymac)) { /* if gwy MAC not resolved */
printf (" Warning: Gateway MAC address was not resolved! "
"Check %s interface, use -i ethN, or use -H gwymac.\n",
@@ -5792,8 +5762,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
if (IpIsValid (rggwy2ip)) {
if (!MacIsValid (rggwy2mac)) /* if gwy2 MAC not set by user */
@@ -5806,8 +5775,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
memcpy (&LanRecord, rggwy2mac, 6);
ret = SetLanEntry (15, &LanRecord, 6);
printf ("SetLanEntry(15), ret = %d\n", ret);
@@ -5815,8 +5783,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
} /* end-else static IP */
if (flansecure) { /* disable cipher 0 */
@@ -5839,8 +5806,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
ret = SetupSerialOverLan (1); /*enable */
SELprintf ("SetupSerialOverLan: ret = %d\n", ret);
@@ -5889,8 +5855,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
/* Set Alert Destination Type */
LanRecord.data[0] = alertnum; /* dest id = 1 */
LanRecord.data[1] = 0x00; /* dest type = PET, no ack */
@@ -5929,8 +5894,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
/* ChanAcc changed, so show it again */
j = ShowChanAcc (lan_ch);
}
@@ -5945,8 +5909,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
else { /*vlan_enable == 1, enable vlan with id */
LanRecord.data[0] = (vlan_id & 0x00ff);
@@ -5957,8 +5920,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
LanRecord.data[0] = vlan_prio;
ret = SetLanEntry (21, &LanRecord, 1);
printf ("SetLanEntry(21), ret = %d\n", ret);
@@ -5966,8 +5928,7 @@ main(int argc, char **argv)
nerrs++;
lasterr = ret;
}
- else
- ngood++;
+ else ngood++;
}
}
if (failover_enable != PARM_INIT) {