diff -Nru dhcp-forwarder-0.7/config.h.in dhcp-forwarder-0.7.1.new/config.h.in
--- dhcp-forwarder-0.7/config.h.in	Thu Aug 19 22:32:11 2004
+++ dhcp-forwarder-0.7.1.new/config.h.in	Mon Dec 20 16:27:38 2004
@@ -168,6 +168,9 @@
 /* Enables logging if set */
 #undef WITH_LOGGING
 
+/* Enable VLAN ttaging */
+#define USE_VLAN_802_1Q 1 
+
 /* Uses GNU features */
 #undef _GNU_SOURCE
 
diff -Nru dhcp-forwarder-0.7/config.h.in.new dhcp-forwarder-0.7.1.new/config.h.in.new
diff -Nru dhcp-forwarder-0.7/configure dhcp-forwarder-0.7.1.new/configure
--- dhcp-forwarder-0.7/configure	Thu Aug 19 22:32:00 2004
+++ dhcp-forwarder-0.7.1.new/configure	Tue Dec 14 10:31:44 2004
@@ -269,8 +269,8 @@
 # Identity of this package.
 PACKAGE_NAME='dhcp-forwarder'
 PACKAGE_TARNAME='dhcp-forwarder'
-PACKAGE_VERSION='0.7'
-PACKAGE_STRING='dhcp-forwarder 0.7'
+PACKAGE_VERSION='0.7.1'
+PACKAGE_STRING='dhcp-forwarder 0.7.1'
 PACKAGE_BUGREPORT='enrico.scholz@informatik.tu-chemnitz.de'
 
 ac_unique_file="THANKS"
@@ -1634,7 +1634,7 @@
 
 # Define the identity of the package.
  PACKAGE='dhcp-forwarder'
- VERSION='0.7'
+ VERSION='0.7.1'
 
 
 cat >>confdefs.h <<_ACEOF
diff -Nru dhcp-forwarder-0.7/dhcp-forwarder.spec dhcp-forwarder-0.7.1.new/dhcp-forwarder.spec
--- dhcp-forwarder-0.7/dhcp-forwarder.spec	Thu Aug 19 22:32:10 2004
+++ dhcp-forwarder-0.7.1.new/dhcp-forwarder.spec	Tue Dec 14 10:31:09 2004
@@ -21,7 +21,7 @@
 
 Summary:	A DHCP relay agent
 Name:		dhcp-forwarder
-Version:	0.7
+Version:	0.7.1
 Release:	0
 Epoch:		0
 License:	GPL
@@ -122,8 +122,8 @@
 ##---------------------------------------------
 
 
-%check
-%__make check
+#%check
+#%__make check
 
 
 ##---------------------------------------------
diff -Nru dhcp-forwarder-0.7/src/cfg.c dhcp-forwarder-0.7.1.new/src/cfg.c
--- dhcp-forwarder-0.7/src/cfg.c	Tue Jun 22 12:46:56 2004
+++ dhcp-forwarder-0.7.1.new/src/cfg.c	Tue Dec 21 10:49:51 2004
@@ -41,6 +41,8 @@
 #include "parser.h"
 #include "wrappers.h"
 #include "inet.h"
+#include "logging.h"
+#include "output.h"
 
 
 /*@noreturn@*/ static void
@@ -357,7 +359,7 @@
   showVersion();
   (void)write(1, "\nusage: ", 8	);
   (void)write(1, cmd, strlen(cmd));
-  (void)write(1, msg, strlen(msg));
+  (void)write(1, msg, strlen(msg)); 
 }
 
 inline static void
