version 1.1.1.1.2.2, 2011/10/10 07:50:18
|
version 1.1.1.1.2.3, 2011/10/10 13:56:30
|
Line 22 Usage()
|
Line 22 Usage()
|
"=== %s === %s@%s ===\n\n" |
"=== %s === %s@%s ===\n\n" |
" Syntax: ansh [options] <connect2host>\n\n" |
" Syntax: ansh [options] <connect2host>\n\n" |
"\t-d <dev>\tBind to host interface, like 'em0' (default is first host interface)\n" |
"\t-d <dev>\tBind to host interface, like 'em0' (default is first host interface)\n" |
"\t-i <id>\tService ID (default is 42)\n" |
|
"\t-t <timeout>\tClient session timeout (default is 0 sec)\n" |
"\t-t <timeout>\tClient session timeout (default is 0 sec)\n" |
"\t-u\t\tSwitch to unencrypted traffic between hosts\n" |
"\t-u\t\tSwitch to unencrypted traffic between hosts\n" |
"\t-v\t\tVerbose (more -v, more verbosity ...)\n" |
"\t-v\t\tVerbose (more -v, more verbosity ...)\n" |
Line 35 main(int argc, char **argv)
|
Line 34 main(int argc, char **argv)
|
{ |
{ |
char ch, szDev[STRSIZ] = { 0 }; |
char ch, szDev[STRSIZ] = { 0 }; |
int h, len; |
int h, len; |
u_short id = ANSH_ID; |
|
struct ether_addr ea; |
struct ether_addr ea; |
|
|
srandomdev(); |
srandomdev(); |
Line 45 main(int argc, char **argv)
|
Line 43 main(int argc, char **argv)
|
|
|
Get1stEth(szDev, STRSIZ); |
Get1stEth(szDev, STRSIZ); |
|
|
while ((ch = getopt(argc, argv, "hvui:t:d:")) != -1) | while ((ch = getopt(argc, argv, "hvut:d:")) != -1) |
switch (ch) { |
switch (ch) { |
case 't': |
case 't': |
Timeout = abs(strtol(optarg, NULL, 0)); |
Timeout = abs(strtol(optarg, NULL, 0)); |
Line 53 main(int argc, char **argv)
|
Line 51 main(int argc, char **argv)
|
case 'd': |
case 'd': |
strlcpy(szDev, optarg, sizeof szDev); |
strlcpy(szDev, optarg, sizeof szDev); |
break; |
break; |
case 'i': |
|
id = strtol(optarg, NULL, 0); |
|
break; |
|
case 'u': |
case 'u': |
Crypted ^= Crypted; |
Crypted ^= Crypted; |
break; |
break; |
Line 84 main(int argc, char **argv)
|
Line 79 main(int argc, char **argv)
|
return 1; |
return 1; |
} |
} |
|
|
ConnectL2(h, id, &ea, len); | ConnectL2(h, &ea, len); |
|
|
VERB(1) printf("Finish client.\n"); |
VERB(1) printf("Finish client.\n"); |
close(h); |
close(h); |