# This script is called with the following arguments:
# Arg Name Example
# $1 Interface name ppp0
# $2 The tty ttyS1
# $3 The link speed 38400
# $4 Local IP number 12.34.56.78
# $5 Peer IP number 12.34.56.99
# $6 Optional ``ipparam'' value foo
и только эти переменные передаются в скприпты лежащие в /etc/ppp/ip-up.d
ты маны ваще когда-нибудь читаешь? или только цитаты в которые я носом тыкаю?
man pppd писал(а):SCRIPTS
Pppd invokes scripts at various stages in its processing which can be used to perform site-specific
ancillary processing. These scripts are usually shell scripts, but could be executable code files
instead. Pppd does not wait for the scripts to finish (except for the ip-pre-up script). The
scripts are executed as root (with the real and effective user-id set to 0), so that they can do
things such as update routing tables or run privileged daemons. Be careful that the contents of
these scripts do not compromise your system's security. Pppd runs the scripts with standard input,
output and error redirected to /dev/null, and with an environment that is empty except for some
environment variables that give information about the link. The environment variables that pppd
sets are:
DEVICE The name of the serial tty device being used.
IFNAME The name of the network interface being used.
IPLOCAL
The IP address for the local end of the link. This is only set when IPCP has come up.
IPREMOTE
The IP address for the remote end of the link. This is only set when IPCP has come up.
PEERNAME
The authenticated name of the peer. This is only set if the peer authenticates itself.
SPEED The baud rate of the tty device.
ORIG_UID
The real user-id of the user who invoked pppd.
PPPLOGNAME
The username of the real user-id that invoked pppd. This is always set.
For the ip-down and auth-down scripts, pppd also sets the following variables giving statistics for
the connection:
CONNECT_TIME
The number of seconds from when the PPP negotiation started until the connection was termi‐
nated.
BYTES_SENT
The number of bytes sent (at the level of the serial port) during the connection.
BYTES_RCVD
The number of bytes received (at the level of the serial port) during the connection.
LINKNAME
The logical name of the link, set with the linkname option.
DNS1 If the peer supplies DNS server addresses, this variable is set to the first DNS server
address supplied.
DNS2 If the peer supplies DNS server addresses, this variable is set to the second DNS server
address supplied.
Pppd invokes the following scripts, if they exist. It is not an error if they don't exist.
/etc/ppp/auth-up
A program or script which is executed after the remote system successfully authenticates
itself. It is executed with the parameters
Note that this script is not executed if the peer doesn't authenticate itself, for example
when the noauth option is used.
/etc/ppp/auth-down
A program or script which is executed when the link goes down, if /etc/ppp/auth-up was previ‐
ously executed. It is executed in the same manner with the same parameters as
/etc/ppp/auth-up.
/etc/ppp/ip-pre-up
A program or script which is executed just before the ppp network interface is brought up.
It is executed with the same parameters as the ip-up script (below). At this point the
interface exists and has IP addresses assigned but is still down. This can be used to add
firewall rules before any IP traffic can pass through the interface. Pppd will wait for this
script to finish before bringing the interface up, so this script should run quickly.
/etc/ppp/ip-up
A program or script which is executed when the link is available for sending and receiving IP
packets (that is, IPCP has come up). It is executed with the parameters
/etc/ppp/ip-down
A program or script which is executed when the link is no longer available for sending and
receiving IP packets. This script can be used for undoing the effects of the /etc/ppp/ip-up
and /etc/ppp/ip-pre-up scripts. It is invoked in the same manner and with the same parame‐
ters as the ip-up script.
/etc/ppp/ipv6-up
Like /etc/ppp/ip-up, except that it is executed when the link is available for sending and
receiving IPv6 packets. It is executed with the parameters
/etc/ppp/ipv6-down
Similar to /etc/ppp/ip-down, but it is executed when IPv6 packets can no longer be transmit‐
ted on the link. It is executed with the same parameters as the ipv6-up script.
/etc/ppp/ipx-up
A program or script which is executed when the link is available for sending and receiving
IPX packets (that is, IPXCP has come up). It is executed with the parameters
The local-IPX-routing-protocol and remote-IPX-routing-protocol field may be one of the fol‐
lowing:
NONE to indicate that there is no routing protocol
RIP to indicate that RIP/SAP should be used
NLSP to indicate that Novell NLSP should be used
RIP NLSP to indicate that both RIP/SAP and NLSP should be used
/etc/ppp/ipx-down
A program or script which is executed when the link is no longer available for sending and
receiving IPX packets. This script can be used for undoing the effects of the
/etc/ppp/ipx-up script. It is invoked in the same manner and with the same parameters as the
ipx-up script.
Наконец перекомпилировал пакет ppp с патчем ifname, немножко напильником пришлось поработать, так как куча других патчей немного изменили файлы в части описания переменных.
Теперь опция ifname и у мня робит
char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */
char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */
А патч ifname вносит изменение в области переменных тоже, а про эти строчки незнает потомучто их небыло, вот пришлось их просто добавить, на код патча это никак не повлияло.
ran, вопрос навернае больше к тебе, нежели по тематике форума, но мож кому ещо пригодиться, вот думаю думу, в виндовсе аптайм впн-соединения смотрется очень просто, в окошке его состояния, а вот как бы его поправильному посмотреть под линуксом, можна конечно из текущей даты вычитать дату создания пид-файла необходимого впн-соединения лежащего в /var/run, но думаю что есть более корректные варианты Мож в /proc гденить счётчик есть отвечающий за это?
Яндекс помучал, но чото ничего ненашол...