at_control.c (30822) | at_control.c (34961) |
---|---|
1/* 2 * Copyright (c) 1990,1991 Regents of The University of Michigan. 3 * All Rights Reserved. 4 */ 5 6#include <sys/param.h> 7#include <sys/systm.h> 8#include <sys/proc.h> --- 432 unchanged lines hidden (view full) --- 441 if ( aa->aa_flags & AFA_PHASE2 ) { 442 if ( sat->sat_addr.s_net == ATADDR_ANYNET ) { 443 /* 444 * If we are phase 2, and the net was not specified 445 * then we select a random net within the supplied netrange. 446 * XXX use /dev/random? 447 */ 448 if ( nnets != 1 ) { | 1/* 2 * Copyright (c) 1990,1991 Regents of The University of Michigan. 3 * All Rights Reserved. 4 */ 5 6#include <sys/param.h> 7#include <sys/systm.h> 8#include <sys/proc.h> --- 432 unchanged lines hidden (view full) --- 441 if ( aa->aa_flags & AFA_PHASE2 ) { 442 if ( sat->sat_addr.s_net == ATADDR_ANYNET ) { 443 /* 444 * If we are phase 2, and the net was not specified 445 * then we select a random net within the supplied netrange. 446 * XXX use /dev/random? 447 */ 448 if ( nnets != 1 ) { |
449 net = ntohs( nr.nr_firstnet ) + time.tv_sec % ( nnets - 1 ); | 449 net = ntohs( nr.nr_firstnet ) + time_second % ( nnets - 1 ); |
450 } else { 451 net = ntohs( nr.nr_firstnet ); 452 } 453 } else { 454 /* 455 * if a net was supplied, then check that it is within 456 * the netrange. If it is not then replace the old values 457 * and return an error --- 20 unchanged lines hidden (view full) --- 478 } 479 480 /* 481 * set the node part of the address into the ifaddr. 482 * If it's not specified, be random about it... 483 * XXX use /dev/random? 484 */ 485 if ( sat->sat_addr.s_node == ATADDR_ANYNODE ) { | 450 } else { 451 net = ntohs( nr.nr_firstnet ); 452 } 453 } else { 454 /* 455 * if a net was supplied, then check that it is within 456 * the netrange. If it is not then replace the old values 457 * and return an error --- 20 unchanged lines hidden (view full) --- 478 } 479 480 /* 481 * set the node part of the address into the ifaddr. 482 * If it's not specified, be random about it... 483 * XXX use /dev/random? 484 */ 485 if ( sat->sat_addr.s_node == ATADDR_ANYNODE ) { |
486 AA_SAT( aa )->sat_addr.s_node = time.tv_sec; | 486 AA_SAT( aa )->sat_addr.s_node = time_second; |
487 } else { 488 AA_SAT( aa )->sat_addr.s_node = sat->sat_addr.s_node; 489 } 490 491 /* 492 * Copy the phase. 493 */ 494 AA_SAT( aa )->sat_range.r_netrange.nr_phase --- 8 unchanged lines hidden (view full) --- 503 AA_SAT( aa )->sat_addr.s_net = htons( net ); 504 505 /* 506 * using a rather strange stepping method, 507 * stagger through the possible node addresses 508 * Once again, starting at the (possibly random) 509 * initial node address. 510 */ | 487 } else { 488 AA_SAT( aa )->sat_addr.s_node = sat->sat_addr.s_node; 489 } 490 491 /* 492 * Copy the phase. 493 */ 494 AA_SAT( aa )->sat_range.r_netrange.nr_phase --- 8 unchanged lines hidden (view full) --- 503 AA_SAT( aa )->sat_addr.s_net = htons( net ); 504 505 /* 506 * using a rather strange stepping method, 507 * stagger through the possible node addresses 508 * Once again, starting at the (possibly random) 509 * initial node address. 510 */ |
511 for ( j = 0, nodeinc = time.tv_sec | 1; j < 256; | 511 for ( j = 0, nodeinc = time_second | 1; j < 256; |
512 j++, AA_SAT( aa )->sat_addr.s_node += nodeinc ) { 513 if ( AA_SAT( aa )->sat_addr.s_node > 253 || 514 AA_SAT( aa )->sat_addr.s_node < 1 ) { 515 continue; 516 } 517 aa->aa_probcnt = 10; 518 519 /* --- 27 unchanged lines hidden (view full) --- 547 548 /* 549 * of course we need to break out through two loops... 550 */ 551 if (( aa->aa_flags & AFA_PROBING ) == 0 ) { 552 break; 553 } 554 /* reset node for next network */ | 512 j++, AA_SAT( aa )->sat_addr.s_node += nodeinc ) { 513 if ( AA_SAT( aa )->sat_addr.s_node > 253 || 514 AA_SAT( aa )->sat_addr.s_node < 1 ) { 515 continue; 516 } 517 aa->aa_probcnt = 10; 518 519 /* --- 27 unchanged lines hidden (view full) --- 547 548 /* 549 * of course we need to break out through two loops... 550 */ 551 if (( aa->aa_flags & AFA_PROBING ) == 0 ) { 552 break; 553 } 554 /* reset node for next network */ |
555 AA_SAT( aa )->sat_addr.s_node = time.tv_sec; | 555 AA_SAT( aa )->sat_addr.s_node = time_second; |
556 } 557 558 /* 559 * if we are still trying to probe, then we have finished all 560 * the possible addresses, so we need to give up 561 */ 562 563 if ( aa->aa_flags & AFA_PROBING ) { --- 312 unchanged lines hidden --- | 556 } 557 558 /* 559 * if we are still trying to probe, then we have finished all 560 * the possible addresses, so we need to give up 561 */ 562 563 if ( aa->aa_flags & AFA_PROBING ) { --- 312 unchanged lines hidden --- |