Bug 2161103

Summary: miniupnpd returns incorrect SSDP reply with wrong field order due to bug in spec file
Product: [Fedora] Fedora Reporter: ValdikSS <iam>
Component: miniupnpdAssignee: Michael Cronenworth <mike>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 37CC: mike
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: miniupnpd-2.3.3-1.fc39 miniupnpd-2.3.3-1.fc37 miniupnpd-2.3.3-1.fc38 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-27 03:39:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
miniupnpd spec patch none

Description ValdikSS 2023-01-15 20:54:00 UTC
Created attachment 1938260 [details]
miniupnpd spec patch

Description of problem:

.spec file contains incorrect sed replacement which lead to printf argument shift in the SSDP reply, which breaks UPnP discovery and makes IGD miniupnpd daemon unusable.


Version-Release number of selected component (if applicable):
2.3.1-1, 2.3.0.

How reproducible:
100%


Steps to Reproduce:
1. Configure miniupnpd
2. Run tcpdump -n -i any port ssdp -A
3. Run upnpc -l

Actual results:
miniupnpd returns nonsense values in SSDP reply, namely LOCATION contains `uname -r` instead of IP address.

    HTTP/1.1 200 OK
    CACHE-CONTROL: max-age=120
    ST: urn:schemas-upnp-org:device:InternetGatewayDevice:1
    USN: uuid:00000000-0000-0000-0000-000000000000::urn:schemas-upnp-org:device:InternetGatewayDevice:1
    EXT:
    SERVER: 22 UPnP/1.1 MiniUPnPd/2.3.1
    LOCATION: http://2.6.32-042stab142.1:16405556/rootDesc.xml
    OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
    01-NLS: 38920
    BOOTID.UPNP.ORG: 1673758597
    CONFIGID.UPNP.ORG: 1673758597


Expected results:
miniupnpd SSDP reply returns proper values.


Additional info:

.spec file contains sed replacement for config.h values, replacing, among others, OS_VERSION to %{fedora}.
However, OS_VERSION need to contain %s for miniupnpd's printf to work correctly.

Here's the snippet from the original config.h:

    #define DYNAMIC_OS_VERSION 1
    #define OS_NAME         "Linux"
    #define OS_VERSION      "Linux/%s"
    #define OS_URL          "http://www.kernel.org/"

And this is what in .spec file:

    sed -i 's/OS_NAME.*$/OS_NAME "Fedora"/' config.h
    sed -i 's/OS_VERSION.*$/OS_VERSION "%{fedora}"/' config.h
    sed -i 's/OS_URL.*$/OS_URL "https:\/\/getfedora.org"/' config.h

Not only OS_VERSION needs "%s" in the end, but this sed also replaces boolean DYNAMIC_OS_VERSION to the string value.

Patch for spec file is in attachment.

Comment 1 ValdikSS 2023-07-26 06:16:13 UTC
Still the issue as of miniupnpd-2.3.1-3.fc39.

Comment 2 Fedora Update System 2023-07-27 03:36:26 UTC
FEDORA-2023-61720b3e31 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-61720b3e31

Comment 3 Fedora Update System 2023-07-27 03:39:03 UTC
FEDORA-2023-61720b3e31 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 4 Fedora Update System 2023-07-27 03:41:39 UTC
FEDORA-2023-501a729cf2 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-501a729cf2

Comment 5 Fedora Update System 2023-07-27 03:43:50 UTC
FEDORA-2023-829ba95ee2 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-829ba95ee2

Comment 6 Fedora Update System 2023-07-28 01:43:14 UTC
FEDORA-2023-829ba95ee2 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-829ba95ee2`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-829ba95ee2

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2023-07-28 01:43:23 UTC
FEDORA-2023-501a729cf2 has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-501a729cf2`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-501a729cf2

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2023-08-05 01:19:08 UTC
FEDORA-2023-829ba95ee2 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2023-08-05 01:37:47 UTC
FEDORA-2023-501a729cf2 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.