Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ssdp-responder for openSUSE:Factory checked in at 2022-10-31 10:45:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ssdp-responder (Old) and /work/SRC/openSUSE:Factory/.ssdp-responder.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ssdp-responder" Mon Oct 31 10:45:07 2022 rev:5 rq:1032369 version:1.9 Changes: -------- --- /work/SRC/openSUSE:Factory/ssdp-responder/ssdp-responder.changes 2021-11-27 00:52:23.570580718 +0100 +++ /work/SRC/openSUSE:Factory/.ssdp-responder.new.2275/ssdp-responder.changes 2022-10-31 10:45:08.232985987 +0100 @@ -1,0 +2,10 @@ +Mon Oct 31 06:33:00 UTC 2022 - Andreas Stieger <andreas.stie...@gmx.de> + +- update to 1.9: + * Add testing command line options to sscp-scan + * Fix TOCTOU issue with caching of UUID +- includes changes form 1.8: + * improvements to UUID cache directory handling + * Fix avahi-daemon (mDNS) conflict + +------------------------------------------------------------------- Old: ---- ssdp-responder-1.7.tar.gz New: ---- ssdp-responder-1.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ssdp-responder.spec ++++++ --- /var/tmp/diff_new_pack.2zbkoR/_old 2022-10-31 10:45:08.912989413 +0100 +++ /var/tmp/diff_new_pack.2zbkoR/_new 2022-10-31 10:45:08.912989413 +0100 @@ -1,7 +1,7 @@ # # spec file for package ssdp-responder # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # Copyright (c) 2018, Martin Hauke <mar...@gmx.de> # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,7 @@ Name: ssdp-responder -Version: 1.7 +Version: 1.9 Release: 0 Summary: SSDP responder for Linux License: ISC @@ -40,8 +40,7 @@ announced. %prep -%setup -q -%patch0 -p1 +%autosetup -p1 %build autoreconf -fiv ++++++ ssdp-responder-1.7.tar.gz -> ssdp-responder-1.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/.github/workflows/build.yml new/ssdp-responder-1.9/.github/workflows/build.yml --- old/ssdp-responder-1.7/.github/workflows/build.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/ssdp-responder-1.9/.github/workflows/build.yml 2022-10-30 17:16:41.000000000 +0100 @@ -0,0 +1,51 @@ +name: Bob the Builder + +# Run on all branches, including all pull requests, except the 'dev' +# branch since that's where we run Coverity Scan (limited tokens/day) +on: + push: + branches: + - '**' + - '!dev' + pull_request: + branches: + - '**' + +jobs: + build: + # Verify we can build on latest Ubuntu with both gcc and clang + name: ${{ matrix.compiler }} + runs-on: ubuntu-latest + strategy: + matrix: + compiler: [gcc, clang] + fail-fast: false + env: + MAKEFLAGS: -j3 + CC: ${{ matrix.compiler }} + steps: + - name: Dependencies + run: | + sudo apt-get -y update + sudo apt-get -y install pkg-config libsystemd-dev + - uses: actions/checkout@v3 + - name: Configure + run: | + ./autogen.sh + ./configure --prefix= + - name: Build + run: | + make + - name: Install + run: | + DESTDIR=~/tmp make install-strip + tree ~/tmp + ldd ~/tmp/sbin/ssdpd + size ~/tmp/sbin/ssdpd + ldd ~/tmp/bin/ssdp-scan + size ~/tmp/bin/ssdp-scan + ~/tmp/sbin/ssdpd -h + ~/tmp/bin/ssdp-scan -h + - name: Distcheck + run: | + make distcheck diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/.github/workflows/coverity.yml new/ssdp-responder-1.9/.github/workflows/coverity.yml --- old/ssdp-responder-1.7/.github/workflows/coverity.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/ssdp-responder-1.9/.github/workflows/coverity.yml 2022-10-30 17:16:41.000000000 +0100 @@ -0,0 +1,56 @@ +name: Coverity Scan + +on: + push: + branches: + - 'dev' + +env: + PROJECT_NAME: ssdp-responder + CONTACT_EMAIL: troglo...@gmail.com + COVERITY_NAME: troglobit-ssdp-responder + COVERITY_PROJ: troglobit%2Fssdp-responder + +jobs: + coverity: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + id: coverity-toolchain-cache + with: + path: cov-analysis-linux64 + key: ${{ runner.os }}-coverity + - name: Download Coverity Scan + if: steps.coverity-toolchain-cache.outputs.cache-hit != 'true' + env: + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + run: | + wget -q https://scan.coverity.com/download/cxx/linux64 \ + --post-data "token=$TOKEN&project=${COVERITY_PROJ}" \ + -O cov-analysis-linux64.tar.gz + mkdir cov-analysis-linux64 + tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64 + - name: Install build dependencies + run: | + sudo apt-get -y update + sudo apt-get -y install pkg-config libsystemd-dev + - name: Build + run: | + ./autogen.sh + ./configure --prefix= + export PATH=`pwd`/cov-analysis-linux64/bin:$PATH + cov-build --dir cov-int make + - name: Submit result to Coverity Scan + env: + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} + run: | + tar czvf ${PROJECT_NAME}.tgz cov-int + curl \ + --form project=${COVERITY_NAME} \ + --form token=$TOKEN \ + --form email=${CONTACT_EMAIL} \ + --form file=@${PROJECT_NAME}.tgz \ + --form version=trunk \ + --form description="${PROJECT_NAME} $(git rev-parse HEAD)" \ + https://scan.coverity.com/builds?project=${COVERITY_PROJ} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/.github/workflows/release.yml new/ssdp-responder-1.9/.github/workflows/release.yml --- old/ssdp-responder-1.7/.github/workflows/release.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/ssdp-responder-1.9/.github/workflows/release.yml 2022-10-30 17:16:41.000000000 +0100 @@ -0,0 +1,62 @@ +name: Release General + +on: + push: + tags: + - 'v[0-9]+.[0-9]+' + +jobs: + release: + name: Create GitHub release + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + outputs: + upload_url: ${{ steps.create_release.outputs.upload_url }} + release_id: ${{ steps.create_release.outputs.id }} + steps: + - uses: actions/checkout@v3 + - name: Extract ChangeLog entry ... + # Hack to extract latest entry for body_path below + run: | + awk '/-----*/{if (x == 1) exit; x=1;next}x' ChangeLog.md \ + |head -n -1 > release.md + cat release.md + - name: Create release ... + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ssdp-responder ${{ github.ref }} + body_path: release.md + draft: false + prerelease: false + tarball: + name: Build and upload release tarball + needs: release + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Installing dependencies ... + run: | + sudo apt-get -y update + sudo apt-get -y install libssl-dev + - name: Creating Makefiles ... + run: | + ./autogen.sh + ./configure --prefix= + - name: Build release ... + run: | + make release + ls -lF ../ + mkdir -p artifacts/ + mv ../*.tar.* artifacts/ + - name: Upload release artifacts ... + uses: skx/github-action-publish-binaries@release-0.15 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + releaseId: ${{ needs.release.outputs.release_id }} + args: artifacts/* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/.travis.yml new/ssdp-responder-1.9/.travis.yml --- old/ssdp-responder-1.7/.travis.yml 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,49 +0,0 @@ -# Travis CI integration -# Defaults to GNU GCC and autotools: ./configure && make && make test -language: c - -# Workaoround for running tests that wget from localhost:8080 -#dist: trusty -sudo: required -group: deprecated-2017Q4 - -# Test build with both GCC and Clang (LLVM) -compiler: - - gcc - - clang - -env: - global: - # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created - # via the "travis encrypt" command using the project repo's public key - - secure: "HAfq1X7E6kSeu7AQCsttiiwhc7Q0e+7KbRwBXzH/bZTZ537xhKPvRKGu5AoFKnInj/SfZ4oLnBipvx75kvhhOc1bOWbjNgUwTuXdANKY/5xlo5cX1jq7Dh7boajhrywZmS+ZORg++C3rRUqx8ggCMETw9pWx/Hn2QieEPJy3Qsm3reesJ5CtYSZpXSaAZwi/LLskZ9oz/L6lduKHj5x1XPH/ElP9R2y2SecbUSFQ+2bcHsCK3tvCM8WdkFCbjF2VWabhay0vo3U10j2ADyMnGqvuvo/8aQgRQW53l4vfrN4ApbCnybE95guZ7m9g9kIiIfBt/WS47PbGyYV/u+W9iL+AKYgqVXopnPcRd+07VuBqD8yH9RxmScCSHE4wrIvfbozNCKcHDdDNyfyJ6Ci99U0UNNJsFpRmYL0yBFA+huXY1VGxGHsART+dNcJ7aX5pQ7EG72Kz/gmLSDXoPwbvDBaiVvKE3UqZ6mnyFlIGpG1l11NFE71PQMBXypNGCR/6utmjGNoHIjwhrGDd3Eunn6IuA516kN6lJr8rDLrYoABfmz9EcNsj45YbeKII1i+sk7ZIog5g08gPWG+rbko+6M6yfOTfkyt8tohvUDgN6a6mXQEPRfSOJGCT90+HOp8BblboQrF5j9B1NDqS1SAcnDXofSHWFjcEWCcvVEKCU9s=" - -before_install: - - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- - -addons: - apt: - packages: - - tree - coverity_scan: - project: - name: "troglobit/ssdp-responder" - description: "SSDP responder for Linux" - notification_email: troglo...@gmail.com - build_command_prepend: "./autogen.sh && ./configure --prefix=/" - build_command: "make clean all" - branch_pattern: dev - -# We don't store generated files (configure and Makefile) in GIT, -# so we must customize the default build script to run ./autogen.sh -script: - - ./autogen.sh - - ./configure --prefix= --enable-test-mode - - make V=1 clean - - make V=1 all - - sudo make V=1 check - - make V=1 install-strip DESTDIR=~/tmp - - tree -h ~/tmp - - ldd ~/tmp/sbin/ssdpd - - size ~/tmp/sbin/ssdpd - - ~/tmp/sbin/ssdpd -h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/ChangeLog.md new/ssdp-responder-1.9/ChangeLog.md --- old/ssdp-responder-1.7/ChangeLog.md 1970-01-01 01:00:00.000000000 +0100 +++ new/ssdp-responder-1.9/ChangeLog.md 2022-10-30 17:16:41.000000000 +0100 @@ -0,0 +1,158 @@ +Change Log +========== + +All notable changes to the project are documented in this file. + + +[v1.9][] - 2022-10-30 +--------------------- + +The [Dennis Ritchie](https://www.oreilly.com/content/dennis-ritchie-day/) release. + +### Changes + - Add command line options to `sscp-scan`, mostly for testing but may + be useful for other purposes too + - Use `$ac_default_prefix` instead of `/usr/local` in configure script + when expanding paths + - Update copyright years (affects LICENSE file hash) + - Add ChangeLog to project + - Drop Travis-CI in favor of GitHub Actions + +### Fixes + - Fix #6: workaround for OpenVPN /32 default server setup + - Fix #9: time-of-check vs time-of-use issue with caching of UUID, + found by Coverity Scan, fixed by Raul Porancea + - Fix #10: basic instructions for building and starting the daemon + + +[v1.8][] - 2021-01-23 +--------------------- + +### Changes + - Use UUID cache directory from configure script, with fall-back to + operating system specific `/var/lib/misc` or `/var/db` + - Update man page with info on UUID cache location + - Add missing systemd unit file + - Add missing SysV init script + +### Fixes + - Fix avahi-daemon (mDNS) conflict, no conflict with SSDP, caused by + copy-paste between mdnsd and project and this + - Fix default install prefix, should be GNU `/usr/local` not `/`. The + default for Debian systems is `/usr` + - Workaround for `--runstatedir` on systems with older autoconf + + +[v1.7][] - 2020-06-07 +--------------------- + +### Changes + - Use `/etc/os-release` as base for SSDP server string, distribution + release information is primarily stored in this file, some Linux + systems still use `/etc/lsb-release`, on real UNIX systems we can use + `uname(1)` + - Update [ssdpd(8)](https://man.troglobit.com/man8/ssdpd.8.html) man page + +### Fixes + - N/A + + +[v1.6][] - 2020-06-07 +--------------------- + +### Changes + - Refactor socket handling, enable `SO_REUSEADDR` + `SO_REUSEPORT` + - Change default behavior, must now use `-n` to run in foreground + - Add `ssdp-scan` tool, similar to `mdns-scan` + - Add systemd unit file + - Initial Debian/Ubuntu packaging + +### Fixes + - Fix #1: CVE-2019-14323 + + +[v1.5][] - 2017-09-23 +--------------------- + +### Changes + - New default SSDP notify interval, 300 sec. (Was 600 sec) + - Validation of refresh and notify intervals, the notify interval must + not be longer than half the cache timeout + - Notify: 30-900 sec + - Refresh: 5-1800 sec + +### Fixes + - Fix regression in v1.3, allow running without interface filtering + - The new interface filtering feature of v1.4 managed to filter out all + interfaces if none were given on the command line. + - Fix CPU overload problem, caused by invalid timer comparison + + +[v1.4][] - 2017-05-16 +--------------------- + +Minor bug fix release. + +### Fixes + - Fix invalid argument to `accept()` in web server + + +[v1.3][] - 2017-05-16 +--------------------- + +### Changes + - Massive refactor + - Support SSDP per interface and multiple addresses per interface + - Use `SOCK_DGRAM` instead of `SOCK_RAW`, no longer need to run as root + - New refresh timer, runs independently of NOTIFY timer, checks for new addresses + + +[v1.2][] - 2017-05-16 +--------------------- + +Announces itself as an InternetGatewayDevice, works with Windows, serves +XML description. + +### Changes + - Optional `--with-vendor-url=URL` configure option for XML description + - Read server string from `/etc/lsb-release`, if it exists + - Save cached version of generated UUID between restarts + - Make XML manufacturer and modelName configurable + + +[v1.1][] - 2017-05-12 +--------------------- + +### Changes + - Generate a proper variant 1, version 4, random session UUID + - Send notify only for UUID, rootdevice and IGD + - Weirdly enough the UPnP spec. says the TTL should be 2 for multicast + - Add UUID to description.xml and remove icon data for now + - UPnP spec says to use RFC1123 date, as specified in RFC2616 + - Use HTTP/1.1 everywhere, clean up XML a bit + - `max-age 120` --> 1800 and run web server on SSDP port + - Add SSDP port to address composition + - Add `-d` to enable debug mode, with syslog support + - Add `-v` to list version and update usage text + +### Fixes + - Fix nasty bug in M-SEARCH reply, missing ST rootdevince in USN + - No need to `sleep(1)` after IGMP join, we can announce w/o it + + +v1.0 - 2017-05-11 +----------------- + +Initial release + + +[v1.9]: https://github.com/troglobit/ssdp-responder/compare/v1.8...v1.9 +[v1.8]: https://github.com/troglobit/ssdp-responder/compare/v1.7...v1.8 +[v1.7]: https://github.com/troglobit/ssdp-responder/compare/v1.6...v1.7 +[v1.6]: https://github.com/troglobit/ssdp-responder/compare/v1.5...v1.6 +[v1.5]: https://github.com/troglobit/ssdp-responder/compare/v1.4...v1.5 +[v1.4]: https://github.com/troglobit/ssdp-responder/compare/v1.3...v1.4 +[v1.3]: https://github.com/troglobit/ssdp-responder/compare/v1.2...v1.3 +[v1.2]: https://github.com/troglobit/ssdp-responder/compare/v1.1...v1.2 +[v1.1]: https://github.com/troglobit/ssdp-responder/compare/v1.0...v1.1 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/LICENSE new/ssdp-responder-1.9/LICENSE --- old/ssdp-responder-1.7/LICENSE 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/LICENSE 2022-10-30 17:16:41.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2017-2020 Joachim Nilsson <troglo...@gmail.com> +Copyright (c) 2017-2022 Joachim Wiberg <troglo...@gmail.com> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/Makefile.am new/ssdp-responder-1.9/Makefile.am --- old/ssdp-responder-1.7/Makefile.am 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/Makefile.am 2022-10-30 17:16:41.000000000 +0100 @@ -1,6 +1,6 @@ SUBDIRS = src man -doc_DATA = README.md LICENSE -EXTRA_DIST = README.md LICENSE +doc_DATA = README.md ChangeLog.md LICENSE +EXTRA_DIST = README.md ChangeLog.md LICENSE if HAVE_SYSTEMD systemd_DATA = ssdpd.service @@ -20,9 +20,9 @@ ## Check if tagged in git release-hook: - if [ ! `git tag | grep $(PACKAGE_VERSION)` ]; then \ + if [ "x`git tag -l v$(PACKAGE_VERSION)|grep v$(PACKAGE_VERSION)`" = "x" ]; then \ echo; \ - printf "\e[1m\e[41mCannot find release tag $(PACKAGE_VERSION)\e[0m\n"; \ + printf "\e[1m\e[41mCannot find release tag v$(PACKAGE_VERSION)\e[0m\n"; \ printf "\e[1m\e[5mDo release anyway?\e[0m "; read yorn; \ if [ "$$yorn" != "y" -a "$$yorn" != "Y" ]; then \ printf "OK, aborting release.\n"; \ @@ -31,12 +31,12 @@ echo; \ else \ echo; \ - printf "\e[1m\e[42mFound GIT release tag $(PACKAGE_VERSION)\e[0m\n"; \ + printf "\e[1m\e[42mFound GIT release tag v$(PACKAGE_VERSION)\e[0m\n"; \ printf "\e[1m\e[44m>>Remember to push tags!\e[0m\n"; \ echo; \ fi -release: release-hook distcheck package +release: release-hook distcheck @for file in $(DIST_ARCHIVES); do \ md5sum $$file > ../$$file.md5; \ done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/README.md new/ssdp-responder-1.9/README.md --- old/ssdp-responder-1.7/README.md 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/README.md 2022-10-30 17:16:41.000000000 +0100 @@ -1,6 +1,6 @@ SSDP Responder for Linux/UNIX ============================= -[![License Badge][]][License] [![Travis Status][]][Travis] [![Coverity Status][]][Coverity Scan] +[![License Badge][]][License] [![GitHub Status][]][GitHub] [![Coverity Status][]][Coverity Scan] Simple Service Discovery Protocol daemon (SSDP) for networked Linux and UNIX devices. Useful in any setup, big or small, but targeted more at @@ -54,6 +54,68 @@ ``` +Configure & Build +----------------- + +The GNU Configure & Build system use `/usr/local` as the default install +prefix. In many cases this is useful, but this means the configuration +files, cache, and PID files will also use that prefix. Most users have +come to expect those files in `/etc/` and `/var/` and configure has a +few useful options that are recommended to use. Hence, you may want to +use something like this: + + ./configure --prefix=/usr --sysconfdir=/etc --runstatedir=/var/run + make -j$(($(nproc) + 1)) + sudo make install-strip + +Usually your system reserves `/usr` for native pacakges, so most users +drop `--prefix`, installing to `/usr/local`, or use `--prefix=/opt`. + +**Note:** On some systems `--runstatedir` may not be available in the + configure script, try `--localstatedir=/var` instead. + + +### Building from GIT + +The `configure` script and the `Makefile.in` files are generated for +release tarballs and not stored in GIT. When you work with the GIT +source tree you need the GNU `automake` and `autoconf` tools: + + $ sudo apt install automake autoconf + +Now, from the top directory of the cloned GIT tree, call: + + $ ./autogen.sh + + +### Static Build + +Some people want to build statically, to do this with `autoconf` add the +following `LDFLAGS=` *after* the configure script. You may also need to +add `LIBS=...`, which will depend on your particular system: + + ./configure LDFLAGS="-static" ... + + +Integration with systemd +------------------------ + +For systemd integration `libsystemd-dev` and `pkg-config` are required. +When the unit file is installed, `systemctl` can be used to enable and +start the daemon: + + $ sudo systemctl enable ssdpd.service + $ sudo systemctl start ssdpd.service + +Check that it started properly by inspecting the system log, or: + + $ sudo systemctl status ssdpd.service + +To stop the service: + + $ sudo systemctl stop ssdpd.service + + Origin ------ @@ -62,7 +124,7 @@ [License]: https://en.wikipedia.org/wiki/ISC_license [License Badge]: https://img.shields.io/badge/License-ISC-blue.svg -[Travis]: https://travis-ci.org/troglobit/ssdp-responder -[Travis Status]: https://travis-ci.org/troglobit/ssdp-responder.png?branch=master +[GitHub]: https://github.com/troglobit/ssdp-responder/actions/workflows/build.yml/ +[GitHub Status]: https://github.com/troglobit/ssdp-responder/actions/workflows/build.yml/badge.svg [Coverity Scan]: https://scan.coverity.com/projects/20496 [Coverity Status]: https://scan.coverity.com/projects/20496/badge.svg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/configure.ac new/ssdp-responder-1.9/configure.ac --- old/ssdp-responder-1.7/configure.ac 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/configure.ac 2022-10-30 17:16:41.000000000 +0100 @@ -1,4 +1,4 @@ -AC_INIT([ssdpd], [1.7], [https://github.com/troglobit/ssdp-responder/issues], +AC_INIT([ssdpd], [1.9], [https://github.com/troglobit/ssdp-responder/issues], [ssdp-responder], [https://github.com/troglobit/ssdp-responder]) AC_CONFIG_AUX_DIR(aux) AM_INIT_AUTOMAKE([1.11 foreign]) @@ -9,8 +9,29 @@ AC_CONFIG_HEADER([config.h]) AC_CONFIG_FILES([Makefile src/Makefile man/Makefile ssdpd.service]) +# Check for standard programs, headers, and functions AC_PROG_CC AC_PROG_INSTALL + +# Check build host, differnt for each operating system +AC_CANONICAL_HOST + +case $host_os in + netbsd*|openbsd*|freebsd*|dragonfly*|solaris*) + vardb=db + ;; + linux*) + vardb=lib/misc + CPPFLAGS="-D_GNU_SOURCE" + ;; + *) + vardb=tmp + ;; +esac + +AC_SUBST(vardb) + +# Required to check for libsystemd-dev PKG_PROG_PKG_CONFIG # Check if some func is not in libc @@ -68,14 +89,21 @@ [AC_SUBST([systemddir], [$with_systemd])]) AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemd" != "xno"]) -# Expand variables early, for systemd unit file and others -test "x$prefix" = "xNONE" && prefix= +# Expand $sbindir early, into $SBINDIR, for systemd unit file +# NOTE: This does *not* take prefix/exec_prefix override at "make +# install" into account, unfortunately. +test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = "xNONE" && exec_prefix='${prefix}' SBINDIR=`eval echo $sbindir` SBINDIR=`eval echo $SBINDIR` AC_SUBST(SBINDIR) +# Workaround for autoconf < 2.70, although some major distros have +# backported support for runstatedir already. +AS_IF([test -z "$runstatedir"], runstatedir="$localstatedir/run") +AC_SUBST(runstatedir) + # Create all config files AC_OUTPUT @@ -83,6 +111,7 @@ # sysconfdir => ${prefix}/etc # runstatedir => ${localstatedir}/run SYSCONFDIR=`eval echo $sysconfdir` +LOCALSTATEDIR=`eval echo $localstatedir` RUNSTATEDIR=`eval echo $runstatedir` RUNSTATEDIR=`eval echo $RUNSTATEDIR` @@ -90,9 +119,9 @@ ------------------ Summary ------------------ $PACKAGE_NAME version $PACKAGE_VERSION - Prefix.............: $prefix - Sysconfdir.........: $SYSCONFDIR - Runstatedir........: $RUNSTATEDIR + Install prefix.....: $prefix + PID file...........: $RUNSTATEDIR/ssdpd.pid + UUID cache file....: $LOCALSTATEDIR/$vardb/ssdpd.cache C Compiler.........: $CC $CFLAGS $CPPFLAGS $LDFLAGS $LIBS Site specifics: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/.gitignore new/ssdp-responder-1.9/debian/.gitignore --- old/ssdp-responder-1.7/debian/.gitignore 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -.debhelper -autoreconf.after -autoreconf.before -debhelper-build-stamp -files -ssdpd.debhelper.log -ssdpd.substvars -ssdpd.postinst.debhelper -ssdpd.postrm.debhelper -ssdpd.prerm.debhelper -ssdpd/* -ssdp-scan.debhelper.log -ssdp-scan.substvars -ssdp-scan.postinst.debhelper -ssdp-scan.postrm.debhelper -ssdp-scan.prerm.debhelper -ssdp-scan/ -tmp/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/changelog new/ssdp-responder-1.9/debian/changelog --- old/ssdp-responder-1.7/debian/changelog 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/changelog 1970-01-01 01:00:00.000000000 +0100 @@ -1,20 +0,0 @@ -ssdp-responder (1.7) unstable; urgency=medium - - * Use /etc/os-release as base for SSDP server string, distribution - release information is primarily stored in this file, some Linux - systems still use /etc/lsb-release, on real UNIX systems we can - use uname(1). - * Update ssdpd(8) man page - - -- Joachim Nilsson <troglo...@gmail.com> Sun, 07 Jun 2020 16:40:44 +0200 - -ssdp-responder (1.6) stable; urgency=low - - * Fix #1: CVE-2019-14323 - * Refactor socket handling, enable SO_REUSEADDR + SO_REUSEPORT - * Change default behavior, must now use -n to run in foreground - * Add ssdp-scan tool, similar to mdns-scan - * Add systemd unit file - * Initial Debian/Ubuntu packaging - - -- Joachim Nilsson <troglo...@gmail.com> Sun, 07 Jun 2020 13:34:02 +0200 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/compat new/ssdp-responder-1.9/debian/compat --- old/ssdp-responder-1.7/debian/compat 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/compat 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/control new/ssdp-responder-1.9/debian/control --- old/ssdp-responder-1.7/debian/control 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/control 1970-01-01 01:00:00.000000000 +0100 @@ -1,33 +0,0 @@ -Source: ssdp-responder -Section: net -Priority: optional -Build-Depends: debhelper (>= 10), pkg-config, systemd -Standards-Version: 4.3.0 -Maintainer: Joachim Nilsson <troglo...@gmail.com> -Homepage: https://github.com/troglobit/ssdp-responder -Vcs-Git: https://github.com/troglobit/ssdp-responder.git -Vcs-Browser: https://github.com/troglobit/ssdp-responder/commits/ - -Package: ssdpd -Suggests: mdns-scan -Conflicts: avahi-daemon -Depends: ${shlibs:Depends}, ${misc:Depends} -Architecture: any -Description: SSDP responder for Linux - ssdpd is a stand-alone UNIX daemon with no external dependencies but - the standard C library. It has a built-in web server for serving the - UPnP XML description which Windows use to present the icon, by default - an InternetGatewayDevice is announced. - -Package: ssdp-scan -Suggests: ssdpd -Depends: ${shlibs:Depends}, ${misc:Depends} -Architecture: any -Description: scan for SSDP capable devices on attached networks - ssdp-scan is a companion tool to ssdpd, but can also be used stand-alone - to scan for other SSDP capable devices. It works by sending M-SEARCH * - to the multicast group 239.255.255.250. - . - ssdp-scan runs continuously and detects new devices as they appear on the - network. The load it incurs on the network is noticeable, please use it - only for debug and discovery purposes.. Use Ctrl-C to stop it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/copyright new/ssdp-responder-1.9/debian/copyright --- old/ssdp-responder-1.7/debian/copyright 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/copyright 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: ssdp-responder -Source: https://github.com/troglobit/ssdp-responder - -Files: * -Copyright: 2017-2020 Joachim Nilsson <troglo...@gmail.com> -License: ISC - -Files: debian/* -Copyright: Copyright 2020 Joachim Nilsson <troglo...@gmail.com> -License: ISC - -License: ISC - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - . - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/docs new/ssdp-responder-1.9/debian/docs --- old/ssdp-responder-1.7/debian/docs 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/docs 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -README.md diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/rules new/ssdp-responder-1.9/debian/rules --- old/ssdp-responder-1.7/debian/rules 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/rules 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -#!/usr/bin/make -f -# export DH_VERBOSE=1 -export DEB_BUILD_MAINT_OPTIONS = hardening=+all - -%: - dh $@ --with=autoreconf,systemd - -override_dh_auto_install: - dh_auto_install - rm -f debian/mdnsd/usr/share/doc/mdnsd/LICENSE - -override_dh_installinit: - dh_systemd_enable - dh_installinit - dh_systemd_start diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/source/format new/ssdp-responder-1.9/debian/source/format --- old/ssdp-responder-1.7/debian/source/format 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/source/format 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -3.0 (native) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/ssdp-scan.install new/ssdp-responder-1.9/debian/ssdp-scan.install --- old/ssdp-responder-1.7/debian/ssdp-scan.install 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/ssdp-scan.install 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -usr/bin/ssdp-scan -usr/share/man/man1/ssdp-scan.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/ssdpd.dirs new/ssdp-responder-1.9/debian/ssdpd.dirs --- old/ssdp-responder-1.7/debian/ssdpd.dirs 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/ssdpd.dirs 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -usr/share diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/ssdpd.install new/ssdp-responder-1.9/debian/ssdpd.install --- old/ssdp-responder-1.7/debian/ssdpd.install 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/ssdpd.install 1970-01-01 01:00:00.000000000 +0100 @@ -1,2 +0,0 @@ -usr/sbin/ssdpd -usr/share/man/man8/ssdpd.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/debian/watch new/ssdp-responder-1.9/debian/watch --- old/ssdp-responder-1.7/debian/watch 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/debian/watch 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -version=3 -opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/ssdp-responder-$1\.tar\.gz/ \ - https://github.com/troglobit/ssdp-responder/releases .*/ssdp-responder-?(\d\S*)\.tar\.gz diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/lib/pidfile.c new/ssdp-responder-1.9/lib/pidfile.c --- old/ssdp-responder-1.7/lib/pidfile.c 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/lib/pidfile.c 2022-10-30 17:16:41.000000000 +0100 @@ -49,7 +49,7 @@ static void pidfile_cleanup(void); -const char *__pidfile_path = LOCALSTATEDIR "/run"; +const char *__pidfile_path = _PIDFILEDIR; const char *__pidfile_name = NULL; int diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/lib/utimensat.c new/ssdp-responder-1.9/lib/utimensat.c --- old/ssdp-responder-1.7/lib/utimensat.c 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/lib/utimensat.c 2022-10-30 17:16:41.000000000 +0100 @@ -1,6 +1,6 @@ /* Replacement in case utimensat(2) is missing * - * Copyright (C) 2017-2018 Joachim Nilsson <troglo...@gmail.com> + * Copyright (C) 2017-2018 Joachim Wiberg <troglo...@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/man/ssdp-scan.1 new/ssdp-responder-1.9/man/ssdp-scan.1 --- old/ssdp-responder-1.7/man/ssdp-scan.1 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/man/ssdp-scan.1 2022-10-30 17:16:41.000000000 +0100 @@ -1,5 +1,5 @@ .\" -*- nroff -*- -.\" Copyright (c) 2017-2020 Joachim Nilsson <troglo...@gmail.com> +.\" Copyright (c) 2017-2022 Joachim Wiberg <troglo...@gmail.com> .\" .\" Permission to use, copy, modify, and/or distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -12,7 +12,7 @@ .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.a -.Dd May 31, 2020 +.Dd Oct 22, 2022 .Dt ssdp-scan 1 .Os .Sh NAME @@ -20,6 +20,9 @@ .Nd Scan for SSDP capable devices on attached networks .Sh SYNOPSIS .Nm +.Op Fl h +.Op Fl l Ar LEVEL +.Op Fl t Ar SEC .Sh DESCRIPTION .Nm is a tool for scanning for Simple Service Discovery Protocol (SSDP) @@ -29,8 +32,41 @@ .Cm 239.255.255.250 to continuously update a list of SSDP hosts. .Sh OPTIONS +The following command line options are available: +.Bl -tag -width "-l LEVEL " +.It Fl h +Show program help text. +.It Fl l Ar LEVEL +Set log level to one of the following, default +.Nm notice : +.Pp +.Bl -tag -width WARNING -compact +.It Cm none +Disable all logging +.It Cm error +Error conditions +.It Cm warning +Warning conditions +.It Cm notice +Normal but significant condition (default) +.It Cm info +Informational +.It Cm debug +Debug-level messages +.El +.Pp +..It Fl t Ar SEC +Timeout and exit after +.Ar SEC +seconds. +.It Op Ar IFACE +By default +.Nm +runs on all IPv4 capable interfaces, except loopback. If interface +names are given as arguments, .Nm -has no command line options. +will run only on them. +.El .Sh NOTES .Nm is very impatient. In order to scan for hosts it sends @@ -40,9 +76,12 @@ .Nm to retrieve XML files from each replying host. Be careful. .Pp +Unless started with the +.Fl t Ar SEC +option, .Nm -does not terminate on its own. It scans continuously until the user -stops it by pressing Ctrl-C. +does not terminate on its own. Instead, it scans continuously until the +user stops it by pressing Ctrl-C. .Pp .Nm does not rely on a local SSDP responder. It has no dependencies besides @@ -52,7 +91,8 @@ .Sh AUTHORS .Nm was written by -.An Joachim Nilsson Aq troglo...@gmail.com -to be able to test +.An Joachim Wiberg Aq troglo...@gmail.com +to test .Nm ssdpd -in complex network topologies. +in complex network topologies. It is modeled on +.Xr mdns-scan 1 . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/man/ssdpd.8 new/ssdp-responder-1.9/man/ssdpd.8 --- old/ssdp-responder-1.7/man/ssdpd.8 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/man/ssdpd.8 2022-10-30 17:16:41.000000000 +0100 @@ -1,5 +1,5 @@ .\" -*- nroff -*- -.\" Copyright (c) 2017-2020 Joachim Nilsson <troglo...@gmail.com> +.\" Copyright (c) 2017-2022 Joachim Wiberg <troglo...@gmail.com> .\" .\" Permission to use, copy, modify, and/or distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -12,7 +12,7 @@ .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.a -.Dd June 7, 2020 +.Dd Oct 22, 2022 .Dt ssdpd 8 .Os .Sh NAME @@ -49,8 +49,20 @@ is used as server string. On non-Linux systems the information from .Xr uname 1 is used, since that is the canonical UNIX location for such information. +.Pp +Each SSDP capable device on a LAN has its own UUID. This is generated +the first time +.Nm +is started and stored in +.Pa /var/lib/misc/ssdpd.cache , +on *BSD systems it is stored in +.Pa /var/db/ssdpd.cache . +Note, depending on your system this directory may be wiped on reboot, so +.Nm +may start up with a different UUID every time. .Sh OPTIONS -.Bl -tag -width "-l LEVEL " -compact +The following command line options are available: +.Bl -tag -width "-l LEVEL " .It Fl h Show program help text .It Fl i Ar SEC @@ -86,7 +98,7 @@ Architecture (UDA) .It Fl v Show program version -.It Ar IFACE +.It Op Ar IFACE By default .Nm runs on all IPv4 capable interfaces, except loopback. If interface @@ -112,11 +124,13 @@ falls back to query this non-standard file for information on the distribution name and release version .It Pa /var/lib/misc/ssdpd.cache -Cached value of generated UUID, may be wiped by the system on reboot +Cached UUID (Linux), may be wiped by the system on reboot +.It Pa /var/db/ssdpd.cache +Cached UUID (*BSD), may be wiped by the system on reboot .El .Sh SEE ALSO .Xr ssdp-scan 1 .Xr avahi-daemon 8 .Xr lldpd 8 .Sh AUTHORS -.An Joachim Nilsson Aq troglo...@gmail.com +.An Joachim Wiberg Aq troglo...@gmail.com diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/src/Makefile.am new/ssdp-responder-1.9/src/Makefile.am --- old/ssdp-responder-1.7/src/Makefile.am 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/src/Makefile.am 2022-10-30 17:16:41.000000000 +0100 @@ -1,9 +1,11 @@ AUTOMAKE_OPTIONS = subdir-objects AM_CFLAGS = -W -Wall -Wextra -Wno-unused -std=c11 -AM_CPPFLAGS = -D_GNU_SOURCE -DLOCALSTATEDIR=\"@localstatedir@\" +AM_CPPFLAGS = -D_PIDFILEDIR=\"@runstatedir@\" -D_CACHEDIR=\"@localstatedir@/@vardb@\" +AM_CPPFLAGS += -D_FORTIFY_SOURCE=2 bin_PROGRAMS = ssdp-scan sbin_PROGRAMS = ssdpd + ssdpd_SOURCES = ssdpd.c compat.h ssdp.c ssdp.h web.c queue.h ssdpd_LDADD = $(LIBS) $(LIBOBJS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/src/compat.h new/ssdp-responder-1.9/src/compat.h --- old/ssdp-responder-1.7/src/compat.h 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/src/compat.h 2022-10-30 17:16:41.000000000 +0100 @@ -1,6 +1,6 @@ /* SSDP responder * - * Copyright (c) 2017-2020 Joachim Nilsson <troglo...@gmail.com> + * Copyright (c) 2017-2022 Joachim Wiberg <troglo...@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/src/ssdp-scan.c new/ssdp-responder-1.9/src/ssdp-scan.c --- old/ssdp-responder-1.7/src/ssdp-scan.c 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/src/ssdp-scan.c 2022-10-30 17:16:41.000000000 +0100 @@ -1,6 +1,6 @@ /* SSDP scanner * - * Copyright (c) 2017-2020 Joachim Nilsson <troglo...@gmail.com> + * Copyright (c) 2017-2022 Joachim Wiberg <troglo...@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -272,23 +272,62 @@ running = 0; } +static int usage(int code) +{ + printf("Usage: ssdp-scan [-h] [-l LEVEL] [-t SEC] [IFACE [IFACE ...]]\n" + "\n" + " -h This help text\n" + " -l LEVEL Set log level: none, err, notice (default), info, debug\n" + " -t SEC Timeout and exit after SEC seconds.\n" + "\n" + "Bug report address : %s\n", PACKAGE_BUGREPORT); +#ifdef PACKAGE_URL + printf("Project homepage : %s\n", PACKAGE_URL); +#endif + + return code; +} + int main(int argc, char *argv[]) { struct pollfd pfd[MAX_NUM_IFACES]; int throttle = 1; + int timeout = 0; + int c; + + log_level = LOG_NOTICE; + while ((c = getopt(argc, argv, "hl:t:")) != EOF) { + switch (c) { + case 'h': + return usage(0); + + case 'l': + log_level = log_str2lvl(optarg); + if (-1 == log_level) + return usage(1); + break; + + case 't': + timeout = atoi(optarg); + break; + + default: + return usage(1); + } + } atty = isatty(STDOUT_FILENO); signal(SIGINT, bye); signal(SIGALRM, bye); - log_level = LOG_WARNING; log_init(0); -#ifdef TEST_MODE - alarm(2); -#endif + if (timeout > 0) { + warnx("Auto-stop in %d seconds ...", timeout); + alarm(timeout); + } - if (ssdp_init(1, 0, &argv[1], argc - 1, ssdp_read) < 1) + if (ssdp_init(1, 0, &argv[optind], argc - optind, ssdp_read) < 1) return 1; hidecursor(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/src/ssdp.c new/ssdp-responder-1.9/src/ssdp.c --- old/ssdp-responder-1.7/src/ssdp.c 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/src/ssdp.c 2022-10-30 17:16:41.000000000 +0100 @@ -1,6 +1,6 @@ /* SSDP helper functions * - * Copyright (c) 2017-2020 Joachim Nilsson <troglo...@gmail.com> + * Copyright (c) 2017-2022 Joachim Wiberg <troglo...@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -414,6 +414,17 @@ if (filter_addr(ifa->ifa_addr)) continue; + /* OpenVPN workaround, issue #6 */ + if ((ifa->ifa_flags & IFF_POINTOPOINT) && !strncmp(ifa->ifa_name, "tun", 3)) { + if (ifa->ifa_netmask && ifa->ifa_addr->sa_family == AF_INET) { + struct sockaddr_in *sin_mask = (struct sockaddr_in *)ifa->ifa_netmask; + + /* Override /32, user likely has a /24 route to this interface */ + if (sin_mask->sin_addr.s_addr == htonl(INADDR_BROADCAST)) + sin_mask->sin_addr.s_addr = htonl(IN_CLASSC_NET); + } + } + sd = socket_open(ifa->ifa_name, ifa->ifa_addr, ttl, srv); if (sd < 0) continue; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/src/ssdp.h new/ssdp-responder-1.9/src/ssdp.h --- old/ssdp-responder-1.7/src/ssdp.h 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/src/ssdp.h 2022-10-30 17:16:41.000000000 +0100 @@ -1,6 +1,6 @@ /* SSDP responder * - * Copyright (c) 2017-2020 Joachim Nilsson <troglo...@gmail.com> + * Copyright (c) 2017-2022 Joachim Wiberg <troglo...@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -34,6 +34,7 @@ #include <time.h> #include <unistd.h> #include <arpa/inet.h> +#include <net/if.h> /* IFF_POINTOPOINT */ #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/udp.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/src/ssdpd.c new/ssdp-responder-1.9/src/ssdpd.c --- old/ssdp-responder-1.7/src/ssdpd.c 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/src/ssdpd.c 2022-10-30 17:16:41.000000000 +0100 @@ -1,6 +1,6 @@ /* SSDP responder * - * Copyright (c) 2017-2020 Joachim Nilsson <troglo...@gmail.com> + * Copyright (c) 2017-2022 Joachim Wiberg <troglo...@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -148,7 +148,7 @@ type = NULL; memset(buf, 0, sizeof(buf)); - if (!sa) + if (sa) compose_response(type, host, buf, sizeof(buf)); else compose_notify(type, host, buf, sizeof(buf)); @@ -381,17 +381,37 @@ free(ver); } +/* + * _CACHEDIR is the configurable fallback. We only read that, if it + * exists, otherwise we use the system _PATH_VARDB, which works on all + * *BSD and GLIBC based Linux systems. Some Linux systms don't have the + * correct FHS /var/lib/misc for that define, so we check for that too. + */ +static FILE *fopen_cache(char *mode, char *fn, size_t len) +{ + FILE *fp; + + snprintf(fn, len, _CACHEDIR "/" PACKAGE_NAME ".cache"); + fp = fopen(fn, mode); + if (!fp) { + snprintf(fn, len, "%s/" PACKAGE_NAME ".cache", _PATH_VARDB); + fp = fopen(fn, mode); + } + + return fp; +} + /* https://en.wikipedia.org/wiki/Universally_unique_identifier */ static void uuidgen(void) { - const char *file = _PATH_VARDB PACKAGE_NAME ".cache"; + char file[256]; char buf[42]; FILE *fp; - fp = fopen(file, "r"); + fp = fopen_cache("r", file, sizeof(file)); if (!fp) { generate: - fp = fopen(file, "w"); + fp = fopen_cache("w", file, sizeof(file)); if (!fp) logit(LOG_WARNING, "Cannot create UUID cache, %s: %s", file, strerror(errno)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/src/uget.c new/ssdp-responder-1.9/src/uget.c --- old/ssdp-responder-1.7/src/uget.c 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/src/uget.c 2022-10-30 17:16:41.000000000 +0100 @@ -1,6 +1,6 @@ /* Really stupid get-file-over-http program/function * - * Copyright (c) 2020 Joachim Nilsson <troglo...@gmail.com> + * Copyright (c) 2021-2022 Joachim Wiberg <troglo...@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -209,7 +209,7 @@ return fp; } -#ifndef LOCALSTATEDIR +#ifndef _CACHEDIR static int usage(void) { printf("Usage: uget URL\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssdp-responder-1.7/src/web.c new/ssdp-responder-1.9/src/web.c --- old/ssdp-responder-1.7/src/web.c 2020-06-07 16:41:45.000000000 +0200 +++ new/ssdp-responder-1.9/src/web.c 2022-10-30 17:16:41.000000000 +0100 @@ -1,6 +1,6 @@ /* Micro web server for serving SSDP .xml file * - * Copyright (c) 2017-2020 Joachim Nilsson <troglo...@gmail.com> + * Copyright (c) 2017-2022 Joachim Wiberg <troglo...@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above