From: Antonio Quartulli antonio@open-mesh.com
In order to make batman-adv fully vlan aware later, the semantic used for variables storing the VLAN ID values has to be changed in order to be adapted to the new one which will be used batman-adv wide.
In particular, the VID has to be an "_unsigned_ short int" and its 4 MSB will be used as a flag bitfield, while the remaining 12 bits are used to store the real VID value
Cc: Simon Wunderlich siwu@hrz.tu-chemnitz.de Signed-off-by: Antonio Quartulli antonio@open-mesh.com --- bridge_loop_avoidance.c | 87 +++++++++++++++++++++++++++---------------------- bridge_loop_avoidance.h | 12 ++++--- main.h | 3 ++ packet.h | 8 +++++ soft-interface.c | 4 +-- types.h | 4 +-- 6 files changed, 70 insertions(+), 48 deletions(-)
diff --git a/bridge_loop_avoidance.c b/bridge_loop_avoidance.c index 6a4f728..e0d716c 100644 --- a/bridge_loop_avoidance.c +++ b/bridge_loop_avoidance.c @@ -180,7 +180,7 @@ static struct batadv_bla_claim */ static struct batadv_bla_backbone_gw * batadv_backbone_hash_find(struct batadv_priv *bat_priv, - uint8_t *addr, short vid) + uint8_t *addr, unsigned short vid) { struct batadv_hashtable *hash = bat_priv->bla.backbone_hash; struct hlist_head *head; @@ -257,7 +257,7 @@ batadv_bla_del_backbone_claims(struct batadv_bla_backbone_gw *backbone_gw) * @claimtype: the type of the claim (CLAIM, UNCLAIM, ANNOUNCE, ...) */ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac, - short vid, int claimtype) + unsigned short vid, int claimtype) { struct sk_buff *skb; struct ethhdr *ethhdr; @@ -307,7 +307,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac, */ memcpy(ethhdr->h_source, mac, ETH_ALEN); batadv_dbg(BATADV_DBG_BLA, bat_priv, - "bla_send_claim(): CLAIM %pM on vid %d\n", mac, vid); + "bla_send_claim(): CLAIM %pM on vid %u\n", mac, vid); break; case BATADV_CLAIM_TYPE_UNCLAIM: /* unclaim frame @@ -315,7 +315,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac, */ memcpy(hw_src, mac, ETH_ALEN); batadv_dbg(BATADV_DBG_BLA, bat_priv, - "bla_send_claim(): UNCLAIM %pM on vid %d\n", mac, + "bla_send_claim(): UNCLAIM %pM on vid %u\n", mac, vid); break; case BATADV_CLAIM_TYPE_ANNOUNCE: @@ -324,7 +324,7 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac, */ memcpy(hw_src, mac, ETH_ALEN); batadv_dbg(BATADV_DBG_BLA, bat_priv, - "bla_send_claim(): ANNOUNCE of %pM on vid %d\n", + "bla_send_claim(): ANNOUNCE of %pM on vid %u\n", ethhdr->h_source, vid); break; case BATADV_CLAIM_TYPE_REQUEST: @@ -335,13 +335,13 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, uint8_t *mac, memcpy(hw_src, mac, ETH_ALEN); memcpy(ethhdr->h_dest, mac, ETH_ALEN); batadv_dbg(BATADV_DBG_BLA, bat_priv, - "bla_send_claim(): REQUEST of %pM to %pMon vid %d\n", + "bla_send_claim(): REQUEST of %pM to %pM on vid %u\n", ethhdr->h_source, ethhdr->h_dest, vid); break; }
- if (vid != -1) - skb = vlan_insert_tag(skb, vid); + if (vid & BATADV_VLAN_HAS_TAG) + skb = vlan_insert_tag(skb, vid & BATADV_VID_MASK);
skb_reset_mac_header(skb); skb->protocol = eth_type_trans(skb, soft_iface); @@ -367,7 +367,7 @@ out: */ static struct batadv_bla_backbone_gw * batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig, - short vid, bool own_backbone) + unsigned short vid, bool own_backbone) { struct batadv_bla_backbone_gw *entry; struct batadv_orig_node *orig_node; @@ -379,7 +379,7 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig, return entry;
batadv_dbg(BATADV_DBG_BLA, bat_priv, - "bla_get_backbone_gw(): not found (%pM, %d), creating new entry\n", + "bla_get_backbone_gw(): not found (%pM, %u), creating new entry\n", orig, vid);
entry = kzalloc(sizeof(*entry), GFP_ATOMIC); @@ -434,7 +434,7 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, uint8_t *orig, static void batadv_bla_update_own_backbone_gw(struct batadv_priv *bat_priv, struct batadv_hard_iface *primary_if, - short vid) + unsigned short vid) { struct batadv_bla_backbone_gw *backbone_gw;
@@ -456,7 +456,7 @@ batadv_bla_update_own_backbone_gw(struct batadv_priv *bat_priv, */ static void batadv_bla_answer_request(struct batadv_priv *bat_priv, struct batadv_hard_iface *primary_if, - short vid) + unsigned short vid) { struct hlist_head *head; struct batadv_hashtable *hash; @@ -547,7 +547,7 @@ static void batadv_bla_send_announce(struct batadv_priv *bat_priv, * @backbone_gw: the backbone gateway which claims it */ static void batadv_bla_add_claim(struct batadv_priv *bat_priv, - const uint8_t *mac, const short vid, + const uint8_t *mac, const unsigned short vid, struct batadv_bla_backbone_gw *backbone_gw) { struct batadv_bla_claim *claim; @@ -571,7 +571,7 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv,
atomic_set(&claim->refcount, 2); batadv_dbg(BATADV_DBG_BLA, bat_priv, - "bla_add_claim(): adding new entry %pM, vid %d to hash ...\n", + "bla_add_claim(): adding new entry %pM, vid %u to hash ...\n", mac, vid); hash_added = batadv_hash_add(bat_priv->bla.claim_hash, batadv_compare_claim, @@ -590,7 +590,7 @@ static void batadv_bla_add_claim(struct batadv_priv *bat_priv, goto claim_free_ref;
batadv_dbg(BATADV_DBG_BLA, bat_priv, - "bla_add_claim(): changing ownership for %pM, vid %d\n", + "bla_add_claim(): changing ownership for %pM, vid %u\n", mac, vid);
claim->backbone_gw->crc ^= crc16(0, claim->addr, ETH_ALEN); @@ -611,7 +611,7 @@ claim_free_ref: * given mac address and vid. */ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, - const uint8_t *mac, const short vid) + const uint8_t *mac, const unsigned short vid) { struct batadv_bla_claim search_claim, *claim;
@@ -621,7 +621,7 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, if (!claim) return;
- batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %d\n", + batadv_dbg(BATADV_DBG_BLA, bat_priv, "bla_del_claim(): %pM, vid %u\n", mac, vid);
batadv_hash_remove(bat_priv->bla.claim_hash, batadv_compare_claim, @@ -637,7 +637,7 @@ static void batadv_bla_del_claim(struct batadv_priv *bat_priv, /* check for ANNOUNCE frame, return 1 if handled */ static int batadv_handle_announce(struct batadv_priv *bat_priv, uint8_t *an_addr, uint8_t *backbone_addr, - short vid) + unsigned short vid) { struct batadv_bla_backbone_gw *backbone_gw; uint16_t crc; @@ -657,7 +657,7 @@ static int batadv_handle_announce(struct batadv_priv *bat_priv, crc = ntohs(*((__be16 *)(&an_addr[4])));
batadv_dbg(BATADV_DBG_BLA, bat_priv, - "handle_announce(): ANNOUNCE vid %d (sent by %pM)... CRC = %#.4x\n", + "handle_announce(): ANNOUNCE vid %u (sent by %pM)... CRC = %#.4x\n", vid, backbone_gw->orig, crc);
if (backbone_gw->crc != crc) { @@ -685,7 +685,7 @@ static int batadv_handle_announce(struct batadv_priv *bat_priv, static int batadv_handle_request(struct batadv_priv *bat_priv, struct batadv_hard_iface *primary_if, uint8_t *backbone_addr, - struct ethhdr *ethhdr, short vid) + struct ethhdr *ethhdr, unsigned short vid) { /* check for REQUEST frame */ if (!batadv_compare_eth(backbone_addr, ethhdr->h_dest)) @@ -698,7 +698,7 @@ static int batadv_handle_request(struct batadv_priv *bat_priv, return 1;
batadv_dbg(BATADV_DBG_BLA, bat_priv, - "handle_request(): REQUEST vid %d (sent by %pM)...\n", + "handle_request(): REQUEST vid %u (sent by %pM)...\n", vid, ethhdr->h_source);
batadv_bla_answer_request(bat_priv, primary_if, vid); @@ -709,7 +709,7 @@ static int batadv_handle_request(struct batadv_priv *bat_priv, static int batadv_handle_unclaim(struct batadv_priv *bat_priv, struct batadv_hard_iface *primary_if, uint8_t *backbone_addr, - uint8_t *claim_addr, short vid) + uint8_t *claim_addr, unsigned short vid) { struct batadv_bla_backbone_gw *backbone_gw;
@@ -726,7 +726,7 @@ static int batadv_handle_unclaim(struct batadv_priv *bat_priv,
/* this must be an UNCLAIM frame */ batadv_dbg(BATADV_DBG_BLA, bat_priv, - "handle_unclaim(): UNCLAIM %pM on vid %d (sent by %pM)...\n", + "handle_unclaim(): UNCLAIM %pM on vid %u (sent by %pM)...\n", claim_addr, vid, backbone_gw->orig);
batadv_bla_del_claim(bat_priv, claim_addr, vid); @@ -738,7 +738,7 @@ static int batadv_handle_unclaim(struct batadv_priv *bat_priv, static int batadv_handle_claim(struct batadv_priv *bat_priv, struct batadv_hard_iface *primary_if, uint8_t *backbone_addr, uint8_t *claim_addr, - short vid) + unsigned short vid) { struct batadv_bla_backbone_gw *backbone_gw;
@@ -861,7 +861,7 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, struct batadv_bla_claim_dst *bla_dst; uint16_t proto; int headlen; - short vid = -1; + unsigned short vid = BATADV_NO_FLAGS; int ret;
ethhdr = (struct ethhdr *)skb_mac_header(skb); @@ -869,6 +869,7 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, if (ntohs(ethhdr->h_proto) == ETH_P_8021Q) { vhdr = (struct vlan_ethhdr *)ethhdr; vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK; + vid |= BATADV_VLAN_HAS_TAG; proto = ntohs(vhdr->h_vlan_encapsulated_proto); headlen = sizeof(*vhdr); } else { @@ -909,8 +910,9 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, ethhdr); if (ret == 1) batadv_dbg(BATADV_DBG_BLA, bat_priv, - "bla_process_claim(): received a claim frame from another group. From: %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", - ethhdr->h_source, vid, hw_src, hw_dst); + "bla_process_claim(): received a claim frame from another group. From: %pM on vid %u ...(hw_src %pM, hw_dst %pM)\n", + ethhdr->h_source, vid, hw_src, + hw_dst);
if (ret < 2) return ret; @@ -944,7 +946,7 @@ static int batadv_bla_process_claim(struct batadv_priv *bat_priv, }
batadv_dbg(BATADV_DBG_BLA, bat_priv, - "bla_process_claim(): ERROR - this looks like a claim frame, but is useless. eth src %pM on vid %d ...(hw_src %pM, hw_dst %pM)\n", + "bla_process_claim(): ERROR - this looks like a claim frame, but is useless. eth src %pM on vid %u ...(hw_src %pM, hw_dst %pM)\n", ethhdr->h_source, vid, hw_src, hw_dst); return 1; } @@ -1033,7 +1035,7 @@ static void batadv_bla_purge_claims(struct batadv_priv *bat_priv, continue;
batadv_dbg(BATADV_DBG_BLA, bat_priv, - "bla_purge_claims(): %pM, vid %d, time out\n", + "bla_purge_claims(): %pM, vid %u, time out\n", claim->addr, claim->vid);
purge_now: @@ -1358,7 +1360,7 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb, struct ethhdr *ethhdr; struct vlan_ethhdr *vhdr; struct batadv_bla_backbone_gw *backbone_gw; - short vid = -1; + unsigned short vid = BATADV_NO_FLAGS;
if (!atomic_read(&orig_node->bat_priv->bridge_loop_avoidance)) return 0; @@ -1375,6 +1377,7 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb,
vhdr = (struct vlan_ethhdr *)(skb->data + hdr_size); vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK; + vid |= BATADV_VLAN_HAS_TAG; }
/* see if this originator is a backbone gw for this VLAN */ @@ -1424,8 +1427,8 @@ void batadv_bla_free(struct batadv_priv *bat_priv) * returns 1, otherwise it returns 0 and the caller shall further * process the skb. */ -int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid, - bool is_bcast) +int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, + unsigned short vid, bool is_bcast) { struct ethhdr *ethhdr; struct batadv_bla_claim search_claim, *claim = NULL; @@ -1519,7 +1522,8 @@ out: * returns 1, otherwise it returns 0 and the caller shall further * process the skb. */ -int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid) +int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, + unsigned short vid) { struct ethhdr *ethhdr; struct batadv_bla_claim search_claim, *claim = NULL; @@ -1623,9 +1627,11 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) hlist_for_each_entry_rcu(claim, head, hash_entry) { is_own = batadv_compare_eth(claim->backbone_gw->orig, primary_addr); - seq_printf(seq, " * %pM on % 5d by %pM [%c] (%#.4x)\n", - claim->addr, claim->vid, - claim->backbone_gw->orig, + seq_printf(seq, + " * %pM on %5u (tag: %3s) by %pM [%c] (%#.4x)\n", + claim->addr, claim->vid & BATADV_VID_MASK, + (claim->vid & BATADV_VLAN_HAS_TAG ? + "yes" : "no"), claim->backbone_gw->orig, (is_own ? 'x' : ' '), claim->backbone_gw->crc); } @@ -1677,9 +1683,12 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset) continue;
seq_printf(seq, - " * %pM on % 5d % 4i.%03is (%#.4x)\n", - backbone_gw->orig, backbone_gw->vid, - secs, msecs, backbone_gw->crc); + " * %pM on %5u (tag: %3s) % 4i.%03is (%#.4x)\n", + backbone_gw->orig, + backbone_gw->vid & BATADV_VID_MASK, + (backbone_gw->vid & BATADV_VLAN_HAS_TAG ? + "yes" : "no"), secs, msecs, + backbone_gw->crc); } rcu_read_unlock(); } diff --git a/bridge_loop_avoidance.h b/bridge_loop_avoidance.h index dea2fbc..4b102e7 100644 --- a/bridge_loop_avoidance.h +++ b/bridge_loop_avoidance.h @@ -21,9 +21,10 @@ #define _NET_BATMAN_ADV_BLA_H_
#ifdef CONFIG_BATMAN_ADV_BLA -int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid, - bool is_bcast); -int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, short vid); +int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb, + unsigned short vid, bool is_bcast); +int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, + unsigned short vid); int batadv_bla_is_backbone_gw(struct sk_buff *skb, struct batadv_orig_node *orig_node, int hdr_size); int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset); @@ -42,13 +43,14 @@ void batadv_bla_free(struct batadv_priv *bat_priv); #else /* ifdef CONFIG_BATMAN_ADV_BLA */
static inline int batadv_bla_rx(struct batadv_priv *bat_priv, - struct sk_buff *skb, short vid, bool is_bcast) + struct sk_buff *skb, unsigned short vid, + bool is_bcast) { return 0; }
static inline int batadv_bla_tx(struct batadv_priv *bat_priv, - struct sk_buff *skb, short vid) + struct sk_buff *skb, unsigned short vid) { return 0; } diff --git a/main.h b/main.h index 2c751c6..17821e1 100644 --- a/main.h +++ b/main.h @@ -136,6 +136,9 @@ enum batadv_uev_type { #define BATADV_DAT_CANDIDATE_NOT_FOUND 0 #define BATADV_DAT_CANDIDATE_ORIG 1
+/* mask needed to extract the vlan ID (12bits) from a 16bits variable */ +#define BATADV_VID_MASK 0x0FFF + /* Debug Messages */ #ifdef pr_fmt #undef pr_fmt diff --git a/packet.h b/packet.h index a51ccfc..d5464f6 100644 --- a/packet.h +++ b/packet.h @@ -105,6 +105,14 @@ enum batadv_tt_client_flags { BATADV_TT_CLIENT_PENDING = BIT(10), };
+/** + * batadv_vlan_flags - flags for the four MSB of any vlan ID field + * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not + */ +enum batadv_vlan_flags { + BATADV_VLAN_HAS_TAG = BIT(15), +}; + /* claim frame types for the bridge loop avoidance */ enum batadv_bla_claimframe { BATADV_CLAIM_TYPE_CLAIM = 0x00, diff --git a/soft-interface.c b/soft-interface.c index 403b8c4..34597a2 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -154,7 +154,7 @@ static int batadv_interface_tx(struct sk_buff *skb, 0x00, 0x00}; unsigned int header_len = 0; int data_len = skb->len, ret; - short vid __maybe_unused = -1; + unsigned short vid __maybe_unused = BATADV_NO_FLAGS; bool do_bcast = false; uint32_t seqno; unsigned long brd_delay = 1; @@ -303,7 +303,7 @@ void batadv_interface_rx(struct net_device *soft_iface, struct ethhdr *ethhdr; struct vlan_ethhdr *vhdr; struct batadv_header *batadv_header = (struct batadv_header *)skb->data; - short vid __maybe_unused = -1; + unsigned short vid __maybe_unused = BATADV_NO_FLAGS; __be16 ethertype = __constant_htons(ETH_P_BATMAN); bool is_bcast;
diff --git a/types.h b/types.h index 5f542bd..b2c94e1 100644 --- a/types.h +++ b/types.h @@ -642,7 +642,7 @@ struct batadv_socket_packet { #ifdef CONFIG_BATMAN_ADV_BLA struct batadv_bla_backbone_gw { uint8_t orig[ETH_ALEN]; - short vid; + unsigned short vid; struct hlist_node hash_entry; struct batadv_priv *bat_priv; unsigned long lasttime; @@ -665,7 +665,7 @@ struct batadv_bla_backbone_gw { */ struct batadv_bla_claim { uint8_t addr[ETH_ALEN]; - short vid; + unsigned short vid; struct batadv_bla_backbone_gw *backbone_gw; unsigned long lasttime; struct hlist_node hash_entry;
On Wed, Apr 03, 2013 at 11:17:14AM +0200, Antonio Quartulli wrote:
From: Antonio Quartulli antonio@open-mesh.com
In order to make batman-adv fully vlan aware later, the semantic used for variables storing the VLAN ID values has to be changed in order to be adapted to the new one which will be used batman-adv wide.
In particular, the VID has to be an "_unsigned_ short int" and its 4 MSB will be used as a flag bitfield, while the remaining 12 bits are used to store the real VID value
Cc: Simon Wunderlich siwu@hrz.tu-chemnitz.de Signed-off-by: Antonio Quartulli antonio@open-mesh.com
[cut..]
diff --git a/packet.h b/packet.h index a51ccfc..d5464f6 100644 --- a/packet.h +++ b/packet.h @@ -105,6 +105,14 @@ enum batadv_tt_client_flags { BATADV_TT_CLIENT_PENDING = BIT(10), };
+/**
- batadv_vlan_flags - flags for the four MSB of any vlan ID field
- @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not
- */
+enum batadv_vlan_flags {
- BATADV_VLAN_HAS_TAG = BIT(15),
+};
/* claim frame types for the bridge loop avoidance */ enum batadv_bla_claimframe { BATADV_CLAIM_TYPE_CLAIM = 0x00, diff --git a/soft-interface.c b/soft-interface.c index 403b8c4..34597a2 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -154,7 +154,7 @@ static int batadv_interface_tx(struct sk_buff *skb, 0x00, 0x00}; unsigned int header_len = 0; int data_len = skb->len, ret;
- short vid __maybe_unused = -1;
- unsigned short vid __maybe_unused = BATADV_NO_FLAGS; bool do_bcast = false; uint32_t seqno; unsigned long brd_delay = 1;
@@ -303,7 +303,7 @@ void batadv_interface_rx(struct net_device *soft_iface, struct ethhdr *ethhdr; struct vlan_ethhdr *vhdr; struct batadv_header *batadv_header = (struct batadv_header *)skb->data;
- short vid __maybe_unused = -1;
- unsigned short vid __maybe_unused = BATADV_NO_FLAGS; __be16 ethertype = __constant_htons(ETH_P_BATMAN); bool is_bcast;
I just realised that this change is going to break compatibility because we change the menaing of the value that BLA sends over the wire.
We must postpone this change to the next (BIG) compat bump.
Cheers,
Hey Antonio,
On Wed, Apr 03, 2013 at 11:23:59AM +0200, Antonio Quartulli wrote:
On Wed, Apr 03, 2013 at 11:17:14AM +0200, Antonio Quartulli wrote:
From: Antonio Quartulli antonio@open-mesh.com
In order to make batman-adv fully vlan aware later, the semantic used for variables storing the VLAN ID values has to be changed in order to be adapted to the new one which will be used batman-adv wide.
That is for the TT change later I guess? Was confused first, because batman-adv is already pretty VLAN aware ... maybe add this as a comment?
In particular, the VID has to be an "_unsigned_ short int" and its 4 MSB will be used as a flag bitfield, while the remaining 12 bits are used to store the real VID value
Cc: Simon Wunderlich siwu@hrz.tu-chemnitz.de Signed-off-by: Antonio Quartulli antonio@open-mesh.com
[cut..]
diff --git a/packet.h b/packet.h index a51ccfc..d5464f6 100644 --- a/packet.h +++ b/packet.h @@ -105,6 +105,14 @@ enum batadv_tt_client_flags { BATADV_TT_CLIENT_PENDING = BIT(10), };
+/**
- batadv_vlan_flags - flags for the four MSB of any vlan ID field
- @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not
- */
+enum batadv_vlan_flags {
- BATADV_VLAN_HAS_TAG = BIT(15),
+};
Please put this into main.h or somewhere else as long as it is not sent over the wire.
/* claim frame types for the bridge loop avoidance */ enum batadv_bla_claimframe { BATADV_CLAIM_TYPE_CLAIM = 0x00, diff --git a/soft-interface.c b/soft-interface.c index 403b8c4..34597a2 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -154,7 +154,7 @@ static int batadv_interface_tx(struct sk_buff *skb, 0x00, 0x00}; unsigned int header_len = 0; int data_len = skb->len, ret;
- short vid __maybe_unused = -1;
- unsigned short vid __maybe_unused = BATADV_NO_FLAGS; bool do_bcast = false; uint32_t seqno; unsigned long brd_delay = 1;
@@ -303,7 +303,7 @@ void batadv_interface_rx(struct net_device *soft_iface, struct ethhdr *ethhdr; struct vlan_ethhdr *vhdr; struct batadv_header *batadv_header = (struct batadv_header *)skb->data;
- short vid __maybe_unused = -1;
- unsigned short vid __maybe_unused = BATADV_NO_FLAGS; __be16 ethertype = __constant_htons(ETH_P_BATMAN); bool is_bcast;
I just realised that this change is going to break compatibility because we change the menaing of the value that BLA sends over the wire.
We must postpone this change to the next (BIG) compat bump.
Actually no, it just uses the VID internally, so this is not a problem. See: http://www.open-mesh.org/projects/batman-adv/wiki/Bridge-loop-avoidance-Prot...
If there is a VID, it will send the frame in the respective VLAN.
The patch looks fine in generally, I have no objections.
Cheers, Simon
Hi Simon,
thanks for reviewing this patch.
On Sun, Apr 07, 2013 at 04:20:53PM +0200, Simon Wunderlich wrote:
Hey Antonio,
On Wed, Apr 03, 2013 at 11:23:59AM +0200, Antonio Quartulli wrote:
On Wed, Apr 03, 2013 at 11:17:14AM +0200, Antonio Quartulli wrote:
From: Antonio Quartulli antonio@open-mesh.com
In order to make batman-adv fully vlan aware later, the semantic used for variables storing the VLAN ID values has to be changed in order to be adapted to the new one which will be used batman-adv wide.
That is for the TT change later I guess? Was confused first, because batman-adv is already pretty VLAN aware ... maybe add this as a comment?
well, the fact that it works does not make it aware, no? :) Actually batman-adv does not take any action and does not recognise the event of creating a new VLAN on top of it.
But from your comment I realise that "being aware" is probably not the correct term. So I will try to improve it.
In particular, the VID has to be an "_unsigned_ short int" and its 4 MSB will be used as a flag bitfield, while the remaining 12 bits are used to store the real VID value
Cc: Simon Wunderlich siwu@hrz.tu-chemnitz.de Signed-off-by: Antonio Quartulli antonio@open-mesh.com
[cut..]
diff --git a/packet.h b/packet.h index a51ccfc..d5464f6 100644 --- a/packet.h +++ b/packet.h @@ -105,6 +105,14 @@ enum batadv_tt_client_flags { BATADV_TT_CLIENT_PENDING = BIT(10), };
+/**
- batadv_vlan_flags - flags for the four MSB of any vlan ID field
- @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not
- */
+enum batadv_vlan_flags {
- BATADV_VLAN_HAS_TAG = BIT(15),
+};
Please put this into main.h or somewhere else as long as it is not sent over the wire.
Ok. I put it there because I'll be sending it over the wire later. But better putting it into main.h for now.
/* claim frame types for the bridge loop avoidance */ enum batadv_bla_claimframe { BATADV_CLAIM_TYPE_CLAIM = 0x00, diff --git a/soft-interface.c b/soft-interface.c index 403b8c4..34597a2 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -154,7 +154,7 @@ static int batadv_interface_tx(struct sk_buff *skb, 0x00, 0x00}; unsigned int header_len = 0; int data_len = skb->len, ret;
- short vid __maybe_unused = -1;
- unsigned short vid __maybe_unused = BATADV_NO_FLAGS; bool do_bcast = false; uint32_t seqno; unsigned long brd_delay = 1;
@@ -303,7 +303,7 @@ void batadv_interface_rx(struct net_device *soft_iface, struct ethhdr *ethhdr; struct vlan_ethhdr *vhdr; struct batadv_header *batadv_header = (struct batadv_header *)skb->data;
- short vid __maybe_unused = -1;
- unsigned short vid __maybe_unused = BATADV_NO_FLAGS; __be16 ethertype = __constant_htons(ETH_P_BATMAN); bool is_bcast;
I just realised that this change is going to break compatibility because we change the menaing of the value that BLA sends over the wire.
We must postpone this change to the next (BIG) compat bump.
Actually no, it just uses the VID internally, so this is not a problem. See: http://www.open-mesh.org/projects/batman-adv/wiki/Bridge-loop-avoidance-Prot...
If there is a VID, it will send the frame in the respective VLAN.
My bad, I looked at the patch stats and I misinterpreted _my own_ change to packet.h :)
The patch looks fine in generally, I have no objections.
Thanks a lot! I'll send v2.
Cheers,
b.a.t.m.a.n@lists.open-mesh.org