|
AquilaOS documentation
How it works, and its code
|
ICMP. More...
#include <core/system.h>#include <core/string.h>#include <net/byteorder.h>#include <net/inet.h>#include <aquila/errno.h>Go to the source code of this file.
Functions | |
| static void | icmp_unreachable_input (struct netif *netif, struct icmp_hdr *icmp, size_t len) |
| Handles a "destination unreachable" about a datagram we sent: the UDP socket that sent it gets the error. | |
| void | icmp_input (struct netif *netif, struct netbuf *nb, uint32_t src, uint32_t dst) |
| Takes in an ICMP message that IPv4 received. | |
| void | icmp_unreachable (struct netif *netif, const struct ipv4_hdr *ih, int code) |
| Tells the sender of a datagram that it couldn't get where it was sent. | |
ICMP.
An echo request (a ping) is answered. An echo reply goes to the ping socket whose identifier it carries (the socket's port). A "destination unreachable" goes to the UDP socket whose datagram couldn't get there, as an error. This file also sends "unreachable" for the datagrams that arrive for no socket.
Definition in file icmp.c.
Takes in an ICMP message that IPv4 received.
| netif | the interface it came in on |
| nb | the message, from its ICMP header; it is freed, sent back or delivered |
| src | the sender's address |
| dst | the address it was sent to |
Definition at line 50 of file icmp.c.
References icmp_hdr::checksum, icmp_hdr::code, netbuf::data, ICMP_ECHO_REPLY, ICMP_ECHO_REQUEST, icmp_input(), ICMP_UNREACH, icmp_unreachable_input(), icmp_hdr::id, inet_checksum(), inet_sock_deliver(), inet_sock_find(), IP_PROTO_ICMP, ipv4_is_local(), ipv4_output(), netbuf::len, netbuf_free(), netbuf::src_ip, netbuf::src_port, netif::stats, and icmp_hdr::type.
Referenced by icmp_input(), and ipv4_input().
Tells the sender of a datagram that it couldn't get where it was sent.
| netif | the interface the datagram came in on |
| ih | the datagram's IPv4 header, with its payload after it |
| code | why (ICMP_UNREACH_*) |
Definition at line 105 of file icmp.c.
References icmp_hdr::checksum, icmp_hdr::code, ICMP_UNREACH, icmp_unreachable(), icmp_hdr::id, inet_checksum(), IP_PROTO_ICMP, ipv4_output(), ipv4_hdr::len, memcpy(), netbuf_alloc(), ntohs, icmp_hdr::seq, ipv4_hdr::src, icmp_hdr::type, and ipv4_hdr::ver_ihl.
Referenced by icmp_unreachable(), ipv4_input(), and udp_input().
Handles a "destination unreachable" about a datagram we sent: the UDP socket that sent it gets the error.
Definition at line 20 of file icmp.c.
References icmp_hdr::code, ipv4_hdr::dst, udp_hdr::dst, ICMP_UNREACH_PORT, icmp_unreachable_input(), inet_sock_error(), inet_sock_find(), IP_PROTO_UDP, ipv4_hdr::len, ipv4_hdr::proto, ipv4_hdr::src, udp_hdr::src, and ipv4_hdr::ver_ihl.
Referenced by icmp_input(), and icmp_unreachable_input().