Re: tmdns patches

Steve G <[email protected]> Tue, 27 Jan 2004 20:18:03 -0800 (PST)
Newsgroups gmane.network.zeroconf.workers
Message-ID <[email protected]>
Hello,

Attached is the first set of patches. This is mostly a function
prototype cleanup. It moves everything static that can be, and
deletes a couple unused functions and data elements. There is one
security related fix tucked away in this patch (escaped_space). I
wanted to get that in asap.

I am sending the patch as an attachment since yahoo mail will
mess up the patch to where its unusable. Its a plain text diff
between cvs & my devel copy.

Please let me know if anything is objectionable since future
patches will depend on this one.

Best Regards,
Steve Grubb

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
tmdns-patch1.txt (text/plain, 22.5 KB)
diff -urbB tmdns/server/conf.c tmdns-devel/server/conf.c
--- tmdns/server/conf.c	2003-01-15 01:18:41.000000000 -0500
+++ tmdns-devel/server/conf.c	2004-01-27 23:00:12.000000000 -0500
@@ -12,7 +12,7 @@
  *      option should be configurable by the config file.
  */ 
 
-#include <config.h>
+#include "config.h"
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -20,10 +20,10 @@
 #include "conf.h"
 #include "debug.h"
 
-int initialized = 0;
+static int initialized = 0;
 
 struct config config;  
