Add icmp handling / replying
This commit is contained in:
parent
79a46f42c2
commit
d87b897069
5 changed files with 58 additions and 11 deletions
|
|
@ -225,9 +225,9 @@ Echo or Echo Reply Message
|
|||
}
|
||||
|
||||
|
||||
/********************** ICMP6 + NDP ***********************************/
|
||||
/********************** ICMP6 + NDP + ICMP ***********************************/
|
||||
|
||||
/* old/unused action */
|
||||
/* old/unused action -- is it??*/
|
||||
action icmp6_answer() {
|
||||
if(hdr.icmp6.isValid()) {
|
||||
if(hdr.icmp6.code == ICMP6_ECHO_REQUEST) {
|
||||
|
|
@ -299,7 +299,28 @@ Echo or Echo Reply Message
|
|||
}
|
||||
size = ICMP6_TABLE_SIZE;
|
||||
default_action = controller_debug_table_id(TABLE_ICMP6);
|
||||
// default_action = NoAction;
|
||||
}
|
||||
|
||||
action icmp_echo_reply() {
|
||||
ipv4_addr_t tmp = hdr.ipv4.src_addr;
|
||||
|
||||
hdr.icmp.type = ICMP_ECHO_REPLY;
|
||||
hdr.ipv4.src_addr = hdr.ipv4.dst_addr;
|
||||
hdr.ipv4.dst_addr = tmp;
|
||||
}
|
||||
|
||||
table icmp {
|
||||
key = {
|
||||
hdr.ipv4.dst_addr: lpm;
|
||||
hdr.icmp.type: exact;
|
||||
}
|
||||
actions = {
|
||||
icmp_echo_reply;
|
||||
controller_debug_table_id;
|
||||
NoAction;
|
||||
}
|
||||
size = ICMP_TABLE_SIZE;
|
||||
default_action = controller_debug_table_id(TABLE_ICMP);
|
||||
}
|
||||
|
||||
/********************** debugging / general support ***********************************/
|
||||
|
|
@ -440,7 +461,10 @@ Echo or Echo Reply Message
|
|||
|
||||
v6_networks.apply(); /* regular egress / routing */
|
||||
} else if(hdr.ipv4.isValid()) {
|
||||
if(nat46.apply().hit) {
|
||||
if(icmp.apply().hit()) {
|
||||
v4_networks.apply();
|
||||
exit;
|
||||
} else if(nat46.apply().hit) {
|
||||
if(hdr.icmp.isValid()) {
|
||||
nat46_icmp_generic();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue