Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Mar 2000 18:15:06 +0100 (CET)
From:      Ludo Koren <lk@tempest.sk>
To:        robert+freebsd@cyrus.watson.org
Cc:        luigi@info.iet.unipi.it, ipfw@FreeBSD.ORG
Subject:   Re: ipdivert and ethernet bridging
Message-ID:  <200003061715.SAA35436@lk.tempest.sk>
In-Reply-To: <Pine.NEB.3.96L.1000306105208.8352D-100000@fledge.watson.org> (message from Robert Watson on Mon, 6 Mar 2000 10:53:28 -0500 (EST))

next in thread | previous in thread | raw e-mail | index | archive | help
     > Ludo,

     > I would be very interested in this code.  While I probably
     > could develop it myself, I'd really rather not :-).

     > Presumably you pull the same tricks that the normal ip_input
     > code does for reassembly appropriate-looking packets, etc, etc.

The patch follows. Comments are welcomed.


ludo

Index: src/sys/net/bridge.c
===================================================================
RCS file: /home/ncvs/src/sys/net/bridge.c,v
retrieving revision 1.4.2.6
diff -c -r1.4.2.6 bridge.c
*** bridge.c	2000/01/18 14:07:13	1.4.2.6
--- bridge.c	2000/03/06 17:04:54
***************
*** 645,650 ****
--- 645,651 ----
  	struct ip_fw_chain *rule = NULL ;
  	int off;
  	struct ip *ip ;
+ 	extern struct sockaddr_in *ip_fw_fwd_addr;
  
  	m = *m0 ;
  #ifdef DUMMYNET
***************
*** 708,714 ****
  	 * The third parameter to the firewall code is the dst.  interface.
  	 * Since we apply checks only on input pkts we use NULL.
  	 */
! 	off = (*ip_fw_chk_ptr)(NULL, 0, NULL, &dummy, &m, &rule, NULL) ;
  
  	if (m == NULL) { /* pkt discarded by firewall */
  	    /*
--- 709,715 ----
  	 * The third parameter to the firewall code is the dst.  interface.
  	 * Since we apply checks only on input pkts we use NULL.
  	 */
! 	off = (*ip_fw_chk_ptr)(NULL, 0, NULL, &dummy, &m, &rule, &ip_fw_fwd_addr) ;
  
  	if (m == NULL) { /* pkt discarded by firewall */
  	    /*
***************
*** 719,724 ****
--- 720,747 ----
  	    if (canfree)
  		*m0 = NULL ;
  	    return 0 ;
+ 	}
+ 
+ 	if (ip_fw_fwd_addr != NULL) {
+ 	  eh = mtod(m, struct ether_header *);
+ 	  ip = (struct ip *)(eh + 1);
+ 
+ 	  HTONS(ip->ip_len);
+ 	  HTONS(ip->ip_id);
+ 	  HTONS(ip->ip_off);
+ 
+ 	  m_adj(m, sizeof(struct ether_header));
+ 	  ip_input(m);
+ 	  ip_fw_fwd_addr = NULL;
+ 
+ 	  /* cleanup any mbuf leftover. */
+ 	  if (m == *m0)
+ 	    *m0 = NULL ;
+ 	  if (canfree && *m0) {
+ 	    m_freem(*m0);
+ 	    *m0 = NULL ;
+ 	  }
+ 	  return 0;
  	}
  
  	/*


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ipfw" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003061715.SAA35436>