keepalived/Fix-segfault-when-receive-netlink-message-for-static.patch

34 lines
1.2 KiB
Diff
Raw Normal View History

From f46327dc6e2daab91b8f164fc0e77fcb4cb80c6a Mon Sep 17 00:00:00 2001
From: Arthur Grosser <15238252+agrrto@users.noreply.github.com>
Date: Fri, 27 May 2022 15:22:25 +0200
Subject: [PATCH] Fix segfault when receive netlink message for static default
route added
This extends acassen@069a039 where the problem was fixed for virtual
routes.
Conflict: NA
Reference: https://github.com/acassen/keepalived/commit/f46327dc6e2daab91b8f164fc0e77fcb4cb80c6a
---
keepalived/core/keepalived_netlink.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/keepalived/core/keepalived_netlink.c b/keepalived/core/keepalived_netlink.c
index ea8843f..5c078d2 100644
--- a/keepalived/core/keepalived_netlink.c
+++ b/keepalived/core/keepalived_netlink.c
@@ -321,7 +321,10 @@ route_is_ours(struct rtmsg* rt, struct rtattr *tb[RTA_MAX + 1], vrrp_t** ret_vrr
tos != route->tos)
continue;
- if (compare_addr(family, RTA_DATA(tb[RTA_DST]), route->dst))
+ if (!tb[RTA_DST])
+ memset(&default_addr, 0, sizeof(default_addr));
+
+ if (compare_addr(family, tb[RTA_DST] ? RTA_DATA(tb[RTA_DST]) : &default_addr, route->dst))
continue;
return route;
--
2.23.0