Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dhcp
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 109
    • Issues 109
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source Projects
  • dhcp
  • Issues
  • #19

Closed
Open
Created May 22, 2019 by Joe LeVeque@jlevequeGuest

HAVE_SO_BINDTODEVICE referenced before it has a chance to be defined

name: HAVE_SO_BINDTODEVICE referenced before it has a chance to be defined

Describe the bug

In includes/osdep.h, HAVE_SO_BINDTODEVICE is referenced on line 152 in the following conditional:

#if defined (USE_BPF_SEND) || defined (USE_NIT_SEND) || \
    defined (USE_DLPI_SEND) || defined (USE_UPF_SEND) || \
    defined (USE_LPF_SEND) || \
    (defined (USE_SOCKET_SEND) && defined (HAVE_SO_BINDTODEVICE))
#  define USE_SOCKET_FALLBACK
#  define USE_FALLBACK
#endif

However, it might not get defined until line 267, as follows:

#if defined (SO_BINDTODEVICE) && !defined (HAVE_SO_BINDTODEVICE)
# define HAVE_SO_BINDTODEVICE
#endif

Therefore, if USE_SOCKET_SEND is defined, it is possible that USE_SOCKET_FALLBACK and USE_FALLBACK will not get defined, even though they should, simply because HAVE_SO_BINDTODEVICE is referenced before it has had a chance to get defined.

To Reproduce

Steps to reproduce the behavior:

  1. Add a #pragma message() line inside the first #if block mentioned above (e.g., at line 153 of includes/osdep.h) so that the preprocessor will print the message if it enters the block
  2. Compile isc-dhcp on a system which defines SO_BINDTODEVICE (e.g., Debian Stretch), while also defining USE_SOCKETS (e.g., via the --enable-use-sockets configure flag)
  3. Note that the message does not print, although it should

Expected behavior

HAVE_SO_BINDTODEVICE should have an opportunity to be defined before it is referenced

Environment:

  • ISC DHCP version: All versions since commit d758ad8c (pre-version 4.0.0)
  • OS: Debian Jessie/Stretch, most likely many other Linux flavors
  • Which features were compiled in: USE_SOCKETS

Describe the solution you'd like

Reorder the file includes/osdep.h to ensure HAVE_SO_BINDTODEVICE has a chance to be defined before it is referenced.

Assignee
Assign to
Time tracking