]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
First large MPPE patch from Frank Cusack.
[ppp.git] / pppd / sys-linux.c
index f391dac082ad1993042c853ec604514e497baf4c..5f40b06d36a965c69dc6de66603f1169e7d41917 100644 (file)
@@ -127,7 +127,7 @@ static int master_fd = -1;
 #ifdef INET6
 static int sock6_fd = -1;
 #endif /* INET6 */
-static int ppp_dev_fd = -1;    /* fd for /dev/ppp (new style driver) */
+int ppp_dev_fd = -1;   /* fd for /dev/ppp (new style driver) */
 static int chindex;            /* channel index (new style driver) */
 
 static fd_set in_fds;          /* set of fds that wait_input waits for */
@@ -946,6 +946,7 @@ void output (int unit, unsigned char *p, int len)
     int proto;
 
     dump_packet("sent", p, len);
+    if (snoop_send_hook) snoop_send_hook(p, len);
 
     if (len < PPP_HDRLEN)
        return;
@@ -1087,6 +1088,24 @@ netif_set_mtu(int unit, int mtu)
        error("ioctl(SIOCSIFMTU): %m (line %d)", __LINE__);
 }
 
+/*
+ * netif_get_mtu - get the MTU on the PPP network interface.
+ */
+int
+netif_get_mtu(int unit)
+{
+    struct ifreq ifr;
+
+    memset (&ifr, '\0', sizeof (ifr));
+    strlcpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
+
+    if (ifunit >= 0 && ioctl(sock_fd, SIOCGIFMTU, (caddr_t) &ifr) < 0) {
+       error("ioctl(SIOCGIFMTU): %m (line %d)", __LINE__);
+       return 0;
+    }
+    return ifr.ifr_mtu;
+}
+
 /********************************************************************
  *
  * tty_send_config - configure the transmit characteristics of
@@ -1174,7 +1193,8 @@ void tty_recv_config (int mru,u_int32_t asyncmap,int pcomp,int accomp)
  * is acceptable for use.
  */
 
-int ccp_test (int unit, u_char *opt_ptr, int opt_len, int for_transmit)
+int
+ccp_test(int unit, u_char *opt_ptr, int opt_len, int for_transmit)
 {
     struct ppp_option_data data;
 
@@ -1512,6 +1532,8 @@ int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway)
     SET_SA_FAMILY (rt.rt_dst,     AF_INET);
     SET_SA_FAMILY (rt.rt_gateway, AF_INET);
 
+    rt.rt_dev = ifname;
+
     if (kernel_version > KVERSION(2,1,0)) {
        SET_SA_FAMILY (rt.rt_genmask, AF_INET);
        SIN_ADDR(rt.rt_genmask) = 0L;