diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-08-04 15:06:38 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-08-04 15:06:38 +0200 |
commit | a83e3ae172dd516f8aa3e075a9cb292339606ed6 (patch) | |
tree | 2c2c103e2954238165bf19f896b229f03200b87e | |
parent | e3475838354d6bba414ab8cdc2211313ad29dc9d (diff) | |
download | busybox-w32-a83e3ae172dd516f8aa3e075a9cb292339606ed6.tar.gz busybox-w32-a83e3ae172dd516f8aa3e075a9cb292339606ed6.tar.bz2 busybox-w32-a83e3ae172dd516f8aa3e075a9cb292339606ed6.zip |
zcip: tweak comments and make unsigned division more obvious
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/zcip.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/networking/zcip.c b/networking/zcip.c index a167c7e91..dba269bd8 100644 --- a/networking/zcip.c +++ b/networking/zcip.c | |||
@@ -56,9 +56,6 @@ struct arp_packet { | |||
56 | } PACKED; | 56 | } PACKED; |
57 | 57 | ||
58 | enum { | 58 | enum { |
59 | /* 169.254.0.0 */ | ||
60 | LINKLOCAL_ADDR = 0xa9fe0000, | ||
61 | |||
62 | /* 0-1 seconds before sending 1st probe */ | 59 | /* 0-1 seconds before sending 1st probe */ |
63 | PROBE_WAIT = 1, | 60 | PROBE_WAIT = 1, |
64 | /* 1-2 seconds between probes */ | 61 | /* 1-2 seconds between probes */ |
@@ -70,7 +67,7 @@ enum { | |||
70 | /* if probe/announce sees a conflict, multiply RANDOM(NUM_CONFLICT) by... */ | 67 | /* if probe/announce sees a conflict, multiply RANDOM(NUM_CONFLICT) by... */ |
71 | CONFLICT_MULTIPLIER = 2, | 68 | CONFLICT_MULTIPLIER = 2, |
72 | /* if we monitor and see a conflict, how long is defend state? */ | 69 | /* if we monitor and see a conflict, how long is defend state? */ |
73 | DEFEND_INTERVAL = 10 | 70 | DEFEND_INTERVAL = 10, |
74 | }; | 71 | }; |
75 | 72 | ||
76 | /* States during the configuration process. */ | 73 | /* States during the configuration process. */ |
@@ -196,7 +193,7 @@ static int run(char *argv[3], const char *param, uint32_t nip) | |||
196 | */ | 193 | */ |
197 | static ALWAYS_INLINE unsigned random_delay_ms(unsigned secs) | 194 | static ALWAYS_INLINE unsigned random_delay_ms(unsigned secs) |
198 | { | 195 | { |
199 | return rand() % (secs * 1000); | 196 | return (unsigned)rand() % (secs * 1000); |
200 | } | 197 | } |
201 | 198 | ||
202 | /** | 199 | /** |
@@ -328,9 +325,9 @@ int zcip_main(int argc UNUSED_PARAM, char **argv) | |||
328 | // - start with some address we want to try | 325 | // - start with some address we want to try |
329 | // - short random delay | 326 | // - short random delay |
330 | // - arp probes to see if another host uses it | 327 | // - arp probes to see if another host uses it |
331 | // 00:04:e2:64:23:c2 > ff:ff:ff:ff:ff:ff: arp who-has 169.254.194.171 tell 0.0.0.0 | 328 | // 00:04:e2:64:23:c2 > ff:ff:ff:ff:ff:ff arp who-has 169.254.194.171 tell 0.0.0.0 |
332 | // - arp announcements that we're claiming it | 329 | // - arp announcements that we're claiming it |
333 | // 00:04:e2:64:23:c2 > ff:ff:ff:ff:ff:ff: arp who-has 169.254.194.171 (00:04:e2:64:23:c2) tell 169.254.194.171 | 330 | // 00:04:e2:64:23:c2 > ff:ff:ff:ff:ff:ff arp who-has 169.254.194.171 (00:04:e2:64:23:c2) tell 169.254.194.171 |
334 | // - use it | 331 | // - use it |
335 | // - defend it, within limits | 332 | // - defend it, within limits |
336 | // exit if: | 333 | // exit if: |
@@ -412,7 +409,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv) | |||
412 | // NOTE: all other exit paths should deconfig... | 409 | // NOTE: all other exit paths should deconfig... |
413 | if (QUIT) | 410 | if (QUIT) |
414 | return EXIT_SUCCESS; | 411 | return EXIT_SUCCESS; |
415 | // fall through: switch_to_MONITOR | 412 | // fall through: switch to MONITOR |
416 | default: | 413 | default: |
417 | // case DEFEND: | 414 | // case DEFEND: |
418 | // case MONITOR: (shouldn't happen, MONITOR timeout is infinite) | 415 | // case MONITOR: (shouldn't happen, MONITOR timeout is infinite) |
@@ -520,7 +517,7 @@ int zcip_main(int argc UNUSED_PARAM, char **argv) | |||
520 | } | 517 | } |
521 | // Note: if we only have a target IP conflict here (ip_conflict & 2), | 518 | // Note: if we only have a target IP conflict here (ip_conflict & 2), |
522 | // IOW: if we just saw this sort of ARP packet: | 519 | // IOW: if we just saw this sort of ARP packet: |
523 | // aa:bb:cc:dd:ee:ff > xx:xx:xx:xx:xx:xx: arp who-has <chosen_nip> tell 0.0.0.0 | 520 | // aa:bb:cc:dd:ee:ff > xx:xx:xx:xx:xx:xx arp who-has <chosen_nip> tell 0.0.0.0 |
524 | // we expect _kernel_ to respond to that, because <chosen_nip> | 521 | // we expect _kernel_ to respond to that, because <chosen_nip> |
525 | // is (expected to be) configured on this iface. | 522 | // is (expected to be) configured on this iface. |
526 | } // while (1) | 523 | } // while (1) |