Re: How to send UDP packet from kernel?

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

 



Hi Se`bastien

|Daniele> your code seems to be quite demanded ;)

not so much .. you just need a little effort but not so much ;)

|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));	

i'm sorry but i never played with IPv6 ;(

|my socket works very fine, but I'm wondering if passing sizeof(sin) instead of
|sizeof(struct sockaddr) is wise. 

Why should it be wise?

|Could it cause some troubles at some point?

i don't think so.

|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)

Be aware, my kernel module doesn't compile with 2.6.

-- 

Daniele.




"I could have made money this way, and perhaps amused myself writing code. 
But I knew that at the end of my career, I would look back on years of 
building walls to divide people, and feel I had spent my life making the 
world a worse place."                               
                                                          Richard Stallman

--
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