- attr = createEmptyList();
-
- if (memchr(ports, 0, sa->ports) != NULL) {
- /* if at least one port is unchanged, we need to read old config */
- pushBackList(attr, newEmptyAttr(ATTR_VLAN_PORT_CONF));
- ret = readRequest(nga, attr);
- if (ret != ERR_OK)
- goto end;
-
- filterAttributes(attr, ATTR_VLAN_PORT_CONF, ATTR_END);
- /* FIXME: check if the returned array effectively contains correct data */
+ /* read old config */
+ conf_old = createEmptyList();
+ pushBackList(conf_old, newEmptyAttr(ATTR_VLAN_PORT_CONF));
+ ret = readRequest(nga, conf_old);
+ if (ret != ERR_OK)
+ goto end;
+
+ filterAttributes(conf_old, ATTR_VLAN_PORT_CONF, ATTR_END);
+
+ /* check if the switch is in port mode */
+ if (conf_old->first == NULL) {
+ ret = ERR_INVARG;
+ goto end;