X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fsys-str.c;h=866a61a1738a6752fe47f9b7588031f7bad77bf4;hb=cfeda08c9caa6410ce3a5ebab961e6f571512206;hp=ecee95b576ff8b001a92ea4a9d013aa749991631;hpb=0b63a24d54ba4708c88e31bdd74b0145956c1478;p=ppp.git diff --git a/pppd/sys-str.c b/pppd/sys-str.c index ecee95b..866a61a 100644 --- a/pppd/sys-str.c +++ b/pppd/sys-str.c @@ -22,8 +22,10 @@ * TODO: */ +#include #include #include +#include #include #include #include @@ -38,7 +40,7 @@ #include "pppd.h" #include "ppp.h" -#include "ppp_str.h" +#include #ifndef ifr_mtu #define ifr_mtu ifr_metric @@ -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.