discover: Avoid writing network overrides to NVRAM
[petitboot] / lib / pb-protocol / pb-protocol.c
index 1560ef797fe1ed31f0e0c98bf9ad215092f44eba..706aec9786169af697c0488f535a2730c95269db 100644 (file)
@@ -283,6 +283,8 @@ static int pb_protocol_interface_config_len(struct interface_config *conf)
                len += 4 + optional_strlen(conf->static_config.url);
        }
 
                len += 4 + optional_strlen(conf->static_config.url);
        }
 
+       len += 4 /* conf->override */;
+
        return len;
 }
 
        return len;
 }
 
@@ -511,6 +513,9 @@ static int pb_protocol_serialise_config_interface(char *buf,
                                conf->static_config.url);
        }
 
                                conf->static_config.url);
        }
 
+       *(uint32_t *)pos = conf->override;
+       pos += 4;
+
        return pos - buf;
 }
 
        return pos - buf;
 }
 
@@ -1019,6 +1024,10 @@ static int pb_protocol_deserialise_config_interface(const char **buf,
                        return -1;
        }
 
                        return -1;
        }
 
+       if (read_u32(buf, len, &tmp))
+               return -1;
+       iface->override = !!tmp;
+
        return 0;
 }
 
        return 0;
 }