summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospfd
diff options
context:
space:
mode:
authorremi <remi@openbsd.org>2019-08-12 20:32:39 +0000
committerremi <remi@openbsd.org>2019-08-12 20:32:39 +0000
commit8c9a8c5f30e03b6ee025e0efab35d2f748b78725 (patch)
tree4affcf7e5e690147d2a290cd8d00a6b12048dae6 /usr.sbin/ospfd
parentWarn when a neighbor changes its source IP address. Either it is because (diff)
downloadwireguard-openbsd-8c9a8c5f30e03b6ee025e0efab35d2f748b78725.tar.xz
wireguard-openbsd-8c9a8c5f30e03b6ee025e0efab35d2f748b78725.zip
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/ospfd')
-rw-r--r--usr.sbin/ospfd/packet.c18
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;