From 09b83e96b3032b0f99193fbf6e5fe40b3471ed0a Mon Sep 17 00:00:00 2001 From: Nick Moore Date: Thu, 2 May 2019 14:32:35 +1000 Subject: [PATCH] Avoid socket #0 used by DHCP --- shared-module/wiznet/wiznet5k.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-module/wiznet/wiznet5k.c b/shared-module/wiznet/wiznet5k.c index ee732859af..39b2bd3fed 100644 --- a/shared-module/wiznet/wiznet5k.c +++ b/shared-module/wiznet/wiznet5k.c @@ -106,8 +106,8 @@ int wiznet5k_socket_socket(mod_network_socket_obj_t *socket, int *_errno) { } if (socket->u_param.fileno == -1) { - // get first unused socket number - for (mp_uint_t sn = 0; sn < _WIZCHIP_SOCK_NUM_; sn++) { + // get first unused socket number ... 0 is reserved for DHCP + for (mp_uint_t sn = 1; sn < _WIZCHIP_SOCK_NUM_; sn++) { if ((wiznet5k_obj.socket_used & (1 << sn)) == 0) { wiznet5k_obj.socket_used |= (1 << sn); socket->u_param.fileno = sn;