summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcp
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2019-03-09 19:24:07 +0100
committerFrancis Dupont <fdupont@isc.org>2019-03-12 09:59:39 +0100
commitf3563396d2227e48e96a5d65587406d8d1868db5 (patch)
treeffc3d67fc4d37740511e77d0d75e9e3d92842b34 /src/lib/dhcp
parent[master] Added ChangeLog entry for deleteSharedNetworkSubnets4 (diff)
downloadkea-f3563396d2227e48e96a5d65587406d8d1868db5.tar.xz
kea-f3563396d2227e48e96a5d65587406d8d1868db5.zip
[519-dhcp-server-response-an-empty-rai-field] Added the bad RAI case
Diffstat (limited to 'src/lib/dhcp')
-rw-r--r--src/lib/dhcp/tests/pkt_captures.h8
-rw-r--r--src/lib/dhcp/tests/pkt_captures4.cc53
2 files changed, 61 insertions, 0 deletions
diff --git a/src/lib/dhcp/tests/pkt_captures.h b/src/lib/dhcp/tests/pkt_captures.h
index 56a3aaf10f..9e93ef04bf 100644
--- a/src/lib/dhcp/tests/pkt_captures.h
+++ b/src/lib/dhcp/tests/pkt_captures.h
@@ -33,6 +33,14 @@ public:
/// @return relayed DISCOVER
static isc::dhcp::Pkt4Ptr captureRelayedDiscover2();
+ /// @brief returns captured DISCOVER that went through a relay
+ ///
+ /// See method code for a detailed explanation. This is a discover from
+ /// a buggy relay device with a bad suboption.
+ ///
+ /// @return relayed DISCOVER
+ static isc::dhcp::Pkt4Ptr captureBadRelayedDiscover();
+
/// @brief returns captured DISCOVER that contains a valid VIVSO option
///
/// See method code for a detailed explanation.
diff --git a/src/lib/dhcp/tests/pkt_captures4.cc b/src/lib/dhcp/tests/pkt_captures4.cc
index 53836bea86..018506ed43 100644
--- a/src/lib/dhcp/tests/pkt_captures4.cc
+++ b/src/lib/dhcp/tests/pkt_captures4.cc
@@ -178,6 +178,59 @@ Bootstrap Protocol
return (packetFromCapture(hex_string));
}
+Pkt4Ptr PktCaptures::captureBadRelayedDiscover() {
+
+/* Modified packet 1 with a bad RAI.
+
+Bootstrap Protocol
+ Message type: Boot Request (1)
+ Hardware type: Ethernet
+ Hardware address length: 6
+ Hops: 1
+ Transaction ID: 0x5d05478d
+ Seconds elapsed: 0
+ Bootp flags: 0x0000 (Unicast)
+ Client IP address: 0.0.0.0 (0.0.0.0)
+ Your (client) IP address: 0.0.0.0 (0.0.0.0)
+ Next server IP address: 0.0.0.0 (0.0.0.0)
+ Relay agent IP address: 10.254.226.1 (10.254.226.1)
+ Client MAC address: Netgear_b8:15:14 (20:e5:2a:b8:15:14)
+ Client hardware address padding: 00000000000000000000
+ Server host name not given
+ Boot file name not given
+ Magic cookie: DHCP
+ Option: (53) DHCP Message Type
+ Option: (55) Parameter Request List
+ Option: (60) Vendor class identifier (docsis3.0)
+ Option: (125) V-I Vendor-specific Information
+ - suboption 1 (Option Request): requesting option 2
+ - suboption 5 (Modem Caps): 117 bytes
+ Option: (43) Vendor-Specific Information (CableLabs)
+ Option: (61) Client identifier
+ Option: (57) Maximum DHCP Message Size
+ Option: (82) Agent Information Option */
+
+ string hex_string =
+ "010106015d05478d000000000000000000000000000000000afee20120e52ab8151400"
+ "0000000000000000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000000000000000000000000000638253633501013707"
+ "0102030407067d3c0a646f63736973332e303a7d7f0000118b7a010102057501010102"
+ "010303010104010105010106010107010f0801100901030a01010b01180c01010d0200"
+ "400e0200100f010110040000000211010014010015013f160101170101180104190104"
+ "1a01041b01201c01021d01081e01201f01102001102101022201012301002401002501"
+ "01260200ff2701012b59020345434d030b45434d3a45524f55544552040d3242523232"
+ "39553430303434430504312e3034060856312e33332e30330707322e332e3052320806"
+ "30303039354209094347333030304443520a074e657467656172fe01083d0fff2ab815"
+ "140003000120e52ab81514390205dc52205141000102030405060708090a0b0c0d0e0f"
+ "101112131415161718191a1b1c1d";
+
+ return (packetFromCapture(hex_string));
+}
+
Pkt4Ptr PktCaptures::discoverWithValidVIVSO() {
/* DISCOVER that contains a valid VIVSO option 125
User Datagram Protocol, Src Port: 67, Dst Port: 67