cmd: net: Add the "arp" command
PATCH v3 1/1 cmd: net: Add the "arp" command
From: Joe Xue <[email protected]>
The command is to query and show mac address of a specific ipAddress.
---
cmd/Kconfig | 6 ++++++ cmd/net.c | 37 +++++++++++++++++++++++++++++++++++++ doc/usage/arp.rst | 31 +++++++++++++++++++++++++++++++ include/net.h | 5 +++++ net/arp.c | 24 ++++++++++++++++++++++++ net/arp.h | 4 ++++ net/net.c | 8 ++++++++ 7 files changed, 115 insertions(+) create mode 100644 doc/usage/arp.rst
cmd/Kconfig +6 -0
@@ -1587,6 +1587,12 @@ config CMD_PING help Send ICMP ECHO_REQUEST to network host +config CMD_ARP + bool "arp" + help + Sends ARP_REQUEST to network host and shows the result if there is arp + response. + config CMD_CDP bool "cdp" help
cmd/net.c +37 -0
@@ -480,3 +480,40 @@ U_BOOT_CMD( );#endif /* CONFIG_CMD_LINK_LOCAL */ + +#ifdef CONFIG_CMD_ARP +static int do_arp (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) +{ +u8 *ethaddr = arp_query_ethaddr; + +if (argc <2 ) +return CMD_RET_USAGE ; + + arp_query_ip =string_to_ip (argv[1 ]); +if (arp_query_ip.s_addr ==0 ) +return CMD_RET_USAGE ; + +if ((arp_query_ip.s_addr & net_netmask.s_addr) != + (net_ip.s_addr & net_netmask.s_addr)) { +printf ("The host %s is not in the same network\n" , argv[1 ]); +return CMD_RET_SUCCESS ; + } + +if (net_loop (ARP ) <0 ) { +printf ("arp failed; host %s is not alive\n" , argv[1 ]); +return CMD_RET_FAILURE ; + } + +printf ("%s\t%02x:%02x:%02x:%02x:%02x:%02x\n" , argv[1 ], ethaddr[0 ], + ethaddr[1 ], ethaddr[2 ], ethaddr[3 ], ethaddr[4 ], ethaddr[5 ]); + +return CMD_RET_SUCCESS ; +} + +U_BOOT_CMD ( + arp,2 ,1 , do_arp, +"send ARP ARP_REQUEST to network host" , +"ipAddress" +); + +#endif /* CONFIG_CMD_ARP */
doc/usage/arp.rst new file +31 -0
@@ -0,0 +1,31 @@ +arp command +=========== + +Synopis +------- + +:: + + arp ipAddress + +Description +----------- + +The arp command is used to send ARP_REQUEST to network host and show the result. + +ipAddress + the host ip address + +Example +------- + +:: + + => arp 192.168.0.1 + Using host_ens33 device + 192.168.0.1 84:94:8c:5f:e1:62 + +Return value +------------ + +The return value $? is 0 if the comand running was successful else 1
include/net.h +5 -0
@@ -580,6 +580,11 @@ extern char *net_dns_env_var; /* the env var to put the ip into */extern struct in_addr net_ping_ip;/* the ip address to ping */ #endif +#if defined(CONFIG_CMD_ARP ) +extern u8 arp_query_ethaddr[6 ];/* the arp query result */ +extern struct in_addr arp_query_ip;/* the ip address to arp query */ +#endif +#if defined(CONFIG_CMD_CDP )/* when CDP completes these hold the return values */ extern ushort cdp_native_vlan;/* CDP returned native VLAN */
net/arp.c +24 -0
@@ -220,11 +220,20 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)net_get_arp_handler ()((uchar *)arp,0 , reply_ip_addr,0 , len); +#ifdef CONFIG_CMD_ARP +if (arp_query_ip.s_addr !=0 ) { + arp_query_ip.s_addr =0 ; +net_set_state (NETLOOP_SUCCESS ); + }else { +#endif /* set the mac address in the waiting packet's header and transmit it */ memcpy (((struct ethernet_hdr *)net_tx_packet)->et_dest, &arp->ar_sha,ARP_HLEN );net_send_packet (net_tx_packet, arp_wait_tx_packet_size); +#ifdef CONFIG_CMD_ARP + } +#endif /* no arp request pending now */ net_arp_wait_packet_ip.s_addr =0 ;
@@ -243,3 +252,18 @@ bool arp_is_waiting(void) {return !!net_arp_wait_packet_ip.s_addr; } + +#ifdef CONFIG_CMD_ARP +u8 arp_query_ethaddr[6 ]; +struct in_addr arp_query_ip; + +void arp_query (void ) +{ + arp_wait_packet_ethaddr = arp_query_ethaddr; + net_arp_wait_packet_ip = arp_query_ip; + + arp_wait_timer_start =get_timer (0 ); +printf ("Using %s device\n" ,eth_get_name ()); +arp_request (); +} +#endif
net/arp.h +4 -0
@@ -29,4 +29,8 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,int arp_timeout_check (void );void arp_receive (struct ethernet_hdr *et,struct ip_udp_hdr *ip,int len); +#ifdef CONFIG_CMD_ARP +void arp_query (void ); +#endif +#endif /* __ARP_H__ */
net/net.c +8 -0
@@ -492,6 +492,11 @@ restart:rarp_request ();break ;#endif +#if defined(CONFIG_CMD_ARP ) +case ARP : +arp_query (); +break ; +#endif #if defined(CONFIG_CMD_PING )case PING :ping_start ();
@@ -1385,6 +1390,9 @@ common:case CDP :case DHCP :case LINKLOCAL : +#ifdef CONFIG_CMD_ARP +case ARP : +#endif if (memcmp (net_ethaddr,"\0\0\0\0\0\0" ,6 ) ==0 ) {int num =eth_get_dev_index ();
Signature · 1 line
2.27.0
PATCH v3 1/1 cmd: net: Add the "arp" command
Quoted 15 lines · lgxue at hotmail.com
From: Joe Xue <[email protected]>
The command is to query and show mac address of a specific ipAddress.
Signed-off-by Joe Xue <[email protected]>---
cmd/Kconfig | 6 ++++++ cmd/net.c | 37 +++++++++++++++++++++++++++++++++++++ doc/usage/arp.rst | 31 +++++++++++++++++++++++++++++++ include/net.h | 5 +++++ net/arp.c | 24 ++++++++++++++++++++++++ net/arp.h | 4 ++++ net/net.c | 8 ++++++++ 7 files changed, 115 insertions(+)
Quoted 1 line
create mode 100644
doc/usage/arp.rst
Do you have a list of changes you made since v1/v2?
--Sean
Quoted 199 lines
cmd/Kconfig +6
-0@@ -1587,6 +1587,12 @@ config CMD_PING help Send ICMP ECHO_REQUEST to network host +config CMD_ARP + bool "arp" + help + Sends ARP_REQUEST to network host and shows the result if there is arp + response. + config CMD_CDP bool "cdp" helpcmd/net.c +37
-0@@ -480,3 +480,40 @@ U_BOOT_CMD( );#endif /* CONFIG_CMD_LINK_LOCAL */ + +#ifdef CONFIG_CMD_ARP +static int do_arp (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) +{ +u8 *ethaddr = arp_query_ethaddr; + +if (argc <2 ) +return CMD_RET_USAGE ; + + arp_query_ip =string_to_ip (argv[1 ]); +if (arp_query_ip.s_addr ==0 ) +return CMD_RET_USAGE ; + +if ((arp_query_ip.s_addr & net_netmask.s_addr) != + (net_ip.s_addr & net_netmask.s_addr)) { +printf ("The host %s is not in the same network\n" , argv[1 ]); +return CMD_RET_SUCCESS ; + } + +if (net_loop (ARP ) <0 ) { +printf ("arp failed; host %s is not alive\n" , argv[1 ]); +return CMD_RET_FAILURE ; + } + +printf ("%s\t%02x:%02x:%02x:%02x:%02x:%02x\n" , argv[1 ], ethaddr[0 ], + ethaddr[1 ], ethaddr[2 ], ethaddr[3 ], ethaddr[4 ], ethaddr[5 ]); + +return CMD_RET_SUCCESS ; +} + +U_BOOT_CMD ( + arp,2 ,1 , do_arp, +"send ARP ARP_REQUEST to network host" , +"ipAddress" +); + +#endif /* CONFIG_CMD_ARP */ doc/usage/arp.rst new file +31
-0@@ -0,0 +1,31 @@ +arp command +=========== + +Synopis +------- + +:: + + arp ipAddress + +Description +----------- + +The arp command is used to send ARP_REQUEST to network host and show the result. + +ipAddress + the host ip address + +Example +------- + +:: + + => arp 192.168.0.1 + Using host_ens33 device + 192.168.0.1 84:94:8c:5f:e1:62 + +Return value +------------ + +The return value $? is 0 if the comand running was successful else 1include/net.h +5
-0@@ -580,6 +580,11 @@ extern char *net_dns_env_var; /* the env var to put the ip into */extern struct in_addr net_ping_ip;/* the ip address to ping */ #endif +#if defined(CONFIG_CMD_ARP ) +extern u8 arp_query_ethaddr[6 ];/* the arp query result */ +extern struct in_addr arp_query_ip;/* the ip address to arp query */ +#endif +#if defined(CONFIG_CMD_CDP )/* when CDP completes these hold the return values */ extern ushort cdp_native_vlan;/* CDP returned native VLAN */ net/arp.c +24
-0@@ -220,11 +220,20 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)net_get_arp_handler ()((uchar *)arp,0 , reply_ip_addr,0 , len); +#ifdef CONFIG_CMD_ARP +if (arp_query_ip.s_addr !=0 ) { + arp_query_ip.s_addr =0 ; +net_set_state (NETLOOP_SUCCESS ); + }else { +#endif /* set the mac address in the waiting packet's header and transmit it */ memcpy (((struct ethernet_hdr *)net_tx_packet)->et_dest, &arp->ar_sha,ARP_HLEN );net_send_packet (net_tx_packet, arp_wait_tx_packet_size); +#ifdef CONFIG_CMD_ARP + } +#endif /* no arp request pending now */ net_arp_wait_packet_ip.s_addr =0 ;@@ -243,3 +252,18 @@ bool arp_is_waiting(void) {return !!net_arp_wait_packet_ip.s_addr; } + +#ifdef CONFIG_CMD_ARP +u8 arp_query_ethaddr[6 ]; +struct in_addr arp_query_ip; + +void arp_query (void ) +{ + arp_wait_packet_ethaddr = arp_query_ethaddr; + net_arp_wait_packet_ip = arp_query_ip; + + arp_wait_timer_start =get_timer (0 ); +printf ("Using %s device\n" ,eth_get_name ()); +arp_request (); +} +#endif net/arp.h +4
-0@@ -29,4 +29,8 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,int arp_timeout_check (void );void arp_receive (struct ethernet_hdr *et,struct ip_udp_hdr *ip,int len); +#ifdef CONFIG_CMD_ARP +void arp_query (void ); +#endif +#endif /* __ARP_H__ */ net/net.c +8
-0@@ -492,6 +492,11 @@ restart:rarp_request ();break ;#endif +#if defined(CONFIG_CMD_ARP ) +case ARP : +arp_query (); +break ; +#endif #if defined(CONFIG_CMD_PING )case PING :ping_start ();@@ -1385,6 +1390,9 @@ common:case CDP :case DHCP :case LINKLOCAL : +#ifdef CONFIG_CMD_ARP +case ARP : +#endif if (memcmp (net_ethaddr,"\0\0\0\0\0\0" ,6 ) ==0 ) {int num =eth_get_dev_index ();
PATCH v3 1/1 cmd: net: Add the "arp" command
I moved the v1 and v2 as "Superseeded" if that is what you mean.
Thanks
Joe Xue
________________________________
From: Sean Anderson <[email protected]>
Sent: April 13, 2021 11:16 AM
To: lgxue at hotmail.com <[email protected]>; u-boot at lists.denx.de <[email protected]>
Cc: bmeng.cn at gmail.com <[email protected]>; frederic.danis at collabora.com <[email protected]>; xypron.glpk at gmx.de <[email protected]>; joe.hershberger at ni.com <[email protected]>; Olaf.Krebs at emh-metering.com <[email protected]>; patrick.delaunay at foss.st.com <[email protected]>; peng.fan at nxp.com <[email protected]>; philippe.reynes at softathome.com <[email protected]>; rfried.dev at gmail.com <[email protected]>; sjg at chromium.org <[email protected]>
Subject: Re: [PATCH v3] cmd: net: Add the "arp" command
Quoted 15 lines · lgxue at hotmail.com
From: Joe Xue <[email protected]>
The command is to query and show mac address of a specific ipAddress.
Signed-off-by Joe Xue <[email protected]>---
cmd/Kconfig | 6 ++++++ cmd/net.c | 37 +++++++++++++++++++++++++++++++++++++ doc/usage/arp.rst | 31 +++++++++++++++++++++++++++++++ include/net.h | 5 +++++ net/arp.c | 24 ++++++++++++++++++++++++ net/arp.h | 4 ++++ net/net.c | 8 ++++++++ 7 files changed, 115 insertions(+)
Quoted 1 line
create mode 100644
doc/usage/arp.rst
Do you have a list of changes you made since v1/v2?
--Sean
Quoted 199 lines
cmd/Kconfig +6
-0@@ -1587,6 +1587,12 @@ config CMD_PING help Send ICMP ECHO_REQUEST to network host +config CMD_ARP + bool "arp" + help + Sends ARP_REQUEST to network host and shows the result if there is arp + response. + config CMD_CDP bool "cdp" helpcmd/net.c +37
-0@@ -480,3 +480,40 @@ U_BOOT_CMD( );#endif /* CONFIG_CMD_LINK_LOCAL */ + +#ifdef CONFIG_CMD_ARP +static int do_arp (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) +{ +u8 *ethaddr = arp_query_ethaddr; + +if (argc <2 ) +return CMD_RET_USAGE ; + + arp_query_ip =string_to_ip (argv[1 ]); +if (arp_query_ip.s_addr ==0 ) +return CMD_RET_USAGE ; + +if ((arp_query_ip.s_addr & net_netmask.s_addr) != + (net_ip.s_addr & net_netmask.s_addr)) { +printf ("The host %s is not in the same network\n" , argv[1 ]); +return CMD_RET_SUCCESS ; + } + +if (net_loop (ARP ) <0 ) { +printf ("arp failed; host %s is not alive\n" , argv[1 ]); +return CMD_RET_FAILURE ; + } + +printf ("%s\t%02x:%02x:%02x:%02x:%02x:%02x\n" , argv[1 ], ethaddr[0 ], + ethaddr[1 ], ethaddr[2 ], ethaddr[3 ], ethaddr[4 ], ethaddr[5 ]); + +return CMD_RET_SUCCESS ; +} + +U_BOOT_CMD ( + arp,2 ,1 , do_arp, +"send ARP ARP_REQUEST to network host" , +"ipAddress" +); + +#endif /* CONFIG_CMD_ARP */ doc/usage/arp.rst new file +31
-0@@ -0,0 +1,31 @@ +arp command +=========== + +Synopis +------- + +:: + + arp ipAddress + +Description +----------- + +The arp command is used to send ARP_REQUEST to network host and show the result. + +ipAddress + the host ip address + +Example +------- + +:: + + => arp 192.168.0.1 + Using host_ens33 device + 192.168.0.1 84:94:8c:5f:e1:62 + +Return value +------------ + +The return value $? is 0 if the comand running was successful else 1include/net.h +5
-0@@ -580,6 +580,11 @@ extern char *net_dns_env_var; /* the env var to put the ip into */extern struct in_addr net_ping_ip;/* the ip address to ping */ #endif +#if defined(CONFIG_CMD_ARP ) +extern u8 arp_query_ethaddr[6 ];/* the arp query result */ +extern struct in_addr arp_query_ip;/* the ip address to arp query */ +#endif +#if defined(CONFIG_CMD_CDP )/* when CDP completes these hold the return values */ extern ushort cdp_native_vlan;/* CDP returned native VLAN */ net/arp.c +24
-0@@ -220,11 +220,20 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)net_get_arp_handler ()((uchar *)arp,0 , reply_ip_addr,0 , len); +#ifdef CONFIG_CMD_ARP +if (arp_query_ip.s_addr !=0 ) { + arp_query_ip.s_addr =0 ; +net_set_state (NETLOOP_SUCCESS ); + }else { +#endif /* set the mac address in the waiting packet's header and transmit it */ memcpy (((struct ethernet_hdr *)net_tx_packet)->et_dest, &arp->ar_sha,ARP_HLEN );net_send_packet (net_tx_packet, arp_wait_tx_packet_size); +#ifdef CONFIG_CMD_ARP + } +#endif /* no arp request pending now */ net_arp_wait_packet_ip.s_addr =0 ;@@ -243,3 +252,18 @@ bool arp_is_waiting(void) {return !!net_arp_wait_packet_ip.s_addr; } + +#ifdef CONFIG_CMD_ARP +u8 arp_query_ethaddr[6 ]; +struct in_addr arp_query_ip; + +void arp_query (void ) +{ + arp_wait_packet_ethaddr = arp_query_ethaddr; + net_arp_wait_packet_ip = arp_query_ip; + + arp_wait_timer_start =get_timer (0 ); +printf ("Using %s device\n" ,eth_get_name ()); +arp_request (); +} +#endif net/arp.h +4
-0@@ -29,4 +29,8 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther,int arp_timeout_check (void );void arp_receive (struct ethernet_hdr *et,struct ip_udp_hdr *ip,int len); +#ifdef CONFIG_CMD_ARP +void arp_query (void ); +#endif +#endif /* __ARP_H__ */ net/net.c +8
-0@@ -492,6 +492,11 @@ restart:rarp_request ();break ;#endif +#if defined(CONFIG_CMD_ARP ) +case ARP : +arp_query (); +break ; +#endif #if defined(CONFIG_CMD_PING )case PING :ping_start ();@@ -1385,6 +1390,9 @@ common:case CDP :case DHCP :case LINKLOCAL : +#ifdef CONFIG_CMD_ARP +case ARP : +#endif if (memcmp (net_ethaddr,"\0\0\0\0\0\0" ,6 ) ==0 ) {int num =eth_get_dev_index ();
PATCH v3 1/1 cmd: net: Add the "arp" command
Quoted 1 line · Joe Xue
I moved the v1 and v2 as "Superseeded" if that is what you mean.
No, I mean what are the differences between this patch and the patch you sent labeled "v2"?
There is no changelog after the diffstat.
--Sean
Quoted 233 lines
Thanks
Joe Xue
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*From:* Sean Anderson <[email protected]>
*Sent:* April 13, 2021 11:16 AM
*To:* lgxue at hotmail.com <[email protected]>; u-boot at lists.denx.de <[email protected]>
*Cc:* bmeng.cn at gmail.com <[email protected]>; frederic.danis at collabora.com <[email protected]>; xypron.glpk at gmx.de <[email protected]>; joe.hershberger at ni.com <[email protected]>; Olaf.Krebs at emh-metering.com <[email protected]>; patrick.delaunay at foss.st.com <[email protected]>; peng.fan at nxp.com <[email protected]>; philippe.reynes at softathome.com <[email protected]>; rfried.dev at gmail.com <[email protected]>; sjg at chromium.org <[email protected]> *Subject:* Re: [PATCH v3] cmd: net: Add the "arp" commandQuoted 14 lines · lgxue at hotmail.com
From: Joe Xue <[email protected]>
The command is to query and show mac address of a specific ipAddress.
Signed-off-by Joe Xue <[email protected]>---
?? cmd/Kconfig?????? |? 6 ++++++ ?? cmd/net.c???????? | 37 +++++++++++++++++++++++++++++++++++++ ?? doc/usage/arp.rst | 31 +++++++++++++++++++++++++++++++ ?? include/net.h???? |? 5 +++++ ?? net/arp.c???????? | 24 ++++++++++++++++++++++++ ?? net/arp.h???????? |? 4 ++++ ?? net/net.c???????? |? 8 ++++++++Quoted 2 lines
?? 7 files changed, 115 insertions(+)
?? create mode 100644doc/usage/arp.rstDo you have a list of changes you made since v1/v2?
--Sean
Quoted 199 lines
cmd/Kconfig +0
-0@@ -1587,6 +1587,12 @@ config CMD_PING??????? help
????????? Send ICMPECHO_REQUESTto network hostcmd/Kconfig +6
-0+config CMD_ARP +???? bool "arp" +???? help +?????? Sends ARP_REQUEST to network host and shows the result if there is arp +?????? response. +?? config
CMD_CDP
??????? bool "cdp"
??????? helpcmd/net.c +0
-0@@ -480,3 +480,40 @@ U_BOOT_CMD( ?? );?? #endif? /*
CONFIG_CMD_LINK_LOCAL*/cmd/net.c +37
-0+ +#ifdef CONFIG_CMD_ARP +static int do_arp (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) +{ +???? u8 *ethaddr = arp_query_ethaddr; + +???? if (argc < 2) +???????????? return CMD_RET_USAGE; + +???? arp_query_ip = string_to_ip(argv[1]); +???? if (arp_query_ip.s_addr == 0) +???????????? return CMD_RET_USAGE; + +???? if ((arp_query_ip.s_addr & net_netmask.s_addr) != +???????? (net_ip.s_addr & net_netmask.s_addr)) { +???????????? printf("The host %s is not in the same network\n", argv[1]); +???????????? return CMD_RET_SUCCESS; +???? } + +???? if (net_loop(ARP) < 0) { +???????????? printf("arp failed; host %s is not alive\n", argv[1]); +???????????? return CMD_RET_FAILURE; +???? } + +???? printf("%s\t%02x:%02x:%02x:%02x:%02x:%02x\n", argv[1], ethaddr[0], +??????????? ethaddr[1], ethaddr[2], ethaddr[3], ethaddr[4], ethaddr[5]); + +???? return CMD_RET_SUCCESS; +} + +U_BOOT_CMD( +???? arp,??? 2,????? 1,????? do_arp, +???? "send ARP ARP_REQUEST to network host", +???? "ipAddress" +); + +#endif /* CONFIG_CMD_ARP */ doc/usage/arp.rst new file +31
-0@@ -0,0 +1,31 @@ +arp command +=========== + +Synopis +------- + +:: + +??? arp ipAddress + +Description +----------- + +The arp command is used to send ARP_REQUEST to network host and show the result. + +ipAddress +??? the host ip address + +Example +------- + +:: + +??? => arp 192.168.0.1 +??? Using host_ens33 device +??? 192.168.0.1 84:94:8c:5f:e1:62 + +Return value +------------ + +The return value $? is 0 if the comand running was successful else 1include/net.h +0
-0@@ -580,6 +580,11 @@ extern char *net_dns_env_var;??????????? /* the env var to put the ip into */?? extern struct
in_addrnet_ping_ip;? /* the ip address to ping */ ?? #endifinclude/net.h +5
-0+#if defined(CONFIG_CMD_ARP ) +extern u8 arp_query_ethaddr[6];????????????? /* the arp query result */ +extern struct in_addr arp_query_ip;/* the ip address to arp query */ +#endif +?? #if
defined(CONFIG_CMD_CDP)
?? /* when CDP completes these hold the return values */
?? extern ushortcdp_native_vlan;????????????? /* CDP returned native VLAN */net/arp.c +6
-0@@ -220,11 +220,20 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) ??????????????????????? net_get_arp_handler()((uchar *)arp, 0, reply_ip_addr, ????????????????????????????????????????????? 0, len); +#ifdef CONFIG_CMD_ARP +???????????????????? if (arp_query_ip.s_addr != 0) { +???????????????????????????? arp_query_ip.s_addr = 0; +???????????????????????????? net_set_state(NETLOOP_SUCCESS); +???????????????????? } else { +#endif ??????????????????????? /* set the mac address in the waiting packet's header ?????????????????????????? and transmit it */ ??????????????????????? memcpy(((struct
ethernet_hdr*)net_tx_packet)->et_dest, ??????????????????????????????&arp->ar_sha,ARP_HLEN); ???????????????????????net_send_packet(net_tx_packet, arp_wait_tx_packet_size);net/arp.c +3
-0+#ifdef CONFIG_CMD_ARP +???????????????????? } +#endif ??????????????????????? /* no arp request pending now */ ??????????????????????? net_arp_wait_packet_ip.s_addr = 0;
net/arp.c +15
-0@@ -243,3 +252,18 @@ bool arp_is_waiting(void) ?? { ??????? return !!net_arp_wait_packet_ip.s_addr; ?? } + +#ifdef CONFIG_CMD_ARP +u8 arp_query_ethaddr[6 ]; +struct in_addr arp_query_ip; + +void arp_query (void ) +{ +???? arp_wait_packet_ethaddr = arp_query_ethaddr; +???? net_arp_wait_packet_ip = arp_query_ip; + +???? arp_wait_timer_start = get_timer(0); +???? printf("Using %s device\n", eth_get_name()); +???? arp_request(); +} +#endif net/arp.h +4
-0@@ -29,4 +29,8 @@ void arp_raw_request(struct in_addr source_ip, const uchar *targetEther, ?? int arp_timeout_check(void); ?? void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len); +#ifdef CONFIG_CMD_ARP +void arp_query (void ); +#endif +?? #endif /*
__ARP_H__*/net/net.c +0
-0@@ -492,6 +492,11 @@ restart: ??????????????????????? rarp_request(); ??????????????????????? break;?? #endif
net/net.c +5
-0+#if defined(CONFIG_CMD_ARP ) +???????????? case ARP: +???????????????????? arp_query(); +???????????????????? break; +#endif ?? #if
defined(CONFIG_CMD_PING)
??????????????? case PING:
???????????????????????ping_start();net/net.c +0
-0@@ -1385,6 +1390,9 @@ common:??????? case CDP:
??????? case DHCP:
??????? case LINKLOCAL:net/net.c +3
-0+#ifdef CONFIG_CMD_ARP +???? case ARP: +#endif ??????????????? if (
memcmp(net_ethaddr, "\0\0\0\0\0\0", 6)== 0) { ??????????????????????? int num =eth_get_dev_index();