common: abort hlq packing of version incompatible fields

Currently, there are no such fields.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
1 files changed, 9 insertions(+), 1 deletions(-)

M common/qso-pack.c
M common/qso-pack.c +9 -1
@@ 413,8 413,16 @@ struct buffer *qso_pack_hlq(const struct
 
 		for (j = 0; j < ARRAY_LEN(side_fields); j++) {
 			const struct side_field *f = &side_fields[j];
+			struct val *val = f->get(side);
 
-			KV(buf, ns, f->name, f->get(side));
+			if (ver >= f->minver) {
+				KV(buf, ns, f->name, val);
+			} else if (val) {
+				/* desired version doesn't support this field */
+				val_putref(val);
+				ret = -ENOTSUP;
+				goto err;
+			}
 		}
 	}