hello again... i've been trying to broadcast a message through UDP and configure the ethernet card bue i've not sucedded yet...
1st question - have you ever tried to do that?
2nd question - i'm trying to set the broadcast adress directly in the NIC. i've tried to ioctl using the change parameter but haven't sucedded. this code works on linux but not with l4:
int if_set_broadaddr(const char *ifn) { int return_val, fd = -1; struct ifreq ifr; /* points to one interface returned from ioctl */ struct in_addr *broadaddr; struct sockaddr_in sa;
fd = socket (PF_INET, SOCK_DGRAM, 0);
if (fd < 0) { LOG("Error opening socket for interface"); return -1; }
strncpy (ifr.ifr_name, ifn, sizeof(ifr.ifr_name)); if (!inet_aton("10.10.255.255", &sa.sin_addr)) LOG("no valid IP address");
sa.sin_family = AF_INET; memcpy(&ifr.ifr_broadaddr, &sa, sizeof(struct sockaddr));
if (ioctl(fd, SIOCSIFBRDADDR, &ifr) < 0) LOG("ioctl(SIOCSIFBRDADDR) returns");
close (fd); return return_val; }
is there any problem with the SIOCSIFBRDADDR flag?
thanks in advance
Tiago Jorge
Hi,
On Fri, Mar 18, 2005 at 02:50:37PM +0000, Tiago Jorge wrote:
i've been trying to broadcast a message through UDP and configure the ethernet card bue i've not sucedded yet...
1st question - have you ever tried to do that?
No, I've no experiences with UDP brodcasts.
2nd question - i'm trying to set the broadcast adress directly in the NIC. i've tried to ioctl using the change parameter but haven't sucedded. this code works on linux but not with l4:
[...]
is there any problem with the SIOCSIFBRDADDR flag?
In what respect does SIOCSIFBRDADDR differ from SIOCSIFNETMASK? The latter works in mini_ifconfig (ifconfig.c:151). What error did occur?
Chao
is there any problem with the SIOCSIFBRDADDR flag?
In what respect does SIOCSIFBRDADDR differ from SIOCSIFNETMASK? The latter works in mini_ifconfig (ifconfig.c:151). What error did occur?
SIOCSIFBRDADDR is the flag to access the ifreq_broadaddr to change the broadcast adress of the NIC using ioctl. check it out here http://docsrv.sco.com/cgi-bin/man/man/html.7tcp/Intro.7tcp.html
thats the problem... it gives no error, but it doesn't changes the adress. i've tried the code in linux and it changes the broadcast adress but in ifconfig in Fiasco, it doesn't. My question is if it is implemented or not in the ioctl?
thanks
Tiago Jorge
Tiago Jorge wrote:
is there any problem with the SIOCSIFBRDADDR flag?
In what respect does SIOCSIFBRDADDR differ from SIOCSIFNETMASK? The latter works in mini_ifconfig (ifconfig.c:151). What error did occur?
SIOCSIFBRDADDR is the flag to access the ifreq_broadaddr to change the broadcast adress of the NIC using ioctl. check it out here http://docsrv.sco.com/cgi-bin/man/man/html.7tcp/Intro.7tcp.html
Maybe it is not transported correctly by l4vfs, please check l4/pkg/l4vfs/lib/libc_backends/io/ioctl.c.
It seems your special case is not considered there.
Greets, Martin
Maybe it is not transported correctly by l4vfs, please check l4/pkg/l4vfs/lib/libc_backends/io/ioctl.c.
yep... thats true... it wasn't there. So i added and worked.
just add in the switch statement that handles the the ifreq calls the following lines:
case SIOCSIFBRDADDR: case SIOCGIFBRDADDR:
and add in mini_ifconfig:
if (!inet_aton("YOUR_BROADCAST_ADDR", &sa.sin_addr)) ERR_EXIT("no valid IP broadcast %s", "YOUR_BROADCAST_ADDR"); sa.sin_family = AF_INET; memcpy(&ifr.ifr_broadaddr, &sa, sizeof(struct sockaddr));
if ((err=ioctl(s, SIOCSIFBRDADDR, &ifr)) < 0) ERR_EXIT("ioctl(SIOCSIFBRDADDR) returns %d", err);
now i'm having another problem...
i've set those lines and he changed the broadcast addr in the NIC but refuses to send through broadcast adress again.
i'm setting the broadcast like this:
/* And build BROADCAST address */ destinationAddr.sin_family = AF_INET; destinationAddr.sin_addr.s_addr = htonl(INADDR_BROADCAST); destinationAddr.sin_port = htons(PORTNUMBER);
// Set the socket to permit multicasts on the local LAN if (setsockopt(socketDesc, SOL_SOCKET, SO_BROADCAST, &trueFlag, sizeof(trueFlag)) != 0) { LOG("setsockopt error"); exit(1); }
is there a similar "problem" with the setsockopt function? is it doing an empty call like ioctl was doing? beacause he returns me no error at all.
thanks
Tiago
On Mon, Mar 21, 2005 at 11:36:17AM +0000, Tiago Jorge wrote:
now i'm having another problem...
i've set those lines and he changed the broadcast addr in the NIC but refuses to send through broadcast adress again.
i'm setting the broadcast like this:
[...]
is there a similar "problem" with the setsockopt function? is it doing an empty call like ioctl was doing? beacause he returns me no error at all.
AFAIK after a glimpse at the FLIPS code, setsockopt() should work like on original Linux 2.4. Does it really work this way on Linux?
Christian Helmuth wrote:
On Mon, Mar 21, 2005 at 11:36:17AM +0000, Tiago Jorge wrote:
now i'm having another problem...
i've set those lines and he changed the broadcast addr in the NIC but refuses to send through broadcast adress again.
i'm setting the broadcast like this:
[...]
is there a similar "problem" with the setsockopt function? is it doing an empty call like ioctl was doing? beacause he returns me no error at all.
AFAIK after a glimpse at the FLIPS code, setsockopt() should work like on original Linux 2.4. Does it really work this way on Linux?
In Linux, this test works fine. I thought it was from the broadcast socket address was not set, but i've setted it with ioctl (yes... i know you don't like but...;)) and still gives me error sending in broadcast... but setsockopt doesn't return any error at all... I have my app working on linux like this :). i don't know if somethings missing in the NIC configuration...
thanks
Tiago
On Mon, Mar 21, 2005 at 05:40:16PM +0000, Tiago Jorge wrote:
Christian Helmuth wrote:
AFAIK after a glimpse at the FLIPS code, setsockopt() should work like on original Linux 2.4. Does it really work this way on Linux?
In Linux, this test works fine. I thought it was from the broadcast socket address was not set, but i've setted it with ioctl (yes... i know you don't like but...;)) and still gives me error sending in broadcast... but setsockopt doesn't return any error at all... I have my app working on linux like this :). i don't know if somethings missing in the NIC configuration...
Hmm, no ideas. From my point of view FLIPS does not differ from Linux - same source code. Maybe we missed a configuration detail. Any chance for you to check this under Linux (strace ifconfig or something)? I think it will be the only way, as in Dresden currently nobody works on FLIPS and network applications.
l4-hackers@os.inf.tu-dresden.de