+
+ case ATTR_STATS_RESET:
+ for (p = 0; p < swi.ports_count; p++) {
+ swi.ports[p].sent = 0;
+ swi.ports[p].recv = 0;
+ swi.ports[p].crc = 0;
+ }
+ break;
+
+ case ATTR_DHCP:
+ /* Note: DHCP attribute is special, it is 2 two bytes long
+ * when sent by the switch but only 1 byte long when sent
+ * by the client
+ */
+ if (at->size != 1) {
+ nc->error = 4;
+ break;
+ }
+ byte = at->data;
+ swi.dhcp = (*byte == 1);
+ break;
+
+ case ATTR_IP:
+ case ATTR_NETMASK:
+ case ATTR_GATEWAY:
+ /* a real switch would accept these modifications, but here we
+ * are not going to mess up the host network settings, so we
+ * refuse these requests
+ */
+ nc->error = ERROR_READONLY;
+ nc->attr_error = at->attr;
+ break;
+
+ case ATTR_BITRATE_INPUT:
+ ab = at->data;
+ if (ab->port > swi.ports_count)
+ return -EOVERFLOW;
+ swi.ports[ab->port - 1].bitrate_in = ab->bitrate;
+ break;
+
+ case ATTR_BITRATE_OUTPUT:
+ ab = at->data;
+ if (ab->port > swi.ports_count)
+ return -EOVERFLOW;
+ swi.ports[ab->port - 1].bitrate_out = ab->bitrate;
+ break;