X-Git-Url: https://git.decadent.org.uk/gitweb/?p=ap-utils.git;a=blobdiff_plain;f=lib%2Fwlan.c;h=543718c1449a00712197c10fb0898534bbe984c3;hp=284da947421bc9a11651731934cab512413fc263;hb=17cd5711411f45df26b33c51288780627b7377e2;hpb=63444196dd1edb154f81d9418b3d0bc2367163e5 diff --git a/lib/wlan.c b/lib/wlan.c index 284da94..543718c 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 (ACK timeout) msec: ") +#define SIFS_T _("[T] SIFS time (2nd+ interframe spacing, usec): ") #define WLAN_HELP _("[key] - set option; W - write conf; Q - quit to menu") extern short ap_type, ap_vendorext; @@ -115,8 +115,8 @@ void atmel_wireless() unsigned char dtim, ch; char *AuthenticationTypes[3] = { OSYS, SH_KEY, BOTH_TYPE }, message[1024]; - char domain[32], basic_rates[4], AutoRateFallBack, SSIDBroadcasting, - ap_name[32], PreambleType, AuthenticationType, channel; + char domain[33], basic_rates[4], AutoRateFallBack, SSIDBroadcasting, + ap_name[33], PreambleType, AuthenticationType, channel; char m_channel = 0, m_essid = 0, m_broadcast = 0, m_rts = 0, m_fragment = 0, m_auth = 0, m_ap_name = 0, m_preambule = 0, m_auto_rate = 0, m_inter_roaming = 0, m_beacon = 0, m_dtim = 0, @@ -196,6 +196,7 @@ void atmel_wireless() channel = *(varbinds[0].value); c = *(varbinds[1].value); memcpy(domain, varbinds[2].value, 32); + domain[32] = '\0'; SSIDBroadcasting = *(varbinds[3].value); memcpy(basic_rates, varbinds[4].value, 4); AutoRateFallBack = *(varbinds[5].value); @@ -206,6 +207,7 @@ void atmel_wireless() PreambleType = *(varbinds[8].value); AuthenticationType = *(varbinds[9].value); memcpy(ap_name, varbinds[10].value, 32); + ap_name[32] = '\0'; if (ap_type == ATMEL12350) { InterRoaming = *(varbinds[12].value); if (ap_vendorext == GEMTEK || ap_vendorext == EZYNET) { @@ -226,7 +228,7 @@ void atmel_wireless() memcpy(&str160, varbinds[11].value, sizeof(struct sysDeviceInfo_160)); ap_regdomain = str160.RegulatoryDomain; - } else { /* varbinds[11].len_val == 128 */ + } else { /* varbinds[11].len_val == 92 || varbinds[11].len_val == 128 */ memcpy(&str128, varbinds[11].value, sizeof(struct sysDeviceInfo_128)); ap_regdomain = swap4(str128.RegulatoryDomain); @@ -354,20 +356,20 @@ void atmel_wireless() continue; case 'N': case 'n': -// make_field(2, strlen(AP_NAME), 32); - get_value(ap_name, 2, strlen(AP_NAME), -32, ANY_STRING, 0, 0, NULL); +// make_field(2, strlen(AP_NAME), 33); + get_value(ap_name, 2, strlen(AP_NAME), -33, ANY_STRING, 0, 0, NULL); m_ap_name = 1; continue; case 'E': case 'e': -// make_field(1, strlen(ESSID), 32); - get_value(domain, 1, strlen(ESSID), 32, ANY_STRING, 0, 0, NULL); +// make_field(1, strlen(ESSID), 33); + get_value(domain, 1, strlen(ESSID), 33, ANY_STRING, 0, 0, NULL); m_essid = 1; continue; case 'F': case 'f': // make_field(4, strlen(FRG_TR), 6); - get_value(message, 4, strlen(FRG_TR), 6, INT_STRING, 256, 2346, + get_value(message, 4, strlen(FRG_TR), 5, INT_STRING, 256, 2346, WLAN_HELP); FragmentationThreshold = atoi(message); m_fragment = 1; @@ -375,7 +377,7 @@ void atmel_wireless() case 'R': case 'r': // make_field(3, strlen(RTS_TR), 6); - get_value(message, 3, strlen(RTS_TR), 6, INT_STRING, 0, 2347, + get_value(message, 3, strlen(RTS_TR), 5, INT_STRING, 0, 2347, WLAN_HELP); RTSThreshold = atoi(message); m_rts = 1; @@ -555,6 +557,8 @@ void atmel_wireless() print_helperr(ERR_SET); goto exit; } + wbkgd(main_sub, A_NORMAL); + wrefresh(main_sub); print_help(DONE_SET); goto exit; } @@ -886,14 +890,14 @@ void nwn_wireless() continue; case 'F': case 'f': - get_value(message, 4, strlen(FRG_TR), 6, INT_STRING, 256, 2346, + get_value(message, 4, strlen(FRG_TR), 5, INT_STRING, 256, 2346, WLAN_HELP); FragmentationThreshold = atoi(message); m_fragment = 1; continue; case 'R': case 'r': - get_value(message, 3, strlen(RTS_TR), 6, INT_STRING, 0, 2347, + get_value(message, 3, strlen(RTS_TR), 5, INT_STRING, 0, 2347, WLAN_HELP); RTSThreshold = atoi(message); m_rts = 1; @@ -916,7 +920,6 @@ void nwn_wireless() varbinds[i].type = 0x02; i++; } - if (m_basic_rates) { varbinds[i].oid = operBasicRates; varbinds[i].len_oid = sizeof(operBasicRates); @@ -926,13 +929,14 @@ void nwn_wireless() i++; } - print_help(WAIT_SET); - if (snmp(varbinds, i, SET) <= 0) { - print_helperr(ERR_SET); - goto exit; - } - i = 0; + print_help(WAIT_SET); + + if (snmp(varbinds, i, SET) <= 0) { + print_helperr(ERR_SET); + goto exit; + } + i = 0; if (m_auth) { m_auth = (authi == 1) ? 2 : 1; m_basic_rates = (authi == 0) ? 2 : 1; @@ -949,13 +953,13 @@ void nwn_wireless() varbinds[i].type = INT_VALUE; i++; } - print_help(WAIT_SET); - if (snmp(varbinds, i, SET) <= 0) { - print_helperr(ERR_SET); - goto exit; - } - i = 0; + if (snmp(varbinds, i, SET) <= 0) { + print_helperr(ERR_SET); + goto exit; + } + + i = 0; if (m_ap_name) { c = strlen(ap_name); varbinds[i].oid = operAccessPointName; @@ -965,7 +969,6 @@ void nwn_wireless() varbinds[i].type = STRING_VALUE; i++; } - if (m_ap_location) { c = strlen(ap_location); varbinds[i].oid = operAccessPointLocation; @@ -976,11 +979,10 @@ void nwn_wireless() i++; } - print_help(WAIT_SET); - if (snmp(varbinds, i, SET) <= 0) { - print_helperr(ERR_SET); - goto exit; - } + if (snmp(varbinds, i, SET) <= 0) { + print_helperr(ERR_SET); + goto exit; + } i = 0; if (m_ap_contact) { @@ -1018,11 +1020,12 @@ void nwn_wireless() varbinds[i].type = 0x02; i++; } - print_help(WAIT_SET); - if (snmp(varbinds, i, SET) <= 0) { - print_helperr(ERR_SET); - goto exit; - } + + if (snmp(varbinds, i, SET) <= 0) { + print_helperr(ERR_SET); + goto exit; + } + c = 0; for (i = 0; i < 4; i++) if (m_antenna[i]) { @@ -1034,11 +1037,12 @@ void nwn_wireless() varbinds[c].type = INT_VALUE; c++; } - print_help(WAIT_SET); - if (snmp(varbinds, c, SET) <= 0) { - print_helperr(ERR_SET); - goto exit; - } + + if (snmp(varbinds, c, SET) <= 0) { + print_helperr(ERR_SET); + goto exit; + } + c = 0; for (i = i; i < 6; i++) if (m_antenna[i]) { @@ -1050,11 +1054,12 @@ void nwn_wireless() varbinds[c].type = INT_VALUE; c++; } - print_help(WAIT_SET); - if (snmp(varbinds, c, SET) <= 0) { - print_helperr(ERR_SET); - goto exit; + + if (snmp(varbinds, c, SET) <= 0) { + print_helperr(ERR_SET); + goto exit; } + i = 0; if (m_essid) { c = strlen(domain); @@ -1065,12 +1070,14 @@ void nwn_wireless() varbinds[i].type = 0x04; i++; } - print_help(WAIT_SET); - if (snmp(varbinds, i, SET) <= 0) { - print_helperr(ERR_SET); - goto exit; - } + if (snmp(varbinds, i, SET) <= 0) { + print_helperr(ERR_SET); + goto exit; + } + + wbkgd(main_sub, A_NORMAL); + wrefresh(main_sub); print_help(DONE_SET); goto exit; default: