Skip to content

Commit 09fd9f0

Browse files
committed
ICMP: Fix Interface Information Object printing
s/Interface Identification Object/Interface Information Object/ (Reference: RFC5837. Interface Identification Object is in RFC8335.) Also in some variable names. Use IANA name for the 'ICMP Extension Object Classes' value 2. This implies updates to avoid printing 'Object' twice. Use texts from RFC '7. IANA Considerations' for Interface Roles. Fix indentations in output. Update some test outputs accordingly. This is a follow-up to dbf0433.
1 parent b97d738 commit 09fd9f0

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

print-icmp.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,17 @@ struct icmp_multipart_ext_object_header_t {
294294
};
295295

296296
static const struct tok icmp_multipart_ext_obj_values[] = {
297-
{ 1, "MPLS Stack Entry" },
298-
{ 2, "Interface Identification" },
297+
{ 1, "MPLS Stack Entry Object" },
298+
{ 2, "Interface Information Object" },
299299
{ 0, NULL}
300300
};
301301

302302
/* rfc5837 */
303-
static const struct tok icmp_interface_identification_role_values[] = {
304-
{ 0, "the IP interface upon which a datagram arrived"},
305-
{ 1, "the sub-IP component of an IP interface upon which a datagram arrived"},
306-
{ 2, "the IP interface through which the datagram would have been forwarded had it been forwardable"},
307-
{ 3, "the IP next hop to which the datagram would have been forwarded"},
303+
static const struct tok icmp_interface_information_role_values[] = {
304+
{ 0, "Incoming IP Interface"},
305+
{ 1, "Sub-IP Component of Incoming IP Interface"},
306+
{ 2, "Outgoing IP Interface"},
307+
{ 3, "IP Next hop"},
308308
{ 0, NULL }
309309
};
310310

@@ -316,7 +316,7 @@ Interface IP Address Sub-Object
316316
+-------+-------+-------+-------+
317317
| IP Address ....
318318
*/
319-
struct icmp_interface_identification_ipaddr_subobject_t {
319+
struct icmp_interface_information_ipaddr_subobject_t {
320320
nd_uint16_t afi;
321321
nd_uint16_t reserved;
322322
nd_uint32_t ip_addr;
@@ -329,7 +329,7 @@ octet 0 1 63
329329
| length | interface name octets 1-63 |
330330
+--------+-----------................-----------------+
331331
*/
332-
struct icmp_interface_identification_ifname_subobject_t {
332+
struct icmp_interface_information_ifname_subobject_t {
333333
nd_uint8_t length;
334334
nd_byte if_name[63];
335335
};
@@ -791,7 +791,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen,
791791
obj_ctype = GET_U_1(icmp_multipart_ext_object_header->ctype);
792792
obj_tptr += sizeof(struct icmp_multipart_ext_object_header_t);
793793

794-
ND_PRINT("\n\t %s Object (%u), Class-Type: %u, length %u",
794+
ND_PRINT("\n\t %s (%u), Class-Type: %u, length %u",
795795
tok2str(icmp_multipart_ext_obj_values,"unknown",obj_class_num),
796796
obj_class_num,
797797
obj_ctype,
@@ -844,21 +844,21 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen,
844844
name_flag = (obj_ctype & 0x2) >> 1;
845845
mtu_flag = (obj_ctype & 0x1);
846846

847-
ND_PRINT("\n\t\t This object describes %s",
848-
tok2str(icmp_interface_identification_role_values,
847+
ND_PRINT("\n\t Interface Role: %s",
848+
tok2str(icmp_interface_information_role_values,
849849
"an unknown interface role",interface_role));
850850

851851
offset = obj_tptr;
852852

853853
if (if_index_flag) {
854-
ND_PRINT("\n\t\t Interface Index: %u", GET_BE_U_4(offset));
854+
ND_PRINT("\n\t Interface Index: %u", GET_BE_U_4(offset));
855855
offset += 4;
856856
}
857857
if (ipaddr_flag) {
858-
const struct icmp_interface_identification_ipaddr_subobject_t *ipaddr_subobj;
858+
const struct icmp_interface_information_ipaddr_subobject_t *ipaddr_subobj;
859859

860-
ND_PRINT("\n\t\t IP Address sub-object: ");
861-
ipaddr_subobj = (const struct icmp_interface_identification_ipaddr_subobject_t *) offset;
860+
ND_PRINT("\n\t IP Address sub-object: ");
861+
ipaddr_subobj = (const struct icmp_interface_information_ipaddr_subobject_t *) offset;
862862
switch (GET_BE_U_2(ipaddr_subobj->afi)) {
863863
case 1:
864864
ND_PRINT("%s", GET_IPADDR_STRING(ipaddr_subobj->ip_addr));
@@ -876,11 +876,11 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen,
876876
}
877877
if (name_flag) {
878878
uint8_t inft_name_length_field;
879-
const struct icmp_interface_identification_ifname_subobject_t *ifname_subobj;
879+
const struct icmp_interface_information_ifname_subobject_t *ifname_subobj;
880880

881-
ifname_subobj = (const struct icmp_interface_identification_ifname_subobject_t *) offset;
881+
ifname_subobj = (const struct icmp_interface_information_ifname_subobject_t *) offset;
882882
inft_name_length_field = GET_U_1(ifname_subobj->length);
883-
ND_PRINT("\n\t\t Interface Name");
883+
ND_PRINT("\n\t Interface Name");
884884
if (inft_name_length_field == 0) {
885885
ND_PRINT(" [length %u]", inft_name_length_field);
886886
nd_print_invalid(ndo);
@@ -904,7 +904,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen,
904904
offset += inft_name_length_field;
905905
}
906906
if (mtu_flag) {
907-
ND_PRINT("\n\t\t MTU: %u", GET_BE_U_4(offset));
907+
ND_PRINT("\n\t MTU: %u", GET_BE_U_4(offset));
908908
offset += 4;
909909
}
910910
break;

tests/icmp-cksum-oobr-2.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
(tos 0x0, ttl 1, id 42321, offset 0, flags [none], proto UDP (17), length 40)
44
12.4.4.4.42315 > 12.1.1.1.33440: [bad udp cksum 0x1000 -> 0xbad0!] UDP, length 12
55
ICMP Multi-Part extension v2
6-
Interface Identification Object (2), Class-Type: 14, length 80
7-
This object describes the IP interface upon which a datagram arrived
8-
Interface Index: 15
9-
IP Address sub-object: 10.10.10.10
10-
Interface Name [length 63 != N x 4] (invalid) [|icmp]
6+
Interface Information Object (2), Class-Type: 14, length 80
7+
Interface Role: Incoming IP Interface
8+
Interface Index: 15
9+
IP Address sub-object: 10.10.10.10
10+
Interface Name [length 63 != N x 4] (invalid) [|icmp]

tests/icmp-rfc5837.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
IP (tos 0x0, ttl 1, id 42321, offset 0, flags [none], proto UDP (17), length 40)
44
12.4.4.4.42315 > 12.1.1.1.33440: UDP, length 12
55
ICMP Multi-Part extension v2, checksum 0x246c (correct), length 84
6-
Interface Identification Object (2), Class-Type: 14, length 80
7-
This object describes the IP interface upon which a datagram arrived
8-
Interface Index: 15
9-
IP Address sub-object: 10.10.10.10
10-
Interface Name, length 64: This-is-the-name-of-the-Interface-that-we-are-looking-for-[:-)]
6+
Interface Information Object (2), Class-Type: 14, length 80
7+
Interface Role: Incoming IP Interface
8+
Interface Index: 15
9+
IP Address sub-object: 10.10.10.10
10+
Interface Name, length 64: This-is-the-name-of-the-Interface-that-we-are-looking-for-[:-)]

tests/icmp_inft_name_length_zero.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
IP (tos 0x0, ttl 1, id 42321, offset 0, flags [none], proto UDP (17), length 40, bad cksum f76a (->db81)!)
44
8.15.4.4.42315 > 12.223.32.1.33440: UDP, length 12
55
ICMP Multi-Part extension v2
6-
Interface Identification Object (2), Class-Type: 2, length 8016
7-
This object describes the IP interface upon which a datagram arrived
8-
Interface Name [length 0] (invalid) [|icmp]
6+
Interface Information Object (2), Class-Type: 2, length 8016
7+
Interface Role: Incoming IP Interface
8+
Interface Name [length 0] (invalid) [|icmp]

0 commit comments

Comments
 (0)