View previous topic :: View next topic |
Author |
Message |
vom513
Joined: 13 Sep 2018 Posts: 10 Location: Ohio, USA
|
Posted: Sun Sep 16, 2018 10:12 pm Post subject: miniupnpd segfault if natpmp is enabled |
|
|
OS: Ubuntu 14.04 server
miniupnpd version: I've tried both 2.1 and 2.1.20180706
(IPv6 address below sanitized...)
Code: | root@ice:~/miniupnpd-2.1.20180706# miniupnpd -f /etc/miniupnpd/miniupnpd.conf -d
miniupnpd[7085]: system uptime is 4170 seconds
miniupnpd[7085]: version 2.1 starting NAT-PMP/PCP UPnP-IGD ext if eth0.666 BOOTID=1537135672
miniupnpd[7085]: HTTP listening on port 58046
miniupnpd[7085]: HTTP IPv6 address given to control points : [2001:db8:1234::1]
miniupnpd[7085]: Listening for NAT-PMP/PCP traffic on port 5351
Segmentation fault (core dumped)
|
Another strange datapoint - I had first compiled this and got it running and had nat-pmp enabled in config and it started and ran just fine. My ISP had an outage last night so I've rebooted my firewall several times troubleshooting that issue. It was ever since a fresh boot that it segfaults. I'm racking my brain trying to think of what could be different from running it a few days ago and today after a fresh boot...
I can provide my config.h (I can tell you have I have IPv6 and IGDv2 enabled...) as well as my miniupnpd.conf. Just let me know where to upload them to or how to share.
Also if there's gdb output you need let me know. Disclaimer - I don't really know how to drive gdb. I tried it already and I got 'no debugging symbols' found. I'm guessing I need to tweak the build process at some point so these are preserved ? Let me know what to do here and I'll gladly do so.
Thanks. |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
Posted: Mon Sep 24, 2018 1:44 pm Post subject: |
|
|
Edit the make file to enable the "-g" in CFLAGS
then rebuild.
run using gdb
Code: | gdb --args miniupnpd -f /etc/miniupnpd/miniupnpd.conf -d |
when it crashes, use bt to show the "backtrace" _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
vom513
Joined: 13 Sep 2018 Posts: 10 Location: Ohio, USA
|
Posted: Mon Sep 24, 2018 9:31 pm Post subject: |
|
|
Okay, hopefully this is what you are looking for:
Code: |
gdb --args miniupnpd -f /etc/miniupnpd/miniupnpd.conf -d
...
(gdb) run
Starting program: /usr/sbin/miniupnpd -f /etc/miniupnpd/miniupnpd.conf -d
miniupnpd[6502]: system uptime is 613499 seconds
miniupnpd[6502]: version 2.1 starting NAT-PMP/PCP UPnP-IGD ext if eth0.666 BOOTID=1537824384
miniupnpd[6502]: HTTP listening on port 43572
miniupnpd[6502]: HTTP IPv6 address given to control points : [2001:db8:1234::1]
miniupnpd[6502]: Listening for NAT-PMP/PCP traffic on port 5351
Program received signal SIGSEGV, Segmentation fault.
0x000000000040f4a7 in ?? ()
(gdb) bt
#0 0x000000000040f4a7 in ?? ()
#1 0x000000000040fa79 in ?? ()
#2 0x0000000000403a76 in ?? ()
#3 0x00007ffff741ef45 in __libc_start_main (main=0x402560, argc=4, argv=0x7fffffffe688, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
stack_end=0x7fffffffe678) at libc-start.c:287
#4 0x000000000040488f in ?? ()
|
|
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
Posted: Mon Sep 24, 2018 9:46 pm Post subject: |
|
|
you have not rebuilt with the -g flag... _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
vom513
Joined: 13 Sep 2018 Posts: 10 Location: Ohio, USA
|
Posted: Mon Sep 24, 2018 10:01 pm Post subject: |
|
|
Sorry, stumbling around a bit with this.
In Makefile.linux, I added:
Seems like I also needed to comment out strip in the install: section
Code: | #$(STRIP) miniupnpd |
This looks better to my (untrained) eye:
Code: |
(gdb) run
Starting program: /usr/sbin/miniupnpd -f /etc/miniupnpd/miniupnpd.conf -d
miniupnpd[7646]: system uptime is 615342 seconds
miniupnpd[7646]: version 2.1 starting NAT-PMP/PCP UPnP-IGD ext if eth0.666 BOOTID=1537826227
miniupnpd[7646]: HTTP listening on port 50830
miniupnpd[7646]: HTTP IPv6 address given to control points : [2001:db8:1234::1]
miniupnpd[7646]: Listening for NAT-PMP/PCP traffic on port 5351
Program received signal SIGSEGV, Segmentation fault.
copyIPv6IfDifferent (src=0xfaffffef00000010, dest=0x7fffffffddb8) at pcpserver.c:181
181 memcpy(dest, src, sizeof(struct in6_addr));
(gdb) bt
#0 copyIPv6IfDifferent (src=0xfaffffef00000010, dest=0x7fffffffddb8) at pcpserver.c:181
#1 createPCPResponse (response=response@entry=0x7fffffffdd8c "\002\201", pcp_msg_info=pcp_msg_info@entry=0x7fffffffddc0) at pcpserver.c:1491
#2 0x000000000040fa79 in PCPSendUnsolicitedAnnounce (sockets=sockets@entry=0x622170, n_sockets=n_sockets@entry=2, socket6=socket6@entry=14) at pcpserver.c:1659
#3 0x0000000000403a76 in main (argc=<optimized out>, argv=<optimized out>) at miniupnpd.c:2198
|
|
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
Posted: Tue Sep 25, 2018 8:49 am Post subject: |
|
|
Sorry about the strip, I was not thinking that you ran the installed verstion... _________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
Posted: Tue Sep 25, 2018 9:38 am Post subject: |
|
|
Could you try this ?
Code: | diff --git a/miniupnpd/pcpserver.c b/miniupnpd/pcpserver.c
index 9acfb44..e6c427a 100644
--- a/miniupnpd/pcpserver.c
+++ b/miniupnpd/pcpserver.c
@@ -1652,6 +1652,7 @@ void PCPSendUnsolicitedAnnounce(int * sockets, int n_sockets)
#endif /* ENABLE_IPV6 */
/* this is an Unsolicited ANNOUNCE response */
+ memset(&info, 0, sizeof(info));
info.version = this_server_info.server_version;
info.opcode = PCP_OPCODE_ANNOUNCE;
info.result_code = PCP_SUCCESS;
|
_________________ Main miniUPnP author.
https://miniupnp.tuxfamily.org/ |
|
Back to top |
|
 |
