File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -201,7 +201,13 @@ bool IPAddress::fromString6(const char *address) {
201201 colons++;
202202 acc = 0 ;
203203 } else if (c == ' %' ) {
204- _zone = netif_name_to_index (address);
204+ // netif_index_to_name crashes on latest esp-idf
205+ // _zone = netif_name_to_index(address);
206+ // in the interim, we parse the suffix as a zone number
207+ while ((*address != ' \0 ' ) && (!isdigit (*address))) { // skip all non-digit after '%'
208+ address++;
209+ }
210+ _zone = atol (address);
205211 while (*address != ' \0 ' ) {
206212 address++;
207213 }
@@ -351,6 +357,11 @@ size_t IPAddress::printTo(Print &p, bool includeZone) const {
351357 // netif_index_to_name(_zone, if_name);
352358 // n += p.print(if_name);
353359 // }
360+ // In the interim, we just output the index number
361+ if (_zone > 0 && includeZone) {
362+ n += p.print (' %' );
363+ n += p.print (_zone);
364+ }
354365 return n;
355366 }
356367
You can’t perform that action at this time.
0 commit comments