Hello,
I'm trying to add support for PPP "unnumbered" connections which are PPP
connections which don't use a dedicated IP, instead an IP address of
another local interface is "reused" on the PPP interface.
Some Internet providers require this, since their PPPoE server pushes
the network address when routing multiple IPs, and some customers want
to use it to save IP addresses.
Reference: http://www.sustworks.com/site/ipr_guide/unnumbered.html
I have added an UCI option 'unnumbered' 'INTF' which means "reuse the IP
address of INTF" (e.g. unnumbered LAN will put the IP of the LAN
interface on the ppp interface as well), and the following script in
/etc/ppp/ip-up.d/.
It works, but it is not integrated with netifd, e.g. netifd does not
know about the IP address we assigned.
Any ideas how that could be implemented better and integrated with netifd?
Thanks,
bruno
---
#!/bin/sh
#pppoe-WAN eth0 0 192.168.71.5 10.0.0.1 WAN
P_LOCAL=$4
P_REMOTE=$5
P_IFACE=$1
P_NET=$6
hook_unnumbered() {
local cfg="$1"
local proto ifname unnumbered
config_get proto "$cfg" proto
[ "$proto" = "pppoe" ] || return 0
config_get ifname "$cfg" ifname
[ "x$P_IFACE" = "x$ifname" ] || return 0
config_get unnumbered "$cfg" unnumbered
[ -n "$unnumbered" ] || return 0
# Get ipaddr and netmask from unnumbered interface.
# And that interface must be static one.
local proto ipaddr netmask
config_get proto "$unnumbered" proto
config_get ipaddr "$unnumbered" ipaddr
config_get netmask "$unnumbered" netmask
[ -n "$ipaddr" -a -n "$netmask" -a "x$proto" = "xstatic" ] || return 0
eval "$(ipcalc.sh $ipaddr $netmask)"
# Validate netowrk address
if [ "x$P_LOCAL" = "x$NETWORK" ]; then
/sbin/ifconfig ${P_IFACE} "$ipaddr" pointopoint ${P_REMOTE}
/sbin/route add default gw ${P_REMOTE}
fi
}
. /etc/functions.sh
include /lib/network
scan_interfaces
config_load network
hook_unnumbered $P_NET
---
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel