dhcp-relay compile

agsxs

Neuer User
Mitglied seit
7 Jun 2010
Beiträge
7
Punkte für Reaktionen
0
Punkte
0
We need dhcp-relay functionality. I tried to compile dhcp-helper from:
http://freshmeat.net/projects/dhcp-helper

but I am running into dependency issues:

mipsel-linux-gcc -O2 -Wall -W dhcp-helper.c -o dhcp-helper
dhcp-helper.c:23:24: sys/socket.h: No such file or directory
dhcp-helper.c:24:23: sys/ioctl.h: No such file or directory
dhcp-helper.c:25:24: sys/select.h: No such file or directory
dhcp-helper.c:26:22: sys/time.h: No such file or directory
dhcp-helper.c:27:22: sys/stat.h: No such file or directory
dhcp-helper.c:29:20: net/if.h: No such file or directory
dhcp-helper.c:30:20: unistd.h: No such file or directory
dhcp-helper.c:31:19: fcntl.h: No such file or directory
dhcp-helper.c:32:19: stdio.h: No such file or directory
dhcp-helper.c:33:20: string.h: No such file or directory
dhcp-helper.c:34:20: stdlib.h: No such file or directory
dhcp-helper.c:35:18: time.h: No such file or directory
dhcp-helper.c:36:19: errno.h: No such file or directory
dhcp-helper.c:37:17: pwd.h: No such file or directory
dhcp-helper.c:38:17: grp.h: No such file or directory
dhcp-helper.c:39:19: netdb.h: No such file or directory
dhcp-helper.c:40:25: linux/types.h: No such file or directory
dhcp-helper.c:41:30: linux/capability.h: No such file or directory
dhcp-helper.c:44: error: syntax error before "header"
dhcp-helper.c:45: error: syntax error before "header"
dhcp-helper.c:50:23: sys/prctl.h: No such file or directory
dhcp-helper.c:51:24: net/if_arp.h: No such file or directory
dhcp-helper.c:65: error: `IF_NAMESIZE' undeclared here (not in a function)
dhcp-helper.c:66: error: field `addr' has incomplete type
dhcp-helper.c:72: error: field `addr' has incomplete type
dhcp-helper.c:81: error: field `ciaddr' has incomplete type
dhcp-helper.c:81: error: field `yiaddr' has incomplete type
dhcp-helper.c:81: error: field `siaddr' has incomplete type
dhcp-helper.c:81: error: field `giaddr' has incomplete type
dhcp-helper.c: In function `main':
dhcp-helper.c:90: error: `IP_PMTUDISC_DONT' undeclared (first use in this function)
dhcp-helper.c:90: error: (Each undeclared identifier is reported only once
dhcp-helper.c:90: error: for each function it appears in.)
dhcp-helper.c:91: error: storage size of 'ifr' isn't known
dhcp-helper.c:92: error: storage size of 'saddr' isn't known
dhcp-helper.c:93: error: `size_t' undeclared (first use in this function)
dhcp-helper.c:93: error: syntax error before "buf_size"
dhcp-helper.c:95: error: `NULL' undeclared (first use in this function)
dhcp-helper.c:104: warning: implicit declaration of function `getopt'
dhcp-helper.c:113: warning: implicit declaration of function `malloc'
dhcp-helper.c:117: warning: implicit declaration of function `fprintf'
dhcp-helper.c:117: error: `stderr' undeclared (first use in this function)
dhcp-helper.c:118: warning: implicit declaration of function `exit'
dhcp-helper.c:121: warning: implicit declaration of function `strncpy'
dhcp-helper.c:121: error: `optarg' undeclared (first use in this function)
dhcp-helper.c:127: warning: implicit declaration of function `gethostbyname'
dhcp-helper.c:127: warning: initialization makes pointer from integer without a cast
dhcp-helper.c:134: error: dereferencing pointer to incomplete type
dhcp-helper.c:136: warning: implicit declaration of function `strlen'
dhcp-helper.c:141: warning: implicit declaration of function `socket'
dhcp-helper.c:141: error: `PF_INET' undeclared (first use in this function)
dhcp-helper.c:141: error: `SOCK_DGRAM' undeclared (first use in this function)
dhcp-helper.c:142: warning: implicit declaration of function `ioctl'
dhcp-helper.c:142: error: `SIOCGIFFLAGS' undeclared (first use in this function)
dhcp-helper.c:144: warning: implicit declaration of function `strerror'
dhcp-helper.c:144: error: `errno' undeclared (first use in this function)
dhcp-helper.c:144: warning: format argument is not a pointer (arg 4)
dhcp-helper.c:147: error: `IFF_BROADCAST' undeclared (first use in this function)
dhcp-helper.c:173: warning: implicit declaration of function `strcpy'
dhcp-helper.c:218: error: `buf_size' undeclared (first use in this function)
dhcp-helper.c:220: warning: implicit declaration of function `perror'
dhcp-helper.c:230: warning: implicit declaration of function `setsockopt'
dhcp-helper.c:230: error: `SOL_IP' undeclared (first use in this function)
dhcp-helper.c:230: error: `IP_PKTINFO' undeclared (first use in this function)
dhcp-helper.c:231: error: `SOL_SOCKET' undeclared (first use in this function)
dhcp-helper.c:231: error: `SO_BROADCAST' undeclared (first use in this function)
dhcp-helper.c:232: error: `IP_MTU_DISCOVER' undeclared (first use in this function)
dhcp-helper.c:238: error: `AF_INET' undeclared (first use in this function)
dhcp-helper.c:239: warning: implicit declaration of function `htons'
dhcp-helper.c:240: error: `INADDR_ANY' undeclared (first use in this function)
dhcp-helper.c:241: warning: implicit declaration of function `bind'
dhcp-helper.c:241: error: invalid application of `sizeof' to incomplete type `sockaddr_in'
dhcp-helper.c:249: error: `FILE' undeclared (first use in this function)
dhcp-helper.c:249: error: `pidfile' undeclared (first use in this function)
dhcp-helper.c:251: warning: implicit declaration of function `getpwnam'
dhcp-helper.c:251: warning: initialization makes pointer from integer without a cast
dhcp-helper.c:252: error: `gid_t' undeclared (first use in this function)
dhcp-helper.c:252: error: syntax error before "dummy"
dhcp-helper.c:254: error: `cap_user_header_t' undeclared (first use in this function)
dhcp-helper.c:254: error: syntax error before "hdr"
dhcp-helper.c:255: error: `cap_user_data_t' undeclared (first use in this function)
dhcp-helper.c:257: warning: implicit declaration of function `getuid'
dhcp-helper.c:259: error: `hdr' undeclared (first use in this function)
dhcp-helper.c:264: warning: implicit declaration of function `memset'
dhcp-helper.c:275: error: `data' undeclared (first use in this function)
dhcp-helper.c:287: error: `CAP_NET_ADMIN' undeclared (first use in this function)
dhcp-helper.c:287: error: `CAP_SETGID' undeclared (first use in this function)
dhcp-helper.c:287: error: `CAP_SETUID' undeclared (first use in this function)
dhcp-helper.c:290: warning: implicit declaration of function `prctl'
dhcp-helper.c:290: error: `PR_SET_KEEPCAPS' undeclared (first use in this function)
dhcp-helper.c:306: warning: implicit declaration of function `fork'
dhcp-helper.c:307: warning: implicit declaration of function `_exit'
dhcp-helper.c:309: warning: implicit declaration of function `setsid'
dhcp-helper.c:314: warning: implicit declaration of function `chdir'
dhcp-helper.c:315: warning: implicit declaration of function `umask'
dhcp-helper.c:318: warning: implicit declaration of function `fopen'
dhcp-helper.c:320: warning: implicit declaration of function `getpid'
dhcp-helper.c:321: warning: implicit declaration of function `fclose'
dhcp-helper.c:328: warning: implicit declaration of function `close'
dhcp-helper.c:332: warning: implicit declaration of function `setgroups'
dhcp-helper.c:332: error: `dummy' undeclared (first use in this function)
dhcp-helper.c:334: warning: implicit declaration of function `getgrgid'
dhcp-helper.c:334: error: dereferencing pointer to incomplete type
dhcp-helper.c:334: warning: assignment makes pointer from integer without a cast
dhcp-helper.c:335: warning: implicit declaration of function `setgid'
dhcp-helper.c:335: error: dereferencing pointer to incomplete type
dhcp-helper.c:336: warning: implicit declaration of function `setuid'
dhcp-helper.c:336: error: dereferencing pointer to incomplete type
dhcp-helper.c:348: error: storage size of 'iface_addr' isn't known
dhcp-helper.c:350: error: `ssize_t' undeclared (first use in this function)
dhcp-helper.c:350: error: syntax error before "sz"
dhcp-helper.c:351: error: storage size of 'msg' isn't known
dhcp-helper.c:352: error: storage size of 'iov' isn't known
dhcp-helper.c:356: error: field `align' has incomplete type
dhcp-helper.c:357: warning: implicit declaration of function `CMSG_SPACE'
dhcp-helper.c:357: error: invalid application of `sizeof' to incomplete type `in_pktinfo'
dhcp-helper.c:371: error: syntax error before "newsz"
dhcp-helper.c:374: error: `sz' undeclared (first use in this function)
dhcp-helper.c:374: warning: implicit declaration of function `recvmsg'
dhcp-helper.c:374: error: `MSG_PEEK' undeclared (first use in this function)
dhcp-helper.c:374: error: `EINTR' undeclared (first use in this function)
dhcp-helper.c:376: error: `MSG_TRUNC' undeclared (first use in this function)
dhcp-helper.c:377: warning: implicit declaration of function `realloc'
dhcp-helper.c:377: error: `newsz' undeclared (first use in this function)
dhcp-helper.c:377: warning: assignment makes pointer from integer without a cast
dhcp-helper.c:388: error: invalid application of `sizeof' to incomplete type `cmsghdr'
dhcp-helper.c:392: warning: implicit declaration of function `CMSG_FIRSTHDR'
dhcp-helper.c:392: warning: assignment makes pointer from integer without a cast
dhcp-helper.c:392: warning: implicit declaration of function `CMSG_NXTHDR'
dhcp-helper.c:392: warning: assignment makes pointer from integer without a cast
dhcp-helper.c:393: error: dereferencing pointer to incomplete type
dhcp-helper.c:393: error: dereferencing pointer to incomplete type
dhcp-helper.c:394: warning: implicit declaration of function `CMSG_DATA'
dhcp-helper.c:394: error: dereferencing pointer to incomplete type
dhcp-helper.c:396: error: `SIOCGIFNAME' undeclared (first use in this function)
dhcp-helper.c:400: error: `SIOCGIFADDR' undeclared (first use in this function)
dhcp-helper.c:420: warning: implicit declaration of function `strncmp'
dhcp-helper.c:464: error: `SIOCGIFBRDADDR' undeclared (first use in this function)
dhcp-helper.c:472: warning: implicit declaration of function `sendto'
dhcp-helper.c:512: warning: implicit declaration of function `ntohs'
dhcp-helper.c:517: warning: assignment makes pointer from integer without a cast
dhcp-helper.c:518: error: `INADDR_BROADCAST' undeclared (first use in this function)
dhcp-helper.c:520: error: dereferencing pointer to incomplete type
dhcp-helper.c:521: error: dereferencing pointer to incomplete type
dhcp-helper.c:522: error: dereferencing pointer to incomplete type
dhcp-helper.c:522: warning: implicit declaration of function `CMSG_LEN'
dhcp-helper.c:522: error: invalid application of `sizeof' to incomplete type `in_pktinfo'
dhcp-helper.c:523: error: dereferencing pointer to incomplete type
dhcp-helper.c:524: error: dereferencing pointer to incomplete type
dhcp-helper.c:534: error: storage size of 'req' isn't known
dhcp-helper.c:537: warning: implicit declaration of function `memcpy'
dhcp-helper.c:539: error: `ATF_COM' undeclared (first use in this function)
dhcp-helper.c:540: error: `SIOCSARP' undeclared (first use in this function)
dhcp-helper.c:534: warning: unused variable `req'
dhcp-helper.c:544: warning: implicit declaration of function `sendmsg'
dhcp-helper.c:348: warning: unused variable `iface_addr'
dhcp-helper.c:351: warning: unused variable `msg'
dhcp-helper.c:352: warning: unused variable `iov'
dhcp-helper.c:91: warning: unused variable `ifr'
dhcp-helper.c:92: warning: unused variable `saddr'
make: *** [all] Error 1

Can someone with more experience with compiling for Freetz help?
 
I did the following:

export CC="mipsel-linux-gcc"
PATH=$PATH:/home/arno/freetz-1.1.3/toolchain/build/gcc-3.4.6/mipsel-unknown-linux-gnu/bin
export PATH
make

== Makefile ==
PREFIX?=/home/arno/freetz-1.1.3/root
BINDIR = ${PREFIX}/sbin
MANDIR = ${PREFIX}/man

CFLAGS?= -O2

all: dhcp-helper.c
$(CC) $(CFLAGS) $(RPM_OPT_FLAGS) -Wall -W dhcp-helper.c -o dhcp-helper

clean:
rm -f *~ *.o core dhcp-helper

install : all
install -d $(DESTDIR)$(BINDIR) -d $(DESTDIR)$(MANDIR)/man8
install -m 644 dhcp-helper.8 $(DESTDIR)$(MANDIR)/man8
install -m 755 dhcp-helper $(DESTDIR)$(BINDIR)
===

Thanks!
 
Try the patch attached to ticket #849.

Edit: you don't have to flash Freetz again, just copy
Code:
packages/dhcp-helper-1.0/root/usr/sbin/dhcp-helper
to your box, for example using scp, if you have dropbear or openssh running on your box.
 
Zuletzt bearbeitet:
Looks like you did your magic, but you are going a bit to fast for me, sorry. How do I apply or use this patch?

