Skip to content

Commit

Permalink
Remove non-functional IP address scan code and complain if address no…
Browse files Browse the repository at this point in the history
…t present
  • Loading branch information
pcw-mesa committed Nov 2, 2023
1 parent 1c6f6a6 commit 94a662e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
46 changes: 25 additions & 21 deletions eth_boards.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,8 +683,8 @@ void eth_boards_cleanup(board_access_t *access) {
// Returns 0 if it found one, -1 on failure.
int eth_boards_scan(board_access_t *access) {
char addr[16];
int i;
char *ptr;
// int i;
// char *ptr;
int r = 0;

if (access->address == 0) {
Expand All @@ -707,25 +707,29 @@ int eth_boards_scan(board_access_t *access) {
eth_socket_set_dest_ip(access->dev_addr);
r = eth_scan_one_addr(access);
} else {
strncpy(addr, access->dev_addr, 16);
ptr = strrchr(addr, '.');
*ptr = '\0';

// We're scanning for boards, return Success (0) if we find at
// least one, return Fail (-1) if we don't find any.
r = -1;

for (i = 1; i < 255; i++) {
char addr_name[32];
int this_r;

sprintf(addr_name, "%s.%d", addr, i);
eth_socket_set_dest_ip(addr_name);
this_r = eth_scan_one_addr(access);
if (this_r == 0) {
r = 0;
}
}
// did this scanning ever work?
// remove for now and complain about missing IP address
// strncpy(addr, access->dev_addr, 16);
// ptr = strrchr(addr, '.');
// *ptr = '\0';
//
// // We're scanning for boards, return Success (0) if we find at
// // least one, return Fail (-1) if we don't find any.
// r = -1;
//
// for (i = 1; i < 255; i++) {
// char addr_name[32];
// int this_r;
//
// sprintf(addr_name, "%s.%d", addr, i);
// eth_socket_set_dest_ip(addr_name);
// this_r = eth_scan_one_addr(access);
// if (this_r == 0) {
// r = 0;
// }
// }
r= -1;
printf("You must supply an IP address for Ethernet cards\n");
}
eth_socket_blocking();
return r;
Expand Down
2 changes: 1 addition & 1 deletion mesaflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#endif

#ifndef VERSION
#define VERSION "3.5"
#define VERSION "3.5.1"
#endif

static int device_flag;
Expand Down

0 comments on commit 94a662e

Please sign in to comment.