--- /dev/null
+subrequest DHCPv4.Request {
+ # Client -> Server
+ &request += {
+ &Message-Type = Request
+
+ &Hardware-Type = Ethernet
+ &Hardware-Address-Length = 6
+ &Hop-Count = 0
+ &Transaction-Id = 15646
+ &Number-of-Seconds = 0
+ &Flags = 0
+
+ &Client-IP-Address = 0.0.0.0
+ &Your-IP-Address = 0.0.0.0
+ &Server-IP-Address = 0.0.0.0
+ &Gateway-IP-Address = 0.0.0.0
+ &Client-Hardware-Address = ca:fe:ca:fe:ca:fe
+ &Client-Identifier = 0x01020304050607
+ &Requested-IP-Address = 192.168.0.10
+
+ &Server-Identifier = 192.168.0.1
+ &Parameter-Request-List = Subnet-Mask
+ &Parameter-Request-List = Router-Address
+ &Parameter-Request-List = Domain-Name
+ &Parameter-Request-List = Domain-Name-Server
+ &Parameter-Request-List = NTP-Servers
+ &Network-Subnet = 0.0.0.0/32
+ }
+
+ call dhcpv4 {
+ # 'Discover' expects 'Ack'
+ if (&reply.Packet-Type != Ack) {
+ test_fail
+ }
+
+ # We should reply the below attributes...
+ if (!&reply.Transaction-Id) {
+ test_fail
+ }
+
+ if (&reply.Subnet-Mask != "255.255.255.0") {
+ test_fail
+ }
+
+ if (&reply.Gateway-IP-Address != "0.0.0.0") {
+ test_fail
+ }
+ }
+}
--- /dev/null
+subrequest DHCPv4.Discover {
+ # Server -> Client
+ &request += {
+ &Message-Type = Discover
+
+ &Hardware-Type = Ethernet
+ &Hardware-Address-Length = 6
+ &Hop-Count = 0
+ &Transaction-Id = 12345
+ &Number-of-Seconds = 0
+ &Flags = 0
+
+ &Client-IP-Address = 0.0.0.0
+ &Your-IP-Address = 0.0.0.0
+ &Server-IP-Address = 0.0.0.0
+ &Gateway-IP-Address = 0.0.0.0
+ &Client-Hardware-Address = ca:fe:ca:fe:ca:fe
+ &Client-Identifier = 0x01020304050607
+ &Requested-IP-Address = 0.0.0.0
+
+
+ &Parameter-Request-List = Subnet-Mask
+ &Parameter-Request-List = Router-Address
+ &Parameter-Request-List = Domain-Name
+ &Parameter-Request-List = Domain-Name-Server
+ &Parameter-Request-List = NTP-Servers
+ &Network-Subnet = 0.0.0.0/32
+ }
+
+ call dhcpv4 {
+ # 'Discover' expects 'Offer'
+ if (&reply.Packet-Type != Offer) {
+ test_fail
+ }
+
+ # We should reply the below attributes...
+ if (!&reply.Transaction-Id) {
+ test_fail
+ }
+
+ if (&reply.Subnet-Mask != "255.255.255.0") {
+ test_fail
+ }
+
+ if (&reply.Gateway-IP-Address != "0.0.0.0") {
+ test_fail
+ }
+ }
+}
--- /dev/null
+# -*- text -*-
+#
+# test configuration file. Do not install.
+#
+# $Id$
+#
+
+#
+# Minimal dhcpv6.conf for testing
+#
+
+testdir = $ENV{TESTDIR}
+output = $ENV{OUTPUT}
+run_dir = ${output}
+raddb = raddb
+pidfile = ${run_dir}/radiusd.pid
+panic_action = "gdb -batch -x src/tests/panic.gdb %e %p > ${run_dir}/gdb.log 2>&1; cat ${run_dir}/gdb.log"
+
+maindir = ${raddb}
+radacctdir = ${run_dir}/radacct
+modconfdir = ${maindir}/mods-config
+certdir = ${maindir}/certs
+cadir = ${maindir}/certs
+test_port = $ENV{TEST_PORT}
+
+# Only for testing!
+# Setting this on a production system is a BAD IDEA.
+security {
+ allow_vulnerable_openssl = yes
+}
+
+policy {
+ $INCLUDE ../policy.conf
+ $INCLUDE ${raddb}/policy.d/control
+ $INCLUDE ${raddb}/policy.d/dhcp
+}
+
+modules {
+ dhcpv4 {
+ ipaddr = 127.0.0.1
+ # port = 68
+ # interface = eth0
+ # max_packet_size = 576
+ # send_buff = 1048576
+ }
+}
+
+#
+# This virtual server is chosen for processing requests when using:
+#
+# radiusd -Xd src/tests/ -i 127.0.0.1 -p 12340 -n test
+#
+server dhcpv4 {
+ namespace = dhcpv4
+ listen {
+ type = Discover
+ type = Request
+ transport = udp
+ udp {
+ ipaddr = 127.0.0.1
+ port = 67
+ broadcast = no
+ }
+ }
+
+ recv Discover {
+ &reply += {
+ &Hardware-Type = Ethernet
+ &Hardware-Address-Length = 6
+ &Hop-Count = 0
+ &Transaction-Id = 15645
+ &Number-of-Seconds = 0
+ &Flags = 0
+ &Client-IP-Address = 0.0.0.0
+ &Your-IP-Address = 192.168.0.10
+ &Server-IP-Address = 192.168.0.1
+ &Gateway-IP-Address = 0.0.0.0
+ &Client-Hardware-Address = ca:fe:ca:fe:ca:fe
+ &Message-Type = Offer
+ &Subnet-Mask = 255.255.255.0
+ &Renewal-Time = 1800
+ &Rebinding-Time = 3150
+ &IP-Address-Lease-Time = 3600
+ &Server-Identifier = 192.168.0.1
+ &Network-Subnet = 0.0.0.0/32
+ &Domain-Name = "lorisdoancapistao.com"
+ }
+ ok
+ }
+
+ recv Request {
+ &reply += {
+ &Hardware-Type = Ethernet
+ &Hardware-Address-Length = 6
+ &Hop-Count = 0
+ &Transaction-Id = 15646
+ &Number-of-Seconds = 0
+ &Flags = 0
+ &Client-IP-Address = 0.0.0.0
+ &Your-IP-Address = 192.168.0.10
+ &Server-IP-Address = 0.0.0.0
+ &Gateway-IP-Address = 0.0.0.0
+ &Client-Hardware-Address = ca:fe:ca:fe:ca:fe
+ &Message-Type = Ack
+ &Renewal-Time = 1800
+ &Rebinding-Time = 3150
+ &IP-Address-Lease-Time = 3600
+ &Server-Identifier = 192.168.0.1
+ &Subnet-Mask = 255.255.255.0
+ &Network-Subnet = 0.0.0.0/32
+ }
+ ok
+ }
+}
+