several questions...
Tiago Jorge
tjpj at lasige.di.fc.ul.pt
Fri Mar 18 15:50:37 CET 2005
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
More information about the l4-hackers
mailing list