fff-network: Fix incorrect IPv6 syntax in functions #69
No reviewers
Labels
No Label
RFC
RFT
WIP
blocked
bsp
bug
build/scripts/tools
duplicate
feature
fixed
layer3
mantis
more details required
needs changes
node
packages/fff
rejected
security
trivial
upstream
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: freifunk-franken/firmware#69
Loading…
Reference in New Issue
No description provided.
Delete Branch "fbl/firmware:syntaxfix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Some of our network helper functions did require the use of an invalid
ipv6 prefix syntax to function correctly.
Specifically, if all 64 bits of the prefix are given, the caller has to
omit one colon for our assemble-functions to work properly. Therefore
the prefix '2001:db8:1:2::/64' had to be written as '2001:db8:1:2:/64'.
Also, our functions did not allow to specify the suffix with leading
colons.
This changes the behaviour of these functions to accept properly
formatted IPv6 prefixes and suffixes. All calls to these functions are
adjusted accordingly.
There is one notebly exeption: The incorrect prefix syntax in hoodfiles
cannot be adjusted yet, because that would break devices with using
older firmware. To keep compatibility with older firmware versions, the
hoodfiles prefix syntax is not yet adjusted, and a special case is added
to configurehood to allow the use of the old incorrect syntax.
While this new solution still is kind of hacky and does things that
should actually be done by a proper address parser, it does at least fix
the before mentioned problems.
Fixes: #27
Signed-off-by: Fabian Bläse fabian@blaese.de
Untested for now.
Mich wundert enorm, dass es hier scheinbar auch in OpenWrt keine fertigen Funktionen für sowas gibt. Ich konnte zumindest keine finden ...
Das was wir da tun ist halt auch ziemlicher Pfusch. Zeichenersetzung ist dafür halt absolut nicht das richtige Werkzeug..
Aber irgendwo müsste OpenWrt tatsächlich irgendwas dafür haben, was es dann für ip6assign her nehmen kann.
ec0c638038
todaab44944e
Changes:
Wird bei OpenWrt alles im netifd gemacht, wo es passende Werkzeuge gibt, um Prefix und Suffix ordentlich zusammen zu setzen.
Ich bin gerade auf folgendes aufmerksam geworden:
https://github.com/openwrt/openwrt/blob/master/package/network/utils/owipcalc/src/owipcalc.c
Die Package besteht aus genau einem c-File, sollte also winzig sein.
Damit können wir IP-Adressen zusammensetzen mit Befehlen wie:
owipcalc fdff::1/64 add ::aa:bb
Ergibt:
fdff::aa:bc/64
Habe das gerade auf meinem OpenWrt-AP ausprobiert (Package per opkg installiert).
Auch wenn es da natürlich auch Bugs geben kann, ist es denke ich immer noch besser als mit unseren String-Manipulationen. Ich werde hierfür einen alternativen Patch bauen.
Aaah ja. Genau so was wollte ich wie gesagt eigentlich mal schreiben. In diesem C-Code wird die Adresse ordentlich geparsed und dann in ordentlichen Datenstrukturen zusammen gebaut, so wie das eigentlich sollte.
Dummerweise sagt die Anzahl der C-Dateien quasi nichts über die resultierende Größe eines Programms aus.
https://openwrt.org/packages/pkgdata_owrt18_6/owipcalc sagt, dass es etwa 4kB "installed size" hat. Bleibt die Frage, wie viel das squashfs da noch wegoptimiert bekommt.
Siehe #77
Ich habe dort bewusst nur replaced und nicht die Input-Syntax angefasst.
Da #77 eine deutlich schönere Lösung ist, ist dieser PR obsolet.
Pull request closed