Hello<br><br>My network works correctly, sending and receiving unicast packets for UDP.<br><br>Now I want to receive and send multicast packets.<br><br>First, in the main code of my applications I have configured the sockets in this way:<br>
<br>/******************************************MAIN CODE*********************************************/<br>.<br>.<br>.<br>int net_state=0;<br>int s,sockIDfrom,exito_conexion;<br>struct sockaddr_in myAddr, farAddr,buffer;<br>
struct sockaddr* hola;<br>char cbuf[300];<br>char msg[10];<br>int i;<br>int f, flags;<br>unsigned long int broadaddr=0;<br>struct ip_mreq mreq;<br>ssize_t stat;<br>unsigned int yes=1;<br>     <br>         s=socket(AF_INET,SOCK_DGRAM,0);   <br>
         if (s < 0)<br>         { <br>                    printf("Can't create client socket: %s\n", strerror(errno));<br>                    return;<br>         }<br>         printf("\n He  entrado en UDP");<br>
<br>    memset(&myAddr, 0, sizeof myAddr);<br>    myAddr.sin_family = AF_INET;<br>    myAddr.sin_port = 319; <br>    myAddr.sin_addr.s_addr = inet_addr("138.100.48.242"); <br>    //myAddr.sin_addr.s_addr = htonl(INADDR_ANY); <br>
<br>    if (bind(s, (struct sockaddr *)&myAddr, sizeof myAddr) < 0) <br>    {<br>        printf("Can't bind socket: %s\n", strerror(errno));<br>    }<br> <br>    <br>    <br>    mreq.imr_interface.s_addr=inet_addr("138.100.48.242");<br>
    mreq.imr_multiaddr.s_addr=inet_addr("224.0.1.129");<br><br>    if (setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(yes))<0)<br>    {<br>        printf("\n Error in REUSEADDR configuration");<br>
    }<br><br>    if (setsockopt(s,IPPROTO_IP,IP_MULTICAST_IF,&mreq.imr_interface.s_addr,sizeof(struct in_addr))<0)<br>    {<br>        printf("\n Error in  IP_MULTICAST_IF configuration");<br>    }<br>    <br>
<br>    if (setsockopt(s,IPPROTO_IP,IP_ADD_MEMBERSHIP,&mreq,sizeof(mreq))<0)  <br>    {<br>        printf("\n Error in IP_ADD_MEMBERSHIP");<br>    }<br>    <br>     memset(&farAddr, 0, sizeof farAddr);<br>
     farAddr.sin_family = AF_INET;<br>     farAddr.sin_port=319; <br>     farAddr.sin_addr.s_addr = inet_addr("138.100.48.253");<br><br>.<br>.<br>.<br>/***********************************************************************************************/<br>
<br>In the ioctl Function in the networkdriver on the path: /home/rtems/rtems-work/rtems/c/src/lib/libbsp/m68k/mcf5235/network<br><br>I have included:<br><br>First, do the microcontroller to be in promiscued mode to accpet all packets, and in the ioctl function I have add this:<br>
<br><br>fec_ioctl(struct ifnet *ifp, ioctl_command_t command, caddr_t data)<br>{<br>    struct mcf5235_enet_struct *sc = ifp->if_softc;<br>    struct ifreq *ifr = (struct ifreq *) data;<br>    int error = 0;<br>printf("\n Entra en ioctl\n");<br>
    switch (command) {<br>        case SIOCGIFADDR:<br>        case SIOCSIFADDR:<br>            ether_ioctl(ifp, command, data);<br>            break;<br><br>        case SIOCSIFFLAGS:<br>            switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) {<br>
                case IFF_RUNNING:<br>                    fec_stop(sc);<br>                    break;<br><br>                case IFF_UP:<br>                    fec_init(sc);<br>                    break;<br><br>                case IFF_UP | IFF_RUNNING:<br>
                    fec_stop(sc);<br>                    fec_init(sc);<br>                    break;<br><br>                default:<br>            <br>                    break;<br>            }<br>            break;<br>
    case SIOCADDMULTI:<br>        case SIOCDELMULTI:<br>                error=(command == SIOCADDMULTI)? ether_addmulti(ifr, &sc->arpcom): ether_delmulti(ifr, &sc->arpcom);<br>        <br>           break;<br>
.<br>.<br>.<br>.<br><br>But the function ether_addmulti(), returns error....<br>I would like to know the functions I have to call from the driver to configure the system for multicasting<br><br>Thanks!!<br><br><br><br><br>
<br>