Hello community,
here is the log from the commit of package dhcdbd
checked in at Fri Nov 30 00:35:27 CET 2007.
--------
New Changes file:
--- /dev/null 2006-09-20 18:56:23.000000000 +0200
+++ /mounts/work_src_done/STABLE/dhcdbd/dhcdbd.changes 2007-08-03 19:28:39.000000000 +0200
@@ -0,0 +1,152 @@
+-------------------------------------------------------------------
+Fri Aug 3 19:28:18 CEST 2007 - aj@suse.de
+
+- Add patch to reduce number of wakeups.
+
+-------------------------------------------------------------------
+Fri Nov 17 19:09:26 CET 2006 - varkoly@suse.de
+
+- Fixing bug #222267 - dhcdbd do not remove pid file
+
+-------------------------------------------------------------------
+Wed Oct 25 12:03:39 CEST 2006 - thoenig@suse.de
+
+- Update patch dhcdbd-dbus-reconnect-thoenig-03.patch: Do not crash
+ on D-Bus restart (b.n.c. 212468)
+
+-------------------------------------------------------------------
+Tue Oct 24 16:33:02 CEST 2006 - rml@suse.de
+
+- Update to dhcdbd 1.14. We already carried the fixes as patches,
+ so this is just a version bump and packaging cleanup.
+- Drop patch dhcdbd-1.14-bug-fixes.patch
+
+-------------------------------------------------------------------
+Wed Aug 9 16:57:41 CEST 2006 - thoenig@suse.de
+
+- Add patch: dhcdbd-dbus-api-fix-thoenig-01.patch
+
+-------------------------------------------------------------------
+Thu Jun 15 16:25:21 CEST 2006 - rml@suse.de
+
+- Handle non-empty /etc/HOSTNAME files that only contain newlines
+ (Novell bug #179492)
+
+-------------------------------------------------------------------
+Tue May 30 18:08:13 CEST 2006 - rml@suse.de
+
+- Send only the most significant hostname, not the entire FQDN,
+ from /etc/HOSTNAME when DHCLIENT_HOSTNAME_OPTION is enabled
+ (Novell bug #179903)
+
+-------------------------------------------------------------------
+Tue May 9 15:32:13 CEST 2006 - rml@suse.de
+
+- Fix 64-bit build (use pkg-config like we should)
+
+-------------------------------------------------------------------
+Thu May 4 23:02:48 CEST 2006 - rml@suse.de
+
+- Ask dhclient to set the hostname as required by the sysconfig
+ option DHCLIENT_HOSTNAME_OPTION (Novell major bug #139532)
+- Fix possible memory corruption
+
+-------------------------------------------------------------------
+Tue Mar 28 16:58:28 CEST 2006 - rml@suse.de
+
+- Log debugging spew less readily (Novell bug #161138)
+
+-------------------------------------------------------------------
+Tue Mar 21 21:27:13 CET 2006 - rml@suse.de
+
+- Survive DBUS restarts (Novell bug #150042)
+
+-------------------------------------------------------------------
+Fri Feb 24 21:01:23 CET 2006 - rml@suse.de
+
+- Add dhcdbd-no-nr_open-rml.patch to replace NR_OPEN with a call
+ to getdtablesize() to fix build on beta and remove use of
+ NR_OPEN.
+
+-------------------------------------------------------------------
+Wed Jan 25 21:35:26 CET 2006 - mls@suse.de
+
+- converted neededforbuild to BuildRequires
+
+-------------------------------------------------------------------
+Thu Jan 19 20:10:45 CET 2006 - rml@suse.de
+
+- 1.12 (bug fixes only)
+
+-------------------------------------------------------------------
+Wed Jan 11 22:56:24 CET 2006 - rml@suse.de
+
+- Remove named user from dhcdbd.conf
+
+-------------------------------------------------------------------
+Fri Jan 6 23:25:05 CET 2006 - rml@suse.de
+
+- Use correct lease directory (fix bug #139606)
+
+-------------------------------------------------------------------
+Wed Jan 4 23:12:44 CET 2006 - rml@suse.de
+
+- proper permissions on /etc/dbus-1/system.d/dhcdbd.conf
+
+-------------------------------------------------------------------
+Mon Dec 19 17:51:49 CET 2005 - rml@suse.de
+
+- Update to 1.11 (fixes build against DBUS 0.60)
+
+-------------------------------------------------------------------
+Mon Dec 12 16:21:44 CET 2005 - rml@suse.de
+
+- Remove dhcdbd service file and do not create named user or
+ group (#136872)
+
+-------------------------------------------------------------------
+Fri Dec 9 13:11:28 CET 2005 - ro@suse.de
+
+- create named user and group (since referenced in config)
+ fixing (#136872)
+
+-------------------------------------------------------------------
+Thu Nov 17 20:58:35 CET 2005 - rml@suse.de
+
+- Upgrade to 1.10 (includes our two patches).
+
+-------------------------------------------------------------------
+Mon Oct 31 20:05:30 CET 2005 - rml@suse.de
+
+- Add patch dhcdbd-quiet-dhclient.patch to pass "-q" option to
+ dhclient in order to minimize noise.
+- Add patch dhcdbd-use-daemon.patch to use daemon(3) instead of
+ hand-coded daemonizing code. Also ensures that stdout and stderr
+ are redirected to /dev/null, not /dev/console.
+
+-------------------------------------------------------------------
+Thu Oct 20 16:29:29 CEST 2005 - rml@suse.de
+
+- Update to dhcdbd 1.9
+
+-------------------------------------------------------------------
+Fri Aug 12 18:42:57 CEST 2005 - ro@suse.de
+
+- changed requires (#104373)
+
+-------------------------------------------------------------------
+Thu Jun 30 21:40:53 CEST 2005 - gekker@suse.de
+
+- Remove init script for rml, no longer needed
+
+-------------------------------------------------------------------
+Tue Jun 28 22:26:35 CEST 2005 - gekker@suse.de
+
+- Change requires for rml
+
+-------------------------------------------------------------------
+Fri Jun 24 01:39:02 CEST 2005 - ro@suse.de
+
+- created package taken from FC
+- first steps to adapt init script
+
New:
----
dhcdbd-1.14.tar.gz
dhcdbd.changes
dhcdbd-dbus-api-fix-thoenig-01.patch
dhcdbd-dbus-reconnect-thoenig-03.patch
dhcdbd-lease-dir-rml-1.10-1.patch
dhcdbd-less-verbose-logging-rml.patch
dhcdbd-no-nr_open-rml.patch
dhcdbd-powersave.patch
dhcdbd-remove-named-user-rml.patch
dhcdbd-set-hostname-fix.patch
dhcdbd-set-hostname.patch
dhcdbd-signalhandling-1.14.dif
dhcdbd.spec
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ dhcdbd.spec ++++++
#
# spec file for package dhcdbd (Version 1.14)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: dhcdbd
BuildRequires: dbus-1-devel glib2-devel
Summary: DHCP D-BUS Daemon
Version: 1.14
Release: 75
License: GPL v2 or later
Group: Productivity/Networking/Boot/Utilities
Url: http://people.redhat.com/dcantrel/dhcdbd/
Source0: %{name}-%{version}.tar.gz
Patch0: dhcdbd-lease-dir-rml-1.10-1.patch
Patch1: dhcdbd-remove-named-user-rml.patch
Patch2: dhcdbd-no-nr_open-rml.patch
Patch3: dhcdbd-dbus-reconnect-thoenig-03.patch
Patch4: dhcdbd-less-verbose-logging-rml.patch
Patch5: dhcdbd-set-hostname.patch
Patch6: dhcdbd-set-hostname-fix.patch
Patch7: dhcdbd-dbus-api-fix-thoenig-01.patch
Patch8: dhcdbd-signalhandling-1.14.dif
Patch9: dhcdbd-powersave.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: dhcp-client >= 3.0.3 dbus-1 >= 0.90
%description
DHCP D-BUS daemon (dhcdbd) controls dhclient sessions with D-BUS and
stores and presents DHCP options.
Authors:
--------
Jason Vas Dias
David Cantrell
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p0
%patch8 -p0
%patch9 -p0
%build
make CFLAGS="-Wall $RPM_OPT_FLAGS" CC='gcc' LIBDIR=%_lib
%install
DESTDIR=$RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT
# dbus lib is in /usr, so move
mkdir -p $RPM_BUILD_ROOT/usr/sbin
mv $RPM_BUILD_ROOT/sbin/dhcdbd $RPM_BUILD_ROOT/usr/sbin
mkdir -p $RPM_BUILD_ROOT/var/lib/named
rm $RPM_BUILD_ROOT/usr/share/dbus-1/services/dhcdbd.service
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc README LICENSE dhcp_options.h dhcdbd.h dbus_service.h
%attr(0644,root,root) %{_sysconfdir}/dbus-1/system.d/dhcdbd.conf
%attr(755,root,root) /usr/sbin/dhcdbd
%dir /var/lib/named
%changelog
* Fri Aug 03 2007 - aj@suse.de
- Add patch to reduce number of wakeups.
* Fri Nov 17 2006 - varkoly@suse.de
- Fixing bug #222267 - dhcdbd do not remove pid file
* Wed Oct 25 2006 - thoenig@suse.de
- Update patch dhcdbd-dbus-reconnect-thoenig-03.patch: Do not crash
on D-Bus restart (b.n.c. 212468)
* Tue Oct 24 2006 - rml@suse.de
- Update to dhcdbd 1.14. We already carried the fixes as patches,
so this is just a version bump and packaging cleanup.
- Drop patch dhcdbd-1.14-bug-fixes.patch
* Wed Aug 09 2006 - thoenig@suse.de
- Add patch: dhcdbd-dbus-api-fix-thoenig-01.patch
* Thu Jun 15 2006 - rml@suse.de
- Handle non-empty /etc/HOSTNAME files that only contain newlines
(Novell bug #179492)
* Tue May 30 2006 - rml@suse.de
- Send only the most significant hostname, not the entire FQDN,
from /etc/HOSTNAME when DHCLIENT_HOSTNAME_OPTION is enabled
(Novell bug #179903)
* Tue May 09 2006 - rml@suse.de
- Fix 64-bit build (use pkg-config like we should)
* Thu May 04 2006 - rml@suse.de
- Ask dhclient to set the hostname as required by the sysconfig
option DHCLIENT_HOSTNAME_OPTION (Novell major bug #139532)
- Fix possible memory corruption
* Tue Mar 28 2006 - rml@suse.de
- Log debugging spew less readily (Novell bug #161138)
* Tue Mar 21 2006 - rml@suse.de
- Survive DBUS restarts (Novell bug #150042)
* Fri Feb 24 2006 - rml@suse.de
- Add dhcdbd-no-nr_open-rml.patch to replace NR_OPEN with a call
to getdtablesize() to fix build on beta and remove use of
NR_OPEN.
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Thu Jan 19 2006 - rml@suse.de
- 1.12 (bug fixes only)
* Wed Jan 11 2006 - rml@suse.de
- Remove named user from dhcdbd.conf
* Fri Jan 06 2006 - rml@suse.de
- Use correct lease directory (fix bug #139606)
* Wed Jan 04 2006 - rml@suse.de
- proper permissions on /etc/dbus-1/system.d/dhcdbd.conf
* Mon Dec 19 2005 - rml@suse.de
- Update to 1.11 (fixes build against DBUS 0.60)
* Mon Dec 12 2005 - rml@suse.de
- Remove dhcdbd service file and do not create named user or
group (#136872)
* Fri Dec 09 2005 - ro@suse.de
- create named user and group (since referenced in config)
fixing (#136872)
* Thu Nov 17 2005 - rml@suse.de
- Upgrade to 1.10 (includes our two patches).
* Mon Oct 31 2005 - rml@suse.de
- Add patch dhcdbd-quiet-dhclient.patch to pass "-q" option to
dhclient in order to minimize noise.
- Add patch dhcdbd-use-daemon.patch to use daemon(3) instead of
hand-coded daemonizing code. Also ensures that stdout and stderr
are redirected to /dev/null, not /dev/console.
* Thu Oct 20 2005 - rml@suse.de
- Update to dhcdbd 1.9
* Fri Aug 12 2005 - ro@suse.de
- changed requires (#104373)
* Thu Jun 30 2005 - gekker@suse.de
- Remove init script for rml, no longer needed
* Tue Jun 28 2005 - gekker@suse.de
- Change requires for rml
* Fri Jun 24 2005 - ro@suse.de
- created package taken from FC
- first steps to adapt init script
++++++ dhcdbd-dbus-api-fix-thoenig-01.patch ++++++
--- dbus_service.c_org 2006-08-09 12:21:18.000000000 +0200
+++ dbus_service.c 2006-08-09 12:21:26.000000000 +0200
@@ -1422,7 +1422,7 @@
return ( cs );
give_up:
- dbus_connection_disconnect( connection );
+ dbus_connection_close( connection );
dbus_shutdown();
return ( 0L );
}
++++++ dhcdbd-dbus-reconnect-thoenig-03.patch ++++++
diff -urN dhcdbd-1.12/dbus_service.c dhcdbd-1.12_mod/dbus_service.c
--- dhcdbd-1.12/dbus_service.c 2006-10-25 11:53:00.000000000 +0200
+++ dhcdbd-1.12_mod/dbus_service.c 2006-10-25 12:02:36.000000000 +0200
@@ -78,6 +78,7 @@
struct timeval tv;
} DBusConnectionTimeout;
+#define RECONNECT 254
#define SHUTDOWN 255
static void no_free( void *p){}
@@ -1219,7 +1220,6 @@
return;
fd = dbus_watch_get_fd( w );
flags = dbus_watch_get_flags( w );
- if( cs->dh != 0L ) (*(cs->dh))("handle_watch: %d", dbus_watch_get_fd( w ));
if ( (flags & DBUS_WATCH_READABLE) && (FD_ISSET(fd, &(cs->s_r_fds))) )
dbus_watch_handle(w, DBUS_WATCH_READABLE);
if ( (flags & DBUS_WATCH_WRITABLE) && (FD_ISSET(fd, &(cs->s_w_fds))) )
@@ -1311,12 +1311,12 @@
}
void
-dbus_svc_main_loop( DBusConnectionState *cs, void (*idle_handler)(DBusConnectionState *) )
+dbus_svc_main_loop( DBusConnectionState *cs, void (*idle_handler)(DBusConnectionState *), int *reconnect )
{
struct timeval timeout={0,200000};
int n_fds;
- while( cs->status != SHUTDOWN )
+ while( cs->status != SHUTDOWN && cs->status != RECONNECT )
{
cs->s_r_fds = cs->r_fds;
cs->s_w_fds = cs->w_fds;
@@ -1345,6 +1345,15 @@
if( idle_handler != 0L )
(*idle_handler)(cs);
}
+
+ *reconnect = (cs->status == RECONNECT) ? 1 : 0;
+}
+
+
+void
+dbus_svc_reconnect( DBusConnectionState *cs )
+{
+ cs->status = RECONNECT;
}
void
@@ -1358,7 +1367,7 @@
(
dbus_svc_DBUS_TYPE bus,
char *name,
- dbus_svc_ErrorHandler eh ,
+ dbus_svc_ErrorHandler eh,
dbus_svc_ErrorHandler dh
)
{
@@ -1370,10 +1379,14 @@
dbus_error_init(&error);
- if ( (connection = dbus_bus_get (bus, &error)) == 0L )
- {
- (*eh)("dbus_svc_init failed: %s %s",error.name, error.message);
- return ( 0L );
+ connection = NULL;
+ while (connection == NULL) {
+ if ( (connection = dbus_bus_get (bus, &error)) == 0L ) {
+ dbus_error_free (&error);
+ (*eh)("dbus_svc_init failed: %s %s",error.name, error.message);
+ dbus_error_init(&error);
+ sleep (3);
+ }
}
dbus_connection_set_exit_on_disconnect(connection, FALSE);
@@ -1450,8 +1463,8 @@
tdestroy( cs->roots, free_root);
cs->roots=0L;
-
- dbus_connection_disconnect( cs->connection );
- dbus_shutdown();
+ dbus_connection_unref( cs->connection );
+ dbus_connection_unref( cs->connection );
+
free( cs );
}
diff -urN dhcdbd-1.12/dbus_service.h dhcdbd-1.12_mod/dbus_service.h
--- dhcdbd-1.12/dbus_service.h 2006-01-17 22:23:51.000000000 +0100
+++ dhcdbd-1.12_mod/dbus_service.h 2006-10-25 11:53:42.000000000 +0200
@@ -114,12 +114,14 @@
* "eh" will be called for all errors from this server session.
*/
-extern void dbus_svc_main_loop( DBUS_SVC, void (*idle_handler)(DBUS_SVC) );
+extern void dbus_svc_main_loop( DBUS_SVC, void (*idle_handler)(DBUS_SVC), int * );
/*
* Enter message processing loop.
* If "idle_handler" is non-null, it will be called once per iteration of loop.
*/
+extern void dbus_svc_reconnect( DBUS_SVC );
+
extern void dbus_svc_quit( DBUS_SVC );
/*
* Exit message processing loop
diff -urN dhcdbd-1.12/dhcdbd.c dhcdbd-1.12_mod/dhcdbd.c
--- dhcdbd-1.12/dhcdbd.c 2006-10-25 11:53:00.000000000 +0200
+++ dhcdbd-1.12_mod/dhcdbd.c 2006-10-25 11:53:42.000000000 +0200
@@ -2776,7 +2776,7 @@
)
{
dhcdbd_debug("Filtered QUIT message OK");
- dbus_svc_quit( dbus );
+ dbus_svc_reconnect( dbus );
return HANDLED;
}
return NOT_HANDLED;
@@ -2789,68 +2789,73 @@
struct sigaction sa;
char path[1024];
int fd, l;
+ int reconnect = 0;
if( dhcdbd_daemonize && (daemon(0, 0) == -1) )
return errno;
openlog( "dhcdbd", LOG_NDELAY | LOG_CONS, LOG_USER );
- dbus = dbus_svc_init( bus, dhcdbd_destination, dhcdbd_log, 0L );
+ do {
+ dbus = dbus_svc_init( bus, dhcdbd_destination, dhcdbd_log, 0L );
- if ( dbus == 0L )
- {
- dhcdbd_log("Failed to initialise D-Bus service.\n");
- return( 1 );
- }
-
- dhco = dhco_new( dhcdbd_log );
- if( dhco == 0L )
- {
- dhcdbd_log("Failed to initialise DHCP options object.\n");
- return(1);
- }
+ if ( dbus == 0L )
+ {
+ dhcdbd_log("Failed to initialise D-Bus service.\n");
+ return( 1 );
+ }
+
+ dhco = dhco_new( dhcdbd_log );
+ if( dhco == 0L )
+ {
+ dhcdbd_log("Failed to initialise DHCP options object.\n");
+ return(1);
+ }
+
+ dhcdbd_debug("dhco: %p", dhco);
+
+ if ( !dbus_svc_add_path_handler
+ ( dbus, dhcdbd_object_path, dhcdbd_interface_prefix, dhcdbd_message_handler, dhco, TRUE )
+ )return( 1 );
+
+ if ( !dbus_svc_add_message_filter
+ ( dbus, dhcdbd_message_filter, 0 )
+ )return( 1 );
+
+ snprintf(path,1024,"subscribe.binary.binary");
+ if( !dbus_svc_add_handler(dbus, dhcdbd_object_path, path, dhcdbd_if_subscribe, dhco) )
+ return( 1 );
+ snprintf(path,1024,"subscribe.text.text");
+ if( !dbus_svc_add_handler(dbus, dhcdbd_object_path, path, dhcdbd_if_subscribe, dhco) )
+ return( 1 );
+ snprintf(path,1024,"subscribe.dbus.dbus");
+ if( !dbus_svc_add_handler(dbus, dhcdbd_object_path, path, dhcdbd_if_subscribe, dhco) )
+ return( 1 );
+
+ memset(&sa, '\0', sizeof(struct sigaction));
+ sa.sa_sigaction = dhc_reaper;
+ sa.sa_flags = SA_SIGINFO; /* NO RESTART, NO DEFER, CLDSTOP */
+ if( sigaction( SIGCHLD, &sa, 0L ) == -1 )
+ {
+ dhcdbd_log("sigaction failed: %s\n", strerror(errno));
+ return( 1 );
+ }
+ unlink(DHCDBD_PID_FILE);
+ if( (fd = open(DHCDBD_PID_FILE, O_WRONLY | O_CREAT)) == -1 )
+ exit(errno);
+ l=sprintf(path,"%u",getpid());
+ l=write(fd,path,l);
+ fsync(fd);
+ close(fd);
+ dhcdbd_log("Started up.");
+ dbus_svc_main_loop( dbus, dhcdbd_work, &reconnect );
+ dhcdbd_debug("Main Loop Exited.");
+ dbus_svc_shutdown( dbus );
+ } while (reconnect);
- dhcdbd_debug("dhco: %p", dhco);
-
- if ( !dbus_svc_add_path_handler
- ( dbus, dhcdbd_object_path, dhcdbd_interface_prefix, dhcdbd_message_handler, dhco, TRUE )
- )return( 1 );
-
- if ( !dbus_svc_add_message_filter
- ( dbus, dhcdbd_message_filter, 0 )
- )return( 1 );
-
- snprintf(path,1024,"subscribe.binary.binary");
- if( !dbus_svc_add_handler(dbus, dhcdbd_object_path, path, dhcdbd_if_subscribe, dhco) )
- return( 1 );
- snprintf(path,1024,"subscribe.text.text");
- if( !dbus_svc_add_handler(dbus, dhcdbd_object_path, path, dhcdbd_if_subscribe, dhco) )
- return( 1 );
- snprintf(path,1024,"subscribe.dbus.dbus");
- if( !dbus_svc_add_handler(dbus, dhcdbd_object_path, path, dhcdbd_if_subscribe, dhco) )
- return( 1 );
-
- memset(&sa, '\0', sizeof(struct sigaction));
- sa.sa_sigaction = dhc_reaper;
- sa.sa_flags = SA_SIGINFO; /* NO RESTART, NO DEFER, CLDSTOP */
- if( sigaction( SIGCHLD, &sa, 0L ) == -1 )
- {
- dhcdbd_log("sigaction failed: %s\n", strerror(errno));
- return( 1 );
- }
- unlink(DHCDBD_PID_FILE);
- if( (fd = open(DHCDBD_PID_FILE, O_WRONLY | O_CREAT)) == -1 )
- exit(errno);
- l=sprintf(path,"%u",getpid());
- l=write(fd,path,l);
- fsync(fd);
- close(fd);
- dhcdbd_log("Started up.");
- dbus_svc_main_loop( dbus, dhcdbd_work );
- dhcdbd_debug("Main Loop Exited.");
- dbus_svc_shutdown( dbus );
unlink(DHCDBD_PID_FILE);
dhcdbd_log("Shut down.");
+
return( 0 );
}
diff -urN dhcdbd-1.12/tests/test_binary.c dhcdbd-1.12_mod/tests/test_binary.c
--- dhcdbd-1.12/tests/test_binary.c 2006-01-17 22:23:51.000000000 +0100
+++ dhcdbd-1.12_mod/tests/test_binary.c 2006-10-25 11:53:42.000000000 +0200
@@ -266,6 +266,7 @@
int main( int argc, char **argv, char **envp )
{
DBUS_SVC dbus;
+ int reconnect = 0;
dhcdbd_log("starting up");
dbus = dbus_svc_init( DBUS_SYSTEM, 0L, 0L, 0L );
@@ -282,7 +283,7 @@
)
)return( 1 );
- dbus_svc_main_loop( dbus, 0L);
+ dbus_svc_main_loop( dbus, 0L, &reconnect );
return(0);
}
diff -urN dhcdbd-1.12/tests/test_prospective_subscriber.c dhcdbd-1.12_mod/tests/test_prospective_subscriber.c
--- dhcdbd-1.12/tests/test_prospective_subscriber.c 2006-01-17 22:23:51.000000000 +0100
+++ dhcdbd-1.12_mod/tests/test_prospective_subscriber.c 2006-10-25 11:53:42.000000000 +0200
@@ -184,7 +184,7 @@
int main( int argc, char **argv, char **envp )
{
DBUS_SVC dbus;
-
+ int reconnect = 0;
dbus = dbus_svc_init( DBUS_SYSTEM, 0L, 0L, 0L );
@@ -211,7 +211,7 @@
return(1);
}
- dbus_svc_main_loop( dbus, 0L);
+ dbus_svc_main_loop( dbus, 0L, &reconnect );
return(0);
}
diff -urN dhcdbd-1.12/tests/test_subscriber.c dhcdbd-1.12_mod/tests/test_subscriber.c
--- dhcdbd-1.12/tests/test_subscriber.c 2006-01-17 22:23:51.000000000 +0100
+++ dhcdbd-1.12_mod/tests/test_subscriber.c 2006-10-25 11:53:42.000000000 +0200
@@ -184,6 +184,7 @@
int main( int argc, char **argv, char **envp )
{
DBUS_SVC dbus;
+ int reconnect = 0;
char eth0[]="eth0", *ip_if = &(eth0[0]) ;
if( argc > 1 )
@@ -214,7 +215,7 @@
return(1);
}
- dbus_svc_main_loop( dbus, 0L);
+ dbus_svc_main_loop( dbus, 0L, &reconnect );
return(0);
}
diff -urN dhcdbd-1.12/tests/test_subscriber_dbus.c dhcdbd-1.12_mod/tests/test_subscriber_dbus.c
--- dhcdbd-1.12/tests/test_subscriber_dbus.c 2006-01-17 22:23:51.000000000 +0100
+++ dhcdbd-1.12_mod/tests/test_subscriber_dbus.c 2006-10-25 11:53:42.000000000 +0200
@@ -174,6 +174,7 @@
int main( int argc, char **argv, char **envp )
{
DBUS_SVC dbus;
+ int reconnect = 0;
dbus = dbus_svc_init( DBUS_SYSTEM, 0L, 0L, 0L );
@@ -200,7 +201,7 @@
return(1);
}
- dbus_svc_main_loop( dbus, 0L);
+ dbus_svc_main_loop( dbus, 0L, &reconnect );
return(0);
}
++++++ dhcdbd-lease-dir-rml-1.10-1.patch ++++++
dhcdbd.h | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -urN dhcdbd-1.10/dhcdbd.h dhcdbd/dhcdbd.h
--- dhcdbd-1.10/dhcdbd.h 2005-11-16 21:36:00.000000000 -0500
+++ dhcdbd/dhcdbd.h 2006-01-06 17:22:18.000000000 -0500
@@ -31,7 +31,7 @@
#define DHCDBD_DHCLIENT_BIN "/sbin/dhclient"
#endif
#ifndef DHCDBD_DHCLIENT_LEASE_DIR
-#define DHCDBD_DHCLIENT_LEASE_DIR "/var/lib/dhclient/"
+#define DHCDBD_DHCLIENT_LEASE_DIR "/var/lib/dhcp/"
#endif
#ifndef DHCDBD_DHCLIENT_LEASE_PFX
#define DHCDBD_DHCLIENT_LEASE_PFX "dhclient-"
++++++ dhcdbd-less-verbose-logging-rml.patch ++++++
dbus_service.c | 5 -----
1 file changed, 5 deletions(-)
diff -urN dhcdbd-1.12/dbus_service.c dhcdbd/dbus_service.c
--- dhcdbd-1.12/dbus_service.c 2006-01-17 16:23:51.000000000 -0500
+++ dhcdbd/dbus_service.c 2006-03-28 09:58:24.000000000 -0500
@@ -247,12 +247,7 @@
return r;
mhpp = tfind(&mhn, &(root->tree), mh_comparator);
if ( (mhpp == 0L) || ((mhp=*mhpp)==0L) )
- {
- if( cs->eh != 0L ) (*(cs->eh))("message_handler: message handler not found under %s for sub-path %s", path, sub_path);
-
-
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
}
r =( (*(mhp->mh))
( cs, type, reply, serial, dest, path, member, interface, if_suffix,
++++++ dhcdbd-no-nr_open-rml.patch ++++++
dhcdbd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff -urN dhcdbd-1.12/dhcdbd.c dhcdbd/dhcdbd.c
--- dhcdbd-1.12/dhcdbd.c 2006-01-17 16:23:51.000000000 -0500
+++ dhcdbd/dhcdbd.c 2006-02-24 14:58:36.000000000 -0500
@@ -978,7 +978,8 @@
}else
if( d_if->dhc_pid == 0 )
{
- for( i=0; i < NR_OPEN; i++)
+ int nr_open = getdtablesize();
+ for( i=0; i < nr_open; i++)
close(i);
if((i = open("/dev/null",O_RDONLY)) != -1)
{
++++++ dhcdbd-powersave.patch ++++++
Patch from http://www.linuxpowertop.org/patches/dhcdbd.patch
to reduce number of wakeups of dhcdbd and therefore to save power.
This patch is part of dhcdbd 2.8.
--- dbus_service.c
+++ dbus_service.c
@@ -1132,6 +1132,53 @@
twalk( cs->timeouts, process_timeout );
}
+
+static float next_timeout;
+
+static void find_timeout (const void *p, const VISIT which, const int level) {
+ DBusConnectionState *cs;
+ const void *const *tpp = p;
+ DBusConnectionTimeout *to;
+ struct timeval tv;
+ float now, then, interval, timeout;
+
+ gettimeofday(&tv, 0L);
+
+ if ((tpp != 0L) && (*tpp != 0L) && ((which == postorder) || (which == leaf))) {
+ to = (DBusConnectionTimeout *) * tpp;
+ cs = to->cs;
+
+ if (!dbus_timeout_get_enabled(to->to))
+ return;
+
+ cs = dbus_timeout_get_data(to->to);
+ then = ((float) to->tv.tv_sec) + (((float) to->tv.tv_usec) / 1000000.0);
+
+ if (then != 0.0) {
+ interval = ((float) dbus_timeout_get_interval(to->to)) / 1000.0;
+ now = ((float) tv.tv_sec) + (((float) tv.tv_usec) / 1000000.0);
+
+ timeout = then + interval - now;
+ if (timeout < 0)
+ timeout = 0;
+ if (next_timeout < 0 || timeout < next_timeout)
+ next_timeout = timeout;
+ }
+ }
+}
+
+static struct timeval *find_next_timeout (DBusConnectionState * cs, struct timeval *tv) {
+ next_timeout = 1;
+ twalk(cs->timeouts, find_timeout);
+ printf ("next timeout %f\n", next_timeout);
+ if (next_timeout == -1)
+ return NULL;
+ tv->tv_sec = next_timeout;
+ tv->tv_usec = (next_timeout - tv->tv_sec) * 1000000;
+ return tv;
+}
+
+
static void
set_watch_fds( DBusWatch *watch, DBusConnectionState *cs )
{
@@ -1325,7 +1372,8 @@
timeout.tv_sec = 0;
timeout.tv_usec= 200000;
- if ( (n_fds = select(cs->n, &(cs->s_r_fds), &(cs->s_w_fds), &(cs->s_e_fds), &timeout)) < 0 )
+ if ( (n_fds = select(cs->n, &(cs->s_r_fds), &(cs->s_w_fds),
+ &(cs->s_e_fds), find_next_timeout (cs, &timeout))) < 0)
{
if (errno != EINTR)
{
++++++ dhcdbd-remove-named-user-rml.patch ++++++
remove named user from dhcdbd.conf
system.d/dhcdbd.conf | 4 ----
1 files changed, 4 deletions(-)
diff -urN dhcdbd-1.11/system.d/dhcdbd.conf dhcdbd/system.d/dhcdbd.conf
--- dhcdbd-1.11/system.d/dhcdbd.conf 2005-12-01 19:04:35.000000000 -0500
+++ dhcdbd/system.d/dhcdbd.conf 2006-01-11 16:54:47.000000000 -0500
@@ -7,10 +7,6 @@
<allow send_interface="com.redhat.dhcp"/>
<allow send_destination="com.redhat.dhcp"/>
</policy>
- <policy user="named">
- <allow send_interface="com.redhat.dhcp"/>
- <allow send_destination="com.redhat.dhcp"/>
- </policy>
<policy context="default">
<deny own="com.redhat.dhcp"/>
<deny send_destination="com.redhat.dhcp"/>
++++++ dhcdbd-set-hostname-fix.patch ++++++
diff -u dhcdbd/dhcdbd.c dhcdbd/dhcdbd.c
--- dhcdbd/dhcdbd.c 2006-05-30 12:05:27.000000000 -0400
+++ dhcdbd/dhcdbd.c 2006-05-30 12:05:27.000000000 -0400
@@ -922,7 +922,7 @@
f = fopen ("/etc/HOSTNAME", "r");
if (f) {
- if (fgets (hostname, HOST_NAME_MAX, f)) {
+ if (fgets (hostname, HOST_NAME_MAX, f) && hostname[0] != '\n') {
char *p;
/* just want the most significant hostname */
++++++ dhcdbd-set-hostname.patch ++++++
diff -urN dhcdbd-1.12/dhcdbd.c dhcdbd/dhcdbd.c
--- dhcdbd-1.12/dhcdbd.c 2006-01-17 16:23:51.000000000 -0500
+++ dhcdbd/dhcdbd.c 2006-05-30 12:05:27.000000000 -0400
@@ -20,9 +20,7 @@
#include "dbus_service.h"
#include "dhcdbd.h"
#include "dhcp_options.h"
-
-#define TRUE 1
-#define FALSE 0
+#include "shvar.h"
typedef
enum dhc_ifs_e
@@ -729,9 +727,10 @@
int dhcdbd_run_dhclient( DHC_IF *d_if )
{
char **dhc_args, **dhc_envp, *xtra_arg=0L;
- uint8_t n_args=12, arg;
+ uint8_t n_args=14, arg;
DHC_IF *rel_if=0L;
int i;
+ shvarFile *file;
sigset_t ss;
pid_t kill_pid=0;
char dhc_if_conf_file[1024];
@@ -911,6 +910,54 @@
return -1;
strcpy(dhc_args[arg], "-q");
+ file = svNewFile ("/etc/sysconfig/network/dhcp");
+ if (file) {
+ char hostname[HOST_NAME_MAX+1];
+ char *buf;
+
+ buf = svGetValue (file, "DHCLIENT_HOSTNAME_OPTION");
+ if (buf && buf[0] != '\0' && buf[0] != '"') {
+ if (!strcmp (buf, "AUTO")) {
+ FILE *f;
+
+ f = fopen ("/etc/HOSTNAME", "r");
+ if (f) {
+ if (fgets (hostname, HOST_NAME_MAX, f)) {
+ char *p;
+
+ /* just want the most significant hostname */
+ p = strchr (hostname, '.');
+ if (p)
+ p[0] = '\0';
+ else {
+ size_t len;
+
+ len = strlen (hostname);
+ if (hostname[len-1] == '\n')
+ hostname[len-1] = '\0';
+ }
+ } else {
+ fclose (f);
+ goto out;
+ }
+ fclose (f);
+ }
+ } else
+ strncpy (hostname, buf, HOST_NAME_MAX);
+
+ if((dhc_args[++arg] = (char*)malloc( 3 )) == 0L)
+ return -1;
+ strcpy(dhc_args[arg], "-H");
+ if((dhc_args[++arg] = (char*)malloc( strlen (hostname) + 1 )) == 0L)
+ return -1;
+ strcpy(dhc_args[arg], hostname);
+
+out:
+ free (buf);
+ }
+ svCloseFile (file);
+ }
+
if((dhc_args[++arg] = (char*)malloc( 3 )) == 0L)
return -1;
strcpy(dhc_args[arg], "-e");
diff -urN dhcdbd-1.12/Makefile dhcdbd/Makefile
--- dhcdbd-1.12/Makefile 2006-01-17 16:23:51.000000000 -0500
+++ dhcdbd/Makefile 2006-05-30 12:01:24.000000000 -0400
@@ -7,28 +7,31 @@
LDFLAGS ?= -g
DESTDIR ?= /
LIBDIR ?= lib
-DBUS_INCLUDES ?= -I/usr/$(LIBDIR)/dbus-1.0/include -I/usr/include/dbus-1.0
-DBUS_LIBS ?= -ldbus-1
-OBJS = dbus_service.o dhcdbd.o dhcp_options.o main.o
-SRCS = dbus_service.c dhcdbd.c dhcp_options.c main.c
-INCS = dbus_service.h dhcdbd.h dhcp_options.h includes.h
+INCLUDES ?= `pkg-config --cflags dbus-1 glib-2.0`
+LIBS ?= `pkg-config --libs dbus-1 glib-2.0`
+OBJS = dbus_service.o dhcdbd.o dhcp_options.o main.o shvar.o
+SRCS = dbus_service.c dhcdbd.c dhcp_options.c main.c shvar.c
+INCS = dbus_service.h dhcdbd.h dhcp_options.h includes.h shvar.h
all: dhcdbd tests CHANGES
.c.o:
- ${CC} ${CFLAGS} -c $<
+ ${CC} ${INCLUDES} ${CFLAGS} -c $<
.SUFFIXES: .c .o
dbus_service.o: dbus_service.c dbus_service.h
- $(CC) $(CFLAGS) $(DBUS_INCLUDES) -c dbus_service.c
+ $(CC) $(CFLAGS) $(INCLUDES) -c dbus_service.c
+
+shvar.o: shvar.c shvar.h
+ $(CC) $(CFLAGS) $(INCLUDES) -c shvar.c
dhcdbd.o: $(INCS) dhcdbd.c
dhcp_options.o: dhcp_options.c dhcp_options.h
dhcdbd: $(OBJS) $(SRCS) $(INCS)
- $(LD) $(LDFLAGS) -o $@ $(OBJS) $(DBUS_LIBS)
+ $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
tests: dhcdbd
(cd tests; make)
diff -urN dhcdbd-1.12/shvar.c dhcdbd/shvar.c
--- dhcdbd-1.12/shvar.c 1969-12-31 19:00:00.000000000 -0500
+++ dhcdbd/shvar.c 2006-05-30 12:01:24.000000000 -0400
@@ -0,0 +1,200 @@
+/*
+ * shvar.c
+ *
+ * Implementation of non-destructively reading/writing files containing
+ * only shell variable declarations and full-line comments.
+ *
+ * Includes explicit inheritance mechanism intended for use with
+ * Red Hat Linux ifcfg-* files. There is no protection against
+ * inheritance loops; they will generally cause stack overflows.
+ * Furthermore, they are only intended for one level of inheritance;
+ * the value setting algorithm assumes this.
+ *
+ * Copyright 1999,2000 Red Hat, Inc.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include