| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Missing quotes cause incorrect evaluation of an empty string, causing
the expression to be always true. Thus every route is considered "nodev"
route, causing problems in cases where specific dev is required.
Original "nodev" patch 7c6a8de0 contained bashism that forgave missing
quoutes. But later it was fixed by 97a79cfd, and the missing quotes
became critical.
Signed-off-by: Alexander Zubkov <green@qrator.net>
Closes: https://bugs.gentoo.org/940443
X-Gentoo-Bug: 940443
X-Gentoo-Bug-URL: https://bugs.gentoo.org/940443
Closes: https://github.com/gentoo/netifrc/pull/58
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
| |
Fixes: c7e2531539064d3035e5ae2710e408e8975e354e
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
| |
This is a fixup of bde6dd2ad5b393e351ae8fd8d89f3bec62e52914 where I
didn't notice that I need to additionally add to the Makefile to have
the script installed.
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
|
|
|
|
| |
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
| |
Reported by CyberTailor at https://github.com/gentoo/netifrc/pull/53#discussion_r1740019302.
Fixes: 7c6a8de0c521ea474bccb0dbda4338ff293cdfc6
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than shelling out to the `sysctl` command like the PR does,
let's write directly to `/proc/sys` after checking that it exists.
This likely needs work to do the same thing on BSD.
Closes: https://bugs.gentoo.org/515640
Closes: https://github.com/gentoo/netifrc/pull/55
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
|
|
|
|
|
|
|
|
|
| |
This enables setting ip-token(8) up during pre-up from a config variable
ip6token_${IFVAR} to set up tokens to be used during SLAAC
auto-configuration.
Closes: https://bugs.gentoo.org/935280
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
|
|
|
|
| |
Signed-off-by: Andrey Volkov <volkov@ekb-info.ru>
|
|
|
|
| |
Signed-off-by: Andrey Volkov <volkov@ekb-info.ru>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Wireguard module was configured to run after interface module, that
caused interface-related settings like mtu not to apply, because
wireguard interfaces was not present by that time. It seems logical
that wireguard module should be run before interface module.
Credits to lmk <lmkrawiec@gmail.com> who proposed the solution and
to Louis Sautier (sbraz) <sbraz@gentoo.org> who proposed the patch.
Closes: https://bugs.gentoo.org/678184
Closes: https://github.com/gentoo/netifrc/pull/54
Signed-off-by: Louis Sautier (sbraz) <sbraz@gentoo.org>
Signed-off-by: Alexander Zubkov <green@qrator.net>
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There were several problems preventing usage of routes of types
blackhole, prohibit, throw, unreachable in IFACE_routes variables:
- Those route types do not allow to use dev in the route definition,
but it was added unconditionally
- As there is no dev, such routes are not flushed automatically by dev,
they need to be remembered and deleted while stopping the interface
- Route type must go before the prefix in the command, but first
parameters have special meaning
Signed-off-by: Alexander Zubkov <green@qrator.net>
Closes: https://bugs.gentoo.org/637394
Closes: https://github.com/gentoo/netifrc/pull/53
X-Gentoo-Bug: 637394
X-Gentoo-Bug-URL: https://bugs.gentoo.org/637394
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
|
|
|
|
|
|
|
|
| |
Bug: https://bugs.gentoo.org/694314
Closes: https://bugs.gentoo.org/921538
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
Closes: https://github.com/gentoo/netifrc/pull/51
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The dummy module has a numdummies parameter which will cause it to
automatically create N dummy interfaces at load time. Because creating
a dummy interface causes the kernel to load the module if it is not
already loaded, then if the name of the interface to be created matches
the name of one of the interfaces the kernel creates, an error will be
returned indicating that the interface already exists, despite it not
existing before the command was invoked.
Ensure we load the module before attempting to create any interface,
then only create the interface if it does not already exist, otherwise
simply configure it.
See: https://serverfault.com/q/839430
Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Closes: https://github.com/gentoo/netifrc/pull/43
|
|
|
|
|
|
|
|
|
| |
qmi is useful for cellular modem connection, the management interface is
implemented using libqmi's qmicli utility.
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Closes: https://github.com/gentoo/netifrc/pull/44
|
|
|
|
|
|
|
|
|
|
|
| |
In iwd.sh, the iwd executable used is /usr/libexec/iwd, however in the
dependency block it depends on just "program iwd." Since iwd is not in
PATH, this will fail and cause iwd to not be started when it should be.
Correct this to /usr/libexec/iwd.
Signed-off-by: Violet Purcell <vimproved@inventati.org>
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Closes: https://github.com/gentoo/netifrc/pull/49
|
|
|
|
|
|
|
|
| |
Bug: https://bugs.gentoo.org/881039
Signed-off-by: Kevin Martin <kevinmbecause@gmail.com>
Fixes: bd8ff4aa89e1d56e9886dad32bb2406c8f43c747
Closes: https://github.com/gentoo/netifrc/pull/48
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
| |
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Closes: https://github.com/gentoo/netifrc/pull/47
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
| |
Bug: https://bugs.gentoo.org/889922
Bug: https://bugs.gentoo.org/893290
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
| |
Bug: https://bugs.gentoo.org/907311
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
|
|
|
|
| |
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
|
|
|
|
|
|
| |
Closes: https://bugs.gentoo.org/904422
Signed-off-by: Greg Kubaryk <kurly@vt.edu>
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
| |
Bug: https://bugs.gentoo.org/893290
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 4143e26 re-introduced the ip(8) parser in the course of adding
network namespace support. In doing so, it also introduced two
regressions. Firstly, in the case that no MAC address is successfully
discerned, the function will return 0. Secondly, FF:FF:FF:FF:FF:FF is
no longer handled as a special case.
This patch, once again, does away with the ip(8) parser and, instead,
collects the address from sysfs. The _netns function is used to ensure
that the procedure is carried out within the applicable network
namespace, if necessary. In the event that the address file cannot be
read, or that it contains nothing, the function will now return 1,
which addresses the first issue. The second issue is addressed by
uppercasing the applicable case pattern.
As an aside, this patch also addresses an issue whereby sed(1) was used
to match against a pattern containing \< and \>, which are GNU-specific
extensions.
Fixes: 4143e26dd4a56c08fbb99e18913eaafaf2a04f32
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
| |
The "restructuring" commit went one step too far by combining the test for
whether l2tptunnel_${IFVAR} is defined with the test for whether the tunnel
exists, in a way that adversely affects the outer control flow. Fix it by
nesting the latter test.
Fixes: 0b8b9b13146c1eba04f2bd8d0b2b049c03891010
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
| |
${#*} is undefined behaviour. Just write it as $#.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
| |
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
| |
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
|
|
| |
The previous commit intended to replace an instance of IFVAR with IFACE.
Instead, it replaced with IFNAME, which means nothing to netifrc.
Frustratingly, I had realised my error at the time of submitting the patch,
yet still managed to attach a bad one. Make it right.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
| |
IFVAR is (supposed to be) requoted for injection, so it doesn't make any sense
to expand it within the second argument given to eend.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
| |
Restructure so as to avoid an unnecessary level of indentation. The behaviour
of the function remains the same.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Proposing changes in diff from bug #889922, net-analyzer/macchanger-1.7.0_p5_p4
to net-analyzer/macchanger-1.7.0_p5_p4-r1 changed softlink and binary location due
to #886121.
There was a temporary tidy up in net-analyzer/macchanger-1.7.0_p5_p4-r2, but
proposing macchanger.sh change to allow netifrc to work with macchanger
binary location.
Bug: https://bugs.gentoo.org/886121
Bug: https://bugs.gentoo.org/889922
Closes: https://github.com/gentoo/netifrc/pull/42
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
|
| |
This is how I would initially have submitted it, only I wanted for the initial
set of changes to be legible as a unified diff.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Bug: https://bugs.gentoo.org/890238
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ensure that awk(1) is used portably throughout.
Eliminate the use of ${parameter^^} expansion syntax, which is a bashism.
Delegate netfirc parameter parsing to xargs(1) and awk(1). The potential for
code injection is thus eliminated, to the extent that is currently possible in
netifrc. It also eliminates potential issues pertaining to word splitting and
unintentional pathname expansion.
Add additional sanity checks and increase the rigour of those that exist. For
instance, blank values are no longer permitted and the tunnel_id parameter must
match that of l2tpsession_*, in the case that l2tptunnel_* is defined.
Add additional diagnostic messages while improving the clarity of those that
already existed. This is achieved in some instances by being more precise and,
in others, through the use of English that exhibits greater formality and
consistency. At least one grammatical error was rectified.
Simplify and refine the code in terms of both structure and syntax, and greatly
reduce the number of (local) variables. As a byproduct, all complaints previously
raised by shellcheck have been eliminated, save for the use of local, whose
behaviour is not defined by POSIX. I have not attempted to eliminate the use of
local because, for now, it continues to be used extensively throughout the
netifrc codebase.
Honour the exit status value of ip(8) for the "add" and "del" verbs, rather
than parse STDERR.
Optimise l2tp_post_stop() by refraining from executing ip(8) and awk(8) in the
case that the interface cannot be identifed as a virtual one. Further, do not
attempt to destroy the tunnels associated with an identified session in the
case that the attempt to destroy the session has failed.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Bug: https://bugs.gentoo.org/890238
Signed-off-by: Sam James <sam@gentoo.org>
|
|
|
|
|
| |
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Reference: https://github.com/gentoo/netifrc/pull/38
|
|
|
|
|
|
|
|
| |
Closes: https://bugs.gentoo.org/881039
Signed-off-by: Kevin Martin <kevinmbecause@gmail.com>
(cherry picked from commit 0e1c19959a6d82accdb57fa7a1f5b0036037a001)
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Closes: https://github.com/gentoo/netifrc/pull/41
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Additional options now supported:
--set-channels
--set-dump
--set-fec
--set-phy-tunable
--set-priv-flags
--set-rxfh-indir
--per-queue
--features
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
|
|\
| |
| |
| |
| | |
Closes: https://github.com/gentoo/netifrc/pull/36
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
|
| |
| |
| |
| |
| |
| |
| | |
This adds an ability to set "eee" and "tunable" ethtool parameters of a
network interface.
Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
Currently if a device has virtual functions configured, ip will list the mac
addresses for the virtual functions on a device as well as the device itself.
This makes _get_mac_address return these addresses as well, causing functions
that consume this output to fail in "interesting" ways. This makes sure it only
returns 1 address.
Also don't set the mac variable to the address of the interface from sysfs, then
proceed to overwrite it with a call to "ip".
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
|
|
|
|
|
| |
Closes: https://github.com/gentoo/netifrc/pull/35
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|
|
|
|
| |
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|
|
|
|
| |
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds initial support for network namespaces. An interface can be
assigned to a network namespace with `netns_${IFACE}`. The script will
move the interface to the namespace if it is not already there.
This adds a helper functions to `functions.sh` called `_netns`, this
function facilitates scripts working withing network namespaces. It
allows eching to sysfs etc files, globbing, and arbitrary commands
within a network namespace.
This uses a wrapper for the `ip` command so all calls to it will add
`-n ${netns}` so it's operating in the netns. Basic interface
configuration is tested and working.
Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Re-factor the over-generalised seeding function into a _random_uint16
function. Have it use a simpler, faster method to collect entropy, with
the aid of od(1). Shorten the previously rambling comment.
Simplify the _random_apipa_octets function. Clamp the seed to the range
0-32767 for maximal portability. Convey the seed as a formal parameter,
rather then inject it. Use a simpler method to produce the octets, running
awk(1) only once. Format the random float, so that awk(1) is prevented
from using scientific notation to represent certain numbers.
Change a variable name in the subshell responsible for reading the list of
octet pairs, so as to be less confusing to future readers.
Note that the portability issue mentioned by commit 31a05f1 is addressed.
The code should now be fully POSIX-compliant, save for the continued use
of the local keyword, upon which it does not rely.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|
|
|
|
|
|
|
|
|
|
| |
While the 169.254/16 prefix is used to define IPv4 link-local addresses,
RFC 3927 states that the first 256 and last 256 addresses are reserved for
future use. Therefore, the number of available addresses amounts to neither
64516 nor 65534, but actually 65024.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|
|
|
|
|
|
|
| |
This is a copy-paste remnant from net/wpa_supplicant.sh which never
worked with standalone netifrc.
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sadly, the present implementation has never functioned correctly. The
original author employed incorrect syntax for what was intended to be a
command substitution. As a result, the _random() function is never called.
What actually happens is that arping is needlessly executed exactly 64516
times, with no address ever being considered as a valid candidate.
Furthermore, this module has other bugs and is poorly designed. Here are the
reasons as to why:-
• the 169.254.0.0/16 block offers 65534 addresses, not 64516
• the main loop is horrendously slow at enumerating the address block
• it counts to 64516 but doesn't ensure that each address is unique!
• it prefers bash for generating entropy (fine, but non-standard)
• it falls back to a non-standard utility for generating entropy
Therefore, I decided to re-write most of it. The fundamental difference is
that all 65534 octet pairs are generated up front before being processed by
the main loop. At most, every possible address will now be tested exactly
once.
In fact, this approach turns out to be faster by an order of magnitude. The
following synthetic tests - which calculate the time taken to enumerate the
entire address space - demonstrate the tremendous difference between the
existing code and mine. Of course, to ensure that the comparison was
meaningful, I rectified the command substitution bug in the existing code.
# time bash apipa-old-test.sh
real 2m34.367s
user 1m9.959s
sys 1m37.502s
# time bash apipa-new-test.sh
real 0m1.119s
user 0m0.965s
sys 0m0.182s
Note that the new _random_apipa_octets() function is responsible for
generating all 65534 combinations of octet pairs in a random order. It
mainly relies on awk(1) and sort(1). Where possible, a seed is obtained from
/dev/urandom for the benefit of awk's RNG, but this is not required.
I have isolated and tested the new functions on GNU/Linux, macOS, FreeBSD,
NetBSD, OpenBSD and MirBSD. I have individually tested gawk, mawk, nawk,
busybox awk and the awk implementations provided by the previously mentioned
operating systems in the case that they are distinct. The only
incompatiblity that I was personally able to find was with the awk
implementation of MirBSD, which affects the final invocation of awk in the
_random_apipa_octets function. However, MirBSD was forked from an old
version of OpenBSD and seems sufficiently obscure so as not to be worth
worrying about. If someone should try to integrate netifrc into MirBSD one
day then the matter can be dealt with then.
Finally, I want to thank Steve Arnold for bringing the original bug to my
attention. Congratulations, Steve. You may be the only known user of
net/apipa.sh on the planet.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Reported-by: Steve Arnold <nerdboy@gentoo.org>
Closes: https://bugs.gentoo.org/766890
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Dispense with the hideous ip-link(8) parser. Instead, collect the MAC
address by reading from the relevant sysfs file. While at it, tidy up
the remainder of the function so that the control flow is easier to
ascertain at a glance. Note that the address will be rendered in upper
case, just as it was before.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Closes: https://bugs.gentoo.org/766758
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|
|
|
|
|
|
|
|
|
|
| |
This is a remnant from when netifrc was part of openrc.
After netifrc became it's own standalone project, the call "need dbus"
got caught by the need() function from openrc's sh/openrc-run.sh script
which does a simple echo on every input it receives.
Bug: https://bugs.gentoo.org/622730
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|
|
|
|
|
|
|
| |
Thanks-to: Kerin Millar <kfm@plushkava.net>
Bug: https://bugs.gentoo.org/729920
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
|