From cbc5d9b19c0a4e6546e5d9e32240249d41b03098 Mon Sep 17 00:00:00 2001 From: Adi Masputra Date: Wed, 8 Sep 1999 01:11:16 +0000 Subject: [PATCH] Add IF_UNITSEL ioctl to set ppa since driver is DLPI style 2. Solaris 8 is very picky about this. --- modules/ppp.c | 14 +++++++++++++- pppd/sys-svr4.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-) diff --git a/modules/ppp.c b/modules/ppp.c index 10a5aec..b3a32a3 100644 --- a/modules/ppp.c +++ b/modules/ppp.c @@ -24,7 +24,7 @@ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, * OR MODIFICATIONS. * - * $Id: ppp.c,v 1.19 1999/05/13 00:32:42 paulus Exp $ + * $Id: ppp.c,v 1.20 1999/09/08 01:11:15 masputra Exp $ */ /* @@ -1129,6 +1129,18 @@ dlpi_request(q, mp, us) except that we accept ETHERTYPE_IP in place of PPP_IP. */ sap = d->bind_req.dl_sap; us->req_sap = sap; + +#ifdef SOL2 + /* + * ip will send a sap value of 0 (post-Solaris 7), or + * ETHERTYPE_IP (0x800) (pre-Solaris 8) due to how the + * ppp DLPI provider declares its characteristics. + * + */ + if (sap == 0) + sap = ETHERTYPE_IP; +#endif /* SOL2 */ + if (sap == ETHERTYPE_IP) sap = PPP_IP; if (sap < 0x21 || sap > 0x3fff || (sap & 0x101) != 1) { diff --git a/pppd/sys-svr4.c b/pppd/sys-svr4.c index 0264318..5f0ffa5 100644 --- a/pppd/sys-svr4.c +++ b/pppd/sys-svr4.c @@ -25,7 +25,7 @@ * OR MODIFICATIONS. */ -#define RCSID "$Id: sys-svr4.c,v 1.33 1999/08/13 06:46:20 paulus Exp $" +#define RCSID "$Id: sys-svr4.c,v 1.34 1999/09/08 01:11:16 masputra Exp $" #include #include @@ -111,6 +111,37 @@ static int dlpi_info_req __P((int)); static int dlpi_get_reply __P((int, union DL_primitives *, int, int)); static int strioctl __P((int, int, void *, int, int)); +#ifdef SOL2 +/* + * sifppa - Sets interface ppa + * + * without setting the ppa, ip module will return EINVAL upon setting the + * interface UP (SIOCSxIFFLAGS). This is because ip module in 2.8 expects + * two DLPI_INFO_REQ to be sent down to the driver (below ip) before + * IFF_UP can be set. Plumbing the device causes one DLPI_INFO_REQ to + * be sent down, and the second DLPI_INFO_REQ is sent upon receiving + * IF_UNITSEL (old) or SIOCSLIFNAME (new) ioctls. Such setting of the ppa + * is required because the ppp DLPI provider advertises itself as + * a DLPI style 2 type, which requires a point of attachment to be + * specified. The only way the user can specify a point of attachment + * is via SIOCSLIFNAME or IF_UNITSEL. + * + * Such changes in the behavior of ip module was made to meet new or + * evolving standards requirements. + * + */ +static int +sifppa(fd, ppa) + int fd; + int ppa; +{ + if (ioctl(fd, IF_UNITSEL, (char *)&ppa) < 0) { + return 0; + } + + return 1; +} +#endif /* SOL2 */ /* * sys_init - System-dependent initialization. @@ -163,6 +194,18 @@ sys_init() close(ifd); fatal("Can't push IP module: %m"); } + +#ifdef SOL2 + /* + * Assign ppa according to the unit number returned by ppp device + * after plumbing is completed above. + */ + if (sifppa(ifd, ifunit) < 0) { + close (ifd); + fatal("Can't set ppa for unit %d: %m", ifunit); + } +#endif /* SOL2 */ + #else if (dlpi_attach(ifd, ifunit) < 0 || dlpi_get_reply(ifd, &reply.prim, DL_OK_ACK, sizeof(reply)) < 0) { -- 2.39.2