lkml.org 
[lkml]   [1998]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectSOCK_PACKET again..
Date
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META content='"MSHTML 4.71.1712.3"' name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#000000 size=2>this may have been here hundred times but I
couldn't find</FONT></DIV>
<DIV><FONT size=2>much of a help in the list's archive.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>I'm trying to fix dhcpcd daemon to work under new</FONT></DIV>
<DIV><FONT size=2>kernels 2.1.7x.<BR>As Mr. Alan Cox once replied to me,
SOCK_PACKET</FONT>&nbsp;</DIV>
<DIV><FONT size=2>is the way to go.</FONT></DIV>
<DIV><FONT size=2>Well, so to speak..</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>I tried to do the following steps:</FONT></DIV>
<DIV><FONT size=2>1. create a socket as
socket(AF_INET,SOCK_PACKET,htons(ETHERTYPE_IP))</FONT></DIV>
<DIV><FONT size=2>2. get a hardware address for eth0 interface in the usual way
with ioctl</FONT></DIV>
<DIV><FONT size=2>3. set SO_BROADCAST option on the socket</FONT>&nbsp;</DIV>
<DIV><FONT size=2>4. build the following message {</FONT>&nbsp;</DIV>
<DIV><FONT size=2>struct ether_header&nbsp; ethhdr;</FONT></DIV>
<DIV><FONT size=2>struct ip&nbsp; iph;</FONT>&nbsp;</DIV>
<DIV><FONT size=2>struct udphdr udph;</FONT></DIV>
<DIV><FONT size=2>struct dhcpMessage DhcpMessage;</FONT></DIV>
<DIV><FONT size=2>}&nbsp;</FONT></DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; dhcpMessage I build exactly as with
previous version of dhcpd</FONT>&nbsp;</DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; which worked fine by setting IP address of
interface</FONT>&nbsp;</DIV>
<DIV><FONT size=2>&nbsp;&nbsp;&nbsp; first to 0.</FONT>&nbsp;</DIV>
<DIV><FONT size=2>5. did copy &quot;eth0&quot; into
sockaddr.sa_data</FONT></DIV>
<DIV><FONT size=2>6. sent the message with sendto call</FONT>&nbsp;</DIV>
<DIV><FONT size=2>7. read the reply from dhcp server using
readfrom..</FONT>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Well, &quot;readfrom&quot; call does not get me
anything.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Which makes me suspect something is wrong in</FONT></DIV>
<DIV><FONT size=2>the [my?] logic. What's the difference between
SOCK_PACKET</FONT>&nbsp;</DIV>
<DIV><FONT size=2>and SOCK_RAW ?</FONT>&nbsp;</DIV>
<DIV><FONT size=2>And why there is SOCK_PACKET, and why there is no API
documentation</FONT></DIV>
<DIV><FONT size=2>for it?</FONT>&nbsp;</DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000 size=2>Thanks for your time,</FONT></DIV>
<DIV><FONT color=#000000 size=2>Serge</FONT></DIV>
<DIV><FONT color=#000000 size=2></FONT>&nbsp;</DIV></BODY></HTML>
\
 
 \ /
  Last update: 2005-03-22 13:41    [W:0.027 / U:0.156 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site