Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/nmbd/nmbd_packets.c

    r620 r745  
    55   Copyright (C) Luke Kenneth Casson Leighton 1994-1998
    66   Copyright (C) Jeremy Allison 1994-2003
    7    
     7
    88   This program is free software; you can redistribute it and/or modify
    99   it under the terms of the GNU General Public License as published by
    1010   the Free Software Foundation; either version 3 of the License, or
    1111   (at your option) any later version.
    12    
     12
    1313   This program is distributed in the hope that it will be useful,
    1414   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1515   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1616   GNU General Public License for more details.
    17    
     17
    1818   You should have received a copy of the GNU General Public License
    1919   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    20    
    2120*/
    2221
    2322#include "includes.h"
     23#include "nmbd/nmbd.h"
     24#include "../lib/util/select.h"
     25#include "system/select.h"
     26#include "libsmb/libsmb.h"
    2427
    2528extern int ClientNMB;
     
    3033
    3134bool rescan_listen_set = False;
     35
     36static struct nb_packet_server *packet_server;
     37
     38bool nmbd_init_packet_server(void)
     39{
     40        NTSTATUS status;
     41
     42        status = nb_packet_server_create(
     43                NULL, nmbd_event_context(),
     44                lp_parm_int(-1, "nmbd", "unexpected_clients", 200),
     45                &packet_server);
     46        if (!NT_STATUS_IS_OK(status)) {
     47                DEBUG(0, ("ERROR: nb_packet_server_create failed: %s\n",
     48                          nt_errstr(status)));
     49                return false;
     50        }
     51        return true;
     52}
    3253
    3354
     
    89110**************************************************************************/
    90111
    91 static void debug_browse_data(char *outbuf, int len)
     112static void debug_browse_data(const char *outbuf, int len)
    92113{
    93114        int i,j;
     
    105126                        if (x < 32 || x > 127)
    106127                                x = '.';
    107            
     128
    108129                        DEBUGADD( 4, ( "%c", x ) );
    109130                }
     
    159180                return False;
    160181        }
    161  
     182
    162183        return True;
    163184}
     
    184205                return NULL;
    185206        }
    186    
     207
    187208        memset((char *)packet,'\0',sizeof(*packet));
    188209
     
    196217        nmb->header.nm_flags.authoritative = False;
    197218        nmb->header.nm_flags.bcast = bcast;
    198  
     219
    199220        nmb->header.rcode = 0;
    200221        nmb->header.qdcount = 1;
     
    213234        packet->packet_type = NMB_PACKET;
    214235        packet->locked = False;
    215  
     236
    216237        return packet; /* Caller must free. */
    217238}
     
    237258        nmb->additional->rr_type  = RR_TYPE_NB;
    238259        nmb->additional->rr_class = RR_CLASS_IN;
    239        
     260
    240261        /* See RFC 1002, sections 5.1.1.1, 5.1.1.2 and 5.1.1.3 */
    241262        if (nmb->header.nm_flags.bcast)
     
    243264        else
    244265                nmb->additional->ttl = lp_max_ttl();
    245        
     266
    246267        nmb->additional->rdlength = 6;
    247        
     268
    248269        set_nb_flags(nmb->additional->rdata,nb_flags);
    249        
     270
    250271        /* Set the address for the name we are registering. */
    251272        putip(&nmb->additional->rdata[2], register_ip);
    252        
     273
    253274        /*
    254275           it turns out that Jeremys code was correct, we are supposed
     
    295316{   
    296317        struct nmb_packet *nmb = NULL;
    297  
     318
    298319        nmb = &packet->packet.nmb;
    299320
    300321        nmb->header.opcode = NMB_NAME_QUERY_OPCODE;
    301322        nmb->header.arcount = 0;
    302    
     323
    303324        nmb->header.nm_flags.recursion_desired = False;
    304  
     325
    305326        DEBUG(4,("initiate_name_query_packet_from_wins_server: sending query for name %s (bcast=%s) to IP %s\n",
    306327                nmb_namestr(&nmb->question.question_name),
    307328                BOOLSTR(nmb->header.nm_flags.bcast), inet_ntoa(packet->ip)));
    308    
     329
    309330        return send_netbios_packet( packet );
    310331}
     
    350371
    351372        nmb->header.nm_flags.recursion_desired = True;
    352        
     373
    353374        if(create_and_init_additional_record(packet, nb_flags, register_ip) == False)
    354375                return False;
    355        
     376
    356377        DEBUG(4,("initiate_multihomed_name_register_packet: sending registration \
    357378for name %s IP %s (bcast=%s) to IP %s\n",
     
    479500
    480501        in_addr_to_sockaddr_storage(&ss, subrec->bcast_ip);
    481         pss = iface_ip((struct sockaddr *)&ss);
     502        pss = iface_ip((struct sockaddr *)(void *)&ss);
    482503        if (!pss || pss->ss_family != AF_INET) {
    483504                p->locked = False;
     
    589610        struct response_record *rrec;
    590611        bool ret;
    591        
     612
    592613        /* Sanity check. */
    593614        if(subrec != unicast_subnet) {
     
    599620        if(assert_check_subnet(subrec))
    600621                return NULL;
    601      
     622
    602623        if ((p = create_and_init_netbios_packet(nmbname, False, True, wins_ip)) == NULL)
    603624                return NULL;
     
    613634                return NULL;
    614635        } 
    615  
     636
    616637        if ((rrec = make_response_record(subrec,    /* subnet record. */
    617638                                         p,                     /* packet we sent. */
     
    625646                return NULL;
    626647        } 
    627        
     648
    628649        return rrec;
    629650}
     
    687708 Queue a query name packet to the broadcast address of a subnet.
    688709****************************************************************************/
    689  
     710
    690711struct response_record *queue_query_name( struct subnet_record *subrec,
    691712                          response_function resp_fn,
     
    704725
    705726        to_ip = subrec->bcast_ip;
    706  
     727
    707728        /* queries to the WINS server turn up here as queries to IP 0.0.0.0
    708729                        These need to be handled a bit differently */
     
    10121033void queue_packet(struct packet_struct *packet)
    10131034{
    1014         struct packet_struct *p;
    1015 
    1016         if (!packet_queue) {
    1017                 packet->prev = NULL;
    1018                 packet->next = NULL;
    1019                 packet_queue = packet;
    1020                 return;
    1021         }
    1022 
    1023         /* find the bottom */
    1024         for (p=packet_queue;p->next;p=p->next)
    1025                 ;
    1026 
    1027         p->next = packet;
    1028         packet->next = NULL;
    1029         packet->prev = p;
     1035        DLIST_ADD_END(packet_queue, packet, struct packet_struct *);
    10301036}
    10311037
     
    10581064****************************************************************************/
    10591065
    1060 static void process_browse_packet(struct packet_struct *p, char *buf,int len)
     1066static void process_browse_packet(struct packet_struct *p, const char *buf,int len)
    10611067{
    10621068        struct dgram_packet *dgram = &p->packet.dgram;
     
    11451151****************************************************************************/
    11461152
    1147 static void process_lanman_packet(struct packet_struct *p, char *buf,int len)
     1153static void process_lanman_packet(struct packet_struct *p, const char *buf,int len)
    11481154{
    11491155        struct dgram_packet *dgram = &p->packet.dgram;
     
    12121218static void process_dgram(struct packet_struct *p)
    12131219{
    1214         char *buf;
    1215         char *buf2;
     1220        const char *buf;
     1221        const char *buf2;
    12161222        int len;
    12171223        struct dgram_packet *dgram = &p->packet.dgram;
     
    12191225        /* If we aren't listening to the destination name then ignore the packet */
    12201226        if (!listening(p,&dgram->dest_name)) {
    1221                         unexpected_packet(p);
     1227                        nb_packet_dispatch(packet_server, p);
    12221228                        DEBUG(5,("process_dgram: ignoring dgram packet sent to name %s from %s\n",
    12231229                                nmb_namestr(&dgram->dest_name), inet_ntoa(p->ip)));
     
    12261232
    12271233        if (dgram->header.msg_type != 0x10 && dgram->header.msg_type != 0x11 && dgram->header.msg_type != 0x12) {
    1228                 unexpected_packet(p);
     1234                nb_packet_dispatch(packet_server, p);
    12291235                /* Don't process error packets etc yet */
    12301236                DEBUG(5,("process_dgram: ignoring dgram packet sent to name %s from IP %s as it is \
     
    13121318        }
    13131319
    1314         unexpected_packet(p);
     1320        nb_packet_dispatch(packet_server, p);
    13151321}
    13161322
     
    14321438                        DEBUG(3,("find_subnet_for_nmb_packet: response record not found for response id %hu\n",
    14331439                                nmb->header.name_trn_id));
    1434                         unexpected_packet(p);
     1440                        nb_packet_dispatch(packet_server, p);
    14351441                        return NULL;
    14361442                }
     
    15831589
    15841590        while ((p = packet_queue)) {
    1585                 packet_queue = p->next;
    1586                 if (packet_queue)
    1587                         packet_queue->prev = NULL;
    1588                 p->next = p->prev = NULL;
     1591                DLIST_REMOVE(packet_queue, p);
    15891592
    15901593                switch (p->packet_type) {
     
    16741677***************************************************************************/
    16751678
    1676 static bool create_listen_fdset(fd_set **ppset, int **psock_array, int *listen_number, int *maxfd)
    1677 {
    1678         int *sock_array = NULL;
     1679struct socket_attributes {
     1680        enum packet_type type;
     1681        bool broadcast;
     1682};
     1683
     1684static bool create_listen_pollfds(struct pollfd **pfds,
     1685                                  struct socket_attributes **pattrs,
     1686                                  int *pnum_sockets)
     1687{
    16791688        struct subnet_record *subrec = NULL;
    16801689        int count = 0;
    16811690        int num = 0;
    1682         fd_set *pset = SMB_MALLOC_P(fd_set);
    1683 
    1684         if(pset == NULL) {
    1685                 DEBUG(0,("create_listen_fdset: malloc fail !\n"));
    1686                 return True;
    1687         }
    1688 
    1689         /* The Client* sockets */
    1690         count++;
     1691        struct pollfd *fds;
     1692        struct socket_attributes *attrs;
     1693
     1694        /* The ClientNMB and ClientDGRAM sockets */
     1695        count = 2;
    16911696
    16921697        /* Check that we can add all the fd's we need. */
    1693         for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec))
    1694                 count++;
    1695 
    1696         /* each interface gets 4 sockets */
    1697         count *= 4;
    1698 
    1699         if(count >= FD_SETSIZE) {
    1700                 DEBUG(0,("create_listen_fdset: Too many file descriptors needed (%d). We can \
    1701 only use %d.\n", count, FD_SETSIZE));
    1702                 SAFE_FREE(pset);
    1703                 return True;
    1704         }
    1705 
    1706         if((sock_array = SMB_MALLOC_ARRAY(int, count)) == NULL) {
    1707                 DEBUG(0,("create_listen_fdset: malloc fail for socket array. size %d\n", count));
    1708                 SAFE_FREE(pset);
    1709                 return True;
    1710         }
    1711 
    1712         FD_ZERO(pset);
    1713 
    1714         /* Add in the lp_socket_address() interface on 137. */
    1715         if (ClientNMB < 0 || ClientNMB >= FD_SETSIZE) {
    1716                 errno = EBADF;
    1717                 SAFE_FREE(pset);
    1718                 return True;
    1719         }
    1720 
    1721         FD_SET(ClientNMB,pset);
    1722         sock_array[num++] = ClientNMB;
    1723         *maxfd = MAX( *maxfd, ClientNMB);
    1724 
    1725         /* the lp_socket_address() interface has only one socket */
    1726         sock_array[num++] = -1;
    1727 
    1728         /* Add in the 137 sockets on all the interfaces. */
     1698        for (subrec = FIRST_SUBNET;
     1699             subrec != NULL;
     1700             subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) {
     1701                count += 2;     /* nmb_sock and dgram_sock */
     1702                if (subrec->nmb_bcast != -1) {
     1703                        count += 1;
     1704                }
     1705                if (subrec->dgram_bcast != -1) {
     1706                        count += 1;
     1707                }
     1708        }
     1709
     1710        fds = TALLOC_ZERO_ARRAY(NULL, struct pollfd, count);
     1711        if (fds == NULL) {
     1712                DEBUG(1, ("create_listen_pollfds: malloc fail for fds. "
     1713                          "size %d\n", count));
     1714                return true;
     1715        }
     1716
     1717        attrs = TALLOC_ARRAY(NULL, struct socket_attributes, count);
     1718        if (fds == NULL) {
     1719                DEBUG(1, ("create_listen_pollfds: malloc fail for attrs. "
     1720                          "size %d\n", count));
     1721                SAFE_FREE(fds);
     1722                return true;
     1723        }
     1724
     1725        num = 0;
     1726
     1727        fds[num].fd = ClientNMB;
     1728        attrs[num].type = NMB_PACKET;
     1729        attrs[num].broadcast = false;
     1730        num += 1;
     1731
     1732        fds[num].fd = ClientDGRAM;
     1733        attrs[num].type = DGRAM_PACKET;
     1734        attrs[num].broadcast = false;
     1735        num += 1;
     1736
    17291737        for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) {
    1730                 if (subrec->nmb_sock < 0 || subrec->nmb_sock >= FD_SETSIZE) {
    1731                         /* We have to ignore sockets outside FD_SETSIZE. */
    1732                         sock_array[num++] = -1;
    1733                 } else {
    1734                         FD_SET(subrec->nmb_sock,pset);
    1735                         sock_array[num++] = subrec->nmb_sock;
    1736                         *maxfd = MAX( *maxfd, subrec->nmb_sock);
    1737                 }
    1738 
    1739                 if (subrec->nmb_bcast < 0 || subrec->nmb_bcast >= FD_SETSIZE) {
    1740                         /* We have to ignore sockets outside FD_SETSIZE. */
    1741                         sock_array[num++] = -1;
    1742                 } else {
    1743                         sock_array[num++] = subrec->nmb_bcast;
    1744                         if (subrec->nmb_bcast != -1) {
    1745                                 FD_SET(subrec->nmb_bcast,pset);
    1746                                 *maxfd = MAX( *maxfd, subrec->nmb_bcast);
    1747                         }
    1748                 }
    1749         }
    1750 
    1751         /* Add in the lp_socket_address() interface on 138. */
    1752         if (ClientDGRAM < 0 || ClientDGRAM >= FD_SETSIZE) {
    1753                 errno = EBADF;
    1754                 SAFE_FREE(pset);
    1755                 return True;
    1756         }
    1757         FD_SET(ClientDGRAM,pset);
    1758         sock_array[num++] = ClientDGRAM;
    1759         *maxfd = MAX( *maxfd, ClientDGRAM);
    1760 
    1761         /* the lp_socket_address() interface has only one socket */
    1762         sock_array[num++] = -1;
    1763 
    1764         /* Add in the 138 sockets on all the interfaces. */
    1765         for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) {
    1766                 if (subrec->dgram_sock < 0 || subrec->dgram_sock >= FD_SETSIZE) {
    1767                         /* We have to ignore sockets outside FD_SETSIZE. */
    1768                         sock_array[num++] = -1;
    1769                 } else {
    1770                         FD_SET(subrec->dgram_sock,pset);
    1771                         sock_array[num++] = subrec->dgram_sock;
    1772                         *maxfd = MAX( *maxfd, subrec->dgram_sock);
    1773                 }
    1774 
    1775                 if (subrec->dgram_bcast < 0 || subrec->dgram_bcast >= FD_SETSIZE) {
    1776                         /* We have to ignore sockets outside FD_SETSIZE. */
    1777                         sock_array[num++] = -1;
    1778                 } else {
    1779                         sock_array[num++] = subrec->dgram_bcast;
    1780                         if (subrec->dgram_bcast != -1) {
    1781                                 FD_SET(subrec->dgram_bcast,pset);
    1782                                 *maxfd = MAX( *maxfd, subrec->dgram_bcast);
    1783                         }
    1784                 }
    1785         }
    1786 
    1787         SMB_ASSERT(count == num);
    1788 
    1789         *listen_number = count;
    1790 
    1791         SAFE_FREE(*ppset);
    1792         SAFE_FREE(*psock_array);
    1793 
    1794         *ppset = pset;
    1795         *psock_array = sock_array;
     1738
     1739                fds[num].fd = subrec->nmb_sock;
     1740                attrs[num].type = NMB_PACKET;
     1741                attrs[num].broadcast = false;
     1742                num += 1;
     1743
     1744                if (subrec->nmb_bcast != -1) {
     1745                        fds[num].fd = subrec->nmb_bcast;
     1746                        attrs[num].type = NMB_PACKET;
     1747                        attrs[num].broadcast = true;
     1748                        num += 1;
     1749                }
     1750
     1751                fds[num].fd = subrec->dgram_sock;
     1752                attrs[num].type = DGRAM_PACKET;
     1753                attrs[num].broadcast = false;
     1754                num += 1;
     1755
     1756                if (subrec->dgram_bcast != -1) {
     1757                        fds[num].fd = subrec->dgram_bcast;
     1758                        attrs[num].type = DGRAM_PACKET;
     1759                        attrs[num].broadcast = true;
     1760                        num += 1;
     1761                }
     1762        }
     1763
     1764        TALLOC_FREE(*pfds);
     1765        *pfds = fds;
     1766
     1767        TALLOC_FREE(*pattrs);
     1768        *pattrs = attrs;
     1769
     1770        *pnum_sockets = count;
    17961771
    17971772        return False;
     
    18531828                p->packet_id = packet->packet.dgram.header.dgm_id;
    18541829        } else {
     1830                SAFE_FREE(p);
    18551831                return false;
    18561832        }
     
    18821858bool listen_for_packets(bool run_election)
    18831859{
    1884         static fd_set *listen_set = NULL;
     1860        static struct pollfd *fds = NULL;
     1861        static struct socket_attributes *attrs = NULL;
    18851862        static int listen_number = 0;
    1886         static int *sock_array = NULL;
     1863        int num_sockets;
    18871864        int i;
    1888         static int maxfd = 0;
    1889 
    1890         fd_set r_fds;
    1891         fd_set w_fds;
    1892         int selrtn;
    1893         struct timeval timeout;
     1865
     1866        int pollrtn;
     1867        int timeout;
    18941868#ifndef SYNC_DNS
    18951869        int dns_fd;
     1870        int dns_pollidx = -1;
    18961871#endif
    18971872        struct processed_packet *processed_packet_list = NULL;
    18981873
    1899         if(listen_set == NULL || rescan_listen_set) {
    1900                 if(create_listen_fdset(&listen_set, &sock_array, &listen_number, &maxfd)) {
     1874        if ((fds == NULL) || rescan_listen_set) {
     1875                if (create_listen_pollfds(&fds, &attrs, &listen_number)) {
    19011876                        DEBUG(0,("listen_for_packets: Fatal error. unable to create listen set. Exiting.\n"));
    19021877                        return True;
     
    19051880        }
    19061881
    1907         memcpy((char *)&r_fds, (char *)listen_set, sizeof(fd_set));
    1908         FD_ZERO(&w_fds);
     1882        /*
     1883         * "fds" can be enlarged by event_add_to_poll_args
     1884         * below. Shrink it again to what was given to us by
     1885         * create_listen_pollfds.
     1886         */
     1887
     1888        fds = TALLOC_REALLOC_ARRAY(NULL, fds, struct pollfd, listen_number);
     1889        if (fds == NULL) {
     1890                return true;
     1891        }
     1892        num_sockets = listen_number;
    19091893
    19101894#ifndef SYNC_DNS
    19111895        dns_fd = asyncdns_fd();
    1912         if (dns_fd >= 0 && dns_fd < FD_SETSIZE) {
    1913                 FD_SET(dns_fd, &r_fds);
    1914                 maxfd = MAX( maxfd, dns_fd);
     1896        if (dns_fd != -1) {
     1897                fds = TALLOC_REALLOC_ARRAY(NULL, fds, struct pollfd, num_sockets+1);
     1898                if (fds == NULL) {
     1899                        return true;
     1900                }
     1901                dns_pollidx = num_sockets;
     1902                fds[num_sockets].fd = dns_fd;
     1903                num_sockets += 1;
    19151904        }
    19161905#endif
    19171906
     1907        for (i=0; i<num_sockets; i++) {
     1908                fds[i].events = POLLIN|POLLHUP;
     1909        }
     1910
    19181911        /* Process a signal and timer events now... */
    1919         if (run_events(nmbd_event_context(), 0, NULL, NULL)) {
     1912        if (run_events_poll(nmbd_event_context(), 0, NULL, 0)) {
    19201913                return False;
    19211914        }
     
    19281921         */
    19291922
    1930         timeout.tv_sec = (run_election||num_response_packets) ? 1 : NMBD_SELECT_LOOP;
    1931         timeout.tv_usec = 0;
    1932 
    1933         {
    1934                 struct timeval now = timeval_current();
    1935                 event_add_to_select_args(nmbd_event_context(), &now,
    1936                                          &r_fds, &w_fds, &timeout, &maxfd);
    1937         }
    1938 
    1939         selrtn = sys_select(maxfd+1,&r_fds,&w_fds,NULL,&timeout);
    1940 
    1941         if (run_events(nmbd_event_context(), selrtn, &r_fds, &w_fds)) {
     1923        timeout = ((run_election||num_response_packets)
     1924                   ? 1 : NMBD_SELECT_LOOP) * 1000;
     1925
     1926        event_add_to_poll_args(nmbd_event_context(), NULL,
     1927                               &fds, &num_sockets, &timeout);
     1928
     1929        pollrtn = sys_poll(fds, num_sockets, timeout);
     1930
     1931        if (run_events_poll(nmbd_event_context(), pollrtn, fds, num_sockets)) {
    19421932                return False;
    19431933        }
    19441934
    1945         if (selrtn == -1) {
     1935        if (pollrtn == -1) {
    19461936                return False;
    19471937        }
    19481938
    19491939#ifndef SYNC_DNS
    1950         if (dns_fd != -1 && FD_ISSET(dns_fd,&r_fds)) {
     1940        if ((dns_fd != -1) && (dns_pollidx != -1) &&
     1941            (fds[dns_pollidx].revents & (POLLIN|POLLHUP|POLLERR))) {
    19511942                run_dns_queue();
    19521943        }
     
    19601951                int client_port;
    19611952
    1962                 if (sock_array[i] == -1) {
     1953                if ((fds[i].revents & (POLLIN|POLLHUP|POLLERR)) == 0) {
    19631954                        continue;
    19641955                }
    19651956
    1966                 if (!FD_ISSET(sock_array[i],&r_fds)) {
    1967                         continue;
    1968                 }
    1969 
    1970                 if (i < (listen_number/2)) {
     1957                if (attrs[i].type == NMB_PACKET) {
    19711958                        /* Port 137 */
    19721959                        packet_type = NMB_PACKET;
     
    19821969                }
    19831970
    1984                 packet = read_packet(sock_array[i], packet_type);
     1971                packet = read_packet(fds[i].fd, packet_type);
    19851972                if (!packet) {
    19861973                        continue;
     
    19921979                 */
    19931980                if (lp_bind_interfaces_only() &&
    1994                     (sock_array[i] == client_fd) &&
     1981                    (fds[i].fd == client_fd) &&
    19951982                    (!is_local_net_v4(packet->ip))) {
    19961983                        DEBUG(7,("discarding %s packet sent to broadcast socket from %s:%d\n",
     
    20182005                }
    20192006
    2020 
    20212007                if (is_processed_packet(processed_packet_list, packet)) {
    20222008                        DEBUG(7,("discarding duplicate packet from %s:%d\n",
     
    20282014                store_processed_packet(&processed_packet_list, packet);
    20292015
    2030                 /*
    2031                  * 0,2,4,... are unicast sockets
    2032                  * 1,3,5,... are broadcast sockets
    2033                  *
    2034                  * on broadcast socket we only receive packets
    2035                  * and send replies via the unicast socket.
    2036                  *
    2037                  * 0,1 and 2,3 and ... belong together.
    2038                  */
    2039                 if ((i % 2) != 0) {
     2016                if (attrs[i].broadcast) {
    20402017                        /* this is a broadcast socket */
    2041                         packet->send_fd = sock_array[i-1];
     2018                        packet->send_fd = fds[i-1].fd;
    20422019                } else {
    20432020                        /* this is already a unicast socket */
    2044                         packet->send_fd = sock_array[i];
     2021                        packet->send_fd = fds[i].fd;
    20452022                }
    20462023
Note: See TracChangeset for help on using the changeset viewer.