I could be wrong, but it appears that the configuration time detection of how 
to access pseudo terminals is broken, at least for CentOS 6. I noticed this 
when testing vtun-3.0.3-1.el6.x86_64.rpm (from the vtun download page) ... 
things where failing because vtun was trying to access "/dev/ptyXY" devices, 
rather than using getpt()/grantpt()/unlockpt()/ptsname(). CentOS 6 does not 
have "/dev/ptyXY" devices, but I could get CentOS 6 happily using 
getpt()/grantpt()/unlockpt()/ptsname() to return "/dev/pts/XY" names.

[You can see this behaviour if you try to use the "sz" session that comes in 
the distribution's vtund.conf, a trace of the server session showing it trying 
to open "/dev/ptyp0" to "/dev/ptyzv"]

I pulled down the latest sources, vtun-3.0.3.tar.gz, and tried a ./configure, 
make, ... as far as I can see configure sees that 
getpt()/grantpt()/unlockpt()/ptsname() are available ...

>  # /configure
>  ...
>  checking for getpt... yes
>  checking for grantpt... yes
>  checking for unlockpt... yes
>  checking for ptsname... yes
>  ...
>  configure: creating ./config.status
>  config.status: creating Makefile
>  config.status: creating config.h

but config.h does not have HAVE_GETPT / HAVE_GRANTPT / HAVE_PTSNAME / 
HAVE_UNLOCKPT defined in it, nor do any other .h files ...

>  # egrep -r 'HAVE_GETPT|HAVE_GRANTPT|HAVE_UNLOCKPT|HAVE_PTSNAME' *.h

nothing is found.

However pty_dev.c / pty_open() needs all the 4 HAVE_* values defined before it 
will use getpt()/grantpt()/unlockpt()/ptsname() ...

>  ...
>  int pty_open(char *sl_name)
>  {
>      int  mr_fd;
>  #if defined (HAVE_GETPT) && defined (HAVE_GRANTPT) && defined 
>(HAVE_UNLOCKPT) && defined (HAVE_PTSNAME)
>      char *ptyname;
>
>      if((mr_fd=getpt()) < 0)
>          return -1;
>  ...

The make/compile of pty_dev.c shows ...

>  gcc -g -O2  -I/usr/include/lzo -I/usr/include/openssl -I/usr/include/openssl 
>-I/usr/include/openssl \
>              -I/usr/include/openssl 
>-DVTUN_CONFIG_FILE=\"/usr/local/etc/vtund.conf\" \
>              -DVTUN_PID_FILE=\"/usr/local/var/run/vtund.pid\" 
>-DVTUN_STAT_DIR=\"/usr/local/var/log/vtund\" \
>              -DVTUN_LOCK_DIR=\"/usr/local/var/lock/vtund\" \
>              -c pty_dev.c

so no -DHAVE_* are passed to the compile either.

config.log does have the defines ...

>  # egrep 'HAVE_GETPT|HAVE_GRANTPT|HAVE_UNLOCKPT|HAVE_PTSNAME' config.log
>  #define HAVE_GETPT 1
>  #define HAVE_GRANTPT 1
>  #define HAVE_PTSNAME 1
>  #define HAVE_UNLOCKPT 1

Am I misunderstanding how this should be working, or is there a bug?

For completeness, here is a test program using 
getpt()/grantpt()/unlockpt()/ptsname() that did work under CentOS 6.2 ...

>  #include <stdio.h>
>  #define _XOPEN_SOURCE
>  #define __USE_XOPEN
>  #include <stdlib.h>
>  
>  main()
>  {
>    int  mr_fd;
>    char *ptyname;
>  
>    if((mr_fd=getpt()) < 0)
>        return -1;
>    if(grantpt(mr_fd) != 0)
>        return -1;
>    if(unlockpt(mr_fd) != 0)
>        return -1;
>    if ((ptyname = (char *) ptsname(mr_fd)) == NULL)
>        return -1;
>    printf( "<%s>\n" , ptyname );
>    exit( 0 );
>  }

Max
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Vtun-Users mailing list
Vtun-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vtun-users

Reply via email to