DHCP reply problem

Александр Подрезенко admin at capt.net.ru
Thu Mar 3 10:49:13 CET 2011


Hello all.
I tried to configure freeradius to operate as dhcp server.
I have one problem. Freeradius receives DHCP-Discover and DHCP-Request packets,
but replies are not sent. In logs all OK, but strace output contains
error EINVAL (Invalid argument) in packet sending via sendmsg.


Freeradius version is 2.1.x from git.

My config file:

dhcp:===========================

listen {
        ipaddr = *
        port = 67
        type = dhcp
        interface = eth0
        broadcast = yes
}

dhcp DHCP-Discover {
        linelog
        update reply {
                DHCP-Message-Type = DHCP-Offer
                DHCP-Domain-Name-Server = 192.168.194.169
                DHCP-Domain-Name-Server = 192.168.192.53
                DHCP-Subnet-Mask = 255.255.255.128
                DHCP-Router-Address = 192.168.194.126
                DHCP-IP-Address-Lease-Time = 86400
                DHCP-DHCP-Server-Identifier = 192.168.194.105
                DHCP-Your-IP-Address = 192.168.194.106
        }
        linelog
        ok
}

dhcp DHCP-Request {
        update reply {
               DHCP-Message-Type = DHCP-Ack
        }
        update reply {
                DHCP-Domain-Name-Server = 192.168.194.169
                DHCP-Domain-Name-Server = 192.168.192.53
                DHCP-Subnet-Mask = 255.255.255.128
                DHCP-Router-Address = 192.168.194.126
                DHCP-IP-Address-Lease-Time = 86400
                DHCP-DHCP-Server-Identifier = 192.168.194.105
                DHCP-Your-IP-Address = 192.168.194.106
        }
        ok
}

dhcp:===========================

Log fragment:

freeradius -X ==================
Received DHCP-Discover of id f1b3e779 from 0.0.0.0:68 to 255.255.255.255:67
	DHCP-Opcode = Client-Message
	DHCP-Hardware-Type = Ethernet
	DHCP-Hardware-Address-Length = 6
	DHCP-Hop-Count = 0
	DHCP-Transaction-Id = 4055099257
	DHCP-Number-of-Seconds = 31
	DHCP-Flags = 0
	DHCP-Client-IP-Address = 0.0.0.0
	DHCP-Your-IP-Address = 0.0.0.0
	DHCP-Server-IP-Address = 0.0.0.0
	DHCP-Gateway-IP-Address = 0.0.0.0
	DHCP-Client-Hardware-Address = 00:22:15:30:16:7b
	DHCP-Message-Type = DHCP-Discover
	DHCP-Requested-IP-Address = 192.168.194.106
	DHCP-Hostname = "capt-eee"
	DHCP-Parameter-Request-List = DHCP-Subnet-Mask
	DHCP-Parameter-Request-List = DHCP-Broadcast-Address
	DHCP-Parameter-Request-List = DHCP-Time-Offset
	DHCP-Parameter-Request-List = DHCP-Router-Address
	DHCP-Parameter-Request-List = DHCP-Domain-Name
	DHCP-Parameter-Request-List = DHCP-Domain-Name-Server
	DHCP-Parameter-Request-List = DHCP-Domain-Search
	DHCP-Parameter-Request-List = DHCP-Hostname
	DHCP-Parameter-Request-List = DHCP-NETBIOS-Name-Servers
	DHCP-Parameter-Request-List = DHCP-NETBIOS
	DHCP-Parameter-Request-List = DHCP-Interface-MTU-Size
	DHCP-Parameter-Request-List = DHCP-Classless-Static-Route
	DHCP-Parameter-Request-List = DHCP-NTP-Servers
