Skip to content

Conversation

@rajamukerji
Copy link

Summary

This PR adds comprehensive Solaris support to rpcapd while preserving all existing macOS build fixes from the macos-build-fixes branch.

Changes Made

Solaris-specific fixes:

  • Syslog compatibility: Fixed LOG_PERROR and LOG_MAKEPRI issues that are not available on Solaris
  • Missing system includes: Added stdint.h (for UINT16_MAX) and stdlib.h (for atoi)
  • Macro conflicts: Fixed __NORETURN redefinition conflicts with Solaris system headers
  • Symbol conflicts: Resolved sockmain duplicate definition between rpcapd.c and pcap-new.c
  • Build configuration: Added Solaris compiler flags and library dependencies to vars.mk

libpcap Solaris fixes:

  • Function signatures: Fixed bpf_filter function signature to use const parameters
  • System includes: Added required includes (sys/ioccom.h, fcntl.h, unistd.h) for proper compilation
  • Platform-specific code: Added conditional compilation for Linux-specific AF_PACKET code
  • Header compatibility: Fixed Linux-specific includes in fad-getad.c and fileconf.c

Testing

Successfully tested on:

  • Solaris 11.4 (SunOS caladan 5.11 11.4.82.195.2 i86pc i386 i86pc kvm)
    • libpcap builds successfully
    • rpcapd builds successfully
    • rpcapd runs and binds to network ports correctly
    • All functionality working as expected

Compatibility

  • Preserves all macOS build fixes from the macos-build-fixes branch
  • Maintains Linux compatibility through conditional compilation
  • No breaking changes to existing functionality

Files Modified

  • vars.mk - Added Solaris build configuration
  • winpcap/wpcap/libpcap/bpf/net/bpf.h - Fixed bpf_filter function signature
  • winpcap/wpcap/libpcap/fad-getad.c - Conditional Linux-specific code
  • winpcap/wpcap/libpcap/pcap-bpf.c - Added required system includes
  • winpcap/wpcap/libpcap/pcap-new.c - Fixed sockmain symbol conflict
  • winpcap/wpcap/libpcap/rpcapd/daemon.c - Added stdint.h, fixed __NORETURN
  • winpcap/wpcap/libpcap/rpcapd/fileconf.c - Added stdlib.h, fixed Linux includes
  • winpcap/wpcap/libpcap/rpcapd/rpcapd.c - Fixed syslog compatibility

This enables rpcapd to run on Solaris systems while maintaining full backward compatibility with existing macOS and Linux builds.

## Changes Made

### Build System Fixes
- Update macOS SDK version from 10.8 to current SDK
- Fix Makefile to properly define OSXTARGET and OSXLIB variables
- Use xcrun clang instead of specific SDK version

### Header Guards
- Add missing header guards to gencode.h to prevent redefinition errors

### Compilation Fixes
- Fix pointer sign conversion warnings in daemon.c and pcap-remote.c
- Fix socklen_t type mismatch in getsockopt call
- Remove tautological pointer comparisons for array variables
- Fix varargs warning in rpcap_checkmsg function
- Guard INT_MAX macro redefinition in inet.c

### Function Prototypes
- Update deprecated K&R style function definitions to modern C prototypes
- Fix functions in scanner.l, inet.c, nametoaddr.c, and bpf_image.c

### Missing Symbols
- Add missing pcap_parse and pcap_strcasecmp function definitions
- Include required source files (gencode.c, nametoaddr.c, etc.) in build

## Result
- rpcapd now builds successfully on macOS with only legacy warnings
- All functional compilation errors eliminated
- Binary tested and working on macOS
Add _U_ macro definition to pcap-int.h to resolve compilation errors.
The _U_ macro is used for unused variable attributes but was not defined,
causing build failures on macOS.
Add platform-specific build instructions for Linux, macOS, and Windows.
Include the PLATFORM=osx flag required for macOS builds.
- Add -Wno-deprecated-non-prototype to suppress K&R style function warnings
- Add -Wno-return-type to suppress missing return value warnings
- Add -Wl,-w to suppress linker warnings
- Enables clean builds on macOS without affecting functionality
The port parameter can be NULL, so we need to check for this condition
before dereferencing it to prevent potential segmentation faults.
The ctrlport parameter can be NULL, so we need to check for this condition
before dereferencing it to prevent potential segmentation faults.
This commit adds comprehensive Solaris support while preserving all macOS build fixes:

Solaris-specific changes:
- Add Solaris build configuration to vars.mk
- Fix LOG_PERROR and LOG_MAKEPRI syslog compatibility issues
- Add missing system includes (stdint.h for UINT16_MAX, stdlib.h for atoi)
- Fix __NORETURN macro redefinition conflicts
- Resolve sockmain symbol conflicts between rpcapd.c and pcap-new.c

libpcap Solaris fixes:
- Fix bpf_filter function signature to use const parameters
- Add required system includes (sys/ioccom.h, fcntl.h, unistd.h)
- Conditional compilation for Linux-specific AF_PACKET code
- Fix Linux-specific includes in fad-getad.c and fileconf.c

Based on macos-build-fixes branch, includes all previous macOS compatibility work.
Successfully tested on Solaris 11.4 (SunOS caladan 5.11 11.4.82.195.2)
Added build instructions for Solaris including package installation
and make target usage consistent with other platform sections.
- Fix malformed preprocessor directives in fad-getad.c
- Fix corrupted __NORETURN macro definition in daemon.c
- Restore LOG_MAKEPRI usage for non-Solaris platforms while keeping
  Solaris-specific workaround for LOG_MAKEPRI issues
- Remove tautological NULL comparisons for array pointers in pcap-new.c and pcap-remote.c
- Add HAVE_STRERROR to macOS build flags to avoid sys_nerr redeclaration
- Add pcap.c and savefile.c to the build to resolve undefined symbols
- Replace _U_ macro with __attribute__((unused)) in rcsid declarations
- Fix sys_nerr type declaration to match system headers

These fixes resolve compilation errors that prevented the build from
completing successfully on macOS with modern compilers.
- Add platform detection for macOS/Darwin in Makefile
- Add Solaris platform support to the Makefile
- Fix yacc and lex commands to use pcap_ prefix for generated symbols
- This resolves linking errors for pcap_parse, pcap_lval, and pcap_lex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant