1pptp uses very few linux-specific features, and should be easily 2portable to most Unix systems. 3 4Two things to watch: 5 1) 6 The code in pty.[ch] to find a free pty/tty pair. This was 7 conceptually borrowed from the xterm sources, which need to 8 do more or less the same thing. *But* the xterm sources had 9 a heck of a lot more system-specific #defines to cover all 10 the eccentric unix variants out there. If you are porting 11 this code to a non-unix system, I would recommend downloading 12 the xterm sources to find out how pty.[ch] should look for 13 your system. Xterm is in the standard X distribution, or 14 you can download SRRMs from ftp.redhat.com. 15 16 Configure the xterm sources for your machine, and then preprocess 17 main.c with these configuration options. E.g. I did: 18 19 [cananian@cananian xterm-sb_right-ansi-3d]# make main.o 20 rm -f main.o 21 gcc -c -O2 -fno-strength-reduce -m486 -I/usr/X11R6/include 22 -Dlinux -D__i386__ -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE 23 -DX_LOCALE -DFUNCPROTO=15 -DNARROWPROTO -DUTMP -DUSE_TTY_GROUP 24 -DOSMAJORVERSION=2 -DOSMINORVERSION=0 main.c 25 26 So the appropriate preprocessing command would be: 27 28 [cananian@cananian xterm-sb_right-ansi-3d]# gcc -E -O2 29 -fno-strength-reduce -m486 -I/usr/X11R6/include -Dlinux -D__i386__ 30 -D_POSIX_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -DX_LOCALE 31 -DFUNCPROTO=15 -DNARROWPROTO -DUTMP -DUSE_TTY_GROUP 32 -DOSMAJORVERSION=2 -DOSMINORVERSION=0 main.c > main.CPP 33 34 Grok through the sources to figure out how the ptys are allocated on 35 your machine. I suspect many people will want to look carefully at 36 the function pty_search(), but there are architectures that have 37 other, built-in, functions for doing the same thing. 38 39 Add the code to pty.[ch] with the proper #ifdefs, mail a patch back 40 to me at <cananian@alumni.princeton.edu> and you're good to go! 41 42 2) The pptp_gre_copy function opens an IP protocol socket with: 43 44 s = socket(AF_INET, SOCK_RAW, PPTP_PROTO); 45 46 where PPTP_PROTO is #define'd in the code to be 47. I *think* that 47 this should work across Unix variants, but if your system has a 48 different method for opening a non-TCP, raw-IP-protocol-47 socket, 49 then you'll have to make some changes here, and perhaps in 50 decaps_gre and encaps_gre as well. 51 52OK. Those are the only two potential non-portabilities I can think 53of. I should really be using automake/autoconf, of course, as well. 54 --Scott 15Dec1997 55-------------------------------------------------------------------- 56C. Scott Ananian <cananian@alumni.princeton.edu> 57