diff mbox series

[OpenWrt-Devel] 回复: [PATCH] interface-ip: fix find locally addressable target for p2p

Message ID AM6PR03MB482128572B599B74D0946A7FB50A0@AM6PR03MB4821.eurprd03.prod.outlook.com
State Superseded
Headers show
Series [OpenWrt-Devel] 回复: [PATCH] interface-ip: fix find locally addressable target for p2p | expand

Commit Message

Tan Xiaofan May 16, 2019, 5:27 p.m. UTC
Hi, this is a new patch

From 66c6e2d739daf60c3d4336b6ec8fe24334ee44eb Mon Sep 17 00:00:00 2001
From: xiaofan <xfan1024@live.com>
Date: Fri, 17 May 2019 01:15:11 +0800
Subject: [PATCH] interface-ip: fix find locally addressable target for p2p

In case of tunnel over PPP(such as gretap over l2tp): tunnel interface
use PPP's peer address as remote address, netifd script will call
proto_add_host_dependency function, then netifd will search which device
can reach to the remote address. Before the patch, netifd don't consider
the PPP interface can reach to the remote address, so netifd will select
default route to remote address, it will lead to remote address unreachable.

Signed-off-by: xiaofan <xfan1024@live.com>
---
 interface-ip.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/interface-ip.c b/interface-ip.c
index 6900cd7..8d5587c 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -196,6 +196,9 @@  __find_ip_addr_target(struct interface_ip_settings *ip, union if_addr *a, bool v
 		if (v6 != ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6))
 			continue;
 
+		if (!v6 && addr->point_to_point && a->in.s_addr == addr->point_to_point)
+			return true;
+
 		/* Handle offlink addresses correctly */
 		unsigned int mask = addr->mask;
 		if ((addr->flags & DEVADDR_FAMILY) == DEVADDR_INET6 &&