Arno
 
The ticket contains a short description about what to do.

Maybe a trivial question: are you using Freetz?
 
Zuletzt bearbeitet:
Yes using Freetz!

Have you used svn co http://svn.freetz.org/tags/freetz-1.1.3/ for making this patch?

I get the following error when patching:
patching file make/Config.in
Hunk #1 FAILED at 102.
1 out of 1 hunk FAILED -- saving rejects to file make/Config.in.rej
patching file make/dhcp-helper/dhcp-helper.mk
patching file make/dhcp-helper/Makefile.in
patching file make/dhcp-helper/Config.in
 
Okay, I did use trunk and not 1.1.3, but this is easy to solve.
Add the following manually to your make/Config.in in the testing section:
Code:
source make/dhcp-helper/Config.in
The rest of the patch was okay, so after this you should be able to do a
Code:
make menuconfig
to select DHCP-Helper.
 
Busybox also includes a DHCP relay agent. I use this on my fritzbox 7270 but had to manually enable it in the busybox configuration options as freetz did not give me an option.
 
dhcp-helper works! Super. Still had a bit of a puzzle to get it working over AVM VPN, but now it is.

Thanks alot for your help!
 
Hi Markus,

I can't find the dhcprelay option under the "BusyBox options" in version 1.1.3...

