tunslip6: option to turn off processing of IPA= address allocation

This commit is contained in:
Michael Richardson 2014-05-10 17:19:51 -04:00
parent 6608b62b01
commit f1433f7d5f

View file

@ -704,13 +704,14 @@ main(int argc, char **argv)
const char *port = NULL; const char *port = NULL;
const char *prog; const char *prog;
int baudrate = -2; int baudrate = -2;
int ipa_enable = 1;
int tap = 0; int tap = 0;
slipfd = 0; slipfd = 0;
prog = argv[0]; prog = argv[0];
setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */ setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */
while((c = getopt(argc, argv, "B:HLPhs:t:v::d::a:p:T")) != -1) { while((c = getopt(argc, argv, "B:HILPhs:t:v::d::a:p:T")) != -1) {
switch(c) { switch(c) {
case 'B': case 'B':
baudrate = atoi(optarg); baudrate = atoi(optarg);
@ -736,6 +737,11 @@ main(int argc, char **argv)
} }
break; break;
case 'I':
ipa_enable = 0;
fprintf(stderr, "Will not inquire about IP address using IPA=\n");
break;
case 't': case 't':
if(strncmp("/dev/", optarg, 5) == 0) { if(strncmp("/dev/", optarg, 5) == 0) {
strncpy(tundev, optarg + 5, sizeof(tundev)); strncpy(tundev, optarg + 5, sizeof(tundev));
@ -943,16 +949,15 @@ exit(1);
FD_ZERO(&rset); FD_ZERO(&rset);
FD_ZERO(&wset); FD_ZERO(&wset);
/* do not send IPA all the time... - add get MAC later... */ if(got_sigalarm && ipa_enable) {
/* if(got_sigalarm) { */ /* Send "?IPA". */
/* /\* Send "?IPA". *\/ */ slip_send(slipfd, '?');
/* slip_send(slipfd, '?'); */ slip_send(slipfd, 'I');
/* slip_send(slipfd, 'I'); */ slip_send(slipfd, 'P');
/* slip_send(slipfd, 'P'); */ slip_send(slipfd, 'A');
/* slip_send(slipfd, 'A'); */ slip_send(slipfd, SLIP_END);
/* slip_send(slipfd, SLIP_END); */ got_sigalarm = 0;
/* got_sigalarm = 0; */ }
/* } */
if(!slip_empty()) { /* Anything to flush? */ if(!slip_empty()) { /* Anything to flush? */
FD_SET(slipfd, &wset); FD_SET(slipfd, &wset);
@ -977,7 +982,7 @@ exit(1);
if(FD_ISSET(slipfd, &wset)) { if(FD_ISSET(slipfd, &wset)) {
slip_flushbuf(slipfd); slip_flushbuf(slipfd);
sigalarm_reset(); if(ipa_enable) sigalarm_reset();
} }
/* Optional delay between outgoing packets */ /* Optional delay between outgoing packets */
@ -995,7 +1000,7 @@ exit(1);
if(slip_empty() && FD_ISSET(tunfd, &rset)) { if(slip_empty() && FD_ISSET(tunfd, &rset)) {
size=tun_to_serial(tunfd, slipfd); size=tun_to_serial(tunfd, slipfd);
slip_flushbuf(slipfd); slip_flushbuf(slipfd);
sigalarm_reset(); if(ipa_enable) sigalarm_reset();
if(basedelay) { if(basedelay) {
struct timeval tv; struct timeval tv;
gettimeofday(&tv, NULL) ; gettimeofday(&tv, NULL) ;