diff options
| author | russ <russ@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-10-14 21:41:28 +0000 |
|---|---|---|
| committer | russ <russ@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-10-14 21:41:28 +0000 |
| commit | ee4f31f4963edadf70a7dafc9746d1183acedd8f (patch) | |
| tree | e3b93e0a694be81939f8c4762553c43ffdb9b10b /examples | |
| parent | 06bcc768d224c3fed6f298d58b2b88873de4a4d1 (diff) | |
| download | busybox-w32-ee4f31f4963edadf70a7dafc9746d1183acedd8f.tar.gz busybox-w32-ee4f31f4963edadf70a7dafc9746d1183acedd8f.tar.bz2 busybox-w32-ee4f31f4963edadf70a7dafc9746d1183acedd8f.zip | |
added full udhcp integration
git-svn-id: svn://busybox.net/trunk/busybox@5647 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'examples')
| -rwxr-xr-x | examples/udhcp/sample.bound (renamed from examples/udhcpc/default.bound) | 2 | ||||
| -rwxr-xr-x | examples/udhcp/sample.deconfig (renamed from examples/udhcpc/default.deconfig) | 0 | ||||
| -rwxr-xr-x | examples/udhcp/sample.nak | 4 | ||||
| -rwxr-xr-x | examples/udhcp/sample.renew (renamed from examples/udhcpc/default.renew) | 4 | ||||
| -rw-r--r-- | examples/udhcp/sample.script (renamed from examples/udhcpc/default.script) | 2 | ||||
| -rw-r--r-- | examples/udhcp/simple.script | 39 | ||||
| -rw-r--r-- | examples/udhcp/udhcpd.conf | 116 |
7 files changed, 163 insertions, 4 deletions
diff --git a/examples/udhcpc/default.bound b/examples/udhcp/sample.bound index 98f3aa97e..200352672 100755 --- a/examples/udhcpc/default.bound +++ b/examples/udhcp/sample.bound | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | # Sample udhcpc renew script | 2 | # Sample udhcpc renew script |
| 3 | 3 | ||
| 4 | RESOLV_CONF="/etc/resolv.conf" | 4 | RESOLV_CONF="/etc/udhcpc/resolv.conf" |
| 5 | 5 | ||
| 6 | [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" | 6 | [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" |
| 7 | [ -n "$subnet" ] && NETMASK="netmask $subnet" | 7 | [ -n "$subnet" ] && NETMASK="netmask $subnet" |
diff --git a/examples/udhcpc/default.deconfig b/examples/udhcp/sample.deconfig index b221bcf12..b221bcf12 100755 --- a/examples/udhcpc/default.deconfig +++ b/examples/udhcp/sample.deconfig | |||
diff --git a/examples/udhcp/sample.nak b/examples/udhcp/sample.nak new file mode 100755 index 000000000..f4d08e669 --- /dev/null +++ b/examples/udhcp/sample.nak | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # Sample udhcpc nak script | ||
| 3 | |||
| 4 | echo Received a NAK: $message | ||
diff --git a/examples/udhcpc/default.renew b/examples/udhcp/sample.renew index b64c1fe72..c953e9758 100755 --- a/examples/udhcpc/default.renew +++ b/examples/udhcp/sample.renew | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | # Sample udhcpc bound script | 2 | # Sample udhcpc bound script |
| 3 | 3 | ||
| 4 | RESOLV_CONF="/etc/resolv.conf" | 4 | RESOLV_CONF="/etc/udhcpc/resolv.conf" |
| 5 | 5 | ||
| 6 | [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" | 6 | [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" |
| 7 | [ -n "$subnet" ] && NETMASK="netmask $subnet" | 7 | [ -n "$subnet" ] && NETMASK="netmask $subnet" |
| @@ -27,4 +27,4 @@ for i in $dns | |||
| 27 | do | 27 | do |
| 28 | echo adding dns $i | 28 | echo adding dns $i |
| 29 | echo nameserver $i >> $RESOLV_CONF | 29 | echo nameserver $i >> $RESOLV_CONF |
| 30 | done | 30 | done \ No newline at end of file |
diff --git a/examples/udhcpc/default.script b/examples/udhcp/sample.script index f5920ba96..9b717ac3c 100644 --- a/examples/udhcpc/default.script +++ b/examples/udhcp/sample.script | |||
| @@ -4,4 +4,4 @@ | |||
| 4 | # common initialization first, especially if more dhcp event notifications | 4 | # common initialization first, especially if more dhcp event notifications |
| 5 | # are added. | 5 | # are added. |
| 6 | 6 | ||
| 7 | exec /usr/share/udhcpc/default.$1 | 7 | exec /usr/share/udhcpc/sample.$1 |
diff --git a/examples/udhcp/simple.script b/examples/udhcp/simple.script new file mode 100644 index 000000000..a52a7f812 --- /dev/null +++ b/examples/udhcp/simple.script | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # udhcpc script edited by Tim Riker <Tim@Rikers.org> | ||
| 4 | |||
| 5 | [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 | ||
| 6 | |||
| 7 | RESOLV_CONF="/etc/resolv.conf" | ||
| 8 | [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" | ||
| 9 | [ -n "$subnet" ] && NETMASK="netmask $subnet" | ||
| 10 | |||
| 11 | case "$1" in | ||
| 12 | deconfig) | ||
| 13 | /sbin/ifconfig $interface 0.0.0.0 | ||
| 14 | ;; | ||
| 15 | |||
| 16 | renew|bound) | ||
| 17 | /sbin/ifconfig $interface $ip $BROADCAST $NETMASK | ||
| 18 | |||
| 19 | if [ -n "$router" ] ; then | ||
| 20 | echo "deleting routers" | ||
| 21 | while route del default gw 0.0.0.0 dev $interface ; do | ||
| 22 | : | ||
| 23 | done | ||
| 24 | |||
| 25 | for i in $router ; do | ||
| 26 | route add default gw $i dev $interface | ||
| 27 | done | ||
| 28 | fi | ||
| 29 | |||
| 30 | echo -n > $RESOLV_CONF | ||
| 31 | [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF | ||
| 32 | for i in $dns ; do | ||
| 33 | echo adding dns $i | ||
| 34 | echo nameserver $i >> $RESOLV_CONF | ||
| 35 | done | ||
| 36 | ;; | ||
| 37 | esac | ||
| 38 | |||
| 39 | exit 0 | ||
diff --git a/examples/udhcp/udhcpd.conf b/examples/udhcp/udhcpd.conf new file mode 100644 index 000000000..36cb58c3f --- /dev/null +++ b/examples/udhcp/udhcpd.conf | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | # Sample udhcpd configuration file (/etc/udhcpd.conf) | ||
| 2 | |||
| 3 | # The start and end of the IP lease block | ||
| 4 | |||
| 5 | start 192.168.0.20 #default: 192.168.0.20 | ||
| 6 | end 192.168.0.254 #default: 192.168.0.254 | ||
| 7 | |||
| 8 | |||
| 9 | # The interface that udhcpd will use | ||
| 10 | |||
| 11 | interface eth0 #default: eth0 | ||
| 12 | |||
| 13 | |||
| 14 | # The maximim number of leases (includes addressesd reserved | ||
| 15 | # by OFFER's, DECLINE's, and ARP conficts | ||
| 16 | |||
| 17 | #max_leases 254 #default: 254 | ||
| 18 | |||
| 19 | |||
| 20 | # If remaining is true (default), udhcpd will store the time | ||
| 21 | # remaining for each lease in the udhcpd leases file. This is | ||
| 22 | # for embedded systems that cannot keep time between reboots. | ||
| 23 | # If you set remaining to no, the absolute time that the lease | ||
| 24 | # expires at will be stored in the dhcpd.leases file. | ||
| 25 | |||
| 26 | #remaining yes #default: yes | ||
| 27 | |||
| 28 | |||
| 29 | # The time period at which udhcpd will write out a dhcpd.leases | ||
| 30 | # file. If this is 0, udhcpd will never automatically write a | ||
| 31 | # lease file. (specified in seconds) | ||
| 32 | |||
| 33 | #auto_time 7200 #default: 7200 (2 hours) | ||
| 34 | |||
| 35 | |||
| 36 | # The amount of time that an IP will be reserved (leased) for if a | ||
| 37 | # DHCP decline message is received (seconds). | ||
| 38 | |||
| 39 | #decline_time 3600 #default: 3600 (1 hour) | ||
| 40 | |||
| 41 | |||
| 42 | # The amount of time that an IP will be reserved (leased) for if an | ||
| 43 | # ARP conflct occurs. (seconds | ||
| 44 | |||
| 45 | #conflict_time 3600 #default: 3600 (1 hour) | ||
| 46 | |||
| 47 | |||
| 48 | # How long an offered address is reserved (leased) in seconds | ||
| 49 | |||
| 50 | #offer_time 60 #default: 60 (1 minute) | ||
| 51 | |||
| 52 | # If a lease to be given is below this value, the full lease time is | ||
| 53 | # instead used (seconds). | ||
| 54 | |||
| 55 | #min_lease 60 #defult: 60 | ||
| 56 | |||
| 57 | |||
| 58 | # The location of the leases file | ||
| 59 | |||
| 60 | #lease_file /var/lib/misc/udhcpd.leases #defualt: /var/lib/misc/udhcpd.leases | ||
| 61 | |||
| 62 | # The location of the pid file | ||
| 63 | #pidfile /var/run/udhcpd.pid #default: /var/run/udhcpd.pid | ||
| 64 | |||
| 65 | # Everytime udhcpd writes a leases file, the below script will be called. | ||
| 66 | # Useful for writing the lease file to flash every few hours. | ||
| 67 | |||
| 68 | #notify_file #default: (no script) | ||
| 69 | |||
| 70 | #notify_file dumpleases # <--- usefull for debugging | ||
| 71 | |||
| 72 | # The following are bootp specific options, setable by udhcpd. | ||
| 73 | |||
| 74 | #siaddr 192.168.0.22 #default: 0.0.0.0 | ||
| 75 | |||
| 76 | #sname zorak #default: (none) | ||
| 77 | |||
| 78 | #boot_file /var/nfs_root #default: (none) | ||
| 79 | |||
| 80 | # The remainer of options are DHCP options and can be specifed with the | ||
| 81 | # keyword 'opt' or 'option'. If an option can take multiple items, such | ||
| 82 | # as the dns option, they can be listed on the same line, or multiple | ||
| 83 | # lines. The only option with a default is 'lease'. | ||
| 84 | |||
| 85 | #Examles | ||
| 86 | opt dns 192.168.10.2 192.168.10.10 | ||
| 87 | option subnet 255.255.255.0 | ||
| 88 | opt router 192.168.10.2 | ||
| 89 | opt wins 192.168.10.10 | ||
| 90 | option dns 129.219.13.81 # appened to above DNS servers for a total of 3 | ||
| 91 | option domain local | ||
| 92 | option lease 864000 # 10 days of seconds | ||
| 93 | |||
| 94 | |||
| 95 | # Currently supported options, for more info, see options.c | ||
| 96 | #subnet | ||
| 97 | #timezone | ||
| 98 | #router | ||
| 99 | #timesvr | ||
| 100 | #namesvr | ||
| 101 | #dns | ||
| 102 | #logsvr | ||
| 103 | #cookiesvr | ||
| 104 | #lprsvr | ||
| 105 | #bootsize | ||
| 106 | #domain | ||
| 107 | #swapsvr | ||
| 108 | #rootpath | ||
| 109 | #ipttl | ||
| 110 | #mtu | ||
| 111 | #broadcast | ||
| 112 | #wins | ||
| 113 | #lease | ||
| 114 | #ntpsrv | ||
| 115 | #tftp | ||
| 116 | #bootfile \ No newline at end of file | ||
