diff options
author | brian <brian@FreeBSD.org> | 1998-05-25 02:22:38 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1998-05-25 02:22:38 +0000 |
commit | 02218556c6995f24069e2dc1ca9533572cd1c70e (patch) | |
tree | 8533006e9326a5a8d8e768c905871e42dd0b4cd0 /usr.sbin/ppp/datalink.c | |
parent | 631316592f05d5ef85d9d819cb08570b9b8cd481 (diff) | |
download | FreeBSD-src-02218556c6995f24069e2dc1ca9533572cd1c70e.zip FreeBSD-src-02218556c6995f24069e2dc1ca9533572cd1c70e.tar.gz |
o Don't try to transfer tty device descriptors as there's no way of
transferring session rights with them. Instead, create two
`/bin/cat' processes. A new child is spawned and disassociated from
the terminal and the parent, which continues with the rest of the ppp
process. Meanwhile, the parent spawns another child, and both the
parent and child exec the `/bin/cat' commands with the appropriate
descriptors. This way, the session is owned by the parent, and the
tty is held open.
o Close LCPs that have done a TLF and are now in ST_STOPPED before
calling Down. This prevents them from trying to come back up again
after the peer has shut them down (it seems a bit strange that the
rfc says that a Down in ST_STOPPED will cause a TLS etc).
o Don't try to set the physical link name pointer when we're receiving
and renaming a datalink. The physical hasn't been created yet, and as
it happens, the garbage physical pointer happens to be the value of another
physical - so we're pointing that other physical name at ourselves.
yeuck.
o Re-arrange the order of things in main (DoLoop()). We now handle
signals only after the select and not before the UpdateSet. It's
possible that either a signal (FSM timeout) or a descriptor_Read()
brings a link down, after which we'd better tidy up any dead direct
and 1off descriptors before calling UpdateSet() again.
o Mention when we detect a PPP packet when we see one before the link
is up (then start LCP as before).
Diffstat (limited to 'usr.sbin/ppp/datalink.c')
-rw-r--r-- | usr.sbin/ppp/datalink.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c index 655fc0a..a41e93b 100644 --- a/usr.sbin/ppp/datalink.c +++ b/usr.sbin/ppp/datalink.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: datalink.c,v 1.3 1998/05/23 13:38:06 brian Exp $ + * $Id: datalink.c,v 1.4 1998/05/23 22:24:33 brian Exp $ */ #include <sys/types.h> @@ -526,7 +526,9 @@ datalink_LayerFinish(void *v, struct fsm *fp) struct datalink *dl = (struct datalink *)v; if (fp->proto == PROTO_LCP) { - fsm_Down(fp); /* Bring us to INITIAL or STARTING */ + if (fp->state == ST_STOPPED) + fsm_Close(fp); /* back to CLOSED */ + fsm_Down(fp); /* Bring us to INITIAL or STARTING */ (*dl->parent->LayerFinish)(dl->parent->object, fp); datalink_ComeDown(dl, 0); } else if (fp->state == ST_CLOSED && fp->open_mode == OPEN_PASSIVE) @@ -761,6 +763,8 @@ datalink_Down(struct datalink *dl, int stay) case DATALINK_AUTH: case DATALINK_LCP: + if (dl->physical->link.lcp.fsm.state == ST_STOPPED) + fsm_Close(&dl->physical->link.lcp.fsm); /* back to CLOSED */ fsm_Down(&dl->physical->link.lcp.fsm); if (stay) fsm_Close(&dl->physical->link.lcp.fsm); @@ -965,7 +969,6 @@ iov2datalink(struct bundle *bundle, struct iovec *iov, int *niov, int maxiov, free(oname); } else { dl->name = strdup(dl->name); - dl->physical->link.name = dl->name; free(iov[*niov].iov_base); } (*niov)++; @@ -1076,7 +1079,8 @@ datalink_NextName(struct datalink *dl) n = sprintf(name, "%.*s-", dl->name[f] == '-' ? f : f + 1, dl->name); sprintf(name + n, "%d", atoi(dl->name + f + 1) + 1); oname = dl->name; - dl->physical->link.name = dl->name = name; + dl->name = name; + /* our physical link name isn't updated (it probably isn't created yet) */ return oname; } |