@adjuster ..
In fact, I just got it. When I set SO_BROADCAST , I get 92 (package not installed)
Which package should I install, then?
Edit: kernel version 2.6.18, and you're right! 92 ENOPROTOOPT
//Socket creation sock_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock); //Broadcasting int broadcast = 1; int err; if( (err = sock->ops->setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&broadcast, sizeof broadcast)) < 0 ) { printk(KERN_ALERT MODULE_NAME ": Could not configure broadcast, error %d\n", err); return -1; }
Edit: I have this from the setsockopt man page ...
ENOPROTOOPT
The option is unknown at the specified level.
... therefore, I believe SOL_SOCKET not a valid value. I also tried IPPROTO_UDP instead of SOL_SOCKET with no luck.
Edit: http://docs.hp.com/en/32650-90372/ch02s10.html says that SO_BROADCAST is a SOL_SOCKET level SOL_SOCKET , but I keep getting -92
Edit: I'm desperate, so I tried SOL_UDP , another -92.
Yes, this is fun:) ... Good synergy! In the end (I hope we get there soon) let the assembly of the final answer be clean and enjoyable! :)
Edit: even if the broadcast flag is hard-set, sock_sendmsg will fail (-13, "Permission denied")
sock->sk->sk_flags |= SO_BROADCAST;
I really need help with this ...