mirror of
https://github.com/ChronosX88/netsukuku.git
synced 2024-11-25 11:42:24 +00:00
Revert "gmap: Limit new IPv4 nodes to a class-b private network"
This reverts commit 1dc21e5bc5
.
* May bike-shed the ipv4 address to a class A.
This commit is contained in:
parent
1dc21e5bc5
commit
eb6648d7ec
26
src/gmap.c
26
src/gmap.c
@ -572,31 +572,11 @@ random_ip(inet_prefix * ipstart, int final_level, int final_gid,
|
|||||||
for (;;) {
|
for (;;) {
|
||||||
/*
|
/*
|
||||||
* Let's choose a completely random ip.
|
* Let's choose a completely random ip.
|
||||||
* New gnodes are limited to:
|
|
||||||
* IPv4: 172.16.0.0/12
|
|
||||||
* IPv6: fe6e:746b::/32
|
|
||||||
*/
|
*/
|
||||||
levels = total_levels;
|
levels = total_levels;
|
||||||
if (my_family == AF_INET) {
|
if (my_family == AF_INET)
|
||||||
int i = 0;
|
idata[0] = rand();
|
||||||
while (i < 4) {
|
else {
|
||||||
int octet = 0;
|
|
||||||
switch (i) {
|
|
||||||
case 0:
|
|
||||||
octet = 172;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
octet = (rand() % (31-16)) + 16;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
octet = rand() % 255;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
idata[0] |= (octet << (i * 8));
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// TODO: Generate a random address in fe6e:746b::/32
|
|
||||||
idata[0] = rand();
|
idata[0] = rand();
|
||||||
idata[1] = rand();
|
idata[1] = rand();
|
||||||
idata[2] = rand();
|
idata[2] = rand();
|
||||||
|
Loading…
Reference in New Issue
Block a user