server dhcp {
Trying sub-section dhcp DHCP-Discover {...}
+- entering group DHCP-Discover {...}
[linelog] 	expand: %{reply:DHCP-Message-Type} ->
[linelog] 	... expanding second conditional
[linelog] 	expand: %{request:DHCP-Message-Type} -> DHCP-Discover
[linelog] 	expand:
%{%{reply:DHCP-Message-Type}:-%{request:DHCP-Message-Type}} ->
DHCP-Discover
[linelog] 	expand: /var/log/radius/linelog -> /var/log/radius/linelog
[linelog] 	expand: %{DHCP-Transaction-Id} DISCOVER:
[%{DHCP-Client-Hardware-Address}] via (%{DHCP-Gateway-IP-Address})
%{DHCP-Hostname} -> 4055099257 DISCOVER: [00:22:15:30:16:7b] via
(0.0.0.0) capt-eee
++[linelog] returns ok
++[reply] returns ok
[linelog] 	expand: %{reply:DHCP-Message-Type} -> DHCP-Offer
[linelog] 	expand:
%{%{reply:DHCP-Message-Type}:-%{request:DHCP-Message-Type}} ->
DHCP-Offer
[linelog] 	expand: /var/log/radius/linelog -> /var/log/radius/linelog
[linelog] 	expand: %{DHCP-Transaction-Id} OFFER:
%{reply:DHCP-Your-IP-Address} to [%{DHCP-Client-Hardware-Address}] ...
-> 4055099257 OFFER: 192.168.194.106 to [00:22:15:30:16:7b] ...
++[linelog] returns ok
++[ok] returns ok
} # server dhcp
Sending DHCP-Offer of id f1b3e779 from 0.0.0.0:67 to 255.255.255.255:68
	DHCP-Subnet-Mask = 255.255.255.128
	DHCP-Router-Address = 192.168.194.126
	DHCP-Domain-Name-Server = 192.168.194.169
	DHCP-IP-Address-Lease-Time = 86400
	DHCP-DHCP-Server-Identifier = 192.168.194.105
Finished request 5.
Cleaning up request 5 ID -239868039 with timestamp +85
Going to the next request
Ready to process requests.
freeradius -X ==================

