LMP: add -T override and fix version 1 test(s)

The Link Management Protocol version 1 sample capture added to the tests
directory in commit 212eef2 was produced using non-standard UDP port
49998. Later assignment of port 701 reflected in commit 960aee5 made it
impossible to decode the capture.

This change adds a -T override for LMP, uses it to replace the broken
test with two working tests and dismisses the custom test script,
lmp.sh.
This commit is contained in:
Denis Ovsienko 2013-09-07 12:22:37 +04:00
parent 1da88e5c5d
commit eadd71d493
9 changed files with 230 additions and 51 deletions

View File

@ -82,6 +82,7 @@ extern char *strsep(char **, const char *);
#define PT_VXLAN 13 /* Virtual eXtensible Local Area Network */
#define PT_PGM 14 /* [UDP-encapsulated] Pragmatic General Multicast */
#define PT_PGM_ZMTP1 15 /* ZMTP/1.0 inside PGM (native or UDP-encapsulated) */
#define PT_LMP 16 /* Link Management Protocol */
#ifndef min
#define min(a,b) ((a)>(b)?(b):(a))

View File

@ -194,6 +194,7 @@ struct netdissect_options {
#define PT_VXLAN 13 /* Virtual eXtensible Local Area Network */
#define PT_PGM 14 /* [UDP-encapsulated] Pragmatic General Multicast */
#define PT_PGM_ZMTP1 15 /* ZMTP/1.0 inside PGM (native or UDP-encapsulated) */
#define PT_LMP 16 /* Link Management Protocol */
#ifndef min
#define min(a,b) ((a)>(b)?(b):(a))

View File

@ -485,6 +485,10 @@ udp_print(register const u_char *bp, u_int length,
udpipaddr_print(ip, sport, dport);
pgm_print(cp, length, bp2);
break;
case PT_LMP:
udpipaddr_print(ip, sport, dport);
lmp_print(cp, length);
break;
}
return;
}

View File

@ -519,6 +519,7 @@ Currently known types are
\fBaodv\fR (Ad-hoc On-demand Distance Vector protocol),
\fBcarp\fR (Common Address Redundancy Protocol),
\fBcnfp\fR (Cisco NetFlow protocol),
\fBlmp\fR (Link Management Protocol),
\fBpgm\fR (Pragmatic General Multicast),
\fBpgm_zmtp1\fR (ZMTP/1.0 inside PGM/EPGM),
\fBradius\fR (RADIUS),

View File

@ -1024,6 +1024,8 @@ main(int argc, char **argv)
packettype = PT_PGM;
else if (strcasecmp(optarg, "pgm_zmtp1") == 0)
packettype = PT_PGM_ZMTP1;
else if (strcasecmp(optarg, "lmp") == 0)
packettype = PT_LMP;
else
error("unknown packet type `%s'", optarg);
break;

View File

@ -20,9 +20,9 @@ isakmp2 isakmp-pointer-loop.pcap isakmp2.out -t
isakmp3 isakmp-identification-segfault.pcap isakmp3.out -t -v
isakmp4 isakmp4500.pcap isakmp4.out -t -E "file esp-secrets.txt"
# LMP tests (what is it?)
# fails right now.
#lmp lmp.pcap lmp.out -t -v -v
# Link Management Protocol tests
lmp lmp.pcap lmp.out -t -T lmp
lmp-v lmp.pcap lmp-v.out -t -T lmp -v
# MPLS tests
mpls-ldp-hello mpls-ldp-hello.pcap mpls-ldp-hello.out -t -v

200
tests/lmp-v.out Normal file
View File

