netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] brouted packet identified as PACKET_OTHERHOST blocked by higher protocol
@ 2015-07-14 10:37 Yigal Reiss (yreiss)
  2015-07-14 11:05 ` Florian Westphal
  0 siblings, 1 reply; 6+ messages in thread
From: Yigal Reiss (yreiss) @ 2015-07-14 10:37 UTC (permalink / raw)
  To: netdev@vger.kernel.org

The problem I'm trying to solve is that when packets being sent from one bridged interface to the other are "brouted" they get dropped by the IP layer. The reason is that the packet being raised has pkt_type of type PACKET_OTHERHOST.

The semantics of "brouting" a packet is that it is sent up to higher network layers. Problem is that when the pkt_type of the packet is 
PACKET_OTHERHOST it (at least for IP) gets dropped. (e.g. dropping OTHERHOST packets is the first thing ip_rcv() does).

The suggested patch below changes the packet type to PACKET_HOST which fixes the problem. This is a bit of a cheat but I didn't find any side effects and couldn't find a better way w/o defining a new packet type. 

Also removed " dest = eth_hdr(skb)->h_dest;" which does nothing as far as I can see as it is already assigned the same value before.

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index f921a5d..2cae324 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -291,12 +291,11 @@ forward:
        switch (p->state) {
        case BR_STATE_FORWARDING:
                rhook = rcu_dereference(br_should_route_hook);
-               if (rhook) {
-                       if ((*rhook)(skb)) {
-                               *pskb = skb;
-                               return RX_HANDLER_PASS;
-                       }
-                       dest = eth_hdr(skb)->h_dest;
+               if (rhook && (*rhook)(skb)) {
+                   if (skb->pkt_type == PACKET_OTHERHOST)
+                       skb->pkt_type = PACKET_HOST; /* so it does not get rejected by higher protocol receiver, e.g. by ip_rcv()  */
+                   *pskb = skb;
+                   return RX_HANDLER_PASS;
                }
                /* fall through */
        case BR_STATE_LEARNING:

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-14 11:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-14 10:37 [PATCH] brouted packet identified as PACKET_OTHERHOST blocked by higher protocol Yigal Reiss (yreiss)
2015-07-14 11:05 ` Florian Westphal
2015-07-14 11:18   ` Yigal Reiss (yreiss)
2015-07-14 11:35     ` Florian Westphal
2015-07-14 11:52       ` Yigal Reiss (yreiss)
2015-07-14 11:59         ` Florian Westphal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).