summaryrefslogtreecommitdiff
path: root/util/ilan.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/ilan.c')
-rw-r--r--util/ilan.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/util/ilan.c b/util/ilan.c
index 910b1fa..2458fbb 100644
--- a/util/ilan.c
+++ b/util/ilan.c
@@ -305,7 +305,7 @@ extern char *get_sensor_type_desc(uchar stype); /*from ievents.c*/
/*
* Global variables
*/
-static char * progver = "2.95";
+static char * progver = "2.96";
static char * progname = "ilan";
static char fdebug = 0;
static char fipmilan = 0;
@@ -362,6 +362,8 @@ static uchar osmyip[4] = {0,0,0,0};
static uchar bmcmyip[4] = {0,0,0,0};
static uchar bmcdestip[4] = {0,0,0,0};
static uchar bmcdestmac[6]= {0xff,0,0,0,0,0};
+static uchar bmcgwyip[4] = {0,0,0,0};
+static uchar bmcgwymac[6]= {0xff,0,0,0,0,0};
static uchar bmcmymac[6] = {0xff,0,0,0,0,0};
static uchar rgmymac[6] = {0xff,0,0,0,0,0};
static uchar osmymac[6] = {0xff,0,0,0,0,0};
@@ -4492,6 +4494,10 @@ main(int argc, char **argv)
// if (pc[0] >= 30) memcpy(bparm7,pc,3);
} else if (ival == 17) { /* num dest */
ndest = pc[0]; /* save the number of destinations */
+ } else if (ival == 12) { /* gateway addr */
+ if (IpIsValid(pc)) memcpy(bmcgwyip,pc,4);
+ } else if (ival == 13) { /* gateway mac */
+ if (MacIsValid(pc)) memcpy(bmcgwymac,pc,MAC_LEN);
} else if (ival == 19) { /* dest addr */
if (IpIsValid(&pc[3])) memcpy(bmcdestip,&pc[3],4);
if (MacIsValid(&pc[7])) memcpy(bmcdestmac,&pc[7],MAC_LEN);
@@ -4964,8 +4970,12 @@ main(int argc, char **argv)
rggwyip[0], rggwyip[1], rggwyip[2], rggwyip[3],
rggwymac[0], rggwymac[1], rggwymac[2], rggwymac[3],
rggwymac[4], rggwymac[5]);
- if (!SubnetIsSame(rgmyip,rggwyip,rgsubnet))
- printf("WARNING: IP Address and Gateway are not on the same subnet.\n");
+ if (!SubnetIsSame(rgmyip,rggwyip,rgsubnet)) {
+ printf("WARNING: IP Address and Gateway are not on the same subnet,"
+ " setting Gateway to previous value\n");
+ memcpy(rggwyip,bmcgwyip,4);
+ memcpy(rggwymac,bmcgwymac,6);
+ }
/* Set the Default Gateway IP & MAC */
memcpy(&LanRecord,rggwyip,4);
@@ -4977,13 +4987,14 @@ main(int argc, char **argv)
printf(" Warning: Gateway MAC address was not resolved! "
"Check %s interface, use -i ethN, or use -H gwymac.\n",
ifname);
+ memcpy(&LanRecord,bmcgwymac,6);
} else {
memcpy(&LanRecord,rggwymac,6);
+ }
ret = SetLanEntry(13, &LanRecord, 6);
printf("SetLanEntry(13), ret = %d\n",ret);
if (ret != 0) { nerrs++; lasterr = ret; }
else ngood++;
- }
}
if (IpIsValid(rggwy2ip)) {
if (!MacIsValid(rggwy2mac)) /* if gwy2 MAC not set by user */