| 131 | |
| 132 | #ifdef CONFIG_NETDEV_IFINDEX |
| 133 | int netdev_nextindex(int ifindex) |
| 134 | { |
| 135 | /* The bit index is the interface index minus one. Zero is reserved in |
| 136 | * POSIX to mean no interface index. |
| 137 | */ |
| 138 | |
| 139 | DEBUGASSERT(ifindex > 0 && ifindex <= MAX_IFINDEX); |
| 140 | ifindex--; |
| 141 | |
| 142 | if (ifindex >= 0 && ifindex < MAX_IFINDEX) |
| 143 | { |
| 144 | netdev_list_lock(); |
| 145 | for (; ifindex < MAX_IFINDEX; ifindex++) |
| 146 | { |
| 147 | if ((g_devset & (1UL << ifindex)) != 0) |
| 148 | { |
| 149 | /* NOTE that the index + 1 is returned. Zero is reserved to |
| 150 | * mean no-index in the POSIX standards. |
| 151 | */ |
| 152 | |
| 153 | netdev_list_unlock(); |
| 154 | return ifindex + 1; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | netdev_list_unlock(); |
| 159 | } |
| 160 | |
| 161 | return -ENODEV; |
| 162 | } |
| 163 | #endif |
no test coverage detected