Menu

Tree [r14] /
 History

HTTPS access


File Date Author Commit
 CVS 2006-11-18 skinkie [r1] Initial development version.
 samples 2011-03-21 skinkie [r13] Implements a few feature requests, currently _u...
 .cvsignore 2006-11-18 skinkie [r1] Initial development version.
 AUTHORS 2011-03-17 skinkie [r8] My e-mail address did change.
 COPYING 2006-11-18 skinkie [r1] Initial development version.
 ChangeLog 2006-11-18 skinkie [r1] Initial development version.
 Makefile 2006-11-18 skinkie [r1] Initial development version.
 README 2006-11-18 skinkie [r1] Initial development version.
 README.dhcpsql 2011-03-21 skinkie [r13] Implements a few feature requests, currently _u...
 README.dumpleases 2006-11-18 skinkie [r1] Initial development version.
 README.udhcpc 2006-11-18 skinkie [r1] Initial development version.
 README.udhcpd 2006-11-18 skinkie [r1] Initial development version.
 TODO 2006-11-18 skinkie [r1] Initial development version.
 arpping.c 2006-11-18 skinkie [r1] Initial development version.
 arpping.h 2006-11-18 skinkie [r1] Initial development version.
 clientpacket.c 2006-11-18 skinkie [r1] Initial development version.
 clientpacket.h 2006-11-18 skinkie [r1] Initial development version.
 clientsocket.c 2006-11-18 skinkie [r1] Initial development version.
 clientsocket.h 2006-11-18 skinkie [r1] Initial development version.
 common.c 2006-11-18 skinkie [r1] Initial development version.
 common.h 2006-11-18 skinkie [r1] Initial development version.
 dhcpc.c 2006-11-18 skinkie [r1] Initial development version.
 dhcpc.h 2006-11-18 skinkie [r1] Initial development version.
 dhcpd.c 2006-11-18 skinkie [r1] Initial development version.
 dhcpd.h 2011-03-21 skinkie [r13] Implements a few feature requests, currently _u...
 dumpleases.1 2006-11-18 skinkie [r1] Initial development version.
 dumpleases.c 2006-11-18 skinkie [r1] Initial development version.
 files.c 2011-03-21 skinkie [r13] Implements a few feature requests, currently _u...
 files.h 2006-11-18 skinkie [r1] Initial development version.
 frontend.c 2006-11-18 skinkie [r1] Initial development version.
 leases.c 2006-11-18 skinkie [r1] Initial development version.
 leases.h 2006-11-18 skinkie [r1] Initial development version.
 libbb_udhcp.h 2006-11-18 skinkie [r1] Initial development version.
 options.c 2011-03-23 skinkie [r14] Lot of compiler fixes, and clean ups.
 options.h 2011-03-23 skinkie [r14] Lot of compiler fixes, and clean ups.
 packet.c 2006-11-18 skinkie [r1] Initial development version.
 packet.h 2006-11-18 skinkie [r1] Initial development version.
 pidfile.c 2006-11-18 skinkie [r1] Initial development version.
 pidfile.h 2006-11-18 skinkie [r1] Initial development version.
 script.c 2006-11-18 skinkie [r1] Initial development version.
 script.h 2006-11-18 skinkie [r1] Initial development version.
 serverpacket.c 2006-11-18 skinkie [r1] Initial development version.
 serverpacket.h 2006-11-18 skinkie [r1] Initial development version.
 serverpacket_mysql.c 2011-03-23 skinkie [r14] Lot of compiler fixes, and clean ups.
 signalpipe.c 2006-11-18 skinkie [r1] Initial development version.
 signalpipe.h 2006-11-18 skinkie [r1] Initial development version.
 socket.c 2006-11-18 skinkie [r1] Initial development version.
 socket.h 2006-11-18 skinkie [r1] Initial development version.
 static_leases.c 2006-11-18 skinkie [r1] Initial development version.
 static_leases.h 2011-03-21 skinkie [r13] Implements a few feature requests, currently _u...
 static_leases_mysql.c 2011-03-23 skinkie [r14] Lot of compiler fixes, and clean ups.
 svn-commit.tmp 2006-11-18 skinkie [r1] Initial development version.
 udhcpc.8 2006-11-18 skinkie [r1] Initial development version.
 udhcpd.8 2006-11-18 skinkie [r1] Initial development version.
 udhcpd.conf.5 2006-11-18 skinkie [r1] Initial development version.
 version.h 2006-11-18 skinkie [r1] Initial development version.

