]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Don't unconditionally disable VJ compression under Linux
authorPaul Mackerras <paulus@samba.org>
Sun, 6 May 2012 07:32:26 +0000 (17:32 +1000)
committerPaul Mackerras <paulus@samba.org>
Sun, 6 May 2012 07:32:26 +0000 (17:32 +1000)
We were always clearing vjcomp if it was set, so VJ header compression
was never getting enabled.  This adds a pair of braces so it only gets
disabled if there was an error.

Reported by Stanislav Litvinenko.

Signed-off-by: Paul Mackerras <paulus@samba.org>
pppd/sys-linux.c

index b675c9765718c26ef9d547ac9d1f5f4cb9dca0ae..4fe221d86549ba9efeb204db375e093eebfceba0 100644 (file)
@@ -2018,7 +2018,7 @@ ppp_registered(void)
 
 int ppp_available(void)
 {
-    int s, ok, fd, err;
+    int s, ok, fd;
     struct ifreq ifr;
     int    size;
     int    my_version, my_modification, my_patch;
@@ -2041,7 +2041,6 @@ int ppp_available(void)
        close(fd);
        return 1;
     }
-    err = errno;
 
     if (kernel_version >= KVERSION(2,3,13)) {
        error("Couldn't open the /dev/ppp device: %m");
@@ -2233,9 +2232,10 @@ int sifvjcomp (int u, int vjcomp, int cidcomp, int maxcid)
        u_int x;
 
        if (vjcomp) {
-               if (ioctl(ppp_dev_fd, PPPIOCSMAXCID, (caddr_t) &maxcid) < 0)
+               if (ioctl(ppp_dev_fd, PPPIOCSMAXCID, (caddr_t) &maxcid) < 0) {
                        error("Couldn't set up TCP header compression: %m");
-               vjcomp = 0;
+                       vjcomp = 0;
+               }
        }
 
        x = (vjcomp? SC_COMP_TCP: 0) | (cidcomp? 0: SC_NO_TCP_CCID);