-struct config config_defaults = {
+static struct config config_defaults = {
   port:           5353,
   daemon_mode:    1 ,
   username:      "daemon" ,
@@ -32,7 +32,7 @@
   config_file:    CONFIG_FILE_DEFAULT, 
   debug_file:     DEBUG_FILE_DEFAULT, 
   service_file:   SERVICE_FILE_DEFAULT, 
-  interfaces:     { NULL } , 
+/*  interfaces:     { NULL } ,               not used */
   default_ttl:    120 * 60 ,              /* TTL for local entries */
   pid_file:       PID_FILE_DEFAULT ,
   dns_bridge:     1,                      /* do not bridge dns queries */
@@ -50,6 +50,7 @@
   dynamic_service_file:   DYNAMIC_SERVICE_FILE_DEFAULT, 
 };
 
+static void conf_cmdparse(char *cmd, char *arg1);
 static void copy_bool(char *, void *);
 static void print_bool(FILE * fd , void * value ) ;
 static void init_int(char *, void *);
@@ -62,8 +63,6 @@
 static void copy_string_array(char *, char **, int);
 static void print_string_array(FILE * fd , void * value ) ;
 
-static void copy_block_networks(char *str, void * val); 
-
 static void copy_interfaces(char *str, void * val) {
     copy_string_array(str,(char **)val, MAX_IF );
 }
@@ -77,7 +76,7 @@
 static void print_dummy(FILE * fd, void * value ) {}
 
 
-config_param config_params[] = {
+static config_param config_params[] = {
    { 
      "hostname" ,
      "# If you leave this empty, tmdns will announce the name from the system config\n"
@@ -291,7 +290,7 @@
   return 0;
 }
 /*****************************************************************************/
-void conf_cmdparse(char *cmd, char *arg1)
+static void conf_cmdparse(char *cmd, char *arg1)
 {
   int i = 0;
 
@@ -443,7 +442,7 @@
 /************************************************************************
  * print the configuration on stdout.
 ************************************************************************/
-void conf_print() {
+void conf_print(void) {
    int i = 0;
    FILE * fd;
 
diff -urbB tmdns/server/conf.h tmdns-devel/server/conf.h
--- tmdns/server/conf.h	2003-01-15 01:18:41.000000000 -0500
+++ tmdns-devel/server/conf.h	2004-01-27 22:56:03.000000000 -0500
@@ -14,7 +14,7 @@
 #ifndef CONF_H 
 #define CONF_H 1
 
-#include <config.h>
+#include "config.h"
 
 #include "tmdns.h"
 
@@ -32,7 +32,7 @@
   char service_file[CONF_PATH_LEN];
   char config_file[CONF_PATH_LEN];
   char debug_file[CONF_PATH_LEN];
-  char * interfaces[MAX_IF + 1];
+/*  char * interfaces[MAX_IF + 1]; */
   /* ttl stuff */
   int  default_ttl;
   char username[CONF_PATH_LEN];
@@ -69,9 +69,7 @@
 extern struct config config;                      
 int  conf_load (char *conf_file);
 void conf_defaults (void);
-void conf_cmdparse(char *cmd, char *arg1);
-int  conf_bool (char *val);
 
-void conf_print();
+void conf_print(void);
 
 #endif /* CONF_H */
diff -urbB tmdns/server/debug.c tmdns-devel/server/debug.c
--- tmdns/server/debug.c	2003-01-11 07:32:37.000000000 -0500
+++ tmdns-devel/server/debug.c	2004-01-27 20:28:01.000000000 -0500
@@ -27,7 +27,7 @@
 
 #ifdef DEBUG
 
-static FILE * open_log() {
+static FILE * open_log(void) {
      if( config.debug_file[0] ){
 	 FILE *fp;
 	 fp = fopen( config.debug_file, "a");
diff -urbB tmdns/server/dns.c tmdns-devel/server/dns.c
--- tmdns/server/dns.c	2003-01-15 01:18:41.000000000 -0500
+++ tmdns-devel/server/dns.c	2004-01-27 23:00:42.000000000 -0500
@@ -13,7 +13,7 @@
   **
 */
 
-#include <config.h>
+#include "config.h"
 
 #include "conf.h"
 #include "tmdns.h"
@@ -23,7 +23,6 @@
 #define BYTESLEFT(x) (x->bufsize - (x->data - x->u.raw) + sizeof(HEADER))
 
 static dns_soa_rr * fake_soa = NULL;
-static char servername[MAXDNAME];
 
 /****************************************************************************
  * get the length of the dns message.
@@ -106,7 +105,7 @@
  * compress a domain into a message
  *
  ****************************************************************************/
-int dns_compress_domain( dns_t * pkt , char * domain ) {
+static int dns_compress_domain( dns_t * pkt , char * domain ) {
     int count = 0;
     count = dn_comp( domain,
 	             pkt->data   , BYTESLEFT(pkt) ,
@@ -123,7 +122,7 @@
  * character strings are at most 255 bytes long, all strings are
  * prefixed with a length byte.
  ****************************************************************************/
-int dns_put_string( dns_t * pkt, char * string ) {
+static int dns_put_string( dns_t * pkt, char * string ) {
 
     int slen = strlen(string);
 
@@ -530,13 +529,3 @@
     return ;
 }
 
-int dump_cb ( dns_sect section,
-	      char * domain,
-	      int type, int class, long ttl ,
-	      int rr_len ,u_char * rr_data, 
-	      void * user_data ) 
-{
-    debug( "%d|%d|%s\n" , type , class, domain );
-    return 0;
-}
-
diff -urbB tmdns/server/dns.h tmdns-devel/server/dns.h
--- tmdns/server/dns.h	2003-01-15 01:18:41.000000000 -0500
+++ tmdns-devel/server/dns.h	2004-01-27 22:54:57.000000000 -0500
@@ -62,7 +62,7 @@
 
 
 typedef struct {
-  struct in_addr dst_ip;	       /* to wich address send this msg. */
+  /* struct in_addr dst_ip;	          to wich address send this msg. */
   int           dst_port;	       /* to which port send             */
 
   socklen_t        dst_len;
@@ -144,6 +144,8 @@
 
 int  dns_init_answer( dns_t * , dns_query * );
 
+int  dns_add_ar( dns_t * pkt, dns_rr * rr );
+
 int  dns_add_rr( dns_t * pkt , dns_rr * rr );
 
 int  dns_add_qr( dns_t * pkt , char * domain,
@@ -170,12 +172,6 @@
 			   int rr_len ,u_char * rr_data, 
 			   void * user_data ) ;
 
-extern dump_cb(dns_sect section, 
-			   char * domain, 
-			   int type, int class, long ttl,
-			   int rr_len ,u_char * rr_data, 
-			   void * user_data ) ;
-
 void dns_walk_buf   ( u_char * buf , int len,
 		      dnswalk_cb callback ,
 		      void * userdata );
diff -urbB tmdns/server/ifaddrs.h tmdns-devel/server/ifaddrs.h
--- tmdns/server/ifaddrs.h	2004-01-27 20:07:46.000000000 -0500
+++ tmdns-devel/server/ifaddrs.h	2004-01-27 22:31:21.000000000 -0500
@@ -1,27 +1,21 @@
 
-
-#ifdef HAVE_GETIFADDRS
-
-/* dunno where it really is, could somebody fix ? */
-#include <net/ifaddrs.h>
-
-#else
-
 #ifndef IF_ADDRS_H
 #define IF_ADDRS_H 1
+
+#include <sys/socket.h>
+
 /*
  *  striped down version of struct ifaddrs, only that stuff,
  *  that our implementaion provides are included. 
  */
 struct ifaddrs {
-    struct ifaddrs *	ifa_next;
+    struct ifaddrs     *ifa_next;
     char *		ifa_name;
     unsigned int        ifa_flags;
     struct sockaddr	*ifa_addr;
 };
 
-int getifaddrs(struct ifaddrs**);
-void freeifaddrs(struct ifaddrs*);
+extern int getifaddrs(struct ifaddrs**);
+extern void freeifaddrs(struct ifaddrs*);
 
 #endif
-#endif
diff -urbB tmdns/server/info.c tmdns-devel/server/info.c
--- tmdns/server/info.c	2003-01-15 01:18:41.000000000 -0500
+++ tmdns-devel/server/info.c	2004-01-27 23:03:51.000000000 -0500
@@ -1,4 +1,6 @@
 
+#include "config.h"
+#define _GNU_SOURCE 1 
 #include <stdio.h>
 
 #include <sys/utsname.h>
@@ -6,24 +8,21 @@
 #include <sys/ioctl.h>
 #include <netinet/in.h>
 #include <ctype.h>
-
 #include <assert.h>
 
+#include "conf.h"
 #include "debug.h"
 #include "tmdns.h"
 #include "dns.h"
 #include "llist.h"
 #include "info.h"
-
-#include "conf.h"
-
 #include "ifaddrs.h"
 
 static list_t * records;
 
-static dns_rr * newHinfoRec(char * domain );
-static dns_rr * newARec( char * domain , struct in_addr * ip );
-
+static dns_rr * newHinfoRec( const char * domain );
+static dns_rr * newARec( const char * domain , struct in_addr * ip );
+static const char escaped_space[]="\\032";
 
 /*****************************************************************************
  * Escape characters in domain labels.
@@ -31,7 +30,7 @@
  * Returns a malloc'ed copy of the string with "." "\" and " " escaped.
  *
  *****************************************************************************/
-char * escapeDomainLabel(char * label) {
+static char * escapeDomainLabel(char * label) {
     int needed = 0;
     char * now = NULL;
     char * to  = NULL;
@@ -45,7 +44,7 @@
 		needed += 2;
 		break;
 	    case ' ':
-		needed += 4;
+		needed += sizeof(escaped_space);
 		break;
 	    default:
 		needed ++;
@@ -53,6 +52,8 @@
     }
 
     result = (char *)malloc(needed + 1);
+    if (result == NULL)
+       return NULL;
     to = result;
 
     for( now = label; *now != 0; now ++ ) {
@@ -65,8 +66,8 @@
 		*to = *now;
 		break;
 	    case ' ':
-		strcat(to,"\\032");
-		to += 4;
+		strcat(to,escaped_space);
+		to += sizeof(escaped_space);
 		break;
 	    default:
 		*to = *now;
@@ -84,11 +84,11 @@
  * Constructor and destructor functions for basic resource records.
  *
  *****************************************************************************/
-void free_rr(dns_rr * rr) {
+static void free_rr(dns_rr * rr) {
   free(rr);
 }
 
-void init_rr(dns_rr * rr,char * domain, short type ) {
+static void init_rr(dns_rr * rr,const char * domain, short type ) {
   rr->domain   = strdup(domain);
   rr->type     = type;
   rr->class    = C_IN;
@@ -100,13 +100,13 @@
  * Constructor and destructor functions for hostinfo resource records.
  *
  *****************************************************************************/
-void freeHinfoRec(dns_rr * hinfo) {
+static void freeHinfoRec(dns_rr * hinfo) {
    free(hinfo->rr.hinfo.cpu_type);
    free(hinfo->rr.hinfo.os_name);
    free_rr(hinfo);
 }
 
-dns_rr * newHinfoRec(char * domain ) {
+static dns_rr * newHinfoRec(const char * domain ) {
 
     struct utsname info;
     dns_rr * hinfo = NULL;
@@ -118,6 +118,8 @@
     asprintf(&os, "%s %s" , info.sysname , info.release);
 
     hinfo = (dns_rr *)malloc( sizeof(dns_rr) );
+    if (hinfo == NULL)
+        return NULL;
 
     init_rr(hinfo,domain,T_HINFO);
     hinfo->rr.hinfo.cpu_type = strdup(info.machine);
@@ -132,7 +134,7 @@
  * Constructor function for ipv4 address resource records.
  *
  *****************************************************************************/
-dns_rr * newARec( char * domain , struct in_addr * ip ) {
+static dns_rr * newARec( const char * domain , struct in_addr * ip ) {
     dns_rr * aRec = NULL;
     
     aRec = (dns_rr *)malloc( sizeof(dns_rr) );
@@ -148,12 +150,12 @@
  * Constructor and destructor functions for pointer resource records.
  *
  *****************************************************************************/
-void freePtrRec(dns_rr * rr) {
+static void freePtrRec(dns_rr * rr) {
     free(rr->rr.dn);
     free_rr(rr);
 }
 
-dns_rr * newPtrRec( char * domain , char * rev ) {
+static dns_rr * newPtrRec( const char * domain , char * rev ) {
     dns_rr * ptrRec = NULL;
     
     ptrRec = (dns_rr *)malloc( sizeof(dns_rr) );
@@ -169,12 +171,12 @@
  * Constructor and destructor functions for service resource records.
  *
  *****************************************************************************/
-void freeSrvRec(dns_rr * rr) {
+static void freeSrvRec(dns_rr * rr) {
     free(rr->rr.srv.target);
     free_rr(rr);
 }
 
-dns_rr * newSrvRec( char * domain,
+static dns_rr * newSrvRec( const char * domain,
                   unsigned short priority,
                   unsigned short weight,
                   unsigned short port,
@@ -199,7 +201,7 @@
  * Read a service regestry and add a service record for each entry.
  *
  *****************************************************************************/
-void info_read_serviceconf( char * service_file , char * hostname ) {
+static void info_read_serviceconf( char * service_file , char * hostname ) {
 
     FILE *fp;
     char line[1024];
@@ -296,7 +298,7 @@
  *
  *****************************************************************************/
 
-void info_init() {
+void info_init(void) {
 
     struct ifconf ifconfig;
     struct ifaddrs * ifs = NULL;
@@ -390,12 +392,12 @@
  *
  * 
  *****************************************************************************/
-void info_destroy() {
+void info_destroy(void) {
     ll_entry_t * el      = NULL;
 
     for( el = ll_first(records) ; el != NULL ; el = ll_next(el) ) {
 	dns_rr * rr = (dns_rr *)el->data;
-	assert(rr != NULL );
+	assert(rr != NULL );		/* FIXME: syslog and exit */
 	if( rr->freeFunc != NULL ) {
 	    rr->freeFunc(rr);
 	} else {
diff -urbB tmdns/server/info.h tmdns-devel/server/info.h
--- tmdns/server/info.h	2003-01-11 07:32:38.000000000 -0500
+++ tmdns-devel/server/info.h	2004-01-27 20:19:32.000000000 -0500
@@ -12,8 +12,8 @@
   ll_entry_t * el;    /* where to continue the search   */
 } search_state;
 
-void info_init();
-void info_destroy();
+void info_init(void);
+void info_destroy(void);
 
 void info_init_search( search_state * state, char * query, int type );
 
diff -urbB tmdns/server/llist.c tmdns-devel/server/llist.c
--- tmdns/server/llist.c	2003-01-11 07:32:38.000000000 -0500
+++ tmdns-devel/server/llist.c	2004-01-27 23:02:10.000000000 -0500
@@ -12,6 +12,7 @@
  **
  */
 
+#include "config.h"
 #include <stdlib.h>
 #include "llist.h"
 #include "debug.h"
@@ -176,7 +177,7 @@
   
   @param element The element to be moved to the front of the linked list
  ***************************************************/ 
-void ll_to_front(ll_entry_t *element)
+static void ll_to_front(ll_entry_t *element)
 {
    list_t *control;
    
diff -urbB tmdns/server/serv_udp.c tmdns-devel/server/serv_udp.c
--- tmdns/server/serv_udp.c	2003-01-11 07:32:36.000000000 -0500
+++ tmdns-devel/server/serv_udp.c	2004-01-27 23:01:13.000000000 -0500
@@ -19,7 +19,7 @@
   **
 */
 
-#include <config.h>
+#include "config.h"
 
 #include <net/if.h>
 
@@ -37,6 +37,9 @@
 static int bridge_sock = -1;
 
 static struct sockaddr mcast_v4_sa;
+static char * udp_answerdst2str(dns_t * answer); 
+static int udp_sock_open( int mcast , struct sockaddr * sock );
+static char * udp_sockaddr_str( struct sockaddr * addr );
 
 /*****************************************************************************
  * open sockets we ar interested in.
@@ -60,8 +63,6 @@
  ****************************************************************************/
 int udp_open_sockets(char ** exclude_devs , int * sockets) {
 
-    int   iffound = 0;
-
     struct ifaddrs * ifs = NULL;
     struct ifaddrs * ifnow = NULL;
 
@@ -71,7 +72,6 @@
 
     if( config.dns_bridge ) {
 	struct sockaddr_in * sock = (struct sockaddr_in *)&mcast_v4_sa;
-	struct in_addr mcast_addr;
 
 	memset( sock , 0 , sizeof(struct sockaddr_in) );
 	sock->sin_family = AF_INET;
@@ -145,7 +145,6 @@
      */
     {
 	struct sockaddr_in * sock = (struct sockaddr_in *)&mcast_v4_sa;
-	struct in_addr mcast_addr;
 
 	memset( sock , 0 , sizeof(struct sockaddr_in) );
 	sock->sin_family = AF_INET;
@@ -182,7 +181,7 @@
  *   >= if the socket could be opened, < 1 if an error occured.
  *
  ****************************************************************************/
-int udp_sock_open( int mcast , struct sockaddr * sock )
+static int udp_sock_open( int mcast , struct sockaddr * sock )
 {
   int fd;
   
@@ -260,7 +259,7 @@
   return numread;
 }
 /*****************************************************************************/
-int udp_send_dnsmsg( int sockfd, dns_t * pkt ) {
+void udp_send_dnsmsg( int sockfd, dns_t * pkt ) {
 
   struct sockaddr_in sa;
 
@@ -336,7 +335,7 @@
 #define INET6_ADDRSTRLEN 256
 #endif
 #define PORT_LEN 7
-char * udp_sockaddr_str( struct sockaddr * addr ) {
+static char * udp_sockaddr_str( struct sockaddr * addr ) {
 
     static char result[INET6_ADDRSTRLEN+PORT_LEN+2];
     int  addr_port;
@@ -362,7 +361,7 @@
 
 }
 
-char * udp_answerdst2str(dns_t * answer) {
+static char * udp_answerdst2str(dns_t * answer) {
     return udp_sockaddr_str( &(answer->dst_address) );
 }
 
diff -urbB tmdns/server/serv_udp.h tmdns-devel/server/serv_udp.h
--- tmdns/server/serv_udp.h	2003-01-11 07:32:36.000000000 -0500
+++ tmdns-devel/server/serv_udp.h	2004-01-27 22:50:33.000000000 -0500
@@ -4,16 +4,14 @@
 
 #include <config.h>
 
-extern int udp_sock_open(int mcast, struct sockaddr *);
 extern int udp_packet_read(int sockfd, struct udp_packet *udp_pkt);
 
 extern int udp_open_sockets(char ** ifstr, int * sockets );
-extern int udp_send_dnsmsg(int, dns_t * );
+extern void udp_send_dnsmsg(int, dns_t * );
 
 void udp_copy_answer_address(dns_t * answer, struct udp_packet * udp_pkt);
 
 char * udp_sockaddr_str( struct sockaddr * addr );
-char * udp_answerdst2str(dns_t * answer);
 char * udp_pktsrc2str(struct udp_packet * udp_pkt);
 
 #endif /*SERV_UDP_H*/
diff -urbB tmdns/server/tmdns.c tmdns-devel/server/tmdns.c
--- tmdns/server/tmdns.c	2003-01-15 01:18:41.000000000 -0500
+++ tmdns-devel/server/tmdns.c	2004-01-27 23:01:39.000000000 -0500
@@ -1,5 +1,5 @@
 
-#include <config.h>
+#include "config.h"
 
 #include "tmdns.h"
 #include "conf.h"
@@ -26,16 +26,18 @@
  *
  *****************************************************************************/
 
-int  handle_query(int sock, struct udp_packet * udp_pkt);
-int  store_query(int sock, struct udp_packet * udp_pkt);
-int  answer_outstanding_queries(); 
-void fill_outstanding_queries(int sock, struct udp_packet * udp_pkt); 
+static int  handle_query(int sock, struct udp_packet * udp_pkt);
+static int  store_query(int sock, struct udp_packet * udp_pkt);
+static int  answer_outstanding_queries(void); 
+static void fill_outstanding_queries(int sock, struct udp_packet * udp_pkt); 
+static int announce( int sock );
+static int probe( int sock );
 
-int go_down = 0;
-int do_config = 0;
+volatile static int go_down = 0;
+volatile static int do_config = 0;
 
 /* a list of domain name suffixes that may be queried per multicast */
-char * dot_local_domains[] = {
+static char * dot_local_domains[] = {
     ".local" ,
     ".254.169.in-addr.arpa" ,
     "0.8.e.f.ip6.arpa" ,
@@ -43,20 +45,20 @@
 };
 
 /* list of queries to answer. */
-list_t * query_list = NULL;
+static list_t * query_list = NULL;
 
 /*****************************************************************************
  * Signal handlers
  *
  *****************************************************************************/
-void sig_hup (int signo)
+static void sig_hup (int signo)
 {
   signal(SIGHUP, sig_hup); /* set this for the next sighup */
   /* conf_load (config.config_file); */
   do_config = 1;
 }
 
-void sig_term (int signo) {
+static void sig_term (int signo) {
   debug("signal %d, going down ...", signo);
   go_down = 1;
 }
@@ -65,7 +67,7 @@
  * print usage informations to stderr.
  * 
  *****************************************************************************/
-void usage(char * program , char * message ) {
+static void usage(char * program , char * message ) {
   fprintf(stderr,"%s\n" , message );
   fprintf(stderr,"%s ver. %s\n" , PACKAGE , VERSION );
   fprintf(stderr,"usage : %s [-c <config-file>] [-bdFhP] [-p <port>\n",program );
@@ -85,7 +87,7 @@
  * with return code 0.
  *
  *****************************************************************************/
-int get_options( int argc, char ** argv ) {
+static int get_options( int argc, char ** argv ) {
 
   char c = 0;
   int dns_bridge = 0;
@@ -185,7 +187,7 @@
  * log- and pidfiles to allow writing when we are not longer root.
  * 
  *****************************************************************************/
-void change_id() {
+static void change_id(void) {
 
     struct passwd * pw = NULL;
 
@@ -488,7 +490,9 @@
   } /* while not go down */
   unlink( config.pid_file );
   syslog(LOG_INFO,"normal exit");
+  return 0;
 }
+
 /*****************************************************************************
  * Sleep for a random delay between 20-120 msec.
  *****************************************************************************/
@@ -492,7 +496,7 @@
 /*****************************************************************************
  * Sleep for a random delay between 20-120 msec.
  *****************************************************************************/
-void random_sleep() {
+static void random_sleep() {
     unsigned long rdelay = 0;
     rdelay = 20000 + (100000.0*rand()/(RAND_MAX+1.0));
     debug("random sleep for %d usec\n" , rdelay );
@@ -509,7 +513,7 @@
  *
  * @return >=0 on success, < 0 on error.
  *****************************************************************************/
-int handle_query( int sock,  struct udp_packet *udp_pkt ) {
+static int handle_query( int sock,  struct udp_packet *udp_pkt ) {
 
     int n = 0;
     int answer_count  = 0;
@@ -560,7 +564,7 @@
  * The packet contains questions for all of out RR's plus all
  * the RR's in the authority section. 
  *****************************************************************************/
-int probe( int sock ) {
+static int probe( int sock ) {
     dns_t answer;
     search_state s;
 
@@ -600,7 +604,7 @@
  * An announcement is simply an answer to all of our RR's
  *
  *****************************************************************************/
-int announce( int sock ) {
+static int announce( int sock ) {
     dns_t answer;
     search_state s;
 
@@ -639,7 +643,7 @@
  * After a timeout of about two seconds we answer the question to the
  * unicast socket.
  *****************************************************************************/
-int store_query( int sock,  struct udp_packet *udp_pkt ) {
+static int store_query( int sock,  struct udp_packet *udp_pkt ) {
 
     int n = 0;
     int answer_count  = 0;
@@ -771,7 +775,7 @@
  *
  *
  *****************************************************************************/
-int answer_outstanding_queries() {
+static int answer_outstanding_queries(void) {
 
     ll_entry_t * el;
     int now;
@@ -829,7 +833,7 @@
 #define min(a,b)  (a<b?a:b)
 #endif
 
-int dup_check_cb ( 
+static int dup_check_cb ( 
 	      dns_sect section,
               char * domain,
               int type, int class, long ttl,
@@ -854,7 +858,7 @@
     return 0;
 }
 
-int fill_answer_cb ( 
+static int fill_answer_cb ( 
 	      dns_sect section,
               char * domain,
               int type, int class, long ttl,
@@ -907,7 +911,7 @@
  * We do no duplicat elimination.
  *
  *****************************************************************************/
-void fill_outstanding_queries(int fd, struct udp_packet * pkt) {
+static void fill_outstanding_queries(int fd, struct udp_packet * pkt) {
     ll_entry_t * el;
 
     el = ll_first(query_list);
diff -urbB tmdns/server/tmdns.h tmdns-devel/server/tmdns.h
--- tmdns/server/tmdns.h	2003-01-11 07:32:37.000000000 -0500
+++ tmdns-devel/server/tmdns.h	2004-01-27 22:53:49.000000000 -0500
@@ -41,8 +41,6 @@
 #define PORT 5353
 #endif
 
-#define BUF_SIZE 2048
-
 #ifndef CONFIG_FILE_DEFAULT 
 #define CONFIG_FILE_DEFAULT "/etc/tmdns.conf"
 #endif