Read Me

DHCPsql
-------

The light in evil days have come. Storing your static leases in a decent SQL
database is a lucid dream from many SysOps. This initial version supports an
online and active database. Please don't forget this implies angry customers
when your MySQL database is dead.

To enable this yet, very _UNTESTED_ software. Go to the Makefile and uncomment
DHCPsql. You should setup a database in MySQL. By default we use:

dbserver           127.0.0.1
user               dhcp
password           dhcp
database           dhcp
table_options      options
table_staticleases staticleases
table_efficient    yes

These same options can be set in the udhcpd.conf. Create a table that is able
to store staticleases:

CREATE TABLE `options` (
  `id` int(11) NOT NULL auto_increment,
  `class` int(11) NOT NULL,
  `code` tinyint(5) NOT NULL,
  `data` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


CREATE TABLE `staticleases` (
  `mac` bigint(6) NOT NULL,
  `ip` bigint(11) default NULL,
  `class` int(11) default NULL,
  PRIMARY KEY  (`mac`),
  UNIQUE KEY `ip` (`ip`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

To explain this design choice. It is a waste of space to store a text version
of a mac adress or an ip adress. As you learned in school every hex address
can just be added to make up a bigger number.
So... YO:UR:MA:CA:DD:YY would be 0xYOURMACADDYY. Decimal ipaddress by hand:

192 * 256^3 + 168 * 256^2 + 0 * 256^1 + 1 * 256^0 = ip
or... inet_aton('192.168.0.1') in your favorite MySQL server.


If SQL_EFFICIENT_FIELDS is not defined, you can use:

CREATE TABLE `staticleases_readable` (
  `mac` char(12) NOT NULL,
  `ip` varchar(15) default NULL,
  `class` int(11) default NULL,
  PRIMARY KEY  (`mac`),
  UNIQUE KEY `ip` (`ip`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

This allows plain strings such als YOURMACADDY and 192.168.0.1 as string in
the table.


Then WHY do you have to make it so easy for me in the second table. Hey :)
good question. Basically because SQL doesn't allow me to do active limiting
on the data field, by the code field. So you can just do:

Subnet:
code: 0x01
data: '255.255.255.0'

Could we make it more easy for you? Sure... 
http://www.faqs.org/rfcs/rfc2132.html 

Could we make it even more easy for you? Sure...

** Check out the dhcp.sql **


The bigger picture should eventually be to get 'maskable' DHCP packages.
Using mask you could set up a simple provisioning system for Cable/DSL 
subscribers.

A default configuration options have been added, in the options table,
class = 0 will basically be appended to any configuration. If class = 0
is not defined, it will not be added. Overiding is currently _not_ possible.


Version 0.1 'A new begin'
-------------------------

- Supports static leases from MySQL


Version 0.1.1 'for us'
______________________

- Support single options in MySQL


Version 0.2-pre6 'From Wodkaland with Love'
-------------------------------------------

- Support for OPTION_LIST with OPTION_IP


TODO:
-----

I have put some untested code in the option handling. If you could test
the memcpy's for this material. And report back if it _really_ works...

SQL code abstraction, I want to put the MySQL code in some wrapper. To
allow to 'wait' until a connection comes back up. (And reduce the
amount of connects).

If Option 82/83 are requested I'll add them.



Have fun :)

Stefan de Konink <stefan@konink.de>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.