X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-solaris.c;h=dc2fe2bc20aab2c6ea72ea63a0194b941afbf7c7;hp=923bce84dc979050a654a47507c92494acda13bf;hb=bcfa20820fc9ff3b25bcf62308e3e737c1897dc6;hpb=f9eac6e29b5137c46063855b3bfc253159c90c29 diff --git a/pppd/sys-solaris.c b/pppd/sys-solaris.c index 923bce8..dc2fe2b 100644 --- a/pppd/sys-solaris.c +++ b/pppd/sys-solaris.c @@ -42,7 +42,7 @@ * OR MODIFICATIONS. */ -#define RCSID "$Id: sys-solaris.c,v 1.1 2000/04/18 23:51:26 masputra Exp $" +#define RCSID "$Id: sys-solaris.c,v 1.7 2002/02/12 20:07:09 dfs Exp $" #include #include @@ -89,8 +89,12 @@ #include "ipcp.h" #include "ccp.h" +#if !defined(PPP_DRV_NAME) +#define PPP_DRV_NAME "ppp" +#endif /* !defined(PPP_DRV_NAME) */ + #if !defined(PPP_DEV_NAME) -#define PPP_DEV_NAME "/dev/ppp" +#define PPP_DEV_NAME "/dev/" PPP_DRV_NAME #endif /* !defined(PPP_DEV_NAME) */ #if !defined(AHDLC_MOD_NAME) @@ -568,7 +572,7 @@ sys_init() * will fail, or maybe, I should move them to a later point ? * */ - sprintf(ifname, "ppp%d", ifunit); + sprintf(ifname, PPP_DRV_NAME "%d", ifunit); #endif /* defined(SOL2) */ /* * Open the ppp device again and link it under the ip multiplexor. @@ -706,7 +710,7 @@ sys_init() #if !defined(SOL2) /* Set the interface name for the link. */ - slprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "ppp%d", ifunit); + slprintf(ifr.ifr_name, sizeof(ifr.ifr_name), PPP_DRV_NAME "%d", ifunit); ifr.ifr_metric = ipmuxid; if (strioctl(ipfd, SIOCSIFNAME, (char *)&ifr, sizeof ifr, 0) < 0) fatal("Can't set interface name %s: %m", ifr.ifr_name); @@ -871,10 +875,10 @@ any_compressions() } /* - * establish_ppp - Turn the serial port into a ppp interface. + * tty_establish_ppp - Turn the serial port into a ppp interface. */ int -establish_ppp(fd) +tty_establish_ppp(fd) int fd; { int i; @@ -929,21 +933,12 @@ establish_ppp(fd) } /* - * restore_loop - reattach the ppp unit to the loopback. - * This doesn't need to do anything because disestablish_ppp does it. - */ -void -restore_loop() -{ -} - -/* - * disestablish_ppp - Restore the serial port to normal operation. + * tty_disestablish_ppp - Restore the serial port to normal operation. * It attempts to reconstruct the stream with the previously popped * modules. This shouldn't call die() because it's called from die(). */ void -disestablish_ppp(fd) +tty_disestablish_ppp(fd) int fd; { int i; @@ -1297,8 +1292,8 @@ output(unit, p, len) int retries; struct pollfd pfd; - if (debug) - dbglog("sent %P", p, len); + dump_packet("sent", p, len); + if (snoop_send_hook) snoop_send_hook(p, len); data.len = len; data.buf = (caddr_t) p; @@ -1456,48 +1451,23 @@ get_loop_output() } /* - * ppp_send_config - configure the transmit characteristics of - * the ppp interface. + * netif_set_mtu - set the MTU on the PPP network interface. */ void -ppp_send_config(unit, mtu, asyncmap, pcomp, accomp) +netif_set_mtu(unit, mtu) int unit, mtu; - u_int32_t asyncmap; - int pcomp, accomp; { - int cf[2]; struct ifreq ifr; #if defined(INET6) && defined(SOL2) struct lifreq lifr; int fd; #endif /* defined(INET6) && defined(SOL2) */ - link_mtu = mtu; - if (strioctl(pppfd, PPPIO_MTU, &mtu, sizeof(mtu), 0) < 0) { - if (hungup && errno == ENXIO) - return; - error("Couldn't set MTU: %m"); - } - if (fdmuxid >= 0) { - if (!sync_serial) { - if (strioctl(pppfd, PPPIO_XACCM, &asyncmap, sizeof(asyncmap), 0) < 0) { - error("Couldn't set transmit ACCM: %m"); - } - } - cf[0] = (pcomp? COMP_PROT: 0) + (accomp? COMP_AC: 0); - cf[1] = COMP_PROT | COMP_AC; - if (any_compressions() && - strioctl(pppfd, PPPIO_CFLAGS, cf, sizeof(cf), sizeof(int)) < 0) { - error("Couldn't set prot/AC compression: %m"); - } - } - - /* set the MTU for IP as well */ memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); ifr.ifr_metric = link_mtu; if (ioctl(ipfd, SIOCSIFMTU, &ifr) < 0) { - error("Couldn't set IP MTU: %m"); + error("Couldn't set IP MTU (%s): %m", ifr.ifr_name); } #if defined(INET6) && defined(SOL2) @@ -1510,18 +1480,50 @@ ppp_send_config(unit, mtu, asyncmap, pcomp, accomp) lifr.lifr_mtu = link_mtu; if (ioctl(fd, SIOCSLIFMTU, &lifr) < 0) { close(fd); - error("Couldn't set IPv6 MTU: %m"); + error("Couldn't set IPv6 MTU (%s): %m", ifr.ifr_name); } close(fd); #endif /* defined(INET6) && defined(SOL2) */ } /* - * ppp_set_xaccm - set the extended transmit ACCM for the interface. + * tty_send_config - configure the transmit characteristics of + * the ppp interface. */ void -ppp_set_xaccm(unit, accm) - int unit; +tty_send_config(mtu, asyncmap, pcomp, accomp) + int mtu; + u_int32_t asyncmap; + int pcomp, accomp; +{ + int cf[2]; + + link_mtu = mtu; + if (strioctl(pppfd, PPPIO_MTU, &mtu, sizeof(mtu), 0) < 0) { + if (hungup && errno == ENXIO) + return; + error("Couldn't set MTU: %m"); + } + if (fdmuxid >= 0) { + if (!sync_serial) { + if (strioctl(pppfd, PPPIO_XACCM, &asyncmap, sizeof(asyncmap), 0) < 0) { + error("Couldn't set transmit ACCM: %m"); + } + } + cf[0] = (pcomp? COMP_PROT: 0) + (accomp? COMP_AC: 0); + cf[1] = COMP_PROT | COMP_AC; + if (any_compressions() && + strioctl(pppfd, PPPIO_CFLAGS, cf, sizeof(cf), sizeof(int)) < 0) { + error("Couldn't set prot/AC compression: %m"); + } + } +} + +/* + * tty_set_xaccm - set the extended transmit ACCM for the interface. + */ +void +tty_set_xaccm(accm) ext_accm accm; { if (sync_serial) @@ -1535,12 +1537,12 @@ ppp_set_xaccm(unit, accm) } /* - * ppp_recv_config - configure the receive-side characteristics of + * tty_recv_config - configure the receive-side characteristics of * the ppp interface. */ void -ppp_recv_config(unit, mru, asyncmap, pcomp, accomp) - int unit, mru; +tty_recv_config(mru, asyncmap, pcomp, accomp) + int mru; u_int32_t asyncmap; int pcomp, accomp; { @@ -1627,6 +1629,8 @@ get_ppp_stats(u, stats) } stats->bytes_in = s.p.ppp_ibytes; stats->bytes_out = s.p.ppp_obytes; + stats->pkts_in = s.p.ppp_ipackets; + stats->pkts_out = s.p.ppp_opackets; return 1; } @@ -1954,12 +1958,6 @@ sifaddr(u, o, h, m) error("Couldn't set remote IP address: %m"); ret = 0; } -#if 0 /* now done in ppp_send_config */ - ifr.ifr_metric = link_mtu; - if (ioctl(ipfd, SIOCSIFMTU, &ifr) < 0) { - error("Couldn't set IP MTU: %m"); - } -#endif remote_addr = h; return ret;