X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2Fwlan.c;fp=lib%2Fwlan.c;h=284da947421bc9a11651731934cab512413fc263;hb=16204dfc7715783c2ebdfb55fc44fb9344613a76;hp=fc8e555ec7a0b0b77fe78e53a265f01948835cd3;hpb=17638f5bff2fddb825562f9242a364674aa5fb94;p=ap-utils.git diff --git a/lib/wlan.c b/lib/wlan.c index fc8e555..284da94 100644 --- a/lib/wlan.c +++ b/lib/wlan.c @@ -45,7 +45,7 @@ #define INT_ROAMING _("[I] International roaming: ") #define BEACON_PER _("[B] Beacon period (msec): ") #define DTIM_I _("[D] DTIM sending interval (beacons): ") -#define SIFS_T _("[T] SIFS time (msec): ") +#define SIFS_T _("[T] SIFS time (ACK timeout) msec: ") #define WLAN_HELP _("[key] - set option; W - write conf; Q - quit to menu") extern short ap_type, ap_vendorext; @@ -94,14 +94,14 @@ void atmel_wireless() char operInterRoaming[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x01, 0x0D, 0x00 }; - /* These two are ATMEL12350 TELLUS MIB specific. */ + /* These two are ATMEL12350 GEMTEK MIB specific. */ char operBeaconPeriod[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x01, 0x0E, 0x00 }; char operDTIM[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x01, 0x0F, 0x00 }; - /* This one is ATMEL12350 VERNET MIB specific. */ + /* This one is ATMEL12350 EZYNET MIB specific. */ char operSIFSTIME[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0xE0, 0x3E, 0x01, 0x02, 0x01, 0x10, 0x00 }; @@ -126,8 +126,8 @@ void atmel_wireless() short __rates[4] = { 2, 4, 11, 22 }; int i, c = 0, rd_idx; unsigned short ap_regdomain; - struct sysDeviceInfo_ATMEL410 str410; - struct sysDeviceInfo_ATMEL12350 str12350; + struct sysDeviceInfo_128 str128; + struct sysDeviceInfo_160 str160; if (ap_type == ATMEL12350) { @@ -179,16 +179,16 @@ void atmel_wireless() varbinds[i++].oid = sysDeviceInfo; if (ap_type == ATMEL12350) { varbinds[i++].oid = operInterRoaming; - if (ap_vendorext == TELLUS || ap_vendorext == VERNET) { + if (ap_vendorext == GEMTEK || ap_vendorext == EZYNET) { varbinds[i++].oid = operBeaconPeriod; varbinds[i++].oid = operDTIM; } - if (ap_vendorext == VERNET) + if (ap_vendorext == EZYNET) varbinds[i++].oid = operSIFSTIME; } print_help(WAIT_RET); - if (snmp(varbinds, i, GET) <= 0) { + if (snmp(varbinds, i, GET) < i) { print_helperr(ERR_RET); goto exit; } @@ -208,28 +208,28 @@ void atmel_wireless() memcpy(ap_name, varbinds[10].value, 32); if (ap_type == ATMEL12350) { InterRoaming = *(varbinds[12].value); - if (ap_vendorext == TELLUS || ap_vendorext == VERNET) { + if (ap_vendorext == GEMTEK || ap_vendorext == EZYNET) { BeaconPeriod = varbinds[13].len_val == 2 ? (varbinds[13].value[0] << 8) | varbinds[13].value[1] : varbinds[13].value[0] < 0x80 ? varbinds[13].value[0] : 0xff00 | varbinds[13].value[0]; dtim = *(varbinds[14].value); } - if (ap_vendorext == VERNET) + if (ap_vendorext == EZYNET) sifs = varbinds[15].len_val == 2 ? (varbinds[15].value[0] << 8) | varbinds[15].value[1] : varbinds[15].value[0] < 0x80 ? varbinds[15].value[0] : 0xff00 | varbinds[15].value[0]; } - if (ap_type == ATMEL12350) { - memcpy(&str12350, varbinds[11].value, - sizeof(struct sysDeviceInfo_ATMEL12350)); - ap_regdomain=str12350.RegulatoryDomain; - } else /* ATMEL410 */{ - memcpy(&str410, varbinds[11].value, - sizeof(struct sysDeviceInfo_ATMEL410)); - ap_regdomain = swap4(str410.RegulatoryDomain); + if (varbinds[11].len_val == 160) { + memcpy(&str160, varbinds[11].value, + sizeof(struct sysDeviceInfo_160)); + ap_regdomain = str160.RegulatoryDomain; + } else { /* varbinds[11].len_val == 128 */ + memcpy(&str128, varbinds[11].value, + sizeof(struct sysDeviceInfo_128)); + ap_regdomain = swap4(str128.RegulatoryDomain); } rd_idx = regdom_idx(ap_regdomain); @@ -265,13 +265,13 @@ void atmel_wireless() if (ap_type == ATMEL12350) { sprintf(message, "%s%s", INT_ROAMING, (InterRoaming == 1) ? ON : OFF); mvwaddstr(main_sub, 15, 0, message); - if (ap_vendorext == TELLUS || ap_vendorext == VERNET) { + if (ap_vendorext == GEMTEK || ap_vendorext == EZYNET) { sprintf(message, "%s%u", BEACON_PER, BeaconPeriod); mvwaddstr(main_sub, 16, 0, message); sprintf(message, "%s%u", DTIM_I, dtim); mvwaddstr(main_sub, 17, 0, message); } - if (ap_vendorext == VERNET) { + if (ap_vendorext == EZYNET) { sprintf(message, "%s%u", SIFS_T, sifs); mvwaddstr(main_sub, 18, 0, message); } @@ -391,7 +391,7 @@ void atmel_wireless() continue; case 'B': case 'b': - if (ap_vendorext != TELLUS && ap_vendorext != VERNET) + if (ap_vendorext != GEMTEK && ap_vendorext != EZYNET) continue; get_value(message, 16, strlen(BEACON_PER), 6, INT_STRING, 0, 65535, WLAN_HELP); @@ -400,7 +400,7 @@ void atmel_wireless() continue; case 'D': case 'd': - if (ap_vendorext != TELLUS && ap_vendorext != VERNET) + if (ap_vendorext != GEMTEK && ap_vendorext != EZYNET) continue; get_value(message, 17, strlen(DTIM_I), 4, INT_STRING, 0, 255, WLAN_HELP); @@ -409,7 +409,7 @@ void atmel_wireless() continue; case 'T': case 't': - if (ap_vendorext != VERNET) + if (ap_vendorext != EZYNET) continue; get_value(message, 18, strlen(SIFS_T), 6, INT_STRING, 0, 65535, WLAN_HELP); @@ -647,7 +647,7 @@ void nwn_wireless() varbinds[7].oid = operAccessPointName; varbinds[7].len_oid = sizeof(operAccessPointName); print_help(WAIT_RET); - if (snmp(varbinds, 8, GET) <= 0) { + if (snmp(varbinds, 8, GET) < 8) { print_helperr(ERR_RET); goto exit; } @@ -704,7 +704,7 @@ void nwn_wireless() varbinds[8].oid = operAccessPointLocation; varbinds[8].len_oid = sizeof(operAccessPointLocation); - if (snmp(varbinds, 9, GET) <= 0) { + if (snmp(varbinds, 9, GET) < 9) { print_helperr(ERR_RET); goto exit; }