-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial import to github (version 4.5)
- Loading branch information
Showing
14 changed files
with
3,239 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
2012-12-03: | ||
4.5 version | ||
* destroy() in plugins for smooth shutdown. | ||
* Change plugin functions declaration. Use more appropriate types. | ||
* radius_plugin: get rid of freeradius-client library. | ||
Use a system libradius instead. | ||
* radius_plugin: rename bind_interface option to bind_to and allow | ||
to specify an IP address there. | ||
|
||
2012-11-01: | ||
4.4 version | ||
* radius_plugin: send accounting only for DHCPACK packet. | ||
|
||
2012-09-02: | ||
4.3 version | ||
* Fix options string parsing | ||
* Minor fix in radius_plugin | ||
* Fix byte order for eh->ether_type | ||
|
||
2012-03-07: | ||
4.2 version | ||
* If there is no interface to listen, dhcprelya took 100% CPU. | ||
* Fix memory leaks. | ||
* Implement rps_limit opetion to protect a server from a packet storm. | ||
* Fix checksum calculation in option82_plugin (thanks to Manuel Kasper). | ||
* Allow specify a DHCP server port. Useful for testing. (Manuel Kasper) | ||
|
||
2009-07-16: | ||
4.1 version | ||
* In radius plugin: build NAS port as client IP, not random. | ||
|
||
2009-06-16: | ||
4.0 version | ||
* Be more RFC compliant: | ||
+ don't change GIADDR if it's not 0. | ||
+ don't save incoming interface for a client. | ||
detect it by GIADDR address. It's simplified | ||
code a lot. | ||
+ don't use INADDR_BROADCAST for answers, but | ||
YIADDR instead (excluding bellow). | ||
+ take into account a BROADCAST flag. If it's on, | ||
send an answer as a broadcast (both L2 & L3). | ||
* Added option82 plugin. RFC 3046 implementation. | ||
* Add a bind_interface option for radius plugin. | ||
|
||
2009-02-13: | ||
3.0 version | ||
* Add -A and -c options. They are ISC dhcrelay compatible. | ||
* Change configuration file format: add sections (ala .ini). | ||
* Add a plugin architecture. | ||
* Make log as a plugin. Improve it a lot. | ||
|
||
2009-01-13: | ||
2.3 version | ||
* Set MAC address in reply packets to MAC address of client. | ||
Exotic clients don't get packets with a broadcast MAC. | ||
|
||
2009-01-12: | ||
2.2 version | ||
* Minor bugfix: buffer size for sendto was a little more. | ||
|
||
2008-12-15: | ||
2.1 version released | ||
* Close standard descriptors when daemonize. | ||
* Fix an error in calculation of servers index | ||
(when server >2). | ||
|
||
2008-09-19: | ||
2.0 version released | ||
* It's possible to put your configureation into a config file. | ||
The old syntax still can be used for compatibility. | ||
|
||
2008-05-26: | ||
1.3 version released | ||
* When an interface disabled/removed dhcprelya looped and eated CPU time | ||
|
||
2008-04-30: | ||
1.2 version released | ||
* Do not turn on promisc mode for interfaces. | ||
* Do not create PID file when run with -d. | ||
* A little code clean up. | ||
|
||
2008-02-01: | ||
1.1 version released | ||
* Optimized. Less system CPU time used. | ||
|
||
2007-12-17: | ||
1.0 version released |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
PROGNAME= dhcprelya | ||
OBJS= dhcprelya.o utils.o net_utils.o ip_checksum.o log_plugin.o \ | ||
option82_plugin.o | ||
HEADER= dhcprelya.h | ||
LIBS= -L/usr/local/lib -lpcap -lutil -lthr | ||
CFLAGS+= -Wall -fPIC | ||
|
||
LOG_PLUGIN_OBJS= utils.o log_plugin.o | ||
OPTION82_PLUGIN_OBJS= utils.o option82_plugin.o ip_checksum.o | ||
|
||
.if defined(DEBUG) | ||
DEBUG_FLAGS= -g | ||
.else | ||
STRIP_FLAG= -s | ||
.endif | ||
|
||
LOG_PLUGIN= log_plugin | ||
RADIUS_PLUGIN= radius_plugin | ||
OPTION82_PLUGIN= option82_plugin | ||
.if defined(WITH_RADIUS_PLUGIN) | ||
LIBS+= -lradius | ||
RADIUS_PLUGIN_OBJS= utils.o net_utils.o radius_plugin.o | ||
OBJS+= radius_plugin.o | ||
CFLAGS+= -rdynamic | ||
|
||
all: ${PROGNAME} ${PROGNAME}_${RADIUS_PLUGIN}.so ${PROGNAME}_${LOG_PLUGIN}.so \ | ||
${PROGNAME}_${OPTION82_PLUGIN}.so | ||
.else | ||
all: ${PROGNAME} ${PROGNAME}_${LOG_PLUGIN}.so ${PROGNAME}_${OPTION82_PLUGIN}.so | ||
.endif | ||
|
||
${PROGNAME}: ${OBJS} | ||
${CC} ${DEBUG_FLAGS} ${CFLAGS} ${OBJS} ${LIBS} -o ${.TARGET} | ||
|
||
${PROGNAME}_${RADIUS_PLUGIN}.so: ${OBJS} | ||
${CC} ${DEBUG_FLAGS} -shared ${RADIUS_PLUGIN_OBJS} -o ${.TARGET} | ||
|
||
${PROGNAME}_${LOG_PLUGIN}.so: ${OBJS} | ||
${CC} ${DEBUG_FLAGS} -shared ${LOG_PLUGIN_OBJS} -o ${.TARGET} | ||
|
||
${PROGNAME}_${OPTION82_PLUGIN}.so: ${OBJS} | ||
${CC} ${DEBUG_FLAGS} -shared ${OPTION82_PLUGIN_OBJS} -o ${.TARGET} | ||
|
||
.c.o: ${HEADER} | ||
${CC} ${CPPFLAGS} ${DEBUG_FLAGS} ${CFLAGS} -c ${.IMPSRC} | ||
|
||
clean: | ||
rm -f ${PROGNAME} *.so *.o *.core | ||
|
||
install: ${PROGNAME} | ||
install ${STRIP_FLAG} -m 555 ${PROGNAME} /usr/local/sbin/ | ||
install ${STRIP_FLAG} -m 555 ${PROGNAME}_${LOG_PLUGIN}.so /usr/local/lib/ | ||
install ${STRIP_FLAG} -m 555 ${PROGNAME}_${OPTION82_PLUGIN}.so /usr/local/lib/ | ||
.if defined(WITH_RADIUS_PLUGIN) | ||
install ${STRIP_FLAG} -m 555 ${PROGNAME}_${RADIUS_PLUGIN}.so /usr/local/lib/ | ||
.endif | ||
|
||
install-rc: | ||
install -m 555 ${PROGNAME}.sh /usr/local/etc/rc.d/${PROGNAME} | ||
|
||
deinstall: | ||
rm -f /usr/local/sbin/${PROGNAME} /usr/local/lib/${PROGNAME}_* /usr/local/etc/rc.d/${PROGNAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
dhcprelya is a lightweight DHCP relay agent written for Yandex company for | ||
high loaded routers with tens interfaces and thousands hosts behind them. | ||
|
||
It's fast, independed from any side libraries, and it does not turn on | ||
a promisc mode for listening interfaces. Plugins supported. With plugins | ||
you can implement any functionality. A command line options is compatible | ||
with ISC dhcrelay but extended. | ||
|
||
Some ideas was taken from Edwin's dhcprelay (net/dhcprelay in ports collection. | ||
which unfortunately has some shortages) and dhcpdump (net/dhcpdump). | ||
|
||
It's distributed under BSD license. | ||
|
||
HOW TO RUN | ||
There are two syntax. The first one is a ISC dhcrelay compatible: | ||
|
||
dhcprelya [-d] [-p<pidfile>] -A <packet_size> -c <hops_count> | ||
-i<if1>... -i<ifN> <server1>... <serverN> | ||
|
||
-i - an interfaces list that should be listened. | ||
server - a servers list where request will be forward to. | ||
-A - set maximum packet size. Default: 1400. It's more then enough. | ||
-c - When hops counter in a DHCP packet more then this value, | ||
the packet is dropped. It prevets loops. Defaul: 10. | ||
|
||
A second one allows to use a configuration file: | ||
|
||
dhcprelya [-d] [-p<pidfile>] -f <config.file> | ||
|
||
Common options are: | ||
-d - do not demonize and output debugging info onto terminal. | ||
-p - use not default pid file. You can run more than one copy of | ||
dhcprelya with different pid files. | ||
|
||
See dhcprelya.conf-example for format. | ||
|
||
If an interface does not exist on this host, it'll be ignored. It's useful | ||
for only one config file for all routers with logical interfaces (vlanNN etc.). | ||
|
||
Any questions, bug reports and feature requests are welcome. | ||
|
||
Sergey Matveychuk <[email protected]> |
Oops, something went wrong.