diff --git a/repos/os/include/net/ipv4.h b/repos/os/include/net/ipv4.h index 41380a4e1d..3327bf9962 100644 --- a/repos/os/include/net/ipv4.h +++ b/repos/os/include/net/ipv4.h @@ -56,6 +56,8 @@ struct Net::Ipv4_address : Network_address bool is_in_range(Ipv4_address const &first, Ipv4_address const &last) const; + + bool is_multicast() const; } __attribute__((packed)); diff --git a/repos/os/src/lib/net/ipv4.cc b/repos/os/src/lib/net/ipv4.cc index cc33996343..3e256e9c12 100644 --- a/repos/os/src/lib/net/ipv4.cc +++ b/repos/os/src/lib/net/ipv4.cc @@ -41,6 +41,12 @@ void Net::Ipv4_packet::print(Genode::Output &output) const } +bool Ipv4_address::is_multicast() const +{ + return (addr[0] & 0xf0) == 0b11100000; +} + + bool Ipv4_address::is_in_range(Ipv4_address const &first, Ipv4_address const &last) const { diff --git a/repos/os/src/server/nic_router/interface.cc b/repos/os/src/server/nic_router/interface.cc index 77df57ff0d..25b74247af 100644 --- a/repos/os/src/server/nic_router/interface.cc +++ b/repos/os/src/server/nic_router/interface.cc @@ -1391,9 +1391,21 @@ void Interface::_handle_ip(Ethernet_frame ð, return; } - /* give up and drop packet */ - _send_icmp_dst_unreachable(local_intf, eth, ip, - Icmp_packet::Code::DST_NET_UNREACHABLE); + /* + * Give up and drop packet. According to RFC 1812 section 4.3.2.7, an ICMP + * "Destination Unreachable" is sent as response only if the dropped + * packet fullfills certain properties. + * + * FIXME + * + * There are some properties required by the RFC that are not yet checked + * at this point. + */ + if(not ip.dst().is_multicast()) { + + _send_icmp_dst_unreachable(local_intf, eth, ip, + Icmp_packet::Code::DST_NET_UNREACHABLE); + } if (_config().verbose()) { log("[", local_domain, "] unroutable packet"); } }