Re: How to send UDP packet from kernel?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Daniele> your code seems to be quite demanded ;)


after a quick look, I found a little difference with my code in the bind call.

you do it that way:

retval = sock->ops->bind(sock, (struct sockaddr *) knetlog->addr_in,
sizeof(struct sockaddr)); 


whereas I use IPv6 and therefore do so:

   
struct sockaddr_in6 sin;
...
error = sock->ops->bind(sock,(struct sockaddr*)&sin,sizeof(sin));	


my socket works very fine, but I'm wondering if passing sizeof(sin) instead of
sizeof(struct sockaddr) is wise. Could it cause some troubles at some point?




may I suggest a pointer concerning kernel threads?
http://www.scs.ch/~frey/linux/kernelthreads.html

khttpd might also be used as example of threads and sockets...
(from 2.4 if i recall correctly, but has been given up in 2.6)


Cheers,
Sébastien...
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux