]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/sys-linux.c
moved protos here from ipcp.h; print reason on terminate-request;
[ppp.git] / pppd / sys-linux.c
index d176edf2d01db235718b7874052fc1bc3758486d..f790b8cdbe089698e11112e1ca59b66b3fd04b32 100644 (file)
@@ -66,6 +66,7 @@ static struct termios inittermios;    /* Initial TTY termios */
 static int sockfd;             /* socket for doing interface ioctls */
 
 static int     if_is_up;       /* Interface has been marked up */
+static u_int32_t ipaddrs[2];   /* Local and remote addrs we've set */
 static u_int32_t default_route_gateway;        /* Gateway for default route added */
 static u_int32_t proxy_arp_addr;       /* Addr for proxy arp entry added */
 
@@ -142,13 +143,6 @@ static void set_flags (int flags)
 
 void sys_init(void)
   {
-    openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP);
-    setlogmask(LOG_UPTO(LOG_INFO));
-    if (debug)
-      {
-       setlogmask(LOG_UPTO(LOG_DEBUG));
-      }
-    
     /* Get an internet socket for doing socket ioctls. */
     sockfd = socket(AF_INET, SOCK_DGRAM, 0);
     if (sockfd < 0)
@@ -169,6 +163,8 @@ void sys_cleanup()
 
     if (if_is_up)
        sifdown(0);
+    if (ipaddrs[0])
+       cifaddr(0, ipaddrs[0], ipaddrs[1]);
     /* XXX maybe we need to delete the route through the interface */
     if (has_default_route)
        cifdefaultroute(0, default_route_gateway);
@@ -176,23 +172,6 @@ void sys_cleanup()
        cifproxyarp(0, proxy_arp_addr);
 }
 
-/*
- * note_debug_level - note a change in the debug level.
- */
-
-void note_debug_level (void)
-  {
-    if (debug)
-      {
-       MAINDEBUG ((LOG_INFO, "Debug turned ON, Level %d", debug));
-       setlogmask(LOG_UPTO(LOG_DEBUG));
-      }
-    else
-      {
-       setlogmask(LOG_UPTO(LOG_WARNING));
-      }
-  }
-
 /*
  * set_kdebugflag - Define the debugging level for the kernel
  */
@@ -961,6 +940,9 @@ int sifaddr (int unit, int our_adr, int his_adr, int net_mask)
         syslog (LOG_ERR, "ioctl(SIOCADDRT) device route: %m");
         return (0);
       }
+
+    ipaddrs[0] = our_adr;
+    ipaddrs[1] = his_adr;
     return 1;
   }
 
@@ -972,6 +954,8 @@ int sifaddr (int unit, int our_adr, int his_adr, int net_mask)
 int cifaddr (int unit, int our_adr, int his_adr)
   {
     struct rtentry rt;
+
+    ipaddrs[0] = 0;
 /*
  *  Delete the route through the device
  */