Dhcp
Scenario: create a DHCP Ack
- When I create a packet with:
Pio::Dhcp::Ack.new( source_mac: 'aa:bb:cc:dd:ee:ff', destination_mac: '11:22:33:44:55:66', source_ip_address: '192.168.0.10', destination_ip_address: '192.168.0.1', transaction_id: 0xdeadbeef, renewal_time_value: 0xdeadbeef, rebinding_time_value: 0xdeadbeef, ip_address_lease_time: 0xdeadbeef, subnet_mask: '255.255.255.0' ) - Then the packet has the following fields and values:
field value class Pio::Dhcp::Ack destination_mac 11:22:33:44:55:66 source_mac aa:bb:cc:dd:ee:ff ether_type 2048 ip_version 4 ip_header_length 5 ip_type_of_service 0 ip_total_length 328 ip_identifier 0 ip_flag 0 ip_fragment 0 ip_ttl 128 ip_protocol 17 ip_header_checksum 47177 source_ip_address 192.168.0.10 destination_ip_address 192.168.0.1 udp_source_port 67 udp_destination_port 68 udp_length 308 udp_checksum 7012 message_type 5 hw_addr_type 1 hw_addr_len 6 hops 0 transaction_id 3735928559 seconds 0 bootp_flags 0 client_ip_address 0.0.0.0 your_ip_address 192.168.0.1 next_server_ip_address 0.0.0.0 relay_agent_ip_address 0.0.0.0 client_mac_address aa:bb:cc:dd:ee:ff subnet_mask 255.255.255.0 server_identifier 192.168.0.10 renewal_time_value 3735928559 rebinding_time_value 3735928559 ip_address_lease_time 3735928559
Scenario: create a DHCP Discover
- When I create a packet with:
Pio::Dhcp::Discover.new( source_mac: '24:db:ac:41:e5:5b', transaction_id: 0xdeadbeef ) - Then the packet has the following fields and values:
field value class Pio::Dhcp::Discover destination_mac ff:ff:ff:ff:ff:ff source_mac 24:db:ac:41:e5:5b ether_type 2048 ip_version 4 ip_header_length 5 ip_type_of_service 0 ip_total_length 328 ip_identifier 0 ip_flag 0 ip_fragment 0 ip_ttl 128 ip_protocol 17 ip_header_checksum 14758 source_ip_address 0.0.0.0 destination_ip_address 255.255.255.255 udp_source_port 68 udp_destination_port 67 udp_length 308 udp_checksum 34836 message_type 1 hw_addr_type 1 hw_addr_len 6 hops 0 transaction_id 3735928559 seconds 0 bootp_flags 0 client_ip_address 0.0.0.0 your_ip_address 0.0.0.0 next_server_ip_address 0.0.0.0 relay_agent_ip_address 0.0.0.0 client_mac_address 24:db:ac:41:e5:5b parameters_list [1, 3, 6, 42] client_identifier 24:db:ac:41:e5:5b
Scenario: create a DHCP Request
- When I create a packet with:
Pio::Dhcp::Request.new( source_mac: '24:db:ac:41:e5:5b', transaction_id: 0xdeadbeef, server_identifier: '192.168.0.1', requested_ip_address: '192.168.0.10' ) - Then the packet has the following fields and values:
field value class Pio::Dhcp::Request destination_mac ff:ff:ff:ff:ff:ff source_mac 24:db:ac:41:e5:5b ether_type 2048 ip_version 4 ip_header_length 5 ip_type_of_service 0 ip_total_length 328 ip_identifier 0 ip_flag 0 ip_fragment 0 ip_ttl 128 ip_protocol 17 ip_header_checksum 14758 source_ip_address 0.0.0.0 destination_ip_address 255.255.255.255 udp_source_port 68 udp_destination_port 67 udp_length 308 udp_checksum 52915 message_type 3 hw_addr_type 1 hw_addr_len 6 hops 0 transaction_id 3735928559 seconds 0 bootp_flags 0 client_ip_address 0.0.0.0 your_ip_address 0.0.0.0 next_server_ip_address 0.0.0.0 relay_agent_ip_address 0.0.0.0 client_mac_address 24:db:ac:41:e5:5b parameters_list [1, 3, 6, 42] client_identifier 24:db:ac:41:e5:5b requested_ip_address 192.168.0.10
Scenario: create a DHCP Offer
- When I create a packet with:
Pio::Dhcp::Offer.new( source_mac: 'aa:bb:cc:dd:ee:ff', destination_mac: '11:22:33:44:55:66', source_ip_address: '192.168.0.10', destination_ip_address: '192.168.0.1', transaction_id: 0xdeadbeef, renewal_time_value: 0xdeadbeef, rebinding_time_value: 0xdeadbeef, ip_address_lease_time: 0xdeadbeef, subnet_mask: '255.255.255.0' ) - Then the packet has the following fields and values:
field value class Pio::Dhcp::Offer destination_mac 11:22:33:44:55:66 source_mac aa:bb:cc:dd:ee:ff ether_type 2048 ip_version 4 ip_header_length 5 ip_type_of_service 0 ip_total_length 328 ip_identifier 0 ip_flag 0 ip_fragment 0 ip_ttl 128 ip_protocol 17 ip_header_checksum 47177 source_ip_address 192.168.0.10 destination_ip_address 192.168.0.1 udp_source_port 67 udp_destination_port 68 udp_length 308 udp_checksum 7780 message_type 2 hw_addr_type 1 hw_addr_len 6 hops 0 transaction_id 3735928559 seconds 0 bootp_flags 0 client_ip_address 0.0.0.0 your_ip_address 192.168.0.1 next_server_ip_address 0.0.0.0 relay_agent_ip_address 0.0.0.0 client_mac_address aa:bb:cc:dd:ee:ff subnet_mask 255.255.255.0 server_identifier 192.168.0.10 renewal_time_value 3735928559 rebinding_time_value 3735928559 ip_address_lease_time 3735928559
Scenario: parse dhcp.pcap
- Then I parse a file named "
dhcp.pcap" with "Pio::Dhcp" class
Source: features/dhcp.feature at commit 40dd0fb6, Pio (GPL license).