[Problem] vpnc startet nicht (malloc of 0 bytes failed)

nightshade78

Neuer User
Mitglied seit
24 Sep 2008
Beiträge
8
Punkte für Reaktionen
0
Punkte
0
Hallo zusammen,

ich würde gerne auf meiner 3370 ein paar Sachen mit VPNC ausprobieren.

Die Konfiguration habe ich entsprechend auf der Weboberfläche gesetzt und gespeichert, aber beim Starten:

Code:
vpnc: malloc of 0 bytes failed: Cannot allocate memory
Starting vpnc ... failed.

Ein sh -x /etc/init.d/rc.vpnc start liefert:

Code:
+ DAEMON=vpnc
+ . /etc/init.d/modlibrc
+ export PATH=/mod/sbin:/mod/bin:/mod/usr/sbin:/mod/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin
+ export LD_LIBRARY_PATH=/mod/lib:/mod/usr/lib
+ : vpnc
+ : vpnc
+ : vpnc_ENABLED
+ : /mod/etc/vpnc.conf
+ : vpnc
+ : /var/run/vpnc.pid
+ [ -n vpnc ]
+ modlib_loadconfig
+ local CONF_FILE=/mod/etc/conf/vpnc.cfg
+ [ ! -r /mod/etc/conf/vpnc.cfg ]
+ . /mod/etc/conf/vpnc.cfg
+ export VPNC_DISABLENATTRAVERSAL=no
+ export VPNC_DOMAIN=[removed]
+ export VPNC_ENABLED=yes
+ export VPNC_ENABLESINGLEDES=yes
+ export VPNC_IKEDHGROUP=dh2
+ export VPNC_IPSECGATEWAY=[removed]
+ export VPNC_IPSECID=[removed]
+ export VPNC_IPSECSECRET=[removed]
+ export VPNC_LOCALPORT=500
+ export VPNC_MASK=255.255.248.0
+ export VPNC_NETWORK=10.121.8.0
+ export VPNC_PERFECTFORWARDSECRECY=nopfs
+ export VPNC_UDPENCAPSULATE=no
+ export VPNC_VENDOR=Cisco
+ export VPNC_XAUTHPASSWORD=[removed]
+ export VPNC_XAUTHUSERNAME=[removed]
+ modlib_start
+ local DAEMON_ENABLED=
+ [  == no ]
+ [  == inetd -a ! -x /etc/init.d/rc.inetd ]
+ modlib_check_running
+ [ -n  ]
+ [ -x /etc/init.d/rc.inetd ]
+ echo vpnc_ENABLED
+ tr [:lower:]- [:upper:]_
+ eval echo $VPNC_ENABLED
+ echo yes
+ [ yes == inetd ]
+ [ -n  ]
+ local fn=/var/run/vpnc.pid
+ [ ! -s /var/run/vpnc.pid ]
+ return 3
+ start
+ grep network /var/mod/etc/vpnc.conf
+ sed -e s/#network //g
+ NETWORK=10.121.8.0
+ grep mask /var/mod/etc/vpnc.conf
+ sed -e s/#mask //g
+ MASK=255.255.248.0
+ [ 10.121.8.0 != 0.0.0.0 ]
+ sed -e s/#set -x/INTERNAL_IP4_DNS=\nCISCO_SPLIT_INC=1\nCISCO_SPLIT_INC_0_ADDR=10.121.8.0\nCISCO_SPLIT_INC_0_MASK=255.2
55.248.0\nCISCO_SPLIT_INC_0_MASKLEN=22\nCISCO_SPLIT_INC_0_PROTOCOL=0\nCISCO_SPLIT_INC_0_SPORT=0\nCISCO_SPLIT_INC_0_DPORT
=0\n\n#set -x\n/g /etc/default.vpnc/vpnc-script
+ chmod +x /var/tmp/vpnc-script
+ VPNC_SCRIPT=/var/tmp/vpnc-script
+ modlib_startdaemon vpnc --script /var/tmp/vpnc-script /mod/etc/vpnc.conf
+ echo -n Starting vpnc ...
Starting vpnc ... + config
+ modlib_config
+ local in_files=vpnc
+ local out_file=/mod/etc/vpnc.conf
+ [ -x /tmp/flash/vpnc_conf ]
+ [ -x /tmp/flash/vpnc/vpnc_conf ]
+ /mod/etc/default.vpnc/vpnc_conf
+ [ -f /tmp/flash/vpnc.extra ]
+ [ -f /tmp/flash/vpnc/vpnc.extra ]
+ which vpnc
+ [ ! -x /sbin/vpnc ]
+ env - PATH=/mod/sbin:/mod/bin:/mod/usr/sbin:/mod/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin LD_LIBRARY_PATH=/mod/lib:/mod/u
sr/lib vpnc --script /var/tmp/vpnc-script /mod/etc/vpnc.conf
vpnc: malloc of 0 bytes failed: Cannot allocate memory
+ local rv=1
+ [ 1 -ne 0 ]
+ echo failed.
failed.
+ exit 1

