Lines 75-80
Link Here
|
75 |
extern int InitialHostName_len,InitialDomainName_len; |
75 |
extern int InitialHostName_len,InitialDomainName_len; |
76 |
extern char *InitialHostName,*InitialDomainName; |
76 |
extern char *InitialHostName,*InitialDomainName; |
77 |
extern int DownIfaceOnStop; |
77 |
extern int DownIfaceOnStop; |
|
|
78 |
extern int DoARP; |
78 |
|
79 |
|
79 |
extern char resolv_file[128]; |
80 |
extern char resolv_file[128]; |
80 |
extern char resolv_file_sv[128]; |
81 |
extern char resolv_file_sv[128]; |
Lines 90-98
Link Here
|
90 |
|
91 |
|
91 |
extern int SetFQDNHostName; |
92 |
extern int SetFQDNHostName; |
92 |
|
93 |
|
93 |
#ifdef ARPCHECK |
94 |
int arpCheck(); |
94 |
int arpCheck(); |
|
|
95 |
#endif |
96 |
int arpRelease(); |
95 |
int arpRelease(); |
97 |
int dhcpConfig(); |
96 |
int dhcpConfig(); |
98 |
int readDhcpCache(); |
97 |
int readDhcpCache(); |
Lines 1088-1114
Link Here
|
1088 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[1], |
1085 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[1], |
1089 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[2], |
1086 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[2], |
1090 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[3]); |
1087 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[3]); |
1091 |
#ifdef ARPCHECK |
|
|
1092 |
/* check if the offered IP address already in use */ |
1088 |
/* check if the offered IP address already in use */ |
1093 |
if ( arpCheck() ) |
1089 |
if ( DoARP ) |
1094 |
{ |
1090 |
{ |
1095 |
logger(LOG_ERR, |
1091 |
if ( arpCheck() ) |
1096 |
"requested %u.%u.%u.%u address is in use", |
1092 |
{ |
1097 |
((unsigned char *)&DhcpIface.ciaddr)[0], |
1093 |
logger(LOG_ERR, |
1098 |
((unsigned char *)&DhcpIface.ciaddr)[1], |
1094 |
"requested %u.%u.%u.%u address is in use", |
1099 |
((unsigned char *)&DhcpIface.ciaddr)[2], |
1095 |
((unsigned char *)&DhcpIface.ciaddr)[0], |
1100 |
((unsigned char *)&DhcpIface.ciaddr)[3]); |
1096 |
((unsigned char *)&DhcpIface.ciaddr)[1], |
1101 |
dhcpDecline(); |
1097 |
((unsigned char *)&DhcpIface.ciaddr)[2], |
1102 |
DhcpIface.ciaddr = 0; |
1098 |
((unsigned char *)&DhcpIface.ciaddr)[3]); |
1103 |
return &dhcpInit; |
1099 |
dhcpDecline(); |
|
|
1100 |
DhcpIface.ciaddr = 0; |
1101 |
return &dhcpInit; |
1102 |
} |
1103 |
logger(LOG_INFO, |
1104 |
"verified %u.%u.%u.%u address is not in use", |
1105 |
((unsigned char *)&DhcpIface.ciaddr)[0], |
1106 |
((unsigned char *)&DhcpIface.ciaddr)[1], |
1107 |
((unsigned char *)&DhcpIface.ciaddr)[2], |
1108 |
((unsigned char *)&DhcpIface.ciaddr)[3]); |
1104 |
} |
1109 |
} |
1105 |
logger(LOG_INFO, |
|
|
1106 |
"verified %u.%u.%u.%u address is not in use", |
1107 |
((unsigned char *)&DhcpIface.ciaddr)[0], |
1108 |
((unsigned char *)&DhcpIface.ciaddr)[1], |
1109 |
((unsigned char *)&DhcpIface.ciaddr)[2], |
1110 |
((unsigned char *)&DhcpIface.ciaddr)[3]); |
1111 |
#endif |
1112 |
if ( dhcpConfig() ) |
1110 |
if ( dhcpConfig() ) |
1113 |
{ |
1111 |
{ |
1114 |
dhcpStop(); |
1112 |
dhcpStop(); |
Lines 1169-1174
Link Here
|
1169 |
if (FD_ISSET(dhcpSocket, &rset)) |
1167 |
if (FD_ISSET(dhcpSocket, &rset)) |
1170 |
while (recvfrom(dhcpSocket,(void *)foobuf,sizeof(foobuf),0,NULL,NULL) != -1 ); |
1168 |
while (recvfrom(dhcpSocket,(void *)foobuf,sizeof(foobuf),0,NULL,NULL) != -1 ); |
1171 |
} |
1169 |
} |
|
|
1170 |
|
1171 |
/* Sleep for 2 seconds so we don't gobble CPU time */ |
1172 |
sleep(2); |
1172 |
} |
1173 |
} |
1173 |
} |
1174 |
} |
1174 |
/*****************************************************************************/ |
1175 |
/*****************************************************************************/ |
Lines 1333-1339
Link Here
|
1333 |
return &dhcpStart; |
1332 |
return &dhcpStart; |
1334 |
} |
1333 |
} |
1335 |
/*****************************************************************************/ |
1334 |
/*****************************************************************************/ |
1336 |
#ifdef ARPCHECK |
|
|
1337 |
void *dhcpDecline() |
1335 |
void *dhcpDecline() |
1338 |
{ |
1336 |
{ |
1339 |
struct sockaddr addr; |
1337 |
struct sockaddr addr; |
Lines 1353-1359
Link Here
|
1353 |
logger(LOG_ERR,"dhcpDecline: sendto: %s",strerror(errno)); |
1351 |
logger(LOG_ERR,"dhcpDecline: sendto: %s",strerror(errno)); |
1354 |
return &dhcpInit; |
1352 |
return &dhcpInit; |
1355 |
} |
1353 |
} |
1356 |
#endif |
|
|
1357 |
/*****************************************************************************/ |
1354 |
/*****************************************************************************/ |
1358 |
void *dhcpInform() |
1355 |
void *dhcpInform() |
1359 |
{ |
1356 |
{ |
Lines 1422-1447
Link Here
|
1422 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[1], |
1419 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[1], |
1423 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[2], |
1420 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[2], |
1424 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[3]); |
1421 |
((unsigned char *)DhcpOptions.val[dhcpServerIdentifier])[3]); |
1425 |
#ifdef ARPCHECK |
|
|
1426 |
/* check if the offered IP address already in use */ |
1422 |
/* check if the offered IP address already in use */ |
1427 |
if ( arpCheck() ) |
1423 |
if ( DoARP ) |
1428 |
{ |
1424 |
{ |
1429 |
logger(LOG_ERR, |
1425 |
if ( arpCheck() ) |
1430 |
"requested %u.%u.%u.%u address is in use", |
1426 |
{ |
1431 |
((unsigned char *)&DhcpIface.ciaddr)[0], |
1427 |
logger(LOG_ERR, |
1432 |
((unsigned char *)&DhcpIface.ciaddr)[1], |
1428 |
"requested %u.%u.%u.%u address is in use", |
1433 |
((unsigned char *)&DhcpIface.ciaddr)[2], |
1429 |
((unsigned char *)&DhcpIface.ciaddr)[0], |
1434 |
((unsigned char *)&DhcpIface.ciaddr)[3]); |
1430 |
((unsigned char *)&DhcpIface.ciaddr)[1], |
1435 |
dhcpDecline(); |
1431 |
((unsigned char *)&DhcpIface.ciaddr)[2], |
1436 |
return 0; |
1432 |
((unsigned char *)&DhcpIface.ciaddr)[3]); |
|
|
1433 |
dhcpDecline(); |
1434 |
return 0; |
1435 |
} |
1436 |
logger(LOG_INFO, |
1437 |
"verified %u.%u.%u.%u address is not in use", |
1438 |
((unsigned char *)&DhcpIface.ciaddr)[0], |
1439 |
((unsigned char *)&DhcpIface.ciaddr)[1], |
1440 |
((unsigned char *)&DhcpIface.ciaddr)[2], |
1441 |
((unsigned char *)&DhcpIface.ciaddr)[3]); |
1437 |
} |
1442 |
} |
1438 |
logger(LOG_INFO, |
|
|
1439 |
"verified %u.%u.%u.%u address is not in use", |
1440 |
((unsigned char *)&DhcpIface.ciaddr)[0], |
1441 |
((unsigned char *)&DhcpIface.ciaddr)[1], |
1442 |
((unsigned char *)&DhcpIface.ciaddr)[2], |
1443 |
((unsigned char *)&DhcpIface.ciaddr)[3]); |
1444 |
#endif |
1445 |
if ( dhcpConfig() ) return 0; |
1443 |
if ( dhcpConfig() ) return 0; |
1446 |
exit(0); |
1444 |
exit(0); |
1447 |
} |
1445 |
} |