Hi all, IPv6 knows scoped address types i.e. link and site local addresses. Link local addresses require a scope identifier to specify the interface/link an address is valid on (e.g. fe80::1%eth0). This scope identifier is only valid on a single node.
RFC 4007 says that the scope identifier shall not be sent across the wire, unless every node agrees on the semantics. Apache e.g. rejects HTTP requests with a scope identifier in the host header (see https://issues.apache.org/bugzilla/show_bug.cgi?id=35122). This patch removes the scope identifier from the HTTP request, whereas it remains in the structure used to connect to the server. Please apply. Regards, Fabian Index: package/busybox/patches/811-wget_no_ipv6_scope.patch =================================================================== --- package/busybox/patches/811-wget_no_ipv6_scope.patch (revision 0) +++ package/busybox/patches/811-wget_no_ipv6_scope.patch (revision 0) @@ -0,0 +1,63 @@ +diff -ruN busybox-1.11.3.orig/networking/wget.c busybox-1.11.3/networking/wget.c +--- busybox-1.11.3.orig/networking/wget.c 2009-06-04 13:16:55.000000000 +0100 ++++ busybox-1.11.3/networking/wget.c 2009-06-04 14:29:54.000000000 +0100 +@@ -337,6 +337,43 @@ + sp = h->host; + } + ++/* RFC 4007 says that the scope identifier MUST NOT be sent accross the wire, ++ * unless all nodes agree on the semantic. Apache e.g. regards zone identifiers ++ * in the Host header as invalid requests, see ++ * https://issues.apache.org/bugzilla/show_bug.cgi?id=35122 ++ */ ++static void strip_ipv6_scope(struct host_info *h) ++{ ++ char *scope, *br, *newhost; ++ ++ /* Remove the IPv6 scope identifier from the URL, ++ * ugly parsing of [xx]:nn, similar to str2sockaddr() */ ++ ++ if (!ENABLE_FEATURE_IPV6 || h->host[0] != '[') { ++ /* no IPv6 address, dnt touch */ ++ return; ++ } ++ ++ br = strchr(h->host, ']'); ++ if (!br || br[1] != ':') { ++ /* malformed address, dnt touch, will be caught later */ ++ return; ++ } ++ ++ scope = strchr(h->host, '%'); ++ if (!scope || scope > br) { ++ /* no scope identifier, dnt touch */ ++ return; ++ } ++ ++ /* does not update ->allocated, pointers now mixed into different ++ * membory blocks (just in case the data should be freed in future) */ ++ newhost = xstrdup(h->host); ++ /* copy "]:port" from old string to new string overwriting scope ++ * scope > h->host and new string from scope till end is large enough */ ++ strcpy(newhost + (scope - h->host), br); ++ h->host = newhost; ++} + + static char *gethdr(char *buf, size_t bufsiz, FILE *fp /*, int *istrunc*/) + { +@@ -477,6 +514,7 @@ + parse_url(argv[optind], &target); + server.host = target.host; + server.port = target.port; ++ strip_ipv6_scope(&target); + + /* Use the proxy if necessary */ + if (use_proxy) { +@@ -665,6 +703,7 @@ + else { + parse_url(str, &target); + if (use_proxy == 0) { ++ /* FIXME append the scope the old target had */ + server.host = target.host; + server.port = target.port; + } _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
