ICMPv4 protocol.
Definition in file icmpv4.c.
Process a received packet.
- Parameters
-
| iobuf | I/O buffer |
| netdev | Network device |
| st_src | Partially-filled source address |
| st_dest | Partially-filled destination address |
| pshdr_csum | Pseudo-header checksum |
- Return values
-
Definition at line 52 of file icmpv4.c.
56 {
59 unsigned int csum;
62
63
64 if (
len <
sizeof ( *icmp ) ) {
65 DBG (
"ICMP packet too short at %zd bytes (min %zd bytes)\n",
66 len,
sizeof ( *icmp ) );
68 goto discard;
69 }
70
71
73 if ( csum != 0 ) {
74 DBG (
"ICMP checksum incorrect (is %04x, should be 0000)\n",
75 csum );
78 goto discard;
79 }
80
81
86 &icmpv4_echo_protocol );
89 default:
90 DBG (
"ICMP ignoring type %d\n",
type );
92 break;
93 }
94
95 discard:
98}
struct arbelprm_rc_send_wqe rc
uint32_t type
Operating system type.
#define DBG(...)
Print a debugging message.
#define EINVAL
Invalid argument.
int icmp_rx_echo_request(struct io_buffer *iobuf, struct sockaddr_tcpip *st_src, struct icmp_echo_protocol *echo_protocol)
Process a received ICMP echo request.
int icmp_rx_echo_reply(struct io_buffer *iobuf, struct sockaddr_tcpip *st_src)
Process a received ICMP echo request.
#define ICMP_ECHO_REQUEST
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
void * data
Start of data.
uint16_t tcpip_chksum(const void *data, size_t len)
Calculate TCP/IP checkum.
References __unused, io_buffer::data, DBG, DBG_HD, EINVAL, free_iob(), ICMP_ECHO_REPLY, ICMP_ECHO_REQUEST, icmp_rx_echo_reply(), icmp_rx_echo_request(), iob_len(), len, netdev, rc, tcpip_chksum(), icmp_header::type, and type.