local address="$1"
local mask="$2"
local broadcast="$3"
+ local ptp="$4"
- jshn_append PROTO_IPADDR "$address/$mask/$broadcast"
+ jshn_append PROTO_IPADDR "$address/$mask/$broadcast/$ptp"
}
proto_add_ipv6_address() {
_proto_push_ipv4_addr() {
local str="$1"
- local address mask broadcast
+ local address mask broadcast ptp
address="${str%%/*}"
str="${str#*/}"
mask="${str%%/*}"
str="${str#*/}"
- broadcast="$str"
+ broadcast="${str%%/*}"
+ str="${str#*/}"
+ ptp="$str"
json_add_object ""
json_add_string ipaddr "$address"
[ -n "$mask" ] && json_add_string mask "$mask"
[ -n "$broadcast" ] && json_add_string broadcast "$broadcast"
+ [ -n "$ptp" ] && json_add_string ptp "$ptp"
json_close_object
}
ADDR_IPADDR,
ADDR_MASK,
ADDR_BROADCAST,
+ ADDR_PTP,
__ADDR_MAX
};
[ADDR_IPADDR] = { .name = "ipaddr", .type = BLOBMSG_TYPE_STRING },
[ADDR_MASK] = { .name = "mask", .type = BLOBMSG_TYPE_STRING },
[ADDR_BROADCAST] = { .name = "broadcast", .type = BLOBMSG_TYPE_STRING },
+ [ADDR_PTP] = { .name = "ptp", .type = BLOBMSG_TYPE_STRING },
};
unsigned int
if (!inet_pton(v6 ? AF_INET6 : AF_INET, blobmsg_data(cur), &addr->addr))
goto error;
- if (!v6 && (cur = tb[ADDR_BROADCAST])) {
- if (!inet_pton(AF_INET, blobmsg_data(cur), &addr->broadcast))
+ if (!v6) {
+ if ((cur = tb[ADDR_BROADCAST]) &&
+ !inet_pton(AF_INET, blobmsg_data(cur), &addr->broadcast))
+ goto error;
+ if ((cur = tb[ADDR_PTP]) &&
+ !inet_pton(AF_INET, blobmsg_data(cur), &addr->point_to_point))
goto error;
}