All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Carlson <carlsonj@workingcode.com>
To: linux-ppp@vger.kernel.org
Subject: Re: ppp question
Date: Mon, 05 Oct 2009 17:38:06 +0000	[thread overview]
Message-ID: <4ACA2EFE.9060309@workingcode.com> (raw)
In-Reply-To: <008201ca45e2$eb8f8f60$0413010a@scu.escambray.com.cu>

Davy Leon wrote:
> I have a question. Every time I dialup to the internet pppd executes an
> script called ip-up. My question is, everytime someone dials in it's
> executed too?

Yes.  It's executed every time an IP interface is brought up by PPP.

Note that PPP itself knows nothing about dialing in or out; those are
attributes of the lower layer -- the chat script and modems or other
communications gear involved.  PPP is symmetric and peer-to-peer.
There's no "client" or "server."

> If the answer is yes, how can I handle the script to
> execute one part when dianing out and another part when dialing in. I
> meant something like

The man page has a number of environment variables documented that you
could use for this task.  $PEERNAME is fairly useful -- it will be set
only if you have an authenticated peer name.

If you have different devices for dialing in and out (it's often a good
idea to do this, but not always done), then $DEVICE might tell you what
you want to know.

If you want to get fancier, you can use $LINKNAME with the "linkname"
option.

The simple answer would be:

	if [[ -n ${PEERNAME:+I_am_server} ]]; then
		# the peer probably called me
	else
		# I'm probably dialing out
	fi

But note that this is making a big assumption about authentication
configuration: that you always authenticate people calling you, and you
never authenticate people you call.  That's how PPP is commonly used,
but there's nothing in the standards that _requires_ it to be used that way.

-- 
James Carlson         42.703N 71.076W         <carlsonj@workingcode.com>

  parent reply	other threads:[~2009-10-05 17:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-05 16:38 ppp question Davy Leon
2009-10-05 17:33 ` Bill Unruh
2009-10-05 17:38 ` James Carlson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-09-27  0:00 PPP Question Heimo Claasen
2002-09-24  7:38 Peter
2002-09-24 15:27 ` Ray Olszewski
2002-09-25  2:31   ` Peter
2002-09-25  2:46     ` Ray Olszewski
2002-09-25  8:00       ` Peter
2002-09-25 15:21         ` Ray Olszewski
2002-09-26  2:12           ` Peter
2002-09-26  2:30             ` Ray Olszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ACA2EFE.9060309@workingcode.com \
    --to=carlsonj@workingcode.com \
    --cc=linux-ppp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.