| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
| |
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
| |
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
| |
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
|
|
|
| |
This is needed for container networking - the bridge for it
must be in promiscuous mode.
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
| |
Signed-off-by: Jakub Jankowski <shasta@toxcorp.com>
|
|
|
|
| |
Signed-off-by: Jakub Jankowski <shasta@toxcorp.com>
|
|
|
|
|
|
|
| |
Instead of heavy subshelling, use pkill/pgrep. Also, be a bit more
specific on what we're killing.
Signed-off-by: Jakub Jankowski <shasta@toxcorp.com>
|
|
|
|
|
|
|
|
|
| |
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: Jakub Jankowski <shasta@toxcorp.com>
|
|
|
|
|
|
|
| |
Instead of "ip | sed", just read the sysfs file in which hardware
address is readily presented for us.
Signed-off-by: Jakub Jankowski <shasta@toxcorp.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There's no need to $(cat .../uevent | grep DEVTYPE) and then compare it
to what we're looking for. grep can do all of it for us ("Useless Use of
Cat").
While at it, if we have three ways of checking whether a device is
wireless, let's order them from least expensive (checking dir is only
one stat()) to most expensive (iwconfig | grep). Proof of correctness:
if "iwconfig | grep" is returning true and the other two methods are
not, we will still reach "iwconfig | grep" in the series of if/elif.
Signed-off-by: Jakub Jankowski <shasta@toxcorp.com>
|
|
|
|
| |
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
|
|
| |
Thanks to Markus Wiesner.
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
| |
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
| |
|
|
|
|
| |
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
The only places using "num" already clear it with "num=0"
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
|
|
| |
Add same comment as in 4561bd10747935edf3e4f17ad18768d17ee95a4e
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
| |
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
Also, replace "ip addr" with "ip address" for consistency
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
| |
Signed-off-by: Robby Workman <rworkman@slackware.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
This was accidentally changed from 15 seconds back to the
14.2 default of 10 seconds. Thanks to Eduard Rozenberg.
|
| |
|
| |
|
| |
|
|
|
|
| |
There are a few other fixups for previously existing stuff too.
|
| |
|
| |
|
|\ |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| | |
|
|\| |
|
| | |
|
| | |
|
| | |
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|