NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/47877: tip(1) does not disable flow control



>Number:         47877
>Category:       bin
>Synopsis:       tip(1) does not disable flow control
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 02 11:20:00 +0000 2013
>Originator:     Michael van Elst
>Release:        NetBSD 6.1_RC2
>Organization:
-- 
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."
>Environment:
        
        
System: NetBSD pepew 6.1_RC2 NetBSD 6.1_RC2 (PEPEW) #2: Sun Apr 21 11:10:25 
CEST 2013 src@pepew:/home/build/obj/usr/src/sys/arch/i386/compile/PEPEW i386
Architecture: i386
Machine: i386
>Description:
The command tip(1) is used to communicate with a serial device
and supports the option -F to select between no handshake,
tandem mode (xon/xoff) and hardware handshake.

Selecting tandem mode however only configures the IXOFF flag,
leaving xon/xoff processing enabled for input.

If you look at more recent tip sources from Illumos, you can see that
it configures IXOFF and IXON flags together. I suggest to do the same.

>How-To-Repeat:

Use cu -F none to talk to a serial console of another NetBSD machine.
Our serial console doesn't support xon/xoff processing, however even
with -F none you see xon/xoff characters sent to it.

>Fix:

Index: usr.bin/tip/cmds.c
===================================================================
RCS file: /cvsroot/src/usr.bin/tip/cmds.c,v
retrieving revision 1.35
diff -u -r1.35 cmds.c
--- usr.bin/tip/cmds.c  24 Feb 2012 16:03:39 -0000      1.35
+++ usr.bin/tip/cmds.c  2 Jun 2013 11:17:00 -0000
@@ -792,11 +792,11 @@
 
        (void)tcgetattr(FD, &rmtty);
        if (strcmp(option, "on") == 0) {
-               rmtty.c_iflag |= IXOFF;
-               term.c_iflag |= IXOFF;
+               rmtty.c_iflag |= (IXOFF|IXON);
+               term.c_iflag |= (IXOFF|IXON);
        } else {
-               rmtty.c_iflag &= ~IXOFF;
-               term.c_iflag &= ~IXOFF;
+               rmtty.c_iflag &= ~(IXOFF|IXON);
+               term.c_iflag &= ~(IXOFF|IXON);
        }
        (void)tcsetattr(FD, TCSADRAIN, &rmtty);
        (void)tcsetattr(0, TCSADRAIN, &term);
Index: usr.bin/tip/tip.c
===================================================================
RCS file: /cvsroot/src/usr.bin/tip/tip.c,v
retrieving revision 1.51
diff -u -r1.51 tip.c
--- usr.bin/tip/tip.c   6 Sep 2011 18:33:01 -0000       1.51
+++ usr.bin/tip/tip.c   2 Jun 2013 11:17:00 -0000
@@ -496,7 +496,7 @@
        cntrl.c_cc[VMIN] = 1;
        cntrl.c_cc[VTIME] = 0;
        if (boolean(value(TAND)))
-               cntrl.c_iflag |= IXOFF;
+               cntrl.c_iflag |= (IXOFF|IXON);
        return tcsetattr(FD, TCSAFLUSH, &cntrl);
 }
 

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index