Commit:     a26af1e08a3a1e0f88e6f2685ac2313d713a59c9
Parent:     cd8d627a6b66d9755637b4dad2083864a9bfce9a
Author:     Nathaniel Filardo <[EMAIL PROTECTED]>
AuthorDate: Tue Feb 5 03:05:07 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Tue Feb 5 03:05:07 2008 -0800

    tun: impossible to deassert IFF_ONE_QUEUE or IFF_NO_PI
    From: "Nathaniel Filardo" <[EMAIL PROTECTED]>
    Taken from
    The TUN/TAP driver only permits one-way transitions of IFF_NO_PI or
    IFF_ONE_QUEUE during the lifetime of a tap/tun interface.  Note that
    tun_set_iff contains
     541         if (ifr->ifr_flags & IFF_NO_PI)
     542                 tun->flags |= TUN_NO_PI;
     544         if (ifr->ifr_flags & IFF_ONE_QUEUE)
     545                 tun->flags |= TUN_ONE_QUEUE;
    This is easily fixed by adding else branches which clear these bits.
    Steps to reproduce:
    This is easily reproduced by setting an interface persistant using tunctl 
    attempting to open it as IFF_TAP or IFF_TUN, without asserting the IFF_NO_PI
    flag.  The ioctl() will succeed and the ifr.flags word is not modified, but 
    interface remains in IFF_NO_PI mode (as it was set by tunctl).
    Acked-by: Maxim Krasnyansky <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
 drivers/net/tun.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 46339f6..038c1ef 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -529,9 +529,13 @@ static int tun_set_iff(struct file *file, struct ifreq 
        if (ifr->ifr_flags & IFF_NO_PI)
                tun->flags |= TUN_NO_PI;
+       else
+               tun->flags &= ~TUN_NO_PI;
        if (ifr->ifr_flags & IFF_ONE_QUEUE)
                tun->flags |= TUN_ONE_QUEUE;
+       else
+               tun->flags &= ~TUN_ONE_QUEUE;
        file->private_data = tun;
        tun->attached = 1;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to