MantisBT - Zandronum
View Issue Details
0000847Zandronum[All Projects] Bugpublic2012-05-13 13:122018-09-30 19:53
Koromix 
Torr Samaho 
normalminoralways
closedfixed 
LinuxArch Linux
98d 
1.0 
0000847: Broadcast permission denied
Here is what I'm getting with the latest Skulltag version when starting skulltag-server on Arch Linux (kernel 3.3.5, glibc 2.15) :

*** MAP01: entryway ***

compatflags changed to: 0
NETWORK_LaunchPacket: Permission denied
NETWORK_LaunchPacket: Address 192.168.1.255:15101
NETWORK_LaunchPacket: Permission denied
NETWORK_LaunchPacket: Address 192.168.1.255:15101
NETWORK_LaunchPacket: Permission denied
NETWORK_LaunchPacket: Address 192.168.1.255:15101
NETWORK_LaunchPacket: Permission denied
NETWORK_LaunchPacket: Address 192.168.1.255:15101
NETWORK_LaunchPacket: Permission denied
NETWORK_LaunchPacket: Address 192.168.1.255:15101
[...]
Simply start skulltag-server on Linux, I guess it will complain too on *BSD.
UDP broadcasting needs SO_BROADCAST flag set using setsockopt as per POSIX. Something like this should do it:

int allow = 1;
setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &allow, sizeof(allow));
No tags attached.
patch fix-setsockopt.patch (4,013) 2012-05-14 16:01
/tracker/file_download.php?file_id=622&type=bug
Issue History
2012-05-13 13:12KoromixNew Issue
2012-05-13 23:54DuskNote Added: 0003620
2012-05-13 23:54DuskStatusnew => feedback
2012-05-14 16:01KoromixFile Added: fix-setsockopt.patch
2012-05-14 16:07KoromixNote Added: 0003622
2012-05-14 16:07KoromixStatusfeedback => new
2012-05-14 16:13KoromixNote Edited: 0003622bug_revision_view_page.php?bugnote_id=3622#r1985
2012-05-14 17:40Torr SamahoNote Added: 0003625
2012-05-14 17:40Torr SamahoStatusnew => feedback
2012-05-16 10:33DuskStatusfeedback => needs testing
2012-05-16 12:50KoromixNote Added: 0003640
2012-05-20 20:30DuskNote Added: 0003649
2012-05-20 20:30DuskStatusneeds testing => resolved
2012-05-20 20:30DuskFixed in Version => 1.0-beta
2012-05-20 20:30DuskResolutionopen => fixed
2012-05-20 20:30DuskAssigned To => Dusk
2012-05-20 20:30DuskAssigned ToDusk =>
2012-05-20 20:30DuskStatusresolved => feedback
2012-05-20 20:30DuskResolutionfixed => reopened
2012-05-20 20:30DuskStatusfeedback => resolved
2012-05-20 20:30DuskResolutionreopened => fixed
2012-05-20 20:30DuskAssigned To => Dusk
2012-05-20 20:30DuskAssigned ToDusk => Torr Samaho
2012-05-20 20:30DuskStatusresolved => feedback
2012-05-20 20:30DuskResolutionfixed => reopened
2012-05-20 20:30DuskStatusfeedback => resolved
2012-05-20 20:30DuskResolutionreopened => fixed
2012-06-09 13:22Torr SamahoCategoryGeneral => Bug
2012-07-15 16:45Blzut3Fixed in Version1.0-beta => 1.0
2018-09-30 19:53Blzut3Statusresolved => closed

Notes
(0003620)
Dusk   
2012-05-13 23:54   
Skulltag already uses this form of setsockopt. Are you sure this isn't just a problem with your router?
(0003622)
Koromix   
2012-05-14 16:07   
(edited on: 2012-05-14 16:13)
OK I just found out about Torr Samaho's repository and dug the source a little. It appears that setsockopt was used incorrectly, as it was passed a bool which is implementation-defined and may not be of the same size as an int.

On my system, sizeof(bool) returns 1 while sizeof(int) is 4. Both Winsock and POSIX expect an int to be used, but I guess that either Windows' builds have sizeof(bool) == 4 or Winsock does not care about being given a char. Well, actually the MSDN says you should use BOOL which is defined as an int.

I made a small patch to fix all calls to setsockopt (in masterserver, in statsmaker, in src and for upnpnat code). It fixes the error on my system, but I can't build for Windows so you should check that it does not break anything (I doubt so, but I've been bitten more than once).

(0003625)
Torr Samaho   
2012-05-14 17:40   
Thanks! Seems to work fine under Windows, so I added your patch.
(0003640)
Koromix   
2012-05-16 12:50   
Thanks! Pulled and tested here, works perfectly for me :)
(0003649)
Dusk   
2012-05-20 20:30   
Marking this as resolved, then.