summaryrefslogtreecommitdiff
path: root/cleopatre/linux-2.6.25.10-spc300
diff options
context:
space:
mode:
Diffstat (limited to 'cleopatre/linux-2.6.25.10-spc300')
-rw-r--r--cleopatre/linux-2.6.25.10-spc300/include/linux/if_bridge.h2
-rw-r--r--cleopatre/linux-2.6.25.10-spc300/include/linux/if_ether.h4
-rwxr-xr-x[-rw-r--r--]cleopatre/linux-2.6.25.10-spc300/net/Kconfig9
-rwxr-xr-x[-rw-r--r--]cleopatre/linux-2.6.25.10-spc300/net/bridge/br_device.c17
-rwxr-xr-x[-rw-r--r--]cleopatre/linux-2.6.25.10-spc300/net/bridge/br_input.c22
-rwxr-xr-x[-rw-r--r--]cleopatre/linux-2.6.25.10-spc300/net/bridge/br_ioctl.c62
-rwxr-xr-x[-rw-r--r--]cleopatre/linux-2.6.25.10-spc300/net/bridge/br_private.h3
7 files changed, 118 insertions, 1 deletions
diff --git a/cleopatre/linux-2.6.25.10-spc300/include/linux/if_bridge.h b/cleopatre/linux-2.6.25.10-spc300/include/linux/if_bridge.h
index 58e43e5664..c70efd044d 100644
--- a/cleopatre/linux-2.6.25.10-spc300/include/linux/if_bridge.h
+++ b/cleopatre/linux-2.6.25.10-spc300/include/linux/if_bridge.h
@@ -44,6 +44,8 @@
#define BRCTL_SET_PORT_PRIORITY 16
#define BRCTL_SET_PATH_COST 17
#define BRCTL_GET_FDB_ENTRIES 18
+#define BRCTL_GET_RECV_PORT_ADDR 19
+#define BRCTL_SET_BRIDGE_NOT_FORWARD_DEST 20
#define BR_STATE_DISABLED 0
#define BR_STATE_LISTENING 1
diff --git a/cleopatre/linux-2.6.25.10-spc300/include/linux/if_ether.h b/cleopatre/linux-2.6.25.10-spc300/include/linux/if_ether.h
index 983ebf914c..117cd9e2dd 100644
--- a/cleopatre/linux-2.6.25.10-spc300/include/linux/if_ether.h
+++ b/cleopatre/linux-2.6.25.10-spc300/include/linux/if_ether.h
@@ -80,6 +80,10 @@
#define ETH_P_HPAV 0x88E1 /* HomePlug AV packet */
#define ETH_P_8021QINQ 0x9100 /* Cisco QinQ */
+#define ETH_P_1905 0x893A /*IEEE P1905.1 packet*/
+#define ETH_P_LLDP 0x88CC /*IEEE 802.1ab LLDP packet*/
+
+
/*
* Non DIX types. Won't clash for 1500 types.
*/
diff --git a/cleopatre/linux-2.6.25.10-spc300/net/Kconfig b/cleopatre/linux-2.6.25.10-spc300/net/Kconfig
index 29d688f59e..e86fdf1c25 100644..100755
--- a/cleopatre/linux-2.6.25.10-spc300/net/Kconfig
+++ b/cleopatre/linux-2.6.25.10-spc300/net/Kconfig
@@ -193,6 +193,15 @@ source "net/econet/Kconfig"
source "net/wanrouter/Kconfig"
source "net/sched/Kconfig"
+config IEEE1905_1_FORWARD_ENTITY
+ bool "Enable ieee1905.1 forward entity"
+ depends on BRIDGE
+ default N
+ ---help---
+ Use ethernet bridge as ieee1905.1 forward entity.
+
+ If unsure, say N.
+
menu "Network testing"
config NET_PKTGEN
diff --git a/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_device.c b/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_device.c
index bf7787395f..05cbc2ecef 100644..100755
--- a/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_device.c
+++ b/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_device.c
@@ -40,6 +40,23 @@ int br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
skb_reset_mac_header(skb);
skb_pull(skb, ETH_HLEN);
+#ifdef CONFIG_IEEE1905_1_FORWARD_ENTITY
+ /*
+ * if protocol is ieee1905.1 or LLDP, let bridge select transmitting port
+ * by source mac field in mac header.
+ * This modification is for topology discover message because topology
+ * discovery message should be transmitted in specific interface defined
+ * in mac address type tlv.
+ */
+ if (skb->protocol == htons(ETH_P_1905) ||
+ skb->protocol == htons(ETH_P_LLDP)) {
+ if ((dst = __br_fdb_get(br, eth_hdr(skb)->h_source)) != NULL) {
+ br_deliver(dst->dst, skb);
+ return 0;
+ }
+ }
+#endif
+
if (dest[0] & 1)
br_flood_deliver(br, skb);
else if ((dst = __br_fdb_get(br, dest)) != NULL)
diff --git a/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_input.c b/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_input.c
index 255c00f60c..de03bc482f 100644..100755
--- a/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_input.c
+++ b/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_input.c
@@ -22,6 +22,10 @@
/* Bridge group multicast address 802.1d (pg 51). */
const u8 br_group_address[ETH_ALEN] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 };
+#ifdef CONFIG_IEEE1905_1_FORWARD_ENTITY
+const u8 br_p1905_multicast_address[ETH_ALEN] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x13 };
+#endif
+
static void br_pass_frame_up(struct net_bridge *br, struct sk_buff *skb)
{
struct net_device *indev;
@@ -63,7 +67,23 @@ int br_handle_frame_finish(struct sk_buff *skb)
dst = NULL;
- if (is_multicast_ether_addr(dest)) {
+#ifdef CONFIG_IEEE1905_1_FORWARD_ENTITY
+ if (skb->protocol == htons(ETH_P_1905)){
+ /* only send to upper layer(don't forward) if 1905.1 multicast address
+ * or local abstraction layer mac address.
+ * According to ieee1905.1 spec, neighbor multicast CMDU and unicast
+ * CMDU should not be forwarded.
+ */
+ if((!compare_ether_addr(br_p1905_multicast_address,dest)) ||
+ (!compare_ether_addr(br_get_not_forward_dest(),dest)) ||
+ ((dst = __br_fdb_get(br, dest)) && dst->is_local)){
+ skb2 = skb;
+ skb = NULL;
+ }
+ }
+ else
+#endif
+ if (is_multicast_ether_addr(dest)) {
br->statistics.multicast++;
skb2 = skb;
} else if ((dst = __br_fdb_get(br, dest)) && dst->is_local) {
diff --git a/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_ioctl.c b/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_ioctl.c
index 0655a5f07f..326af8668a 100644..100755
--- a/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_ioctl.c
+++ b/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_ioctl.c
@@ -22,6 +22,9 @@
#include <asm/uaccess.h>
#include "br_private.h"
+#ifdef CONFIG_IEEE1905_1_FORWARD_ENTITY
+unsigned char not_forward_dest[6]={0x0,0x0,0x0,0x0,0x0,0x0};
+#endif
/* called with RTNL */
static int get_bridge_ifindices(int *indices, int num)
{
@@ -83,6 +86,46 @@ static int get_fdb_entries(struct net_bridge *br, void __user *userbuf,
return num;
}
+#ifdef CONFIG_IEEE1905_1_FORWARD_ENTITY
+/*
+ * This function is for 1905.1 daemon use.
+ * for 1905.1 relay multicast message, daemon use this function to select
+ * correct interface to re-transmit message.
+ * for topology message, daemon use this function to record the
+ * receiving interface for topology used.
+ */
+static int get_received_port_addr(struct net_bridge *br, void __user *ruserbuf,
+ void __user *wuserbuf)
+{
+ unsigned char mac_addr[6];
+ struct net_bridge_fdb_entry *dst;
+
+ if(copy_from_user(mac_addr, wuserbuf, 6))
+ return -EFAULT;
+
+ if((dst = __br_fdb_get(br,mac_addr)) == NULL)
+ return -EFAULT;
+
+ if (copy_to_user(ruserbuf, dst->dst->dev->dev_addr,6))
+ return -EFAULT;
+
+ return 0;
+}
+
+/*
+ * This function is for 1905.1 daemon use.
+ * let bridge not forward 1905.1 multicast address and local abstraction layer
+ * mac address.
+ */
+static int set_not_forward_dest(struct net_bridge *br, void __user *userbuf)
+{
+ if(copy_from_user(not_forward_dest, userbuf, 6))
+ return -EFAULT;
+
+ return 0;
+}
+#endif
+
static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
{
struct net_device *dev;
@@ -306,6 +349,13 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
case BRCTL_GET_FDB_ENTRIES:
return get_fdb_entries(br, (void __user *)args[1],
args[2], args[3]);
+#ifdef CONFIG_IEEE1905_1_FORWARD_ENTITY
+ case BRCTL_GET_RECV_PORT_ADDR:
+ return get_received_port_addr(br, (void __user *)args[1],\
+ (void __user *)args[2]);
+ case BRCTL_SET_BRIDGE_NOT_FORWARD_DEST:
+ return set_not_forward_dest(br, (void __user *)args[1]);
+#endif
}
return -EOPNOTSUPP;
@@ -365,6 +415,18 @@ static int old_deviceless(void __user *uarg)
return -EOPNOTSUPP;
}
+#ifdef CONFIG_IEEE1905_1_FORWARD_ENTITY
+/*
+ * used in function br_handle_frame_finish.
+ * 1905.1 daemon set not forward mac address in user space, then kernel use
+ * it to handle forwarding rule.
+ */
+unsigned char *br_get_not_forward_dest(void)
+{
+ return &not_forward_dest[0];
+}
+#endif
+
int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd, void __user *uarg)
{
switch (cmd) {
diff --git a/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_private.h b/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_private.h
index c11b554fd1..1050fd7f6e 100644..100755
--- a/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_private.h
+++ b/cleopatre/linux-2.6.25.10-spc300/net/bridge/br_private.h
@@ -193,6 +193,9 @@ extern struct sk_buff *br_handle_frame(struct net_bridge_port *p,
/* br_ioctl.c */
extern int br_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
extern int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd, void __user *arg);
+#ifdef CONFIG_IEEE1905_1_FORWARD_ENTITY
+extern unsigned char *br_get_not_forward_dest(void);
+#endif
/* br_netfilter.c */
#ifdef CONFIG_BRIDGE_NETFILTER