diff options
author | 2014-12-11 08:55:10 +0000 | |
---|---|---|
committer | 2014-12-11 08:55:10 +0000 | |
commit | 8047e79582673f189abb529ba7e1588ba0545a5c (patch) | |
tree | 223d6a4775d0ac70c872f9d97e354a43b7507ab0 | |
parent | Do not use "struct route" when it is not necessary. (diff) | |
download | wireguard-openbsd-8047e79582673f189abb529ba7e1588ba0545a5c.tar.xz wireguard-openbsd-8047e79582673f189abb529ba7e1588ba0545a5c.zip |
Do not change the interface of a route if it is not intended.
When a route change message is submitted, looks for a new ifa to attach
the route only if a gateway, an ifp or an ifa has been specified.
Fix a regression reported by Florian Riehm, ok bluhm@.
-rw-r--r-- | sys/net/rtsock.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 29d7c7700f1..52f2ac36eb5 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.153 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: rtsock.c,v 1.154 2014/12/11 08:55:10 mpi Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -741,13 +741,6 @@ report: break; case RTM_CHANGE: - /* - * new gateway could require new ifaddr, ifp; - * flags may also be different; ifp may be specified - * by ll sockaddr when protocol address is ambiguous - */ - if ((error = rt_getifa(&info, tableid)) != 0) - goto flush; newgate = 0; if (info.rti_info[RTAX_GATEWAY] != NULL) if (rt->rt_gateway == NULL || @@ -762,7 +755,17 @@ report: error = EDQUOT; goto flush; } - ifa = info.rti_ifa; + /* + * new gateway could require new ifaddr, ifp; + * flags may also be different; ifp may be specified + * by ll sockaddr when protocol address is ambiguous + */ + if (newgate || info.rti_info[RTAX_IFP] != NULL || + info.rti_info[RTAX_IFA] != NULL) { + if ((error = rt_getifa(&info, tableid)) != 0) + goto flush; + ifa = info.rti_ifa; + } if (ifa) { if (rt->rt_ifa != ifa) { if (rt->rt_ifa->ifa_rtrequest) |