SOCK_PACKET again..

Sergei Viznyuk (sviznyuk@columbus.rr.com)
Mon, 12 Jan 1998 23:03:03 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0024_01BD1FAE.3C7AE720
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

this may have been here hundred times but I couldn't find
much of a help in the list's archive.

I'm trying to fix dhcpcd daemon to work under new
kernels 2.1.7x.
As Mr. Alan Cox once replied to me, SOCK_PACKET
is the way to go.
Well, so to speak..

I tried to do the following steps:
1. create a socket as socket(AF_INET,SOCK_PACKET,htons(ETHERTYPE_IP))
2. get a hardware address for eth0 interface in the usual way with ioctl
3. set SO_BROADCAST option on the socket
4. build the following message {
struct ether_header ethhdr;
struct ip iph;
struct udphdr udph;
struct dhcpMessage DhcpMessage;
}=20
dhcpMessage I build exactly as with previous version of dhcpd
which worked fine by setting IP address of interface
first to 0.
5. did copy "eth0" into sockaddr.sa_data
6. sent the message with sendto call
7. read the reply from dhcp server using readfrom..

Well, "readfrom" call does not get me anything.

Which makes me suspect something is wrong in
the [my?] logic. What's the difference between SOCK_PACKET
and SOCK_RAW ?
And why there is SOCK_PACKET, and why there is no API documentation
for it?

Thanks for your time,
Serge

------=_NextPart_000_0024_01BD1FAE.3C7AE720
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">

this may have been here hundred = times but I=20 couldn't find
much of a help in the list's archive.
 
I'm trying to fix dhcpcd daemon to work under = new
kernels 2.1.7x.
As Mr. Alan Cox once replied to = me,=20 SOCK_PACKET
 
is the way to go.
Well, so to speak..
 
I tried to do the following steps:
1. create a socket as=20 socket(AF_INET,SOCK_PACKET,htons(ETHERTYPE_IP))
2. get a hardware address for eth0 interface in the = usual way=20 with ioctl
3. set SO_BROADCAST option on the = socket 
4. build the following message { 
struct ether_header  ethhdr;
struct ip  iph; 
struct udphdr udph;
struct dhcpMessage DhcpMessage;
    dhcpMessage I build exactly as = with=20 previous version of dhcpd 
    which worked fine by setting IP = address of=20 interface 
    first to 0. 
5. did copy "eth0" into=20 sockaddr.sa_data
6. sent the message with sendto = call 
7. read the reply from dhcp server using=20 readfrom.. 
 
Well, "readfrom" call does not get me=20 anything.
 
Which makes me suspect something is wrong = in
the [my?] logic. What's the difference between=20 SOCK_PACKET 
and SOCK_RAW ? 
And why there is SOCK_PACKET, and why there is no = API=20 documentation
for it? 
 
Thanks for your time,
Serge
 
------=_NextPart_000_0024_01BD1FAE.3C7AE720--