if (sa == NULL)
return ERR_MEM;
- extractSwitchAttributes(sa, attr);
+ if (extractSwitchAttributes(sa, attr) == 0)
+ pushBackList(swiList, sa);
+
clearList(attr, (void(*)(void*))freeAttr);
- pushBackList(swiList, sa);
}
nga->swi_count = swiList->count;
*/
pushBackList(attr, newAttr(ATTR_PASSWORD, strlen(nga->password), strdup(nga->password)));
ret = readRequest(nga, attr);
+
+ if (ret == ERR_INVOP) {
+ /* it seems some switches do not support login with read request
+ * fallback to write request, even if it has the drawback of
+ * the password being broadcasted back by the switch
+ */
+ ret = writeRequest(nga, NULL);
+ }
+
if (ret == ERR_OK ) {
/* login succeeded */
/* TODO: if keep broadcasting is disabled, connect() the UDP