blob: 353970e67b0263bfd69e374d6b5456fd0ee4eebd [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001#!/bin/sh
2#
3# usage: see function usage()
4
5path_sh=`nv get path_sh`
6. $path_sh/global.sh
7
8
9usage () {
10 echo "usage: config-udhcpd.sh [option]..."
11 echo "options:"
12 echo " -h : print this help"
13 echo " -c : clean the conf file"
14 echo " -u interface : set upstream interface for server"
15 echo " -d interface1 [interface2].. : set downstream interface for client"
16 echo " -s addr : set gateway of upstream interface"
17 echo " -r : run igmpproxy"
18 exit
19}
20
21config () {
22 case "$1" in
23 "-c")
24 sed -i '36,$d' $fname;;
25 "-u")
26 sed -i "30c phyint $2 upstream ratelimit 0 threshold 1" $fname;;
27 "-d")
28 sed -i '$a phyint '"$2"' downstream ratelimit 0 threshold 1' $fname
29 sed -i '$a' $fname;;
30 "-s")
31 sed -i "31c altnet $2/24" $fname;;
32
33 esac
34
35}
36
37
38fname=$path_conf"/igmpproxy.conf"
39
40case "$1" in
41
42
43 "-h") usage;;
44 "-c") config "$1";;
45 "-u") config "$1" "$2";;
46 "-s") config "$1" "$2";;
47 "-d") config "$1" "$2" "$3" "$4";;
48 "-r") igmpproxy& ;;
49 *) usage;;
50esac
51
52