summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in.c
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2019-02-13 23:47:42 +0000
committerdlg <dlg@openbsd.org>2019-02-13 23:47:42 +0000
commit8f960e22352b7ad1b6bb02e6c7de9ee6f54a819f (patch)
tree26ea4e08934508eae0c95ed5a403b7d7fbe5b4f1 /sys/netinet/in.c
parent(unsigned) means (unsigned int) which on ptrdiff_t or size_t or other (diff)
downloadwireguard-openbsd-8f960e22352b7ad1b6bb02e6c7de9ee6f54a819f.tar.xz
wireguard-openbsd-8f960e22352b7ad1b6bb02e6c7de9ee6f54a819f.zip
change rt_ifa_add and rt_ifa_del so they take an rdomain argument.
this allows mpls interfaces (mpe, mpw) to pass the rdomain they wish the local label to be in, rather than have it implicitly forced to 0 by these functions. right now they'll pass 0, but it will soon be possible to have them rx packets in other rdomains. previously the functions used ifp->if_rdomain for the rdomain. everything other than mpls still passes ifp->if_rdomain. ok mpi@
Diffstat (limited to 'sys/netinet/in.c')
-rw-r--r--sys/netinet/in.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 64ed3ee50b9..d3ac28349d0 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.161 2019/02/10 22:32:26 dlg Exp $ */
+/* $OpenBSD: in.c,v 1.162 2019/02/13 23:47:43 dlg Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -694,13 +694,15 @@ in_purgeaddr(struct ifaddr *ifa)
int
in_addhost(struct in_ifaddr *ia, struct sockaddr_in *dst)
{
- return rt_ifa_add(&ia->ia_ifa, RTF_HOST | RTF_MPATH, sintosa(dst));
+ return rt_ifa_add(&ia->ia_ifa, RTF_HOST | RTF_MPATH,
+ sintosa(dst), ia->ia_ifa.ifa_ifp->if_rdomain);
}
int
in_scrubhost(struct in_ifaddr *ia, struct sockaddr_in *dst)
{
- return rt_ifa_del(&ia->ia_ifa, RTF_HOST, sintosa(dst));
+ return rt_ifa_del(&ia->ia_ifa, RTF_HOST,
+ sintosa(dst), ia->ia_ifa.ifa_ifp->if_rdomain);
}
/*
@@ -713,13 +715,14 @@ in_insert_prefix(struct in_ifaddr *ia)
int error;
error = rt_ifa_add(ifa, RTF_CLONING | RTF_CONNECTED | RTF_MPATH,
- ifa->ifa_addr);
+ ifa->ifa_addr, ifa->ifa_ifp->if_rdomain);
if (error)
return (error);
- if (ia->ia_broadaddr.sin_addr.s_addr != 0)
+ if (ia->ia_broadaddr.sin_addr.s_addr != 0) {
error = rt_ifa_add(ifa, RTF_HOST | RTF_BROADCAST | RTF_MPATH,
- ifa->ifa_broadaddr);
+ ifa->ifa_broadaddr, ifa->ifa_ifp->if_rdomain);
+ }
return (error);
}
@@ -729,10 +732,13 @@ in_remove_prefix(struct in_ifaddr *ia)
{
struct ifaddr *ifa = &ia->ia_ifa;
- rt_ifa_del(ifa, RTF_CLONING | RTF_CONNECTED, ifa->ifa_addr);
+ rt_ifa_del(ifa, RTF_CLONING | RTF_CONNECTED,
+ ifa->ifa_addr, ifa->ifa_ifp->if_rdomain);
- if (ia->ia_broadaddr.sin_addr.s_addr != 0)
- rt_ifa_del(ifa, RTF_HOST | RTF_BROADCAST, ifa->ifa_broadaddr);
+ if (ia->ia_broadaddr.sin_addr.s_addr != 0) {
+ rt_ifa_del(ifa, RTF_HOST | RTF_BROADCAST,
+ ifa->ifa_broadaddr, ifa->ifa_ifp->if_rdomain);
+ }
}
/*