u-boot ping功能的实现
static int do_ping(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { if (argc < 2) return CMD_RET_USAGE; net_ping_ip = string_to_ip(argv[1]); if (net_ping_ip.s_addr == 0) return CMD_RET_USAGE; if (net_loop(PING) < 0) { printf("ping failed; host %s is not alive\n", argv[1]); return CMD_RET_FAILURE; } printf("host %s is alive\n", argv[1]); return CMD_RET_SUCCESS; } U_BOOT_CMD( ping, 2, 1, do_ping, "send ICMP ECHO_REQUEST to network host", "pingAddress" );