#include <stdio.h> #include <arpa/inet.h> int main(int argc, const char *argv[]) { char out[64]; struct in6_addr ip; inet_pton(AF_INET6, "::ffff:1.1.1.1", &ip); for (int i = 0; i < 10; i++) { inet_ntop(AF_INET6, &ip, out, sizeof(out)); printf("%s\n", out); for (int octet = 15; octet >= 0; octet--) { if (ip.s6_addr[octet] < 255) { ip.s6_addr[octet]++; break; } else { ip.s6_addr[octet] = 0; } } } return 0; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15129 | zachwhaley | Add practice directory |