X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-str.c;h=6bd2fc91b6cb5be54d43f7ec622834763bd61ffb;hp=ecee95b576ff8b001a92ea4a9d013aa749991631;hb=828173483886990474f217910ebe02583674f0e8;hpb=4cf5144b5b1d39dbfbdfd679913c244d60f83a76 diff --git a/pppd/sys-str.c b/pppd/sys-str.c index ecee95b..6bd2fc9 100644 --- a/pppd/sys-str.c +++ b/pppd/sys-str.c @@ -22,8 +22,10 @@ * TODO: */ +#include #include #include +#include #include #include #include @@ -50,7 +52,24 @@ static struct modlist { } str_modules[MAXMODULES]; static int str_module_count = 0; -extern int hungup; +extern int hungup; /* has the physical layer been disconnected? */ + +/* + * ppp_available - check if this kernel supports PPP. + */ +int +ppp_available() +{ + int fd, ret; + + fd = open("/dev/tty", O_RDONLY, 0); + if (fd < 0) + return 1; /* can't find out - assume we have ppp */ + ret = ioctl(fd, I_FIND, "pppasync") >= 0; + close(fd); + return ret; +} + /* * establish_ppp - Turn the serial port into a ppp interface.