ref: 477ab764da4534bc95acab205dc561562d764af2
parent: 0d34984734c0feceaab774d401a09e9333f81991
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat May 27 08:11:46 EDT 2023
ip/ipconfig: less intrusive work-around for "ANDROID_METERED" The problem is actually that android phones send their non-tlv structured "ANDROID_METERED" string in the vendor option; the other options are structured fine and have no problem parsing.
--- a/sys/src/cmd/ip/ipconfig/dhcp.c
+++ b/sys/src/cmd/ip/ipconfig/dhcp.c
@@ -553,7 +553,9 @@
/* get plan9-specific options */
n = optgetvec(bp->optdata, OBvendorinfo, vopts, sizeof vopts-1);
- if(n > 0 && parseoptions(vopts, n) == 0){
+ if(n >= 15 && memcmp(vopts, "ANDROID_METERED", 15) == 0){
+ /* Android shouldn't be sending us this garbage; ignore it */
+ } else if(n > 0 && parseoptions(vopts, n) == 0){
if(!(Oflag && validip(conf.fs))){
n = optgetp9addrs(vopts, OP9fs, taddr, 2);
if(n < 2)
@@ -950,11 +952,6 @@
int code, len, nin = n;
while (n > 0) {
- /* Android shouldn't be sending us this garbage; filter it out */
- static char garbage[] = "ANDROID_METERED";
- if(n >= sizeof(garbage)-1 && memcmp(p, garbage, sizeof(garbage)-1) == 0)
- memset(p, OBpad, sizeof(garbage)-1);
-
code = *p++;
n--;
if(code == OBend)