Skip to contentSkip to conversation

monitor: add better info about the country code IE

PATCH Applied James Prestwood 2 participants 2 messages Nov 13, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 monitor: add better info about the country code IE

The 3rd byte of the country code was being printed as ASCII but this byte isn't always a printable character. Instead we can check what the value is and describe what it means from the spec.

---
 monitor/nlmon.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
monitor/nlmon.c +24 -1
index ac594c3c..60adddc5 100644
@@ -491,7 +491,30 @@ static void print_ie_country(unsigned int level, const char *label,
 		return;
 	}
 
-	print_attr(level, "%s: %c%c%c", label, code[0], code[1], code[2]);
+	print_attr(level, "%s: %c%c", label, code[0], code[1]);
+
+	switch (code[2]) {
+	case ' ':
+		print_attr(level + 1,
+			"3rd octet: 0x%02x: All environments", code[2]);
+		break;
+	case 'O':
+		print_attr(level + 1,
+			"3rd octet: 0x%02x: Outdoor environments", code[2]);
+		break;
+	case 'I':
+		print_attr(level + 1,
+			"3rd octet: 0x%02x: Indoor environments", code[2]);
+		break;
+	case 'X':
+		print_attr(level + 1,
+			"3rd octet: 0x%02x: Non-country entity", code[2]);
+		break;
+	default:
+		print_attr(level + 1,
+			"3rd octet: 0x%02x: Annex E table", code[2]);
+		break;
+	}
 
 	while (i < size) {
 		if (code[i] > 200) {
Signature · 1 line
2.34.1
#1 lore raw

Hi James,

Quoted 7 lines · James Prestwood

The 3rd byte of the country code was being printed as ASCII but this byte isn't always a printable character. Instead we can check what the value is and describe what it means from the spec.

---
  monitor/nlmon.c | 25 ++++++++++++++++++++++++-
  1 file changed, 24 insertions(+), 1 deletion(-)

Applied, thanks.

Regards,
-Denis