gluon-core: add ip addr support

This commit is contained in:
Maciej Krüger 2022-05-16 09:36:41 +02:00 committed by Alexander List
parent 251043ce3e
commit 8ce65a9cf1
2 changed files with 18 additions and 0 deletions

View File

@ -7,6 +7,8 @@ init_proto "$@"
proto_gluon_mesh_init_config() {
proto_config_add_boolean fixed_mtu
proto_config_add_boolean transitive
proto_config_add_string ipaddr
proto_config_add_string ip6addr
}
proto_gluon_mesh_setup() {
@ -28,6 +30,14 @@ proto_gluon_mesh_setup() {
proto_add_data
json_add_boolean fixed_mtu "$FIXED_MTU"
json_add_boolean transitive "$TRANSITIVE"
if [ ! -n "$ipaddr" ]; then
json_add_string ipaddr "$ipaddr"
ip addr add "$ipaddr" dev "$IFNAME"
fi
if [ ! -n "$ip6addr" ]; then
json_add_string ip6addr "$ip6addr"
ip addr add "$ip6addr" dev "$IFNAME"
fi
[ "$IFNAME" != 'br-wan' ] && json_add_string zone 'mesh'
proto_close_data
proto_send_update "$CONFIG"

View File

@ -9,6 +9,8 @@ proto_gluon_wired_init_config() {
proto_config_add_int index
proto_config_add_boolean vxlan
proto_config_add_string vxpeer6addr
proto_config_add_string ipaddr
proto_config_add_string ip6addr
}
xor2() {
@ -79,6 +81,12 @@ proto_gluon_wired_setup() {
json_add_string ifname "@${meshif}"
json_add_string proto 'gluon_mesh'
json_add_boolean fixed_mtu 1
if [ ! -n "$ipaddr" ]; then
json_add_string ipaddr "$ipaddr"
fi
if [ ! -n "$ip6addr" ]; then
json_add_string ip6addr "$ip6addr"
fi
[ -n "$transitive" ] && json_add_boolean transitive "$transitive"
json_close_object
ubus call network add_dynamic "$(json_dump)"