ICMP 요청에 응답하는 커널 모듈입니다. ICMPv4 모듈은 net/ipv4/icmp.c입니다.
ICMP 모듈은 icmp_pointers
이라는 개체가 icmp_objects
인 다양한 ICMP 요청을 처리하는 방법에 대한 배열 테이블을 정의하며 ICMP 메시지 유형으로 인덱싱됩니다.
ICMP 제어 구조 : 구조체 위부터
struct icmp_control {
void (*handler)(struct sk_buff *skb);
short error; /* This ICMP is classed as an error message */
};
static const struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
...
[ICMP_ECHO] = {
.handler = icmp_echo,
},
...
};
, 당신은 google.com 서버에 에코 요청을 보낼 때 메시지 유형이 icmp_echo
에코 (핑) 요청을 처리 서브 루틴 호출 icmp_echo()까지 끓는 (것 ICMP_ECHO)에 icmp_reply()의 에코 응답 (ICMP_ECHOREPLY)을 보내면됩니다.