Skip to contentSkip to conversation

EACCES sending UDP to broadcast address?

DISCUSSION Ben Greear 3 participants 4 messages Apr 10, 2015

Subsystems (2)
lore
Share & tools
lore

Ben Greear

author
#0 lore raw

I'm running as root user, 4.0-rc6 + hack kernel.

User-space app is (or should be) trying to send a UDP frame to 255.255.255.255 destination.

I am getting EACCESS from sendmmsg.

Is this expected? Is there something even more special than root these days?

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#1 lore raw
Quoted 9 lines · Ben Greear

I'm running as root user, 4.0-rc6 + hack kernel.

User-space app is (or should be) trying to send a UDP frame to 255.255.255.255 destination.

I am getting EACCESS from sendmmsg.

Is this expected? Is there something even more special than root these days?

man 7 socket

SO_BROADCAST
Set or get the broadcast flag. When enabled, datagram
sockets are allowed to send packets to a broadcast address. This option has no effect on stream-oriented
sockets.

root user still has to use this option.

author
#2 lore raw
Quoted 21 lines · Eric Dumazet
Quoted 9 lines · Ben Greear

I'm running as root user, 4.0-rc6 + hack kernel.

User-space app is (or should be) trying to send a UDP frame to 255.255.255.255 destination.

I am getting EACCESS from sendmmsg.

Is this expected? Is there something even more special than root these days?

man 7 socket

SO_BROADCAST
Set or get the broadcast flag. When enabled, datagram
sockets are allowed to send packets to a broadcast address. This option has no effect on stream-oriented
sockets.

Quoted 1 line

root user still has to use this option.

Thanks, I'll go do that.

Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
maintainer
#3 lore raw
In reply to Ben Greear

From: Ben Greear <[email protected]>
Date: Thu, 09 Apr 2015 18:04:44 -0700

Quoted 9 lines

I'm running as root user, 4.0-rc6 + hack kernel.

User-space app is (or should be) trying to send a UDP frame to 255.255.255.255 destination.

I am getting EACCESS from sendmmsg.

Is this expected? Is there something even more special than root these days?

You can't send to broadcast addresses without setting the SOCK_BROADCAST socket option.

I didn't know the answer to this, it took me 10 seconds of grepping around under net/ipv4 to figure it out. You could have done this too.