summaryrefslogtreecommitdiffstats
path: root/rc.inet1
Commit message (Collapse)AuthorAgeFilesLines
* Update early skipping of unconfigured interfaces checkDarren 'Tadgy' Austin2018-11-251-3/+5
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Added IPALIASES setting for v4 and v6; removed old IPALIASES codeDarren 'Tadgy' Austin2018-11-251-11/+22
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Add fixed IP configuration blockDarren 'Tadgy' Austin2018-11-251-10/+25
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Move set of PROMISCIOUS mode to end of interface config blockDarren 'Tadgy' Austin2018-11-251-8/+3
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Set MTU after interface is up (override dhcp server)Darren 'Tadgy' Austin2018-11-251-4/+4
| | | | | | | DHCP may have set the MTU to what the DHCP server advertises, but our override should take precedence. Signed-off-by: Robby Workman <rworkman@slackware.com>
* Consider SLAAC IPs when determining interface up statusDarren 'Tadgy' Austin2018-11-251-1/+1
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Return immediately if interface has no defined config in rc.inet1.confDarren 'Tadgy' Austin2018-11-251-0/+1
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Add stateless RA auto configuration blockDarren 'Tadgy' Austin2018-11-251-0/+10
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Set autoconf to 0 for dhcp/fixed IP, 1 for stateless autoconfigDarren 'Tadgy' Austin2018-11-251-6/+5
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Don't unconditionally bring interface upDarren 'Tadgy' Austin2018-11-251-3/+0
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Account for IPv6 options in interface configuration logicDarren 'Tadgy' Austin2018-11-251-2/+6
| | | | | | | TODO: I (RW) am not convinced that this will behave correctly if the ipv6 address is static while ipv4 is dynamic, or vice versa. Signed-off-by: Robby Workman <rworkman@slackware.com>
* Flush bridge interface address before destroying itDarren 'Tadgy' Austin2018-11-251-2/+2
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Added code to enable/disable v6 autoconf for an interfaceDarren 'Tadgy' Austin2018-11-251-0/+8
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Account for IPv6 addresses in determination of interface statusDarren 'Tadgy' Austin2018-11-251-2/+2
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Removed trailing whitespaces to kill ugly highlights in nanoDarren 'Tadgy' Austin2018-11-251-2/+2
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* Fix up setting of IPALIASES and update docscurrent-20180531Darren Austin2018-05-241-3/+9
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1*: Allow setting an interface in promiscuous modeDarren Austin2018-05-241-7/+17
| | | | | | | This is needed for container networking - the bridge for it must be in promiscuous mode. Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: set the bcast addr and flush ip addr on shutdowncurrent-20180318Robby Workman2018-03-181-2/+4
| | | | | | Thanks to Markus Wiesner. Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Fix typo ( $1 --> $i )current-20171128Jakub Jankowski2017-11-261-1/+1
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Check for iface in /sys/class/net, not /proc/net/devJakub Jankowski2017-11-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a slight problem with things like grep lo: /proc/net/dev especially with tun/tap devices with can have arbitrary names. Consider a scenario where you name your tap iface "trololo": $ grep -c lo: /proc/net/dev 2 $ To fix this (quite hypothetical, but still) problem, instead of simple grepping in /proc/net/dev, check of sysfs path existence (/sys/class/net/<interface>). Same fix in if_up() and if_down() for non-loopback interfaces. While there, also strip colon-whatever from interface name (what I think was the original idea behind a construct like grep $(echo ${1}: | cut -f 1 -d :): /proc/net/dev) by using parameter expansion: ${1%%:*} will remove the longest suffix matching ":*", ie. colon-and-everything-after. This is supported by POSIX: http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html Alternative solution would be to change the grep pattern to grep '^ *lo:' /proc/net/dev Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Remove unnecessary unset numJakub Jankowski2017-11-211-2/+0
| | | | | | The only places using "num" already clear it with "num=0" Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Factor DEBUG_ETH_UP logging to a separate functionJakub Jankowski2017-11-211-15/+12
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Use ${array[*]} not ${array[@]} to produce a stringJakub Jankowski2017-11-211-1/+1
| | | | | | | | | | | | | | | This is the correct usage to produce one string from all elements of an array. foo[0]=b foo[1]=a foo[2]=r "${foo[@]}" here would mean "b" "a" "r" "${foo[*]}" however: "b a r", and that's what we mean when logging it. Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Avoid de-/configuring ifaces with indexes >=MAXNICSJakub Jankowski2017-11-211-0/+12
| | | | | | | | | | | | | | | | | | | | | The code around MAXNICS currently only uses it to populate first $MAXNICS elements of IFNAME array, which is later used to match interface name to index used to access all other arrays. If you configure IPADDR[6], this code doesn't find a matching entry in IFNAME but doesn't do anything about it. This works by accident, because iteration variable "i" stays at "6" after exiting the loop. But when you configure IPADDR[7], it will still stay on "6", and will use ...[6] values to configure that interface, which is potentially damaging. Better safe than sorry: let's check for this overflow and do nothing, instead of potentially doing the wrong thing. Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Avoid code duplication by combining case/esacJakub Jankowski2017-11-211-30/+9
| | | | | | | | | | | | | | There's no reason to have separate cases for start) ... ;; up) ... ;; if they both have the same bodies. Let's combine such cases to avoid code duplication. Also, this is that one time where quoting isn't really needed :) Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Add missing 'dev' keywordJakub Jankowski2017-11-211-4/+4
| | | | | | Also, replace "ip addr" with "ip address" for consistency Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Remove unnecessary $(echo)Jakub Jankowski2017-11-211-4/+4
| | | | Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1*: Simplify virtif_* code, add note to example configJakub Jankowski2017-11-211-15/+8
| | | | | | | | | | | | | There is a built-in way of counting the number of elements in an array: ${#arrayname[@]}. Use this, and the fact that "for i in $(seq 0 -1)" will not evaluate body of the loop even once, to simplify code and get rid of virtif_determine(). While at it, add a note to rc.inet1.conf mentioning the necessity of keeping array indexes monotonically increasing (from 0), otherwise the code will fail (so would the original code). Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Test for loopback being "state UNKNOWN" too.Jakub Jankowski2017-11-211-1/+1
| | | | | | | | On my system "ip link set dev lo up" does not put it into UP state, but rather UNKNOWN. So test for either when trying to decide whether we need to set it up. Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Use simple test (-n/-z) for non-empty/emptyJakub Jankowski2017-11-211-13/+13
| | | | | | | | sh has built-in test for non-empty (-n) and empty (-z) variables, so let's use them. Also, quote variables, especially in tests (if [ ]) and array expansion (${foo[@]}). Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1: Replace [ test1 -a test2 ] with [ test1 ] && [ test2 ]Jakub Jankowski2017-11-211-3/+3
| | | | | | | | | Conditional expression like [ test1 -a test2 ] should be avoided as it is not well defined. See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_16 and https://github.com/koalaman/shellcheck/wiki/SC2166 Signed-off-by: Robby Workman <rworkman@slackware.com>
* rc.inet1*: Fix DHCP timeoutcurrent-20171121Robby Workman2017-11-211-5/+5
| | | | | This was accidentally changed from 15 seconds back to the 14.2 default of 10 seconds. Thanks to Eduard Rozenberg.
* rc.inet1: Remove ipmask usage (unnecessary now)Robby Workman2017-11-121-3/+0
|
* rc.inet1.*: Added support for IP address aliasesRobby Workman2017-07-141-0/+18
| | | | | | | | | | | | | This is accomplished with a new parameter in rc.inet1.conf: IPALIASES[$index]="space separated list of addresses" The aliases are added with a /32 mask and a label of ${interface}:{$number} to remain compatible with net-tools. IP address aliases are supported for both statically configured interfaces and dhcp-configured interfaces, although they'll only be configured for dhcp if the dhcpcd call succeeds. * note: I don't what happens if dhcpcd gets IPv4LL address
* rc.inet1: Use bash builtin arithmetic instead of external exprRobby Workman2017-07-131-1/+1
|
* rc.inet1: fix index number usage in virtual interface setup/destroyRobby Workman2017-07-121-1/+1
|
* rc.inet1{,.conf}: Allow create/destroy of virtual tun/tap devicesRobby Workman2017-07-121-0/+27
|
* rc.inet1: Fix bridge teardown codeRobby Workman2017-07-121-3/+3
|
* rc.inet1: Bugfixes...Robby Workman2017-07-111-4/+4
|
* rc.inet1: Replace backticks with $()Robby Workman2017-07-111-9/+9
|
* rc.inet1: Migrate bridge setup/teardown to iproute2 from brctlRobby Workman2017-07-111-4/+13
| | | | This should complete f7533fca7e82 and eliminate the TODO
* rc.inet1: migrate gateway functionsRobby Workman2017-07-111-6/+6
|
* rc.inet1: Migrate code to take down interfacesRobby Workman2017-07-111-3/+3
|
* rc.inet1: Migrate code to bring up interfacesRobby Workman2017-07-111-10/+11
|
* rc.inet1: Partially migrate bridge setup codeRobby Workman2017-07-111-3/+3
| | | | TODO: brctl --> ip link add name ${br_name} type bridge
* rc.inet1: Migrate loopback interface codeRobby Workman2017-07-111-7/+8
|
* rc.inet1: Use return (not continue) to leave the if_up() function.Robby Workman2017-07-111-1/+1
| | | | | | Thanks to Tim Thomas for the bug report. Merged from Wed Sep 21 15:54:06 UTC 2016 changes to -current tree
* Initial commit of rc.inet1* and rc.wireless*Robby Workman2017-01-061-0/+326
If other files are needed, they can be added later