* added the Unlicense as valid in misc/share/REGISTER
[t2sde.git] / package / network / iproute2 / rocknet_iproute2.sh
blob9b6f90f6404f6f95e3373197c89e5b82efc96441
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../iproute2/rocknet_iproute2.sh
5 # Copyright (C) 2004 - 2006 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; version 2 of the License. A copy of the
12 # GNU General Public License can be found in the file COPYING.
13 # --- T2-COPYRIGHT-NOTE-END ---
15 iproute2_init_if() {
16 if isfirst "iproute2_$if"; then
17 addcode up 5 4 "ip link set $if up"
18 addcode down 5 4 "ip link set $if down"
19 addcode down 5 5 "ip addr flush dev $if"
23 public_ip() {
24 ip="${1%/*}"
25 # common config error sanity check
26 [ $ip = $1 ] &&
27 echo "WARNING: IP has no CIDR network prefix (e.g. /24)!"
28 addcode up 5 5 "ip addr add $1 broadcast + dev $if"
29 iproute2_init_if
32 public_gw() {
33 code="ip route append default via $1 dev $if" ; shift
35 case "$1" in
36 metric)
37 code="$code metric $2" ; shift ;;
38 esac
39 shift
41 addcode up 6 5 "$code"
42 iproute2_init_if
45 public_route() {
46 code="ip route append $1 via $2 dev $if" ; shift ; shift
48 case "$1" in
49 metric)
50 code="$code metric $2" ; shift ;;
51 esac
52 shift
54 addcode up 6 5 "$code"
55 iproute2_init_if
58 public_mac() {
59 addcode up 4 3 "ip link set $if address $1"
60 iproute2_init_if