diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-09-13 08:22:11 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2015-09-13 08:22:11 +0000 |
commit | 8e89ceca230766363aec9794b7db086ad8b351a2 (patch) | |
tree | 53ded1285161985be58197f12757a835ccacc595 /usr.sbin | |
parent | 5222dd889e8e11ea2fc97996875d50c4a9de9777 (diff) |
Set the index of the interface in handroller link_addr(3) like code.
This is now necessary on OpenBSD because our routing interface no longer
use ifunit() to find the corresponding interface.
ok yasuoka@, dlg@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/npppd/npppd/npppd_subr.c | 4 | ||||
-rw-r--r-- | usr.sbin/npppd/pppoe/pppoe_session.c | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/npppd/npppd/npppd_subr.c b/usr.sbin/npppd/npppd/npppd_subr.c index c391419e868..db9877decb6 100644 --- a/usr.sbin/npppd/npppd/npppd_subr.c +++ b/usr.sbin/npppd/npppd/npppd_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: npppd_subr.c,v 1.16 2015/01/19 01:48:59 deraadt Exp $ */ +/* $OpenBSD: npppd_subr.c,v 1.17 2015/09/13 08:22:10 mpi Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -29,6 +29,7 @@ * This file provides helper functions for npppd. */ +#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netinet/ip.h> @@ -216,6 +217,7 @@ in_route0(int type, struct in_addr *dest, struct in_addr *mask, strlcpy(sdl->sdl_data, ifname, IFNAMSIZ); sdl->sdl_family = AF_LINK; sdl->sdl_len = offsetof(struct sockaddr_dl, sdl_data) +IFNAMSIZ; + sdl->sdl_index = if_nametoindex(ifname); memcpy(cp, sdl, sdl->sdl_len); cp += ROUNDUP(sdl->sdl_len); } diff --git a/usr.sbin/npppd/pppoe/pppoe_session.c b/usr.sbin/npppd/pppoe/pppoe_session.c index 676b60cc990..213712b4474 100644 --- a/usr.sbin/npppd/pppoe/pppoe_session.c +++ b/usr.sbin/npppd/pppoe/pppoe_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pppoe_session.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $ */ +/* $OpenBSD: pppoe_session.c,v 1.10 2015/09/13 08:22:10 mpi Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -28,7 +28,7 @@ /**@file * Session management of PPPoE protocol - * $Id: pppoe_session.c,v 1.9 2015/01/19 01:48:59 deraadt Exp $ + * $Id: pppoe_session.c,v 1.10 2015/09/13 08:22:10 mpi Exp $ */ #include <sys/types.h> @@ -503,6 +503,7 @@ pppoe_session_bind_ppp(pppoe_session *_this) memset(&sdl, 0, sizeof(sdl)); sdl.sdl_len = sizeof(sdl); sdl.sdl_family = AF_LINK; + sdl.sdl_index = if_nametoindex(pppoe_session_listen_ifname(_this)); len = strlen(pppoe_session_listen_ifname(_this)); memcpy(sdl.sdl_data, pppoe_session_listen_ifname(_this), len); sdl.sdl_nlen = len; |