mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-10-12 00:10:14 +00:00
ping: add -I for bind device
Add -I option to specify the network device to use for sending ICMP echo requests. This allows users to explicitly bind ping to a specific network interface, which is particularly useful in multi-homed systems with multiple network interfaces. Signed-off-by: meijian <meijian@xiaomi.com>
This commit is contained in:
parent
532a055abb
commit
5d3b2d07d6
6 changed files with 68 additions and 2 deletions
|
|
@ -50,6 +50,7 @@
|
|||
#define ICMP_E_POLL -11 /* extra: error code */
|
||||
#define ICMP_E_RECVFROM -13 /* extra: error code */
|
||||
#define ICMP_E_RECVSMALL -15 /* extra: recv bytes */
|
||||
#define ICMP_E_BINDDEV -17 /* extra: error bind */
|
||||
|
||||
/* Negative even number represent warning(recoverable) */
|
||||
|
||||
|
|
@ -70,6 +71,9 @@ struct ping_result_s;
|
|||
struct ping_info_s
|
||||
{
|
||||
FAR const char *hostname; /* Host name to ping */
|
||||
#ifdef CONFIG_NET_BINDTODEVICE
|
||||
FAR const char *devname; /* Device name to bind */
|
||||
#endif
|
||||
uint16_t count; /* Number of pings requested */
|
||||
uint16_t datalen; /* Number of bytes to be sent */
|
||||
uint16_t delay; /* Deciseconds to delay between pings */
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
#define ICMPv6_E_POLL -11 /* extra: error code */
|
||||
#define ICMPv6_E_RECVFROM -13 /* extra: error code */
|
||||
#define ICMPv6_E_RECVSMALL -15 /* extra: recv bytes */
|
||||
#define ICMPV6_E_BINDDEV -17 /* extra: error bind */
|
||||
|
||||
/* Negative even number represent warning(recoverable) */
|
||||
|
||||
|
|
@ -70,6 +71,9 @@ struct ping6_result_s;
|
|||
struct ping6_info_s
|
||||
{
|
||||
FAR const char *hostname; /* Host name to ping */
|
||||
#ifdef CONFIG_NET_BINDTODEVICE
|
||||
FAR const char *devname; /* Device name to bind */
|
||||
#endif
|
||||
uint16_t count; /* Number of pings requested */
|
||||
uint16_t datalen; /* Number of bytes to be sent */
|
||||
uint16_t delay; /* Deciseconds to delay between pings */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue