package/network/ipv6/ipv6-support/files/support.sh |
11 | 11 | local __return="$1" |
12 | 12 | local __device="$2" |
13 | 13 | local __option="$3" |
14 | | local __value=$(cat "/proc/sys/net/ipv6/conf/$device/$option") |
| 14 | local __value=$(cat "/proc/sys/net/ipv6/conf/$__device/$__option") |
15 | 15 | eval "$__return=$__value" |
16 | 16 | } |
17 | 17 | |
... | ... | |
110 | 110 | announce_prefix() { |
111 | 111 | local prefix="$1" |
112 | 112 | local network="$2" |
113 | | local cmd="$3" |
114 | | local type="$4" |
| 113 | local device="$3" |
| 114 | local cmd="$4" |
| 115 | local type="$5" |
115 | 116 | |
116 | 117 | local addr=$(echo "$prefix" | cut -d/ -f1) |
117 | 118 | local rem=$(echo "$prefix" | cut -d/ -f2) |
... | ... | |
142 | 143 | |
143 | 144 | [ "$prefix_action" == "npt" ] && msg="$msg"', "npt": 1' |
144 | 145 | [ "$type" == "secondary" ] && msg="$msg"', "secondary": 1' |
| 146 | |
| 147 | # Detect MTU |
| 148 | local mtu |
| 149 | conf_get mtu "$device" mtu |
| 150 | msg="$msg"', "mtu": '"$mtu" |
| 151 | |
145 | 152 | ubus call 6distributed "$cmd" "$msg}" |
146 | 153 | } |
147 | 154 | |
... | ... | |
364 | 371 | enable_ula_prefix() { |
365 | 372 | local network="$1" |
366 | 373 | local ula="$2" |
| 374 | local device="$3" |
367 | 375 | [ -z "$ula" ] && ula="global" |
368 | 376 | |
369 | 377 | # ULA-integration |
... | ... | |
392 | 400 | } |
393 | 401 | |
394 | 402 | # Announce ULA |
395 | | [ -n "$ula_prefix" ] && announce_prefix "$ula_prefix" "$network" newprefix secondary |
| 403 | [ -n "$ula_prefix" ] && announce_prefix "$ula_prefix" "$network" "$device" newprefix secondary |
396 | 404 | } |
397 | 405 | |
398 | 406 | |
... | ... | |
410 | 418 | conf_set "$device" forwarding 1 |
411 | 419 | |
412 | 420 | # Enable ULA |
413 | | enable_ula_prefix "$network" |
| 421 | enable_ula_prefix "$network" global "$device" |
414 | 422 | # Compatibility (deprecated) |
415 | | enable_ula_prefix "$network" "$network" |
| 423 | enable_ula_prefix "$network" "$network" "$device" |
416 | 424 | |
417 | 425 | # Announce all static prefixes |
418 | | config_list_foreach "$network" static_prefix announce_prefix $network |
| 426 | config_list_foreach "$network" static_prefix announce_prefix "$network" "$device" |
419 | 427 | |
420 | 428 | # start relay if there are forced relay members |
421 | 429 | restart_relay "$network" |
... | ... | |
506 | 514 | local prefix="" |
507 | 515 | network_get_ipaddr6 prefix "$network" |
508 | 516 | |
509 | | announce_prefix "$prefix/$prefixlen" "$network" |
| 517 | announce_prefix "$prefix/$prefixlen" "$network" "$device" |
510 | 518 | } |
511 | 519 | |
512 | 520 | |
... | ... | |
529 | 537 | [ "$mode" == "router" ] && enable_router "$network" "$device" |
530 | 538 | [ "$mode" == "6to4" -o "$mode" == "6rd" ] && enable_6to4 "$network" "$device" "$mode" |
531 | 539 | [ "$mode" == "relay" ] && restart_master_relay "$network" forced |
| 540 | |
| 541 | # Create / Delete site border |
| 542 | local site_border |
| 543 | local cmd="delulaborder" |
| 544 | config_get_bool site_border global site_border 0 |
| 545 | [ "$site_border" == "1" ] && cmd="newulaborder" |
| 546 | ubus call 6distributed "$cmd" |
532 | 547 | } |