How does pppd know the device when invoked from mgetty? - PPP

This is a discussion on How does pppd know the device when invoked from mgetty? - PPP ; I have an login.config for mgetty that includes: /AutoPPP/ - a_ppp /etc/ppp/ppplogin where ppplogin says: #!/bin/sh stty -echo /usr/sbin/pppd silent auth -chap +pap login I assume that when invoked this way, pppd will read /etc/ppp/options but how does it -- ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: How does pppd know the device when invoked from mgetty?

  1. How does pppd know the device when invoked from mgetty?

    I have an login.config for mgetty that includes:

    /AutoPPP/ - a_ppp /etc/ppp/ppplogin

    where ppplogin says:

    #!/bin/sh
    stty -echo
    /usr/sbin/pppd silent auth -chap +pap login

    I assume that when invoked this way, pppd will read /etc/ppp/options
    but how does it -- or does it? -- know the device it's being invoked
    for? If I said:

    pppd ... ttyS00

    I'd expect it to process /etc/ppp/options.ttyS00. When invoked from
    ppplogin, there seems to be no device so I don't know quite what to
    expect. Is there something about being invoked from mgetty that lets
    it know what device it's on?

    Chris


  2. Re: How does pppd know the device when invoked from mgetty?

    Because the device is passed to mgetty as an arguement from your
    /etc/inittab:

    s2:2345:respawn:/usr/local/sbin/mgetty -x 4 -n 2 /dev/ttyS6

  3. Re: How does pppd know the device when invoked from mgetty?

    tkvoice wrote:
    > Because the device is passed to mgetty as an arguement from your
    > /etc/inittab:
    >
    > s2:2345:respawn:/usr/local/sbin/mgetty -x 4 -n 2 /dev/ttyS6


    I know where it comes from, what I wondered is how it gets to pppd. I
    can't find anything that says, "When mgetty invokes the login program,
    it adds the device as an additional argunment" or "pppd gets the device
    from the FOO environment variable if not specified on the command line."


  4. Re: How does pppd know the device when invoked from mgetty?

    "Christopher Nelson" writes:

    >I have an login.config for mgetty that includes:


    > /AutoPPP/ - a_ppp /etc/ppp/ppplogin


    >where ppplogin says:


    > #!/bin/sh
    > stty -echo
    > /usr/sbin/pppd silent auth -chap +pap login


    >I assume that when invoked this way, pppd will read /etc/ppp/options
    >but how does it -- or does it? -- know the device it's being invoked
    >for? If I said:


    Because mgetty opens the file with the terminal as the stdin and stdout,
    and that is what pppd uses.



    > pppd ... ttyS00


    >I'd expect it to process /etc/ppp/options.ttyS00. When invoked from
    >ppplogin, there seems to be no device so I don't know quite what to
    >expect. Is there something about being invoked from mgetty that lets
    >it know what device it's on?


    iIt reads /etc/ppp/options. I do not think it reads /etc/ppp/options.ttyS0


    > Chris



  5. Re: How does pppd know the device when invoked from mgetty?

    "Christopher Nelson" writes:

    >tkvoice wrote:
    >> Because the device is passed to mgetty as an arguement from your
    >> /etc/inittab:
    >>
    >> s2:2345:respawn:/usr/local/sbin/mgetty -x 4 -n 2 /dev/ttyS6


    >I know where it comes from, what I wondered is how it gets to pppd. I
    >can't find anything that says, "When mgetty invokes the login program,
    >it adds the device as an additional argunment" or "pppd gets the device
    >from the FOO environment variable if not specified on the command line."


    if (!isatty(0) || (p = ttyname(0)) == NULL)

    man ttyname
    DESCRIPTION
    The function ttyname() returns a pointer to the NUL-terminated pathname
    of the terminal device that is open on the file descriptor fd, or NULL
    on error (for example, if fd is not connected to a terminal). The
    return value may point to static data, possibly overwritten by the next


  6. Re: How does pppd know the device when invoked from mgetty?

    Unruh writes:
    > >I'd expect it to process /etc/ppp/options.ttyS00. When invoked from
    > >ppplogin, there seems to be no device so I don't know quite what to
    > >expect. Is there something about being invoked from mgetty that lets
    > >it know what device it's on?

    >
    > iIt reads /etc/ppp/options. I do not think it reads /etc/ppp/options.ttyS0


    If the /etc/ppp/options. file is present, then it's _also_
    read, and the options contained inside are treated as "privileged,"
    even if the invoking user is not. (This is true for /etc/ppp/options,
    /etc/ppp/options., and /etc/ppp/peers/.)

    --
    James Carlson, KISS Network
    Sun Microsystems / 1 Network Drive 71.232W Vox +1 781 442 2084
    MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677

+ Reply to Thread