broadcast problem under kernel 2.6

This is a discussion on broadcast problem under kernel 2.6 within the Linux Networking forums, part of the Linux Forums category; We have a hub-and-spoke network here, with two /30 subnets (deployed network will typically have far more than ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-15-2007
Dan Miller
 
Posts: n/a
Default broadcast problem under kernel 2.6

We have a hub-and-spoke network here, with two /30 subnets (deployed
network will typically have far more than two such subnets). The hub
interface is defined thus:

eth1 Link encap:Ethernet HWaddr 00:00:C0:A8:0B:01
inet addr:192.168.11.1 Bcast:192.168.11.255
Mask:255.255.255.252
inet6 addr: fe80::200:c0ff:fea8:b01/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:43 errors:0 dropped:4 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1340 (1.3 Kb) TX bytes:4721 (4.6 Kb)

eth1:1 Link encap:Ethernet HWaddr 00:00:C0:A8:0B:01
inet addr:192.168.11.5 Bcast:192.168.11.255
Mask:255.255.255.252
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Note that the BROADCAST flag is present on both interfaces. Normal
unicast traffic is passing between the hub and the remote machines fine.

The trick to this network is that hub's transmitter is received by all
the remote units, but each remote has a separate channel coming back to
the hub (which is why this "net of /30 subnets" is used).

Now I want to broadcast a udp message to all the remotes at once. So I
try the following, with net_addr=0xFFFFFFFF:

// set up data for sendto()
bzero(&servaddr, sizeof(servaddr)) ;
servaddr.sin_family = AF_INET ;
servaddr.sin_port = htons(PORT_REMOTE) ;
servaddr.sin_addr.s_addr = htonl(net_addr) ;

// set the SO_BROADCAST flag as well,
// so we can send broadcast messages
if (net_addr == 0xFFFFFFFF) {
int flag = 1 ;
int result = setsockopt(udp_send_fd, SOL_SOCKET, SO_BROADCAST,
&flag, sizeof(flag)) ;
if (result < 0) {
syslog(LOG_ERR, "setsockopt (BROADCAST): %s\n",
show_error(errno)) ;
}
else {
syslog(LOG_ERR, "setsockopt (BROADCAST) was successful\n") ;
}
}

// send the message
int result = sendto(udp_send_fd, mesg, mlen, flags, (SA *) &servaddr,
sizeof(SA)) ; //lint !e740

Under kernel 2.2, sendto() would succeed, but the network stack would
actually break this message up into separate messages on each of the
subnets, using the subnet broadcast address.

However, under kernel 2.6.11, setsockopt() returns success, sendto()
returns 20 (which is correct, the packet is 20 bytes), but no packet is
actually delivered to the eth1 driver. The packet just silently vanishes
into space. No errors (udp or otherwise) are logged anywhere.

What is happening here?? Is there something else that I need to do under
kernel 2.6, to enable udp broadcasts??

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Reply With Quote
  #2 (permalink)  
Old 02-15-2007
Dan Miller
 
Posts: n/a
Default Re: broadcast problem under kernel 2.6

Dan Miller <dan@mytrashmail.com> wrote in
news:Xns98D8932B74C33dananacominccom@38.119.71.69:

> We have a hub-and-spoke network here, with two /30 subnets (deployed
> network will typically have far more than two such subnets). The hub
> interface is defined thus:
>
> eth1 Link encap:Ethernet HWaddr 00:00:C0:A8:0B:01
> inet addr:192.168.11.1 Bcast:192.168.11.255
> Mask:255.255.255.252
> inet6 addr: fe80::200:c0ff:fea8:b01/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:20 errors:0 dropped:0 overruns:0 frame:0
> TX packets:43 errors:0 dropped:4 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:1340 (1.3 Kb) TX bytes:4721 (4.6 Kb)
>
> eth1:1 Link encap:Ethernet HWaddr 00:00:C0:A8:0B:01
> inet addr:192.168.11.5 Bcast:192.168.11.255
> Mask:255.255.255.252
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
>
> Note that the BROADCAST flag is present on both interfaces. Normal
> unicast traffic is passing between the hub and the remote machines
> fine.
>
> The trick to this network is that hub's transmitter is received by all
> the remote units, but each remote has a separate channel coming back
> to the hub (which is why this "net of /30 subnets" is used).
>
> Now I want to broadcast a udp message to all the remotes at once. So
> I try the following, with net_addr=0xFFFFFFFF:
>
> // set up data for sendto()
> bzero(&servaddr, sizeof(servaddr)) ;
> servaddr.sin_family = AF_INET ;
> servaddr.sin_port = htons(PORT_REMOTE) ;
> servaddr.sin_addr.s_addr = htonl(net_addr) ;
>
> // set the SO_BROADCAST flag as well,
> // so we can send broadcast messages
> if (net_addr == 0xFFFFFFFF) {
> int flag = 1 ;
> int result = setsockopt(udp_send_fd, SOL_SOCKET, SO_BROADCAST,
> &flag, sizeof(flag)) ;
> if (result < 0) {
> syslog(LOG_ERR, "setsockopt (BROADCAST): %s\n",
> show_error(errno)) ;
> }
> else {
> syslog(LOG_ERR, "setsockopt (BROADCAST) was successful\n") ;
> }
> }
>
> // send the message
> int result = sendto(udp_send_fd, mesg, mlen, flags, (SA *)
> &servaddr,
> sizeof(SA)) ; //lint !e740
>
> Under kernel 2.2, sendto() would succeed, but the network stack would
> actually break this message up into separate messages on each of the
> subnets, using the subnet broadcast address.
>
> However, under kernel 2.6.11, setsockopt() returns success, sendto()
> returns 20 (which is correct, the packet is 20 bytes), but no packet
> is actually delivered to the eth1 driver. The packet just silently
> vanishes into space. No errors (udp or otherwise) are logged
> anywhere.
>
> What is happening here?? Is there something else that I need to do
> under kernel 2.6, to enable udp broadcasts??
>

BTW, I noticed in the preceding ifconfig listing, that the broadcast
addresses on the interfaces were not correct!! Even though I specified a
/30 subnet, the broadcast addresses are still being generated as if these
were /24 subnets. So I manually corrected that, and the broadcast
addresses are now correct, but the symptoms that I describe are still
occuring.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:04 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0