summaryrefslogtreecommitdiffstats
path: root/lib/pb-protocol
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-09-06 13:30:30 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-09-08 14:26:27 +1000
commit662129afba2d344d692a9dbfd430c91eff4f281d (patch)
tree04a6ab48f0c0c575ee2a72b8b2958510a3750d2b /lib/pb-protocol
parent82b4c9d7ecbfada62295620a6082caf1b9860ff6 (diff)
downloadpetitboot-662129afba2d344d692a9dbfd430c91eff4f281d.zip
petitboot-662129afba2d344d692a9dbfd430c91eff4f281d.tar.gz
discover: Avoid writing network overrides to NVRAM
Explicitly keep track of whether the current interface config was set by an IPMI network override, and avoid overwriting any saved config unless the override was marked persistent. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'lib/pb-protocol')
-rw-r--r--lib/pb-protocol/pb-protocol.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index 1560ef7..706aec9 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -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 /* conf->override */;
+
return len;
}
@@ -511,6 +513,9 @@ static int pb_protocol_serialise_config_interface(char *buf,
conf->static_config.url);
}
+ *(uint32_t *)pos = conf->override;
+ pos += 4;
+
return pos - buf;
}
@@ -1019,6 +1024,10 @@ static int pb_protocol_deserialise_config_interface(const char **buf,
return -1;
}
+ if (read_u32(buf, len, &tmp))
+ return -1;
+ iface->override = !!tmp;
+
return 0;
}
OpenPOWER on IntegriCloud