Regards,

Arno
 
dhcp-helper works! Super. Still had a bit of a puzzle to get it working over AVM VPN, but now it is.
Maybe you can help others by writing something in the wiki?
Or maybe you can tell in this thread how you configured it?
Just a few words can save others work.

I can't find the dhcprelay option under the "BusyBox options" in version 1.1.3...
Even in trunk it is not an option, you have to modify the package for it.
If I have the time, I will take a look if I can make a patch for it.
 
Zuletzt bearbeitet:
When finished I will add the setup to the wiki. Currently I having issues finding the right VPN settings in combination with being able to broadcast the dhcp requests from clients over the VPN to our DHCP server in the datacenter.

dhcp-helper -s ip-remote-dhcp-server -b int-freetzbox -i int-freetzbox

When setting up a LAN to LAN VPN I am able to connect from both sides of the VPN (Client A to B and viceversa).

Client A - LAN_Local - Freetz - VPN - Netscreen - LAN_DC - Client B

PING from the Freetz only works when using:
ping -I ip_freetz ip_clientb (ip_freetz = 192.168.178.1)

But NOT:
ping ip_clientb
ping -I interface_freetz ip_clientb

(tested interfaces: eth0, eth0:0, lan, lan:0, lan:1 etc)

This will also be the reason the dhcp-helper does not function correctly, not when the broadcast interface is left empty, nor when set to any of the mentioned interfaces.

When setting the local_virtualip setting to an ip in the freetz subnet, we can ping from the freetz to the dhcp-server on the other side of the VPN with:
ping ip_dhcp-server

BUT when using the local_virtualip all trafic over the VPN is translated to this IP, so the dhcp request reaches the dhcp-server and we see DHCPREQUESTs and DHCPOFFERs, but never DHCPACKs via the Freetz VPN. Same for other traffic like for instance PING. Thus all trafic from clientb to clienta is translated to the local_virtualip (192.168.178.2) for clienta.

We would prefer to be able to use route based VPN's on the Freetz. We run lots of netscreen to netscreen route based VPN's and this has proofen to be very flexibel for us.

Any idears?
 
Zuletzt bearbeitet:
Maybe dsld consumes the pings.
 
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.