Changeset dfb2144 in rtems-libbsd


Ignore:
Timestamp:
05/22/23 07:36:46 (4 months ago)
Author:
Christian Mauderer <christian.mauderer@…>
Branches:
master
Children:
af0fcc3
Parents:
16be3a7
git-author:
Christian Mauderer <christian.mauderer@…> (05/22/23 07:36:46)
git-committer:
Christian Mauderer <christian.mauderer@…> (05/31/23 06:21:12)
Message:

ipsec-tools: Fix copying fd_set prior to select

The racoon session code copies an fd_set from one variable into another
prior to calling select. That works well for simple structures.

In libbsd we have to allocate fd_sets instead of using fixed structures
to avoid a problem with file numbers bigger than FD_SETSIZE. The simple
assignment didn't work in that case.

This patch makes sure that a memcpy is used instead.

Update #4913

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ipsec-tools/src/racoon/session.c

    r16be3a7 rdfb2144  
    216216        FD_ZERO(&preset_mask);
    217217#else /* __rtems__ */
     218        size_t allocated_mask_size = sizeof(fd_set) *
     219            howmany(rtems_libio_number_iops, sizeof(fd_set) * 8);
    218220        allocated_preset_mask = calloc(sizeof(fd_set),
    219221            howmany(rtems_libio_number_iops, sizeof(fd_set) * 8));
     
    353355                /* schedular can change select() mask, so we reset
    354356                 * the working copy here */
     357#ifndef __rtems__
    355358                active_mask = preset_mask;
     359#else /* __rtems__ */
     360                memcpy(allocated_active_mask, allocated_preset_mask,
     361                    allocated_mask_size);
     362#endif /* __rtems__ */
    356363
    357364                error = select(nfds + 1, &active_mask, NULL, NULL, timeout);
Note: See TracChangeset for help on using the changeset viewer.