Re: [bind] How to send UDP packet from kernel?

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

 



|> 
|> |my socket works very fine, but I'm wondering if passing sizeof(sin) instead
|> |of sizeof(struct sockaddr) is wise. 
|
|My question was more porting the size expected by bind. Is it mandatory
|sizeof(struct sockaddr) or sizeof(struct_we_use) ?
|I just do like kHTTPd (+ IPv6)

they returns the same result ;)


|what does bind() use this size for? if the given size is wrong, wouldnt it fool
|some pointers?

look at: net/ipv4/af_inet.c::inet_bind

if the "addr_len" parameter is less than sizeof(struct sockaddr_in)
inet_bind returns -EINVAL.
addr_len is, also, passed to the raw socket bind function (if any)... and no more.

Hope these helps.


-- 

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