Просто общие вопросы

Установка, настройка, поддержка
LKharlamov
Сообщения: 142
Зарегистрирован: Пт окт 24, 2008 4:22 pm
Откуда: Челябинск
Контактная информация:

Сообщение LKharlamov »

В скрипте /etc/ppp/ip-up сказано:

Код: Выделить всё

# 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

Откуда берётся $PEERNAME?

ran
Сообщения: 2298
Зарегистрирован: Вс окт 21, 2007 2:29 pm

Сообщение ran »

Откуда берётся $PEERNAME?
ты маны ваще когда-нибудь читаешь? или только цитаты в которые я носом тыкаю?
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

interface-name peer-name user-name tty-device speed

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

interface-name tty-device speed local-IP-address remote-IP-address ipparam

/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

interface-name tty-device speed local-link-local-address remote-link-local-address ipparam

/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

interface-name tty-device speed network-number local-IPX-node-address remote-IPX-node-address
local-IPX-routing-protocol remote-IPX-routing-protocol local-IPX-router-name
remote-IPX-router-name ipparam pppd-pid

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.

LKharlamov
Сообщения: 142
Зарегистрирован: Пт окт 24, 2008 4:22 pm
Откуда: Челябинск
Контактная информация:

Сообщение LKharlamov »

:oops:

echo "$PEERNAME" > /tmp/678 - оказалось пустая переменная, а ветвится пока решил через такое условие:

Код: Выделить всё

if [ "$PPP_LOCAL" = "172.16.0.1" ]; then

ran
Сообщения: 2298
Зарегистрирован: Вс окт 21, 2007 2:29 pm

Сообщение ran »

echo "$PEERNAME" > /tmp/678 - оказалось пустая переменная
This is only set if the peer authenticates itself

LKharlamov
Сообщения: 142
Зарегистрирован: Пт окт 24, 2008 4:22 pm
Откуда: Челябинск
Контактная информация:

Сообщение LKharlamov »

Я так и понял, что провайдер значение ей не задал.

LKharlamov
Сообщения: 142
Зарегистрирован: Пт окт 24, 2008 4:22 pm
Откуда: Челябинск
Контактная информация:

Сообщение LKharlamov »

ran, а можно полюбопытствовать какой у вас дистрибутив?

LKharlamov
Сообщения: 142
Зарегистрирован: Пт окт 24, 2008 4:22 pm
Откуда: Челябинск
Контактная информация:

Сообщение LKharlamov »

касательно ifname я так понимаю речь шла ведь про этот патч?:
http://marc.info/?l=linux-ppp&m=109025160924399&q=p3

ran
Сообщения: 2298
Зарегистрирован: Вс окт 21, 2007 2:29 pm

Сообщение ran »

LKharlamov писал(а):касательно ifname я так понимаю речь шла ведь про этот патч?:
http://marc.info/?l=linux-ppp&m=109025160924399&q=p3
похоже... тока в моём ппп.рпм он уже наложен дистрибутором
ran, а можно полюбопытствовать какой у вас дистрибутив?
оупенсюзя 10.3

LKharlamov
Сообщения: 142
Зарегистрирован: Пт окт 24, 2008 4:22 pm
Откуда: Челябинск
Контактная информация:

Сообщение LKharlamov »

LKharlamov писал(а):попробую, результат отпишу)
Наконец перекомпилировал пакет ppp с патчем ifname, немножко напильником пришлось поработать, так как куча других патчей немного изменили файлы в части описания переменных.
Теперь опция ifname и у мня робит :)

Код: Выделить всё

ifconfig gateway
gateway   Link encap:Point-to-Point Protocol
          inet addr:83.142.160.66  P-t-P:10.100.222.32  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1400  Metric:1
          RX packets:1627 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1685 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:481892 (470.5 KB)  TX bytes:307183 (299.9 KB)

ran
Сообщения: 2298
Зарегистрирован: Вс окт 21, 2007 2:29 pm

Сообщение ran »

немножко напильником пришлось поработать, так как куча других патчей немного изменили файлы в части описания переменных
можно было и не брать в руки напильник а просто применить патч ifname самым первым :D

LKharlamov
Сообщения: 142
Зарегистрирован: Пт окт 24, 2008 4:22 pm
Откуда: Челябинск
Контактная информация:

Сообщение LKharlamov »

Самым первым хорошо бы, но нетрудно догадаться что какой-нить из последующих патчей будет конфликтовать точна также ;)

ran
Сообщения: 2298
Зарегистрирован: Вс окт 21, 2007 2:29 pm

Сообщение ran »

LKharlamov писал(а):Самым первым хорошо бы, но нетрудно догадаться что какой-нить из последующих патчей будет конфликтовать точна также ;)
вот патчи, которые накладываются в моём spec без всяких проблем и конфликтов

Код: Выделить всё

# Makefile changes
Patch0:         ppp-2.4.3-make.diff
# force pppd use the glibc's logwtmp instead of implementing its own
Patch1:         ppp-2.4.2-logwtmp.diff
# replacedefaultroute option
Patch2:         ppp-2.4.2-cifdefroute.diff
# misc tiny stuff
Patch3:         ppp-2.4.2-misc.diff
# more log output for smpppd
Patch4:         ppp-2.4.2-smpppd.diff
# allow higher serial speeds
Patch5:         ppp-2.4.1-higher-speeds.diff
# fixed use of libpcap including dial on demand
Patch6:         ppp-2.4.3-filter.diff
# option to rename ppp interface
Patch8:         ppp-2.4.2-ifname.diff
# Don't use __P from glibc (pppd uses it wrong)
Patch9:         ppp-2.4.2-__P.diff
Patch10:        ppp-2.4.3-pppoatm.diff
Patch11:        ppp-makedevice.patch
Patch12:        ppp-2.4.2-pie.patch
Patch13:        ppp-2.4.3-demand-fix.diff
Patch14:        ppp-2.4.3-fork-fix.diff
Patch15:        ppp-2.4.3-optflags.patch
Patch16:        ppp-2.4.3-no-strict-aliasing.patch
Patch17:        ppp-2.4.3-strip.diff
Patch18:        ppp-2.4.3-winbind-setuidfix.patch
Patch19:        ppp-2.4.4-strncatfix.patch
Patch20:        ppp-2.4.2-pppoatm-mtu.patch
# Receive PPPD-Unit from Radius and rename interface
Patch21:        pppdunit.patch
последний - мой и накладывается опять же без проблем хоть первым хоть последним

LKharlamov
Сообщения: 142
Зарегистрирован: Пт окт 24, 2008 4:22 pm
Откуда: Челябинск
Контактная информация:

Сообщение LKharlamov »

Да там у мня просто в переменных добавляются каким то из убунтовских патчей следующие строчки:

Код: Выделить всё

char   path_ipup[MAXPATHLEN];  /* pathname of ip-up script */
 char   path_ipdown[MAXPATHLEN];/* pathname of ip-down script */
А патч ifname вносит изменение в области переменных тоже, а про эти строчки незнает потомучто их небыло, вот пришлось их просто добавить, на код патча это никак не повлияло.

LKharlamov
Сообщения: 142
Зарегистрирован: Пт окт 24, 2008 4:22 pm
Откуда: Челябинск
Контактная информация:

Сообщение LKharlamov »

ran, вопрос навернае больше к тебе, нежели по тематике форума, но мож кому ещо пригодиться, вот думаю думу, в виндовсе аптайм впн-соединения смотрется очень просто, в окошке его состояния, а вот как бы его поправильному посмотреть под линуксом, можна конечно из текущей даты вычитать дату создания пид-файла необходимого впн-соединения лежащего в /var/run, но думаю что есть более корректные варианты :) Мож в /proc гденить счётчик есть отвечающий за это?
Яндекс помучал, но чото ничего ненашол...

ran
Сообщения: 2298
Зарегистрирован: Вс окт 21, 2007 2:29 pm

Сообщение ran »

в виндовсе аптайм впн-соединения смотрется очень просто, в окошке его состояния, а вот как бы его поправильному посмотреть под линуксом
а мониторинг в абиллсе на что? :shock:

Ответить