From d00cc1a298f30e22b299e8521ad4bbc00253ac3a Mon Sep 17 00:00:00 2001 From: Jaco Kroon Date: Mon, 23 Sep 2024 22:28:44 +0200 Subject: [PATCH] Export remote_number into REMOTENUMBER environment variable. --- pppd/auth.c | 1 + pppd/main.c | 2 ++ pppd/pppd.8 | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/pppd/auth.c b/pppd/auth.c index aabab177..f69492ea 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -492,6 +492,7 @@ ppp_set_remote_number(const char *buf) { if (buf) { strlcpy(remote_number, buf, sizeof(remote_number)); + ppp_script_setenv("REMOTENUMBER", remote_number, 0); } } diff --git a/pppd/main.c b/pppd/main.c index 7f73e0da..051bac82 100644 --- a/pppd/main.c +++ b/pppd/main.c @@ -852,6 +852,8 @@ set_ifunit(int iskey) create_pidfile(getpid()); /* write pid to file */ create_linkpidfile(getpid()); } + if (*remote_number) + ppp_script_setenv("REMOTENUMBER", remote_number, 0); run_net_script(path_net_init, 1); } diff --git a/pppd/pppd.8 b/pppd/pppd.8 index c028c22c..3279e4b9 100644 --- a/pppd/pppd.8 +++ b/pppd/pppd.8 @@ -1780,6 +1780,12 @@ set when IPV6CP has come up. The authenticated name of the peer. This is only set if the peer authenticates itself. .TP +.B REMOTENUMBER +The remote's number as provided to pppd by the remotenumber option. The +meaning of this varies based on the type of connection, xl2tpd for example can +either provide the dialing number AVP or the remote's IP address. pppoe-server +typically provides the MAC address. +.TP .B SPEED The baud rate of the tty device. .TP