]> git.ozlabs.org Git - ppp.git/blobdiff - modules/if_ppp.c
update for 2.3.9
[ppp.git] / modules / if_ppp.c
index d7541baba67365d1da29265778b9fb68af78acee..4a0dcb4a3b62552ef0b15ff77425a60f6ae9d3c1 100644 (file)
@@ -24,7 +24,7 @@
  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
  * OR MODIFICATIONS.
  *
- * $Id: if_ppp.c,v 1.4 1997/03/04 03:31:21 paulus Exp $
+ * $Id: if_ppp.c,v 1.15 1999/07/23 07:07:34 paulus Exp $
  */
 
 /*
@@ -37,7 +37,6 @@
 
 #include <sys/types.h>
 #include <sys/param.h>
-#include <sys/stream.h>
 #include <sys/errno.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #ifdef __osf__
 #include <sys/ioctl.h>
 #include <net/if_types.h>
-#include "ppp_mod.h"
 #else
 #include <sys/sockio.h>
-#include <modules/ppp_mod.h>
 #endif
+#include "ppp_mod.h"
+
+#include <sys/stream.h>
 
 #ifdef SNIT_SUPPORT
 #include <sys/time.h>
@@ -72,9 +72,6 @@
 
 #define ifr_mtu                ifr_metric
 
-#define PPP_MINMTU     64
-#define PPP_MAXMTU     65536
-
 static int if_ppp_open __P((queue_t *, int, int, int));
 static int if_ppp_close __P((queue_t *, int));
 static int if_ppp_wput __P((queue_t *, mblk_t *));
@@ -291,18 +288,24 @@ if_ppp_wput(q, mp)
                ifs[unit] = ifp;
                ifp->if_name = "ppp";
                ifp->if_unit = unit;
-               ifp->if_mtu = PPP_MRU;
+               ifp->if_mtu = PPP_MTU;
                ifp->if_flags = IFF_POINTOPOINT | IFF_RUNNING;
+#ifndef __osf__
 #ifdef IFF_MULTICAST
                ifp->if_flags |= IFF_MULTICAST;
 #endif
+#endif /* __osf__ */
                ifp->if_output = if_ppp_output;
 #ifdef __osf__
-               ifp->if_version = "Point-to-Point Protocol, version 2.3";
-               ifp->if_mediamtu = 1500;
+               ifp->if_version = "Point-to-Point Protocol, version 2.3.9";
+               ifp->if_mediamtu = PPP_MTU;
                ifp->if_type = IFT_PPP;
                ifp->if_hdrlen = PPP_HDRLEN;
                ifp->if_addrlen = 0;
+               ifp->if_flags |= IFF_NOARP | IFF_SIMPLEX | IFF_NOTRAILERS;
+#ifdef IFF_VAR_MTU
+               ifp->if_flags |= IFF_VAR_MTU;
+#endif
 #ifdef NETMASTERCPU
                ifp->if_affinity = NETMASTERCPU;
 #endif
@@ -313,7 +316,7 @@ if_ppp_wput(q, mp)
                if (sp->flags & DBGLOG)
                    printf("if_ppp: created unit %d\n", unit);
            } else {
-               ifp->if_mtu = PPP_MRU;
+               ifp->if_mtu = PPP_MTU;
                ifp->if_flags |= IFF_RUNNING;
            }
 
@@ -583,6 +586,7 @@ if_ppp_ioctl(ifp, cmd, data)
     int s, error;
     struct ifreq *ifr = (struct ifreq *) data;
     struct ifaddr *ifa = (struct ifaddr *) data;
+    u_short mtu;
 
     error = 0;
     s = splimp();
@@ -605,6 +609,15 @@ if_ppp_ioctl(ifp, cmd, data)
     case SIOCSIFMTU:
        if ((error = NOTSUSER()) != 0)
            break;
+#ifdef __osf__
+       /* this hack is necessary because ifioctl checks ifr_data
+        * in 4.0 and 5.0, but ifr_data and ifr_metric overlay each 
+        * other in the definition of struct ifreq so pppd can't set both.
+        */
+        bcopy(ifr->ifr_data, &mtu, sizeof (u_short));
+        ifr->ifr_mtu = mtu;
+#endif
+
        if (ifr->ifr_mtu < PPP_MINMTU || ifr->ifr_mtu > PPP_MAXMTU) {
            error = EINVAL;
            break;