miniupnp Site Admin
Joined: 14 Apr 2007 Posts: 1594
|
|
Back to top |
|
 |
vom513
Joined: 13 Sep 2018 Posts: 10 Location: Ohio, USA
|
Posted: Tue Sep 25, 2018 12:48 pm Post subject: |
|
|
I was using miniupnpd-2.1.20180706. I just cloned from git and it looks like it's working now:
Code: |
root@ice:/etc/init.d# grep miniupnp /var/log/syslog
Sep 25 08:42:51 ice miniupnpd[7836]: shutting down MiniUPnPd
Sep 25 08:42:58 ice miniupnpd[11697]: HTTP listening on port 33002
Sep 25 08:42:58 ice miniupnpd[11697]: HTTP IPv6 address given to control points : [2001:db8:1234::1]
Sep 25 08:42:58 ice miniupnpd[11697]: Listening for NAT-PMP/PCP traffic on port 5351
root@ice:/etc/init.d# netstat -planoW | grep :5351
udp 0 0 192.168.64.1:5351 0.0.0.0:* 11697/miniupnpd off (0.00/0/0)
udp 0 0 192.168.65.1:5351 0.0.0.0:* 11697/miniupnpd off (0.00/0/0)
udp6 0 0 :::5351 :::* 11697/miniupnpd off (0.00/0/0)
|
Thanks for looking into this. |
|
Back to top |
|
 |
|