X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-linux.c;h=5f40b06d36a965c69dc6de66603f1169e7d41917;hp=76fda67b3f9e94f5f59145b0e4d6eaff966a6c28;hb=b38527fb14af5ebe3d2559e2f861575c722a1ce9;hpb=2ddcabd59d372be3f66c42ed9df15ca7a474ac2a diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 76fda67..5f40b06 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -1088,6 +1088,24 @@ netif_set_mtu(int unit, int mtu) error("ioctl(SIOCSIFMTU): %m (line %d)", __LINE__); } +/* + * netif_get_mtu - get the MTU on the PPP network interface. + */ +int +netif_get_mtu(int unit) +{ + struct ifreq ifr; + + memset (&ifr, '\0', sizeof (ifr)); + strlcpy(ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + + if (ifunit >= 0 && ioctl(sock_fd, SIOCGIFMTU, (caddr_t) &ifr) < 0) { + error("ioctl(SIOCGIFMTU): %m (line %d)", __LINE__); + return 0; + } + return ifr.ifr_mtu; +} + /******************************************************************** * * tty_send_config - configure the transmit characteristics of @@ -1175,7 +1193,8 @@ void tty_recv_config (int mru,u_int32_t asyncmap,int pcomp,int accomp) * is acceptable for use. */ -int ccp_test (int unit, u_char *opt_ptr, int opt_len, int for_transmit) +int +ccp_test(int unit, u_char *opt_ptr, int opt_len, int for_transmit) { struct ppp_option_data data;