<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slacknetsetup, branch current-20171128</title>
<subtitle>Migration to iproute2-based network setup</subtitle>
<link rel='alternate' type='text/html' href='https://git.rlworkman.net/slacknetsetup/'/>
<entry>
<title>rc.inet1: Fix typo ( $1 --&gt; $i )</title>
<updated>2017-11-27T05:09:14+00:00</updated>
<author>
<name>Jakub Jankowski</name>
<email>shasta@toxcorp.com</email>
</author>
<published>2017-11-27T05:09:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rlworkman.net/slacknetsetup/commit/?id=7a0cbb9ec6ce5867e6c8be5a59a3066adc76ee13'/>
<id>7a0cbb9ec6ce5867e6c8be5a59a3066adc76ee13</id>
<content type='text'>
Signed-off-by: Robby Workman &lt;rworkman@slackware.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Robby Workman &lt;rworkman@slackware.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>netconfig: Add back a dropped "."</title>
<updated>2017-11-26T20:38:41+00:00</updated>
<author>
<name>Robby Workman</name>
<email>rworkman@slackware.com</email>
</author>
<published>2017-11-26T20:38:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rlworkman.net/slacknetsetup/commit/?id=ad9786366e1c2ac2e3f9ad2ad6eae851c2f943fb'/>
<id>ad9786366e1c2ac2e3f9ad2ad6eae851c2f943fb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>rc.inet1: Check for iface in /sys/class/net, not /proc/net/dev</title>
<updated>2017-11-21T06:07:59+00:00</updated>
<author>
<name>Jakub Jankowski</name>
<email>shasta@toxcorp.com</email>
</author>
<published>2017-11-21T02:57:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rlworkman.net/slacknetsetup/commit/?id=d0c9d92192a208a4f76ffd7a9e2a580a48698c50'/>
<id>d0c9d92192a208a4f76ffd7a9e2a580a48698c50</id>
<content type='text'>
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/&lt;interface&gt;).

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 &lt;rworkman@slackware.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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/&lt;interface&gt;).

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 &lt;rworkman@slackware.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rc.inet1: Remove unnecessary unset num</title>
<updated>2017-11-21T06:07:59+00:00</updated>
<author>
<name>Jakub Jankowski</name>
<email>shasta@toxcorp.com</email>
</author>
<published>2017-11-21T01:53:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rlworkman.net/slacknetsetup/commit/?id=96cba49d10f8cd7c50bd20b21203fd6277ea3257'/>
<id>96cba49d10f8cd7c50bd20b21203fd6277ea3257</id>
<content type='text'>
The only places using "num" already clear it with "num=0"

Signed-off-by: Robby Workman &lt;rworkman@slackware.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The only places using "num" already clear it with "num=0"

Signed-off-by: Robby Workman &lt;rworkman@slackware.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>netconfig: Add comment to netconfig-generated rc.inet1.conf</title>
<updated>2017-11-21T06:07:59+00:00</updated>
<author>
<name>Jakub Jankowski</name>
<email>shasta@toxcorp.com</email>
</author>
<published>2017-11-21T03:13:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rlworkman.net/slacknetsetup/commit/?id=2fe6ebae0398a1bf67b839e20e5e87b979de547a'/>
<id>2fe6ebae0398a1bf67b839e20e5e87b979de547a</id>
<content type='text'>
Add same comment as in 4561bd10747935edf3e4f17ad18768d17ee95a4e

Signed-off-by: Robby Workman &lt;rworkman@slackware.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add same comment as in 4561bd10747935edf3e4f17ad18768d17ee95a4e

Signed-off-by: Robby Workman &lt;rworkman@slackware.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rc.inet1: Factor DEBUG_ETH_UP logging to a separate function</title>
<updated>2017-11-21T06:07:59+00:00</updated>
<author>
<name>Jakub Jankowski</name>
<email>shasta@toxcorp.com</email>
</author>
<published>2017-11-21T02:38:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rlworkman.net/slacknetsetup/commit/?id=c9a17f15501f539c49372ab99fe5484664f756e0'/>
<id>c9a17f15501f539c49372ab99fe5484664f756e0</id>
<content type='text'>
Signed-off-by: Robby Workman &lt;rworkman@slackware.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Robby Workman &lt;rworkman@slackware.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rc.inet1: Use ${array[*]} not ${array[@]} to produce a string</title>
<updated>2017-11-21T06:07:59+00:00</updated>
<author>
<name>Jakub Jankowski</name>
<email>shasta@toxcorp.com</email>
</author>
<published>2017-11-21T02:32:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rlworkman.net/slacknetsetup/commit/?id=e21625c5bb1b03cad355590021c95009ab4246c5'/>
<id>e21625c5bb1b03cad355590021c95009ab4246c5</id>
<content type='text'>
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 &lt;rworkman@slackware.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;rworkman@slackware.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rc.inet1: Avoid de-/configuring ifaces with indexes &gt;=MAXNICS</title>
<updated>2017-11-21T06:07:59+00:00</updated>
<author>
<name>Jakub Jankowski</name>
<email>shasta@toxcorp.com</email>
</author>
<published>2017-11-21T02:22:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rlworkman.net/slacknetsetup/commit/?id=5d8fad3dc13963fa19ca02913f8c4f12ab3321c1'/>
<id>5d8fad3dc13963fa19ca02913f8c4f12ab3321c1</id>
<content type='text'>
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 &lt;rworkman@slackware.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;rworkman@slackware.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rc.inet1: Avoid code duplication by combining case/esac</title>
<updated>2017-11-21T06:07:59+00:00</updated>
<author>
<name>Jakub Jankowski</name>
<email>shasta@toxcorp.com</email>
</author>
<published>2017-11-21T02:02:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rlworkman.net/slacknetsetup/commit/?id=de60d4bdd7e634320f3c9e1248d51bd5e947808e'/>
<id>de60d4bdd7e634320f3c9e1248d51bd5e947808e</id>
<content type='text'>
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 &lt;rworkman@slackware.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;rworkman@slackware.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>rc.inet1: Add missing 'dev' keyword</title>
<updated>2017-11-21T06:07:59+00:00</updated>
<author>
<name>Jakub Jankowski</name>
<email>shasta@toxcorp.com</email>
</author>
<published>2017-11-21T01:50:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rlworkman.net/slacknetsetup/commit/?id=7cff32cd89f736d32405de05d73145e4e2dd1b70'/>
<id>7cff32cd89f736d32405de05d73145e4e2dd1b70</id>
<content type='text'>
Also, replace "ip addr" with "ip address" for consistency

Signed-off-by: Robby Workman &lt;rworkman@slackware.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also, replace "ip addr" with "ip address" for consistency

Signed-off-by: Robby Workman &lt;rworkman@slackware.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
