summaryrefslogtreecommitdiff
path: root/accel-pppd/ifcfg.c
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2018-05-25 12:44:41 +0300
committerDmitry Kozlov <xeb@mail.ru>2018-05-25 12:44:41 +0300
commitfd996b7dc4464bbfccafaa4ba52246258fc4ae89 (patch)
tree10af783d085973cfa9ec8278673de35c75e81625 /accel-pppd/ifcfg.c
parentb3ca0ac6044b89d77db51f07769a564c705237cc (diff)
downloadaccel-ppp-fd996b7dc4464bbfccafaa4ba52246258fc4ae89.tar.gz
accel-ppp-fd996b7dc4464bbfccafaa4ba52246258fc4ae89.zip
ifcfg: assign p-t-p address if mask=32 and regular address in other cases
Diffstat (limited to 'accel-pppd/ifcfg.c')
-rw-r--r--accel-pppd/ifcfg.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/accel-pppd/ifcfg.c b/accel-pppd/ifcfg.c
index 3035e13..03968fb 100644
--- a/accel-pppd/ifcfg.c
+++ b/accel-pppd/ifcfg.c
@@ -104,8 +104,13 @@ void __export ap_session_accounting_started(struct ap_session *ses)
if (!ses->backup || !ses->backup->internal) {
#endif
if (ses->ipv4) {
- if (ipaddr_add_peer(ses->ifindex, ses->ipv4->addr, ses->ipv4->peer_addr, ses->ipv4->mask ?: 32))
- log_ppp_error("failed to set IPv4 address: %s\n", strerror(errno));
+ if (ses->ipv4->mask == 0 || ses->ipv4->mask == 32) {
+ if (ipaddr_add_peer(ses->ifindex, ses->ipv4->addr, ses->ipv4->peer_addr))
+ log_ppp_error("failed to set IPv4 address: %s\n", strerror(errno));
+ } else {
+ if (ipaddr_add(ses->ifindex, ses->ipv4->addr, ses->ipv4->mask))
+ log_ppp_error("failed to set IPv4 address: %s\n", strerror(errno));
+ }
}
if (ses->ipv6) {