Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/netifrc:master commit in: net/
Date: Wed, 27 Jan 2021 16:55:43
Message-Id: 1611766521.e5c3bb95ed454a270cf1796bc123fb0c8f34ab5a.polynomial-c@OpenRC
1 commit: e5c3bb95ed454a270cf1796bc123fb0c8f34ab5a
2 Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
3 AuthorDate: Wed Jan 27 16:25:05 2021 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 27 16:55:21 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=e5c3bb95
7
8 net/apipa.sh: Account for the first and last /24 being reserved
9
10 While the 169.254/16 prefix is used to define IPv4 link-local addresses,
11 RFC 3927 states that the first 256 and last 256 addresses are reserved for
12 future use. Therefore, the number of available addresses amounts to neither
13 64516 nor 65534, but actually 65024.
14
15 Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
16 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
17
18 net/apipa.sh | 6 +++---
19 1 file changed, 3 insertions(+), 3 deletions(-)
20
21 diff --git a/net/apipa.sh b/net/apipa.sh
22 index f3ec534..41274fa 100644
23 --- a/net/apipa.sh
24 +++ b/net/apipa.sh
25 @@ -36,11 +36,11 @@ _random_apipa_octets()
26 seed=$(_random_bytes_as_int 2)
27
28 # For APIPA (RFC 3927), the 169.254.0.0/16 address block is
29 - # reserved. This provides 65534 addresses, having accounted for the
30 - # network and broadcast address. Note that we must count from 1.
31 + # reserved. This provides 65024 addresses, having accounted for the
32 + # fact that the first and last /24 are reserved for future use.
33 awk "BEGIN {
34 srand($seed)
35 - for (i=1; i<65535; i++) print rand() \" \" i
36 + for (i=256; i<65280; i++) print rand() \" \" i
37 }" |
38 sort -k 1,1 -n |
39 POSIXLY_CORRECT=1 awk '{