This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
manual networking configuration warning
- From: "Brad Petrus (RTC)" <brad dot petrus at rtc dot bosch dot com>
- To: eCos Discussion <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 05 May 2005 12:41:18 -0400
- Subject: [ECOS] manual networking configuration warning
Hi,
I am trying to manually configure a network interface, eth0, and am
getting the following warning:
/ [eth_drv_ioctl] Warning: Driver can't set multi-cast mode
/
Below is the sequence of ioctl() calls I am using together with the
output from show_network_tables() in italics.
The warning occurs each time I try to set the IP address for the
interface. Am I missing something
or is this just some warning that can be ignored?
Brad
-------------------------------------------------------------------------------------
struct ifreq ifr;
struct sockaddr_in *pAddr = ass_dc_NULL;
init_all_network_interfaces();
int sock = ::socket(AF_INET, SOCK_STREAM, 0) );
if(-1 == sock) {
dm_return(false);
}
show_network_tables((pr_fun *)diag_printf);
/ Routing tables
Destination Gateway Mask Flags Interface
127.0.0.0 127.0.0.1 255.0.0.0 UG lo0
127.0.0.1 127.0.0.1 UH lo0
Interface statistics
lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: 255.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0/
// configure the address, netmask, ...
// assume interface is 'eth0'
memset(&ifr, 0, sizeof(struct ifreq));
strncpy(ifr.ifr_name, "eth0", IFNAMSIZ); // 'eth0' interface
// (a) get current address
if(-1 == ioctl(sock, SIOCGIFADDR, &ifr)) {
// this isn't a critical error, so no need to close socket and return
dm_echo(("Unable to obtain IP address\n"));
}
// (b) delete current address
if(-1 == ioctl(sock, SIOCDIFADDR, &ifr)) {
// this isn't a critical error, so no need to close socket and return
dm_echo(("Unable to remove IP address\n"));
}
show_network_tables((pr_fun *)diag_printf);
/
Routing tables
Destination Gateway Mask Flags Interface
127.0.0.0 127.0.0.1 255.0.0.0 UG lo0
127.0.0.1 127.0.0.1 UH lo0
Interface statistics
lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: 255.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0/
// (c) set current address
// NOTE: do we need to set the port here too
memset(&ifr, 0, sizeof(struct ifreq));
pAddr = (struct sockaddr_in *)&(ifr.ifr_addr);
memset(pAddr, 0, sizeof(struct sockaddr_in));
pAddr->sin_len = sizeof(struct sockaddr_in);
pAddr->sin_family = AF_INET;
pAddr->sin_addr.s_addr = inet_addr(getSocketAddress());
strncpy(ifr.ifr_name, "eth0", IFNAMSIZ);
if(-1 == ioctl(sock, SIOCSIFADDR, &ifr)) {
closeSocket(sock);
dm_echo(("Unable to add IP address\n"));
dm_return(false);
}
/[eth_drv_ioctl] Warning: Driver can't set multi-cast mode/
show_network_tables((pr_fun *)diag_printf);
/ Routing tables
Destination Gateway Mask Flags Interface
10.0.0.0 10.0.0.0 255.0.0.0 U eth0
127.0.0.0 127.0.0.1 255.0.0.0 UG lo0
127.0.0.1 127.0.0.1 UH lo0
Interface statistics
eth0 IP: 10.25.59.211, Broadcast: 10.255.255.255, Netmask:
255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU: 1500, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: 255.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0/
// (d) set mask
pAddr->sin_addr.s_addr = inet_addr("255.255.255.0");
if(-1 == ioctl(sock, SIOCSIFNETMASK, &ifr)) {
closeSocket(sock);
dm_echo(("Unable to set net mask\n"));
dm_return(false);
}
show_network_tables((pr_fun *)diag_printf);
/ Routing tables
Destination Gateway Mask Flags Interface
10.0.0.0 10.0.0.0 255.0.0.0 U eth0
127.0.0.0 127.0.0.1 255.0.0.0 UG lo0
127.0.0.1 127.0.0.1 UH lo0
Interface statistics
eth0 IP: 10.25.59.211, Broadcast: 10.255.255.255, Netmask:
255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU: 1500, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: 255.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0/
// (e) set the address again
// NOTE: according to gary thomas in
// <http://article.gmane.org/gmane.os.ecos.general/6372>
// the address must be set a second time ?
pAddr->sin_addr.s_addr = inet_addr(getSocketAddress());
if(-1 == ioctl(sock, SIOCSIFADDR, &ifr)) {
closeSocket(sock);
dm_echo(("Unable to add IP address\n"));
dm_return(false);
}
/[eth_drv_ioctl] Warning: Driver can't set multi-cast mode/
show_network_tables((pr_fun *)diag_printf);
/ Routing tables
Destination Gateway Mask Flags Interface
10.25.59.0 10.25.59.0 255.255.255.0 U eth0
127.0.0.0 127.0.0.1 255.0.0.0 UG lo0
127.0.0.1 127.0.0.1 UH lo0
Interface statistics
eth0 IP: 10.25.59.211, Broadcast: 10.25.59.255, Netmask:
255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU: 1500, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: 255.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0/
// (e) broadcast address
pAddr->sin_addr.s_addr = inet_addr("0.0.0.0");
if(-1 == ioctl(sock, SIOCSIFBRDADDR, &ifr)) {
closeSocket(sock);
dm_echo(("Unable to set broadcast address\n"));
dm_return(false);
}
show_network_tables((pr_fun *)diag_printf);
/ Routing tables
Destination Gateway Mask Flags Interface
10.25.59.0 10.25.59.0 255.255.255.0 U eth0
127.0.0.0 127.0.0.1 255.0.0.0 UG lo0
127.0.0.1 127.0.0.1 UH lo0
Interface statistics
eth0 IP: 10.25.59.211, Broadcast: 0.0.0.0, Netmask: 255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU: 1500, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
lo0 IP: 127.0.0.1, Broadcast: 127.0.0.1, Netmask: 255.0.0.0
UP LOOPBACK RUNNING MULTICAST MTU: 16384, Metric: 0
Rx - Packets: 0, Bytes: 0, Tx - Packets: 0, Bytes: 0
/
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss