Commit 865bb88f by Juliusz Chroboczek

Add ability to specify router-id explicitly on the command-line.

There is no equivalent config-file option, since I'm worried about config
files being copied between nodes.
1 parent 19b6b01e
babeld-1.6.2 (unreleased)
* Added the ability to specify a router-id explicitly (-R).
* Changed router-id computation to use all interfaces, which increases
the chances of a stable id.
* Changed the format of babel-state to only contain the seqno -- the
......
......@@ -56,6 +56,7 @@ THE SOFTWARE.
struct timeval now;
unsigned char myid[8];
int have_id = 0;
int debug = 0;
int link_detect = 0;
......@@ -126,7 +127,8 @@ main(int argc, char **argv)
has_ipv6_subtrees = kernel_has_ipv6_subtrees();
while(1) {
opt = getopt(argc, argv, "m:p:h:H:i:k:A:sruS:d:g:lwz:M:t:T:c:C:DL:I:");
opt = getopt(argc, argv,
"m:p:h:H:i:k:A:srR:uS:d:g:lwz:M:t:T:c:C:DL:I:");
if(opt < 0)
break;
......@@ -179,6 +181,12 @@ main(int argc, char **argv)
case 'r':
random_id = 1;
break;
case 'R':
rc = parse_eui64(optarg, myid);
if(rc < 0)
goto usage;
have_id = 1;
break;
case 'u':
keep_unfeasible = 1;
break;
......@@ -395,9 +403,7 @@ main(int argc, char **argv)
goto fail;
}
if(random_id)
goto random_id;
if(!have_id && !random_id) {
/* We use all available interfaces here, since this increases the
chances of getting a stable router-id in case the set of Babel
interfaces changes. */
......@@ -412,13 +418,16 @@ main(int argc, char **argv)
if(rc < 0)
continue;
memcpy(myid, eui, 8);
goto have_id;
have_id = 1;
break;
}
}
if(!have_id) {
if(!random_id)
fprintf(stderr,
"Warning: couldn't find router id -- using random value.\n");
random_id:
"Warning: couldn't find router id -- "
"using random value.\n");
rc = read_random_bytes(myid, 8);
if(rc < 0) {
perror("read(random)");
......@@ -426,8 +435,8 @@ main(int argc, char **argv)
}
/* Clear group and global bits */
myid[0] &= ~3;
}
have_id:
myseqno = (random() & 0xFFFF);
fd = open(state_file, O_RDONLY);
......
......@@ -94,6 +94,11 @@ derived from the MAC address of the first interface, which is easier
to debug and more reliably prevents routing loops but may sometimes
cause a node to be unreachable for 120 seconds just after boot.
.TP
.BI \-R " router-id"
Specify the router-id explicitly, as a modified EUI-64 or a MAC-48
address. If two nodes have the same router-id, bad things will happen.
Don't use this option unless you know what you are doing.
.TP
.B \-u
Do not flush unfeasible (useless) routes. This is useful in order to
announce more information to a front-end (see
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!