mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-24 01:27:30 +02:00
[package] busybox: add 6RD prefix sanity checking as mandated by RFC5969, bump pkg revision
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@23990 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
47661d88e6
commit
7ffe9830cf
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=busybox
|
PKG_NAME:=busybox
|
||||||
PKG_VERSION:=1.17.3
|
PKG_VERSION:=1.17.3
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=2
|
||||||
PKG_FLAGS:=essential
|
PKG_FLAGS:=essential
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
/* really simple implementation, just count the bits */
|
/* really simple implementation, just count the bits */
|
||||||
static int mton(uint32_t mask)
|
static int mton(uint32_t mask)
|
||||||
{
|
{
|
||||||
@@ -177,6 +195,60 @@ static NOINLINE char *xmalloc_optname_op
|
@@ -177,6 +195,70 @@ static NOINLINE char *xmalloc_optname_op
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -85,33 +85,43 @@
|
|||||||
+ * We convert it to a string "IPv4MaskLen 6rdPrefixLen 6rdPrefix 6rdBRIPv4Address"
|
+ * We convert it to a string "IPv4MaskLen 6rdPrefixLen 6rdPrefix 6rdBRIPv4Address"
|
||||||
+ */
|
+ */
|
||||||
+
|
+
|
||||||
+ /* IPv4MaskLen */
|
+ /* Sanity check: ensure that our length is at least 22 bytes, that
|
||||||
+ dest += sprintf(dest, "%u ", *option++);
|
+ * IPv4MaskLen is <= 32, 6rdPrefixLen <= 128 and that the sum of
|
||||||
+ len--;
|
+ * (32 - IPv4MaskLen) + 6rdPrefixLen is less than or equal to 128.
|
||||||
+
|
+ * If any of these requirements is not fulfilled, return with empty
|
||||||
+ /* 6rdPrefixLen */
|
+ * value.
|
||||||
+ dest += sprintf(dest, "%u ", *option++);
|
+ */
|
||||||
+ len--;
|
+ if ((len >= 22) && (*option <= 32) && (*(option+1) <= 128) &&
|
||||||
+
|
+ (((32 - *option) + *(option+1)) <= 128))
|
||||||
+ /* 6rdPrefix */
|
|
||||||
+ dest += sprint_nip6(dest, "", option);
|
|
||||||
+ option += 16;
|
|
||||||
+ len -= 16;
|
|
||||||
+
|
|
||||||
+ /* 6rdBRIPv4Addresses */
|
|
||||||
+ while (len >= 4)
|
|
||||||
+ {
|
+ {
|
||||||
+ dest += sprint_nip(dest, " ", option);
|
+ /* IPv4MaskLen */
|
||||||
+ option += 4;
|
+ dest += sprintf(dest, "%u ", *option++);
|
||||||
+ len -= 4;
|
+ len--;
|
||||||
+
|
+
|
||||||
+ /* the code to determine the option size fails to work with
|
+ /* 6rdPrefixLen */
|
||||||
+ * lengths that are not a multiple of the minimum length,
|
+ dest += sprintf(dest, "%u ", *option++);
|
||||||
+ * adding all advertised 6rdBRIPv4Addresses here would
|
+ len--;
|
||||||
+ * overflow the destination buffer, therefore skip the rest
|
+
|
||||||
+ * for now
|
+ /* 6rdPrefix */
|
||||||
+ */
|
+ dest += sprint_nip6(dest, "", option);
|
||||||
+ break;
|
+ option += 16;
|
||||||
|
+ len -= 16;
|
||||||
|
+
|
||||||
|
+ /* 6rdBRIPv4Addresses */
|
||||||
|
+ while (len >= 4)
|
||||||
|
+ {
|
||||||
|
+ dest += sprint_nip(dest, " ", option);
|
||||||
|
+ option += 4;
|
||||||
|
+ len -= 4;
|
||||||
|
+
|
||||||
|
+ /* the code to determine the option size fails to work with
|
||||||
|
+ * lengths that are not a multiple of the minimum length,
|
||||||
|
+ * adding all advertised 6rdBRIPv4Addresses here would
|
||||||
|
+ * overflow the destination buffer, therefore skip the rest
|
||||||
|
+ * for now
|
||||||
|
+ */
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return ret;
|
+ return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user