summaryrefslogtreecommitdiff
path: root/mactelnet.c
diff options
context:
space:
mode:
Diffstat (limited to 'mactelnet.c')
-rw-r--r--mactelnet.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/mactelnet.c b/mactelnet.c
index 936fb8e..652023b 100644
--- a/mactelnet.c
+++ b/mactelnet.c
@@ -303,34 +303,6 @@ int main (int argc, char **argv) {
strncpy(devicename, argv[optind++], sizeof(devicename) - 1);
devicename[sizeof(devicename) - 1] = '\0';
- /* Check for identity name or mac address */
- {
- unsigned char *p = argv[optind];
- int colons = 0;
- while (*p++) {
- if (*p == ':') {
- colons++;
- }
- }
-
- if (colons != 5) {
- fprintf(stderr, "Searching for '%s'...", argv[optind]);
-
- /* Search for Router by identity name, using MNDP */
- if (!queryMNDP(argv[optind], dstmac)) {
- fprintf(stderr, "not found.\n");
- return 1;
- }
-
- /* Router found, display mac and continue */
- fprintf(stderr, "%s\n", ether_ntoa((struct ether_addr *)dstmac));
-
- } else {
- /* Convert mac address string to ether_addr struct */
- ether_aton_r(argv[optind], (struct ether_addr *)dstmac);
- }
- }
-
/* Seed randomizer */
srand(time(NULL));
@@ -387,6 +359,34 @@ int main (int argc, char **argv) {
return 1;
}
+ /* Check for identity name or mac address */
+ {
+ unsigned char *p = argv[optind];
+ int colons = 0;
+ while (*p++) {
+ if (*p == ':') {
+ colons++;
+ }
+ }
+
+ if (colons != 5) {
+ fprintf(stderr, "Searching for '%s'...", argv[optind]);
+
+ /* Search for Router by identity name, using MNDP */
+ if (!queryMNDP(argv[optind], dstmac)) {
+ fprintf(stderr, "not found.\n");
+ return 1;
+ }
+
+ /* Router found, display mac and continue */
+ fprintf(stderr, "%s\n", ether_ntoa((struct ether_addr *)dstmac));
+
+ } else {
+ /* Convert mac address string to ether_addr struct */
+ ether_aton_r(argv[optind], (struct ether_addr *)dstmac);
+ }
+ }
+
if (!haveUsername) {
int ret=0;
printf("Login: ");