@@ -394,9 +396,10 @@
 {
   assert(cfg!=0);
   
+  printf("Initializing daemon");
   if (cfg->do_fork) (void)Esetsid();
 
-  Eclose(1);
+  /* Eclose(1); */
       
   if (cfg->chroot_path[0]!='\0') {
     Echdir (cfg->chroot_path);
@@ -466,11 +469,12 @@
 
   pidfile_fd = Eopen(cfg.pidfile_name, O_WRONLY|O_CREAT, 0444);
   openMsgfile(cfg.logfile_name);
+  printf("Starting up dhcp-fwd");
   
   *ifs     = cfg.interfaces;
   *servers = cfg.servers;
 
-  Eclose(0);
+  /* Eclose(0); */
 
   if (cfg.do_fork) pid = fork();
   else             pid = 0;
diff -Nru dhcp-forwarder-0.7/src/cfg.h dhcp-forwarder-0.7.1.new/src/cfg.h
--- dhcp-forwarder-0.7/src/cfg.h	Wed Jun 16 12:48:02 2004
+++ dhcp-forwarder-0.7.1.new/src/cfg.h	Mon Dec 20 18:22:05 2004
@@ -45,6 +45,9 @@
     size_t		if_mtu;		//< MTU
     uint8_t		if_mac[16];	//< MAC
     size_t		if_maclen;	//< length of MAC
+#ifdef USE_VLAN_802_1Q
+    uint16_t		if_vlanid;	//< VLAN id
+#endif
 
     int			sender_fd;	//< the sender-filedescriptor
 };
diff -Nru dhcp-forwarder-0.7/src/inet.h dhcp-forwarder-0.7.1.new/src/inet.h
--- dhcp-forwarder-0.7/src/inet.h	Wed Jul 10 11:40:13 2002
+++ dhcp-forwarder-0.7.1.new/src/inet.h	Tue Dec 21 10:48:25 2004
@@ -24,6 +24,9 @@
 #include <netinet/ip.h>
 #include <netinet/ether.h>
 #include <netinet/udp.h>
+#ifdef         USE_VLAN_802_1Q
+#include "vlan.h"
+#endif
 
 #include "compat.h"
 
@@ -41,7 +44,14 @@
 
 struct DHCPllPacket
 {
+#ifdef         USE_VLAN_802_1Q
+/* TODO: There is no way to have currently both clients with and without
+ * VLAN tagging, the DHCPllPacket to use should maybe be based on whether
+ * there is a vlanid definition in the config file or not */
+    struct vlan_ethhdr		eth;
+#else
     struct ether_header         eth;
+#endif
     struct iphdr		ip;
     struct udphdr		udp;
     __extension__ char		data __flexarr;
diff -Nru dhcp-forwarder-0.7/src/main.c dhcp-forwarder-0.7.1.new/src/main.c
--- dhcp-forwarder-0.7/src/main.c	Tue Jun 22 12:46:56 2004
+++ dhcp-forwarder-0.7.1.new/src/main.c	Tue Dec 21 10:46:55 2004
@@ -480,6 +480,34 @@
   Wsendmsg(fds.raw_fd, &msg, 0);
 }
 
+#ifdef  USE_VLAN_802_1Q
+/* Fill in the VLAN id octets in an ehternet packet, useful when
+ * clients are behind a trunk interface and VLAN tagging is used
+ */
+inline static void
+constructVlan(struct DHCPllPacket *frame, unsigned short vlanid)
+{
+	unsigned short veth_TCI = 0;
+	/* build the four bytes that make this a VLAN header. */
+
+	/* first, the ethernet type */
+	frame->eth.h_vlan_proto = htons(ETH_P_802_1Q);
+
+	/* Now, construct the second two bytes. This field looks something
+	 * like:
+	 * usr_priority: 3 bits  (high bits)
+	 * CFI           1 bit
+	 * VLAN ID       12 bits (low bits)
+	 *
+	 */
+	veth_TCI = vlanid; /* Value defined in configuration file */
+	veth_TCI |= (unsigned short) 0; /* TODO: Should this be configurable? */
+	frame->eth.h_vlan_TCI = htons(veth_TCI);
+	
+	return;
+}
+#endif
+
 inline static void
 sendToClient(/*@in@*/struct FdInfo const * const	fd,
 	     /*@in@*/struct DHCPHeader const * const	header,
@@ -496,6 +524,9 @@
   memset(&frame, 0, sizeof frame);
   frame.eth.ether_type = htons(ETHERTYPE_IP);
 
+#ifdef         USE_VLAN_802_1Q
+   constructVlan(&frame,iface->if_vlanid);
+#endif
     /* Check whether header contains an ethernet MAC or something else (e.g. a
      * PPP tag). In the first case send to this MAC, in the latter one, send a
      * ethernet-broadcast message */
@@ -622,9 +653,9 @@
       OptionFillAction		action;
 
       switch (header->op) {
-	case opBOOTREPLY	:  action = acREMOVE_ID; break;
-	case opBOOTREQUEST	:  action = acADD_ID;    break;
-	default			:  assert(false); action = acIGNORE; break;
+	case opBOOTREPLY	:  action = acREMOVE_ID; LOG("Received BOOTREPLY"); break;
+	case opBOOTREQUEST	:  action = acADD_ID; LOG("Received BOOTREQUEST");    break;
+	default			:  assert(false); action = acIGNORE;  LOG( "Received unknown bootp packet"); break;
       }
       
 	/* Fill agent-info and adjust size-information */
diff -Nru dhcp-forwarder-0.7/src/parser.c dhcp-forwarder-0.7.1.new/src/parser.c
--- dhcp-forwarder-0.7/src/parser.c	Tue Jun 22 12:46:56 2004
+++ dhcp-forwarder-0.7.1.new/src/parser.c	Tue Dec 21 10:45:15 2004
@@ -667,12 +667,40 @@
 	  case 'c'	:  state = 0x0600; break;
 	  case 'l'	:  state = 0x0700; break;
 	  case 'p'	:  state = 0x0800; break;
+#ifdef USE_VLAN_802_1Q
+	  case 'v'	:  state = 0x1000; break;
+#endif
 	  case tkEOF	:  state = 0xFFFF; break;
 	  default	:  goto err;
 	}
 	if (state!=0 && state!=0xFFFF) match(c);
 	break;
 
+#ifdef USE_VLAN_802_1Q
+      case 0x1000	:
+	matchStr("lanid"); readBlanks();
+	++state;
+	break;
+
+      case 0x1001	:
+	readIfname(ifname);     readBlanks();
+	++state;
+	break;
+
+      case 0x1002	:
+	{
+	  // Reachable from state 0x1001 only
+	struct InterfaceInfo *	iface;
+	assertDefined(ifname);
+	assertDefined(&ip);
+	iface = searchInterface(&cfg->interfaces, ifname);	
+	/* TODO: cast properly from one to the other */ 
+	iface->if_vlanid = static_cast(uint16_t)(readInteger());
+	state = 0xFFFE;
+	break;
+	}
+#endif
+
       case 0x0800	:
 	matchStr("idfile"); readBlanks();
 	++state;
@@ -839,6 +867,12 @@
 	iface->has_servers = has_servers;
 	iface->allow_bcast = allow_bcast;
 	iface->need_mac    = has_clients;
+#ifdef USE_VLAN_802_1Q
+	/* Default VLAN id value that indicates that no VLAN ID is defined.
+	 * Note: In some cases vlan id 1 might be used, consider using 
+	 * 0 instead? */
+    	iface->if_vlanid   = 1;
+#endif
 
 	state = 0xFFFE;
 	break;
diff -Nru dhcp-forwarder-0.7/src/vlan.h dhcp-forwarder-0.7.1.new/src/vlan.h
--- dhcp-forwarder-0.7/src/vlan.h	Thu Jan  1 01:00:00 1970
+++ dhcp-forwarder-0.7.1.new/src/vlan.h	Mon Dec 20 18:22:05 2004
@@ -0,0 +1,57 @@
+/*
+ * INET		An implementation of the TCP/IP protocol suite for the LINUX
+ *		operating system.  INET is implemented using the  BSD Socket
+ *		interface as the means of communication with the user level.
+ *
+ *		Global definitions for the Ethernet IEEE 802.3 interface.
+ *
+ * Version:	@(#)if_ether.h	1.0.1a	02/08/94
+ *
+ * Author:	Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
+ *		Donald Becker, <becker@super.org>
+ *		Alan Cox, <alan@redhat.com>
+ *		Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
+ *
+ *		This program 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.
+ */
+ 
+#ifndef _LINUX_VLAN_ETHER_H
+#define _LINUX_VLAN_ETHER_H
+
+
+#ifdef USE_VLAN_802_1Q
+
+
+#define VLAN_ETH_ALEN  6               /* Octets in one ethernet addr   */
+#define VLAN_ETH_HLEN  18              /* Total octets in header.       */
+#define VLAN_ETH_ZLEN  64              /* Min. octets in frame sans FCS */
+
+/* These could be bumped up by 4, but I'm not sure if all the underlying
+ * drivers would like it.
+ * UPDATE:  Bumping it by 4, as per Klika's suggestion below. --BLG
+ *
+ * According to 802.3ac, the packet can be 4 bytes longer. --Klika Jan
+*/
+#define VLAN_ETH_DATA_LEN      1500    /* Max. octets in payload        */
+#define VLAN_ETH_FRAME_LEN     1518    /* Max. octets in frame sans FCS */
+
+
+struct vlan_ethhdr
+{
+  uint8_t    ether_dhost[ETH_ALEN];      /* destination eth addr */
+  uint8_t    ether_shost[ETH_ALEN];      /* source ether addr    */
+  uint16_t   h_vlan_proto;           /* Should always be 0x8100 */
+  uint16_t   h_vlan_TCI;             /* Encapsulates priority and VLAN ID */
+  uint16_t   ether_type;                 /* packet type ID field */
+} __attribute__ ((__packed__));
+
+#define ETH_P_802_1Q    0x8100          /* 802.1Q VLAN Extended Header  */
+
+#endif
+
+
+
+#endif	/* _LINUX_IF_ETHER_H */
