Home > other >  VxWorks MAC multicast to join using SIOCADDMULTI problem
VxWorks MAC multicast to join using SIOCADDMULTI problem

Time:11-29

Vxworks interface using ioctl operation, parameters for struct ifreq, such as access interface hardware address:
Struct ifreq ethreq;
Strncpy (ethreq ifr_name, eth0, IFNAMSIZ);
Retval=ioctl (sockfd [port_index], SIOCGIFLLADDR, & amp; Ethreq);
But the SIOCADDMULTI requires the incoming parameters for struct sockaddr, (# define SIOCADDMULTI VX_IOWR (NETIF, 29, W, struct sockaddr))
If you use a similar ioctl to multicast to join:
Char mymac [6]={0 x01, 0 x0c, XCD 0, 0 x01, 0 x00 to 0 x01};
Struct sockaddr mulcast_addr;
Mulcast_addr. Sa_family=PF_UNSPEC;
Mulcast_addr. Sa_len=6;
for(int i=0; I & lt; 6; I++)
{
Mulcast_addr. Sa_data [I]=mymac [I];
}
Retval=ioctl (sockfd [port_index], SIOCADDMULTI, (struct sockaddr) & amp; Mulcast_addr);//to join the multicast group
Finally retval return error, errno as ENXIO, namely "/* No to device the or address */", doubt here because of the incoming parameter does not contain similar to the above ifr_name interface information, is SIOCADDMULTI can't use?
  • Related