@ -0,0 +1,200 @@
IP (tos 0x0, ttl 1, id 44530, offset 0, flags [none], proto UDP (17), length 84)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Begin Verify, Flags: [none], length: 56
Link ID Object (3), Class-Type: IPv4 Local (1) Flags: [non-negotiable], length: 8
IPv4 Link ID: 1.0.0.0 (0x01000000)
Message ID Object (5), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Message ID: 3 (0x00000003)
Link ID Object (3), Class-Type: IPv4 Remote (2) Flags: [non-negotiable], length: 8
IPv4 Link ID: 1.0.0.0 (0x01000000)
Verify Begin Object (8), Class-Type: 1 (1) Flags: [negotiable], length: 24
Flags: none
Verify Interval: 20
Data links: 30
Encoding type: Lambda (photonic)
Verify Tranport Mechanism: 32768 (0x8000)
Transmission Rate: 0.001 Mbps
Wavelength: 8
IP (tos 0x0, ttl 1, id 44531, offset 0, flags [none], proto UDP (17), length 56)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Hello, Flags: [none], length: 28
Control Channel ID Object (1), Class-Type: Local (1) Flags: [non-negotiable], length: 8
Control Channel ID: 1 (0x00000001)
Hello Object (7), Class-Type: 1 (1) Flags: [non-negotiable], length: 12
Tx Seq: 50, Rx Seq: 60
IP (tos 0x0, ttl 1, id 44532, offset 0, flags [none], proto UDP (17), length 84)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Config NACK, Flags: [none], length: 56
Control Channel ID Object (1), Class-Type: Local (1) Flags: [non-negotiable], length: 8
Control Channel ID: 1 (0x00000001)
Node ID Object (2), Class-Type: Local (1) Flags: [non-negotiable], length: 8
Node ID: 10.0.50.1 (0x0a003201)
Control Channel ID Object (1), Class-Type: Remote (2) Flags: [non-negotiable], length: 8
Control Channel ID: 2 (0x00000002)
Message ID Object (5), Class-Type: 2 (2) Flags: [non-negotiable], length: 8
Message ID Ack: 3 (0x00000003)
Node ID Object (2), Class-Type: Remote (2) Flags: [non-negotiable], length: 8
Node ID: 10.0.50.2 (0x0a003202)
Configuration Object (6), Class-Type: 1 (1) Flags: [negotiable], length: 8
Hello Interval: 5
Hello Dead Interval: 15
IP (tos 0x0, ttl 1, id 44533, offset 0, flags [none], proto UDP (17), length 76)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Config ACK, Flags: [none], length: 48
Control Channel ID Object (1), Class-Type: Local (1) Flags: [non-negotiable], length: 8
Control Channel ID: 1 (0x00000001)
Node ID Object (2), Class-Type: Local (1) Flags: [non-negotiable], length: 8
Node ID: 10.0.50.1 (0x0a003201)
Control Channel ID Object (1), Class-Type: Remote (2) Flags: [non-negotiable], length: 8
Control Channel ID: 2 (0x00000002)
Message ID Object (5), Class-Type: 2 (2) Flags: [non-negotiable], length: 8
Message ID Ack: 3 (0x00000003)
Node ID Object (2), Class-Type: Remote (2) Flags: [non-negotiable], length: 8
Node ID: 10.0.50.2 (0x0a003202)
IP (tos 0x0, ttl 1, id 44534, offset 0, flags [none], proto UDP (17), length 68)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Config, Flags: [none], length: 40
Control Channel ID Object (1), Class-Type: Local (1) Flags: [non-negotiable], length: 8
Control Channel ID: 1 (0x00000001)
Message ID Object (5), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Message ID: 3 (0x00000003)
Node ID Object (2), Class-Type: Local (1) Flags: [non-negotiable], length: 8
Node ID: 10.0.50.1 (0x0a003201)
Configuration Object (6), Class-Type: 1 (1) Flags: [negotiable], length: 8
Hello Interval: 5
Hello Dead Interval: 15
IP (tos 0x0, ttl 1, id 44535, offset 0, flags [none], proto UDP (17), length 44)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Link Summary ACK, Flags: [none], length: 16
Message ID Object (5), Class-Type: 2 (2) Flags: [non-negotiable], length: 8
Message ID Ack: 1 (0x00000001)
IP (tos 0x0, ttl 1, id 44536, offset 0, flags [none], proto UDP (17), length 124)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Link Summary NACK, Flags: [none], length: 96
Message ID Object (5), Class-Type: 2 (2) Flags: [non-negotiable], length: 8
Message ID Ack: 1 (0x00000001)
Error Code Object (20), Class-Type: 2 (2) Flags: [non-negotiable], length: 8
Error Code: Unacceptable non-negotiable LINK-SUMMARY parameters, Renegotiate LINK-SUMMARY parameters, Invalid DATA-LINK Object, Unknown TE-LINK Object c-type, Unknown DATA-LINK Object c-type
Data Link Object (12), Class-Type: IPv4 (1) Flags: [non-negotiable], length: 36
Flags: [none]
Local Interface ID: 192.168.1.1 (0xc0a80101)
Remote Interface ID: 192.168.1.2 (0xc0a80102)
Subobject, Type: Interface Switching Type (1), Length: 12
Switching Type: Lambda-Switch Capable (150)
Encoding Type: Lambda (photonic) (8)
Min Reservable Bandwidth: 0.001 Mbps
Max Reservable Bandwidth: 0.001 Mbps
Subobject, Type: Wavelength (2), Length: 8
Wavelength: 6
Data Link Object (12), Class-Type: IPv4 (1) Flags: [non-negotiable], length: 36
Flags: [none]
Local Interface ID: 10.1.1.1 (0x0a010101)
Remote Interface ID: 10.1.1.2 (0x0a010102)
Subobject, Type: Interface Switching Type (1), Length: 12
Switching Type: Lambda-Switch Capable (150)
Encoding Type: ANSI/ETSI PDH (3)
Min Reservable Bandwidth: 9877.895 Mbps
Max Reservable Bandwidth: 10325.547 Mbps
Subobject, Type: Wavelength (2), Length: 8
Wavelength: 353
IP (tos 0x0, ttl 1, id 44537, offset 0, flags [none], proto UDP (17), length 68)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Begin Verify ACK, Flags: [none], length: 40
Link ID Object (3), Class-Type: IPv4 Local (1) Flags: [non-negotiable], length: 8
IPv4 Link ID: 1.0.0.0 (0x01000000)
Message ID Object (5), Class-Type: 2 (2) Flags: [non-negotiable], length: 8
Message ID Ack: 1 (0x00000001)
Verify Begin ACK Object (9), Class-Type: 1 (1) Flags: [negotiable], length: 8
Verify Dead Interval: 50
Verify Transport Response: 100
Verify ID Object (10), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Verify ID: 5
IP (tos 0x0, ttl 1, id 44538, offset 0, flags [none], proto UDP (17), length 60)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Begin Verify NACK, Flags: [none], length: 32
Link ID Object (3), Class-Type: IPv4 Local (1) Flags: [non-negotiable], length: 8
IPv4 Link ID: 10.0.0.0 (0x0a000000)
Message ID Object (5), Class-Type: 2 (2) Flags: [non-negotiable], length: 8
Message ID Ack: 3 (0x00000003)
Error Code Object (20), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Error Code: Link Verification Procedure Not supported, Unwilling to verify, Unsupported verification transport mechanism
IP (tos 0x0, ttl 1, id 44539, offset 0, flags [none], proto UDP (17), length 52)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: End Verify, Flags: [none], length: 24
Message ID Object (5), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Message ID: 3 (0x00000003)
Verify ID Object (10), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Verify ID: 5
IP (tos 0x0, ttl 1, id 44540, offset 0, flags [none], proto UDP (17), length 52)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: End Verify ACK, Flags: [none], length: 24
Message ID Object (5), Class-Type: 2 (2) Flags: [non-negotiable], length: 8
Message ID Ack: 3 (0x00000003)
Verify ID Object (10), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Verify ID: 5
IP (tos 0x0, ttl 1, id 44541, offset 0, flags [none], proto UDP (17), length 52)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Test, Flags: [none], length: 24
Interface ID Object (4), Class-Type: IPv4 Local (1) Flags: [non-negotiable], length: 8
IPv4 Link ID: 1.0.0.0 (0x01000000)
Verify ID Object (10), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Verify ID: 5
IP (tos 0x0, ttl 1, id 44542, offset 0, flags [none], proto UDP (17), length 52)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Test Status Failure, Flags: [none], length: 24
Message ID Object (5), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Message ID: 1 (0x00000001)
Verify ID Object (10), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Verify ID: 5
IP (tos 0x0, ttl 1, id 44543, offset 0, flags [none], proto UDP (17), length 52)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Test Status ACK, Flags: [none], length: 24
Message ID Object (5), Class-Type: 2 (2) Flags: [non-negotiable], length: 8
Message ID Ack: 1 (0x00000001)
Verify ID Object (10), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Verify ID: 5
IP (tos 0x0, ttl 1, id 44544, offset 0, flags [none], proto UDP (17), length 44)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Channel Status ACK, Flags: [none], length: 16
Message ID Object (5), Class-Type: 2 (2) Flags: [non-negotiable], length: 8
Message ID Ack: 3 (0x00000003)
IP (tos 0x0, ttl 1, id 44545, offset 0, flags [none], proto UDP (17), length 64)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Channel Status Request, Flags: [none], length: 36
Link ID Object (3), Class-Type: IPv4 Local (1) Flags: [non-negotiable], length: 8
IPv4 Link ID: 1.0.0.0 (0x01000000)
Message ID Object (5), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Message ID: 3 (0x00000003)
Channel Status Request Object (14), Class-Type: IPv4 (1) Flags: [non-negotiable], length: 12
Interface ID: 2.0.0.0 (0x02000000)
Interface ID: 2.0.0.0 (0x02000000)
IP (tos 0x0, ttl 1, id 44546, offset 0, flags [none], proto UDP (17), length 72)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Channel Status, Flags: [none], length: 44
Link ID Object (3), Class-Type: IPv4 Local (1) Flags: [non-negotiable], length: 8
IPv4 Link ID: 1.0.0.0 (0x01000000)
Message ID Object (5), Class-Type: 1 (1) Flags: [non-negotiable], length: 8
Message ID: 3 (0x00000003)
Channel Status Object (13), Class-Type: IPv4 (1) Flags: [non-negotiable], length: 20
Interface ID: 1.0.0.0 (0x01000000)
Active: Allocated (1)
Direction: Transmit (1)
Channel Status: Signal Fail (3)
Interface ID: 1.0.0.0 (0x01000000)
Active: Allocated (1)
Direction: Receive (0)
Channel Status: Signal Degraded (2)
IP (tos 0x0, ttl 1, id 44547, offset 0, flags [none], proto UDP (17), length 64)
10.0.12.1.49998 > 10.0.12.2.49998:
LMPv1, msg-type: Channel Status Response, Flags: [none], length: 36
Message ID Object (5), Class-Type: 2 (2) Flags: [non-negotiable], length: 8
Message ID Ack: 3 (0x00000003)
Channel Status Object (13), Class-Type: IPv4 (1) Flags: [non-negotiable], length: 20
Interface ID: 1.0.0.0 (0x01000000)
Active: Allocated (1)
Direction: Transmit (1)
Channel Status: Signal Degraded (2)
Interface ID: 1.0.0.0 (0x01000000)
Active: Allocated (1)
Direction: Transmit (1)
Channel Status: Signal Okay (1)

View File

@ -1,36 +1,18 @@
IP (tos 0x0, ttl 1, id 44530, offset 0, flags [none], proto UDP (17), length 84)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 56
IP (tos 0x0, ttl 1, id 44531, offset 0, flags [none], proto UDP (17), length 56)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 28
IP (tos 0x0, ttl 1, id 44532, offset 0, flags [none], proto UDP (17), length 84)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 56
IP (tos 0x0, ttl 1, id 44533, offset 0, flags [none], proto UDP (17), length 76)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 48
IP (tos 0x0, ttl 1, id 44534, offset 0, flags [none], proto UDP (17), length 68)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 40
IP (tos 0x0, ttl 1, id 44535, offset 0, flags [none], proto UDP (17), length 44)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 16
IP (tos 0x0, ttl 1, id 44536, offset 0, flags [none], proto UDP (17), length 124)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 96
IP (tos 0x0, ttl 1, id 44537, offset 0, flags [none], proto UDP (17), length 68)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 40
IP (tos 0x0, ttl 1, id 44538, offset 0, flags [none], proto UDP (17), length 60)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 32
IP (tos 0x0, ttl 1, id 44539, offset 0, flags [none], proto UDP (17), length 52)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 24
IP (tos 0x0, ttl 1, id 44540, offset 0, flags [none], proto UDP (17), length 52)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 24
IP (tos 0x0, ttl 1, id 44541, offset 0, flags [none], proto UDP (17), length 52)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 24
IP (tos 0x0, ttl 1, id 44542, offset 0, flags [none], proto UDP (17), length 52)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 24
IP (tos 0x0, ttl 1, id 44543, offset 0, flags [none], proto UDP (17), length 52)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 24
IP (tos 0x0, ttl 1, id 44544, offset 0, flags [none], proto UDP (17), length 44)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 16
IP (tos 0x0, ttl 1, id 44545, offset 0, flags [none], proto UDP (17), length 64)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 36
IP (tos 0x0, ttl 1, id 44546, offset 0, flags [none], proto UDP (17), length 72)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 44
IP (tos 0x0, ttl 1, id 44547, offset 0, flags [none], proto UDP (17), length 64)
10.0.12.1.49998 > 10.0.12.2.49998: [no cksum] UDP, length 36
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Begin Verify Message, length: 56
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Hello Message, length: 28
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Config NACK Message, length: 56
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Config ACK Message, length: 48
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Config Message, length: 40
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Link Summary ACK Message, length: 16
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Link Summary NACK Message, length: 96
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Begin Verify ACK Message, length: 40
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Begin Verify NACK Message, length: 32
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 End Verify Message, length: 24
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 End Verify ACK Message, length: 24
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Test Message, length: 24
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Test Status Failure Message, length: 24
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Test Status ACK Message, length: 24
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Channel Status ACK Message, length: 16
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Channel Status Request Message, length: 36
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Channel Status Message, length: 44
IP 10.0.12.1.49998 > 10.0.12.2.49998: LMPv1 Channel Status Response Message, length: 36

View File

@ -1,12 +0,0 @@
#!/bin/sh
echo -n test lmp ...
../tcpdump -t -n -v -v -v -r lmp.pcap >lmp.new
if diff lmp.new lmp.out
then
echo passed.
else
echo failed.
fi