STRACE output =================
write(1, "Ready to process requests.\n", 27) = 27
select(20, [11 13 14 15 16 17 18 19], NULL, NULL, NULL) = 1 (in [17])
getsockname(17, {sa_family=AF_INET, sin_port=htons(67),
sin_addr=inet_addr("0.0.0.0")}, [16]) = 0
recvmsg(17, {msg_name(16)={sa_family=AF_INET, sin_port=htons(68),
sin_addr=inet_addr("0.0.0.0")},
msg_iov(1)=[{"\1\1\6\0\361\263\347y\0\37\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\"\0250"...,
1460}], msg_controllen=32, {cmsg_len=28, cmsg_level=SOL_IP,
cmsg_type=, ...}, msg_flags=0}, 0) = 300
write(1, "Received DHCP-Discover of id f1b"..., 76) = 76
write(1, "\tDHCP-Opcode = Client-Message\n", 30) = 30
write(1, "\tDHCP-Hardware-Type = Ethernet\n", 31) = 31
write(1, "\tDHCP-Hardware-Address-Length = "..., 34) = 34
write(1, "\tDHCP-Hop-Count = 0\n", 20)  = 20
write(1, "\tDHCP-Transaction-Id = 405509925"..., 34) = 34
write(1, "\tDHCP-Number-of-Seconds = 31\n", 29) = 29
write(1, "\tDHCP-Flags = 0\n", 16)      = 16
write(1, "\tDHCP-Client-IP-Address = 0.0.0."..., 34) = 34
write(1, "\tDHCP-Your-IP-Address = 0.0.0.0\n", 32) = 32
write(1, "\tDHCP-Server-IP-Address = 0.0.0."..., 34) = 34
write(1, "\tDHCP-Gateway-IP-Address = 0.0.0"..., 35) = 35
write(1, "\tDHCP-Client-Hardware-Address = "..., 50) = 50
write(1, "\tDHCP-Message-Type = DHCP-Discov"..., 35) = 35
write(1, "\tDHCP-Requested-IP-Address = 80."..., 43) = 43
write(1, "\tDHCP-Hostname = \"capt-eee\"\n", 28) = 28
write(1, "\tDHCP-Parameter-Request-List = D"..., 48) = 48
write(1, "\tDHCP-Parameter-Request-List = D"..., 54) = 54
write(1, "\tDHCP-Parameter-Request-List = D"..., 48) = 48
write(1, "\tDHCP-Parameter-Request-List = D"..., 51) = 51
write(1, "\tDHCP-Parameter-Request-List = D"..., 48) = 48
write(1, "\tDHCP-Parameter-Request-List = D"..., 55) = 55
write(1, "\tDHCP-Parameter-Request-List = D"..., 50) = 50
write(1, "\tDHCP-Parameter-Request-List = D"..., 45) = 45
write(1, "\tDHCP-Parameter-Request-List = D"..., 57) = 57
write(1, "\tDHCP-Parameter-Request-List = D"..., 44) = 44
write(1, "\tDHCP-Parameter-Request-List = D"..., 55) = 55
write(1, "\tDHCP-Parameter-Request-List = D"..., 59) = 59
write(1, "\tDHCP-Parameter-Request-List = D"..., 48) = 48
write(1, "server dhcp {\n", 14)         = 14
write(1, "Trying sub-section dhcp DHCP-Dis"..., 44) = 44
write(1, "+- entering group DHCP-Discover "..., 38) = 38
write(1, "[linelog] \texpand: %{reply:DHCP-"..., 50) = 50
write(1, "[linelog] \t... expanding second "..., 44) = 44
write(1, "[linelog] \texpand: %{request:DHC"..., 65) = 65
write(1, "[linelog] \texpand: %{%{reply:DHC"..., 96) = 96
write(1, "[linelog] \texpand: /var/log/radi"..., 70) = 70
open("/var/log/radius/linelog", O_WRONLY|O_CREAT|O_APPEND, 0600) = 20
write(1, "[linelog] \texpand: %{DHCP-Transa"..., 203) = 203
write(20, "4055099257 DISCOVER: [00:22:15:3"..., 64) = 64
close(20)                               = 0
write(1, "++[linelog] returns ok\n", 23) = 23
write(1, "++[reply] returns ok\n", 21)  = 21
write(1, "[linelog] \texpand: %{reply:DHCP-"..., 60) = 60
write(1, "[linelog] \texpand: %{%{reply:DHC"..., 93) = 93
write(1, "[linelog] \texpand: /var/log/radi"..., 70) = 70
open("/var/log/radius/linelog", O_WRONLY|O_CREAT|O_APPEND, 0600) = 20
write(1, "[linelog] \texpand: %{DHCP-Transa"..., 182) = 182
write(20, "4055099257 OFFER: 80.91.194.106 "..., 59) = 59
close(20)                               = 0
write(1, "++[linelog] returns ok\n", 23) = 23
write(1, "++[ok] returns ok\n", 18)     = 18
write(1, "} # server dhcp\n", 16)       = 16
write(1, "Sending DHCP-Offer of id f1b3e77"..., 72) = 72
write(1, "\tDHCP-Subnet-Mask = 255.255.255."..., 36) = 36
write(1, "\tDHCP-Router-Address = 80.91.194"..., 37) = 37
write(1, "\tDHCP-Domain-Name-Server = 80.91"..., 41) = 41
write(1, "\tDHCP-IP-Address-Lease-Time = 86"..., 36) = 36
write(1, "\tDHCP-DHCP-Server-Identifier = 8"..., 45) = 45
sendmsg(17, {msg_name(16)={sa_family=AF_INET, sin_port=htons(68),
sin_addr=inet_addr("255.255.255.255")},
msg_iov(1)=[{"\2\1\6\0\361\263\347y\0\0\0\0\0\0\0\0P[\302jP[\302i\0\0\0\0\0\"\0250"...,
300}], msg_controllen=32, {cmsg_len=28, cmsg_level=SOL_IP, cmsg_type=,
...}, msg_flags=0}, 0) = -1 EINVAL (Invalid argument)
write(1, "Finished request 5.\n", 20)   = 20
write(1, "Cleaning up request 5 ID -239868"..., 55) = 55
write(1, "Going to the next request\n", 26) = 26
wait4(-1, NULL, 0, NULL)                = -1 ECHILD (No child processes)
write(1, "Ready to process requests.\n", 27) = 27

STRACE output =================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20110303/bee26073/attachment.html>


More information about the Freeradius-Users mailing list