summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/physical.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix warning when compiling with gcc46:eadler2012-01-201-2/+1
| | | | | | | error: variable 'len' set but not used Approved by: dim, cperciva (mentor, blanket for pre-mentorship already-approved commits) MFC after: 3 days
* Port ppp(8) to utmpx.ed2010-01-131-14/+14
| | | | | | | | A nice thing about utmpx is that it makes it very easy to log sessions that don't use TTYs. This is because the file is not indexed by TTY slots anymore. Silence from: brian
* When ``ppp -direct'' is invoked by a program that uses pipe(2) tobrian2009-08-241-0/+1
| | | | | | | | | | | | | create stdin and stdout, don't blindly try to use stdin as a bi-directional channel. Instead, detect the pipe and set up a special exec handler that indirects write() calls through stdout. This fixes the problem where ``set device "!ssh -e none host ppp -direct label"'' no longer works with an openssh-5.2 server side as that version of openssh ignores the USE_PIPES config setting and *always* uses pipes (rather than socketpair) for stdin/stdout channels. MFC after: 3 days
* Make ppp use <termios.h>, not <sys/tty.h>.ed2008-06-051-1/+1
| | | | | | | | ppp's physical.c is filled with calls to termios. For some reason, it includes <sys/tty.h>, not <termios.h>. Even though this works with the current version of FreeBSD, we'd better follow the standards. Approved by: philip (mentor)
* Remove ISDN4BSD (I4B) from HEAD as it is not MPSAFE andbz2008-05-261-10/+0
| | | | | | | | | | | | | | | | | | parts relied on the now removed NET_NEEDS_GIANT. Most of I4B has been disconnected from the build since July 2007 in HEAD/RELENG_7. This is what was removed: - configuration in /etc/isdn - examples - man pages - kernel configuration - sys/i4b (drivers, layers, include files) - user space tools - i4b support from ppp - further documentation Discussed with: rwatson, re
* Add a bunch of malloc() return checksbrian2004-10-111-1/+6
| | | | | PR: 71592 Submitted by: Dan Lukes <dan@obluda.cz> with further changes
* Fix the build on 64-bit platforms.marcel2004-09-061-1/+1
|
* Make ppp WARNS=5 cleanbrian2004-09-051-16/+22
|
* Add configuration option "set pppoe [standard|3Com]" which allowsglebius2004-07-291-0/+8
| | | | | | | to configure mode for ng_pppoe(4) node under control. Reviewed by: brian Approved by: julian (mentor)
* Report the number of bytes not written when complaining about failed writesbrian2004-07-201-2/+2
|
* utmp.ut_time and lastlog.ll_time are explicitly int32_t rather thanpeter2002-11-151-1/+1
| | | | | | | | | | | | time_t. Deal with the possibility that time_t != int32_t. This boils down to this sort of thing: - time(&ut.ut_time); + ut.ut_time = time(NULL); and similar for ctime(3) etc. I've kept it minimal for the stuff that may need to be portable (or 3rd party code), but used Matt's time32 stuff for cases where that isn't as much of a concern. Approved by: re (jhb)
* Include the correct file (stdarg.h) and use va_list rather than _BSD_VA_LIST_brian2002-08-271-0/+1
| | | | Suggested by: mike
* Show the port number (tty slot, pppoe session id etc) underbrian2002-06-301-5/+14
| | | | ``show physical''.
* Remove whitespace at the end of lines.brian2002-06-151-1/+1
|
* Coerce pid_t to long rather than int for better portability.brian2002-05-271-3/+3
| | | | Suggested by: Theo de Raadt <deraadt@openbsd.org>
* o Clean up some #includesbrian2002-05-141-4/+9
| | | | | | | | | | | | | | | | | | o Bump version number to 3.0.4 o When talking to a RADIUS server, provide a NAS-Port-Type. When the NAS-Port-Type is Ethernet, provide a NAS-Port value equal to the SESSIONID from the environment in direct mode or the NGM_PPPOE_SESSIONID message in other modes. If no SESSIONID is found, default to the interface index in client mode or zero in server mode. When the NAS-Port-Type is ISDN, set the NAS-Port to the minor number of the physical device (ie, the N in /dev/i4brbchN). This makes it easier for the RADIUS server to identify the client WRT accounting data etc. Prompted by: lsz8425 <lsz8425@mail.cd.hn.cn>
* Merge the NETGRAPH branch into HEAD. tty devices now use netgraph's linebrian2002-03-301-0/+14
| | | | | | | | discipline to do the async escaping, but no other benefits are available yet. Change ``ifdef HAVE_DES'' to ``ifndef NODES'' for consistency. Make the Makefile a little more sane WRT RELEASE_CRUNCH.
* o Add ipv6 support, abstracting most NCP addresses into opaquebrian2001-08-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | structures (well, they're treated as opaque). It's now possible to manage IPv6 interface addresses and routing table entries and to filter IPV6 traffic whether encapsulated or not. IPV6CP support is crude for now, and hasn't been tested against any other implementations. RADIUS and IPv6 are independent of eachother for now. ppp.linkup/ppp.linkdown aren't currently used by IPV6CP o Understand all protocols(5) in filter rules rather than only a select few. o Allow a mask specification for the ``delete'' command. It's now possible to specifically delete one of two conflicting routes. o When creating and deleting proxy arp entries, do it for all IPv4 interface addresses rather than doing it just for the ``current'' peer address. o When iface-alias isn't in effect, don't blow away manually (via ``iface add'') added interface addresses. o When listening on a tcp server (diagnostic) socket, bind so that a tcp46 socket is created -- allowing both IPv4 and IPv6 connections. o When displaying ICMP traffic, don't display the icmp type twice. When display traffic, display at least some information about unrecognised traffic. o Bump version Inspired after filtering work by: Makoto MATSUSHITA <matusita@jp.FreeBSD.org>
* Handle hardware-imposed MTU/MRU limitations. PPPoE will no longerbrian2001-06-181-0/+6
| | | | | | | | | | | | allow MRU/MTU negotiations to exceed 1492. Add an optional ``max'' specifier to ``set m[rt]u'', ie. set mtu max 1480 Bump the ppp version number. Sponsored by: Monzoon Networks AG and FreeBSD Services Limited
* MAXPATHLEN -> PATH_MAXbrian2001-03-081-4/+4
| | | | | | Don't assume MAXHOSTNAMELEN includes the NUL Correct a diagnostic Use "localhost" in our prompt instead of ""
* Use fstat to check if descriptor 0 is a socket.brian2001-01-141-2/+9
| | | | Suggested by: julian
* Add ``enable/disable tcpmssfixup'', defaulting to enabled.brian2000-11-281-0/+2
| | | | | Suggested by: julian Hijacked from: ru (ports/net/tcpmssd)
* If write() gives -1/ENOBUFS, keep the packet and sleep for 1/10thbrian2000-10-091-2/+3
| | | | | of a second before attempting to write it again (unless there's something else to do instead).
* Support PPPoATM, disabled for now as /usr/include/netnatm doesn't existbrian2000-09-141-1/+7
| | | | Submitted by: Jakob Stoklund Olesen <stoklund@taxidriver.dk>
* Make -DNOSUID (or -DPPP_NOSUID) possible to build ppp without SUIDbrian2000-08-181-0/+3
| | | | capabilities.
* Maintain input and output throughput averages and choose the highestbrian2000-08-151-2/+6
| | | | | | | | | | | | | | of the two when calculating the MP throughput average for the ``set autoload'' implementation. This makes more sense as all links I know of are full-duplex. This also means that people may need to adjust their autoload settings as 100% bandwidth is now the theoretical maximum rather than 200% (but of course, halfing the current settings is probably not the correct answer either!). This involves a ppp version bump as we need to pass an extra throughput array through the MP local domain socket.
* Calculate the average link throughput using a counter based on thebrian2000-08-151-10/+16
| | | | | | | | cumulative total of all active links rather than basing it on the total of PROTO_MP traffic. This fixes a problem whereby Cisco routers send PROTO_IP packets only when there's only one link (hmm, what a good idea!).
* Mention it in the log file when we HUP a process thatbrian2000-05-241-0/+2
| | | | controls a link.
* Fix some printf-style argument bugsbrian2000-03-141-2/+2
|
* To avoid namespace polution in NetBSD:brian2000-03-141-6/+6
| | | | ``struct descriptor'' -> ``struct fdescriptor''
* Cosmetic: Make struct mbuf more like kernel mbufs.brian1999-12-201-9/+9
|
* Make -foreground a proper option (allowing ``allow mode foreground'',brian1999-11-281-0/+1
| | | | ``set mode foreground'' etc.
* Change ``set cd'' so that its default value is device specific. Thebrian1999-11-261-4/+8
| | | | | default is still 1 second for ttys, but is now 6 seconds for i4b (ISDN) devices and 5 seconds for ethernet (PPPoE) devices.
* Rewrite the link descriptor transfer code in MP mode.brian1999-11-251-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, ppp attempted to bind() to a local domain tcp socket based on the peer authname & enddisc. If it succeeded, it listen()ed and became MP server. If it failed, it connect()ed and became MP client. The server then select()ed on the descriptor, accept()ed it and wrote its pid to it then read the link data & link file descriptor, and finally sent an ack (``!''). The client would read() the server pid, transfer the link lock to that pid, send the link data & descriptor and read the ack. It would then close the descriptor and clean up. There was a race between the bind() and listen() where someone could attempt to connect() and fail. This change removes the race. Now ppp makes the RCVBUF big enough on a socket descriptor and attempts to bind() to a local domain *udp* socket (same name as before). If it succeeds, it becomes MP server. If it fails, it sets the SNDBUF and connect()s, becoming MP client. The server select()s on the descriptor and recvmsg()s the message, insisting on at least two descriptors (plus the link data). It uses the second descriptor to write() its pid then read()s an ack (``!''). The client creates a socketpair() and sendmsg()s the link data, link descriptor and one of the socketpair descriptors. It then read()s the server pid from the other socketpair descriptor, transfers any locks and write()s an ack. Now, there can be no race, and a connect() failure indicates a stale socket file. This also fixes MP ppp over ethernet, where the struct msghdr was being misconstructed when transferring the control socket descriptor. Also, if we fail to send the link, don't hang around in a ``session owner'' state, just do the setsid() and fork() if it's required to disown a tty. UDP idea suggested by: Chris Bennet from Mindspring at FreeBSDCon
* Support PPPoEbrian1999-11-061-44/+58
| | | | | Help (lots) from: julian, archie Facilities from: ahebert@pubnix.net
* Don't (unnecessarily) parse wtmp, force ID0logout() to DTRT instead.brian1999-10-251-39/+5
|
* Manually create a correct(*) entry in wtmp when logging out a PPPoTCP orbrian1999-10-211-3/+44
| | | | | | | | PPPoUDP connection. (*) This is as correct as ftp and uucp wtmp entries are - that is, multiple concurrent connections will not record enough information in wtmp to tell last(1) who was logged in for how long.
* If we're running ppp -direct over a tcp or udp connection,brian1999-10-211-1/+10
| | | | | | record the IP number in the `from' slot and not the tty slot. We put ``ppp'' in the tty slot - in line with what ftp (and probably others) does.
* Support ``set cd off'' to tell ppp not to even look for carrier on thebrian1999-09-261-7/+11
| | | | device.
* Back out the bogus #ifdef __NetBSD__ #include <signal.h> lines.brian1999-09-211-3/+0
| | | | | | | The original report was due to a mis-installation of the NetBS header files :-/ Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp>
* NetBSD has moved ``extern int errno;'' to signal.h :-/brian1999-09-201-0/+3
| | | | Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp>
* Cosmetic:brian1999-09-081-1/+1
| | | | alias_cmd -> nat_cmd after a repo-copy
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* o Add the -foreground switch. This switch behaves like -background exceptbrian1999-08-191-4/+4
| | | | | | | | | that ppp stays in the foreground. o Add the -quiet switch to quieten ppps startup o Add the -nat flag and discourage the use of the -alias flag. Both do the same thing. o Correct some nat usage strings. o Change the internal ``alias'' command to ``nat''.
* Add ISDN support via isdnd & i4b. This requires versionbrian1999-08-061-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | 0.81.1 of the i4b code - namely support of the I4B_VR_REQ ioctl via the i4brbchX device. Ppp controls the phone number, but idle timers and SYNC/RAW decisions are still made by isdnd (in isdnd.rc). This involves a new datalink state machine phase. The ``wait for carrier'' phase happens after dialing but before logging in. The whole dial state should really be abstracted so that each device type can deal with it in its own way (thinking about PPPoE) - but that'll have to wait. The ``set cd'' symantics remain the same for tty devices, but we now delay until we either get CD or timeout waiting (at which time we drop the link if we require CD). For i4b devices we always insist on carrier. Thanks to hm@ for his help, and especially for pointing out that I *don't* need to re-implement isdnd (that was a huge waste of time !) :-]
* o Obsolete the undocumented ``set weight'' command.brian1999-08-051-8/+17
| | | | | | | | | | | | | | | | | | | | | | | o If we're using RADIUS and the RADIUS mtu is less than our peers mru/mrru, reduce our mtu to this value for NetBSD too. o Make struct throughput's sample period dynamic and tweak the ppp version number to reflect the extra stuff being passed through the local domain socket as a result (MP mode). o Measure the current throughput based on the number of samples actually taken rather than on the full sample period. o Keep the throughput statisics persistent while being passed to another ppp invocation through the local domain socket. o When showing throughput statistics after the timer has stopped, use the stopped time for overall calculations, not the current time. Also show the stopped time and how long the current throughput has been sampled for. o Use time() consistently in throughput.c o Tighten up the ``show bundle'' output. o Introduce the ``set bandwidth'' command. o Rewrite the ``set autoload'' command. It now takes three arguments and works based on a rolling bundle throughput average compared against the theoretical bundle bandwidth over a given period (read: it's now functional).
* Show the correct error if we fail to open a device.brian1999-06-111-7/+17
|
* Correct the way ppp transfers links on the server side in MPbrian1999-06-051-15/+66
| | | | | | | | | mode by padding out the ``struct device'' to the maximum device size. Bump the ppp version number to indicate the transfer format change. This should make MP over tty and udp devices functional again.
* Introduce the ``keep-session'' option. Refer to the manbrian1999-06-021-3/+6
| | | | | | page for details. This allows MP over non-tty devices where the original ppp process must not exit (such as sshd-spawned ppp sessions).
* Increase the length of an individual device name to LINE_LEN.brian1999-06-011-5/+7
| | | | | Adjust the base physical device name correctly after a link transfer (allowing correct multilink callbacks).
OpenPOWER on IntegriCloud