diff options
author | remi <remi@cvs.openbsd.org> | 2019-08-12 20:32:40 +0000 |
---|---|---|
committer | remi <remi@cvs.openbsd.org> | 2019-08-12 20:32:40 +0000 |
commit | 1407cd965926cc7d52396de4ad52e3458e16c6d6 (patch) | |
tree | 09922ddf8154942964c9d85755b8bb008b38d2ed /usr.sbin | |
parent | db227084bb630557aace5069af77167dcf42cc33 (diff) |
On broadcast and point-to-point interfaces only accept hello packets when
the destination is 224.0.0.5 (AllSPFRouters).
RFC 2328 sys in "9.5. Sending Hello packets" that hello packets are
sent to the multicast address AllSPFRouters on broadcast and physical
point-to-point networks.
With this new check the test for AllDRouters is not needed anymore.
ok benno@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ospfd/packet.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/ospfd/packet.c b/usr.sbin/ospfd/packet.c index 4a8c64210f0..7f1e2de50bf 100644 --- a/usr.sbin/ospfd/packet.c +++ b/usr.sbin/ospfd/packet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: packet.c,v 1.32 2019/07/15 18:26:39 remi Exp $ */ +/* $OpenBSD: packet.c,v 1.33 2019/08/12 20:32:39 remi Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -219,12 +219,16 @@ recv_packet(int fd, short event, void *bula) /* switch OSPF packet type */ switch (ospf_hdr->type) { case PACKET_TYPE_HELLO: - inet_aton(AllDRouters, &addr); - if (ip_hdr.ip_dst.s_addr == addr.s_addr) { - log_debug("recv_packet: invalid destination IP " - "address"); - break; - } + inet_aton(AllSPFRouters, &addr); + if (iface->type == IF_TYPE_BROADCAST || + iface->type == IF_TYPE_POINTOPOINT) + if (ip_hdr.ip_dst.s_addr != addr.s_addr) { + log_warnx("%s: hello ignored on interface %s, " + "invalid destination IP address %s", + __func__, iface->name, + inet_ntoa(ip_hdr.ip_dst)); + break; + } recv_hello(iface, ip_hdr.ip_src, ospf_hdr->rtr_id, buf, len); break; |