Hat jemand Ideen oder Tips?
 
Oh, ein kurzer Nachtrag noch: Ich habe das Freetz-Image mit der aktuellen Firmware ( .05.08 ) und freetz-trunk r9011 gebaut. Die Freetz-Optionen sind alle ziemlich auf Standard (nur paar Patches an der Weboberfläche, kein Replace-Kernel), Pakete nur inadyn-mt und vpnc (und halt alles was das automatisch bedingt)...
 
Habe das gleiche problem mit meiner 7330 .... gibt es eine loesung?
 
Um erstmal das offensichtlichste zu klären: Wie siehts mit dem freien RAM aus ? Habt ihr eine SWAP Datei in benutzung ?
 
Es gab da ein Unterschied im Verhalten von irgendeinem alloc, wenn ein Parameter 0 war oder 0 zurück gegeben wird. Für mich sieht das nach einem compile error aus.

Gruß
Oliver
 
Das Problem ist, dass überhaupt versucht wird, 0 Bytes zu belegen.
Laut malloc Manual kann malloc(0) entweder NULL oder einen gültigen Wert zurück geben:
If size is 0, then malloc() returns either NULL, or a unique pointer value that can later be successfully passed to free().
vpnc verlässt sich anscheinend darauf, dass der Wert nicht NULL ist.
 
Quickhack:
Code:
--- isakmp-pkt.c.orig   2008-11-19 21:36:12.000000000 +0100
+++ isakmp-pkt.c        2012-06-16 08:58:21.965631148 +0200
@@ -34,6 +34,10 @@
 void *xallocc(size_t x)
 {
        void *result;
+
+       if (x == 0)
+               ++x;
+
        result = calloc(1, x);
        if (result == NULL)
                error(1, errno, "malloc of %lu bytes failed", (unsigned long)x);
Oder hat jemand Lust sich das näher anzusehen?

Gruß
Oliver
 
Oder hat jemand Lust sich das näher anzusehen?
Nicht wirklich.

Wobei mir gerade einfällt, dass die 0 Bytes vielleicht auch Folge einer falschen Konfiguration sind, schließlich hat das Programm ja wohl auch schon bei jemandem funktioniert.
Wenn es mit dem Patch läuft, sollte jemand dem Autor Bescheid sagen.
 
Vermutlich war das bevor wir die uclibc Option MALLOC_GLIBC_COMPAT deaktiviert haben...

Gruß
Oliver
 
Wie auch immer, das Programm nutzt undefiniertes Verhalten.
Außerdem gibt es keinen vernünftigen Grund, 0 Bytes Speicher anzufordern.
 
Klappt!

Der Fehler ist weg. Jetzt kann ich endlich das testen, was ich eigentlich testen wollte. :cool:

Vielen Dank, Ihr macht wirklich eine ausgezeichnete Arbeit, auch wenn man manchmal ein bisschen warten muss.

@Suchiman: Kein Swap, aber bei ~50MB freiem RAM habe ich Speichermangel auch nicht wirklich in Betracht gezogen...

Gruß, Arne
 
Zuletzt bearbeitet:
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.