batman-adv: avoid skb_linearise() if not needed
[cascardo/linux.git] / net / batman-adv / packet.h
index 441f3db..0ee1af7 100644 (file)
@@ -25,7 +25,7 @@
 #define ETH_P_BATMAN  0x4305   /* unofficial/not registered Ethertype */
 
 enum bat_packettype {
-       BAT_OGM          = 0x01,
+       BAT_IV_OGM       = 0x01,
        BAT_ICMP         = 0x02,
        BAT_UNICAST      = 0x03,
        BAT_BCAST        = 0x04,
@@ -38,7 +38,8 @@ enum bat_packettype {
 /* this file is included by batctl which needs these defines */
 #define COMPAT_VERSION 14
 
-enum batman_flags {
+enum batman_iv_flags {
+       NOT_BEST_NEXT_HOP   = 1 << 3,
        PRIMARIES_FIRST_HOP = 1 << 4,
        VIS_SERVER          = 1 << 5,
        DIRECTLINK          = 1 << 6
@@ -90,6 +91,23 @@ enum tt_client_flags {
        TT_CLIENT_PENDING = 1 << 10
 };
 
+/* claim frame types for the bridge loop avoidance */
+enum bla_claimframe {
+       CLAIM_TYPE_ADD          = 0x00,
+       CLAIM_TYPE_DEL          = 0x01,
+       CLAIM_TYPE_ANNOUNCE     = 0x02,
+       CLAIM_TYPE_REQUEST      = 0x03
+};
+
+/* the destination hardware field in the ARP frame is used to
+ * transport the claim type and the group id
+ */
+struct bla_claim_dst {
+       uint8_t magic[3];       /* FF:43:05 */
+       uint8_t type;           /* bla_claimframe */
+       uint16_t group;         /* group id */
+} __packed;
+
 struct batman_header {
        uint8_t  packet_type;
        uint8_t  version;  /* batman version field */
@@ -100,8 +118,8 @@ struct batman_ogm_packet {
        struct batman_header header;
        uint8_t  flags;    /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */
        uint32_t seqno;
-       uint8_t  orig[6];
-       uint8_t  prev_sender[6];
+       uint8_t  orig[ETH_ALEN];
+       uint8_t  prev_sender[ETH_ALEN];
        uint8_t  gw_flags;  /* flags related to gateway class */
        uint8_t  tq;
        uint8_t  tt_num_changes;
@@ -109,13 +127,13 @@ struct batman_ogm_packet {
        uint16_t tt_crc;
 } __packed;
 
-#define BATMAN_OGM_LEN sizeof(struct batman_ogm_packet)
+#define BATMAN_OGM_HLEN sizeof(struct batman_ogm_packet)
 
 struct icmp_packet {
        struct batman_header header;
        uint8_t  msg_type; /* see ICMP message types above */
-       uint8_t  dst[6];
-       uint8_t  orig[6];
+       uint8_t  dst[ETH_ALEN];
+       uint8_t  orig[ETH_ALEN];
        uint16_t seqno;
        uint8_t  uid;
        uint8_t  reserved;
@@ -128,8 +146,8 @@ struct icmp_packet {
 struct icmp_packet_rr {
        struct batman_header header;
        uint8_t  msg_type; /* see ICMP message types above */
-       uint8_t  dst[6];
-       uint8_t  orig[6];
+       uint8_t  dst[ETH_ALEN];
+       uint8_t  orig[ETH_ALEN];
        uint16_t seqno;
        uint8_t  uid;
        uint8_t  rr_cur;
@@ -139,16 +157,16 @@ struct icmp_packet_rr {
 struct unicast_packet {
        struct batman_header header;
        uint8_t  ttvn; /* destination translation table version number */
-       uint8_t  dest[6];
+       uint8_t  dest[ETH_ALEN];
 } __packed;
 
 struct unicast_frag_packet {
        struct batman_header header;
        uint8_t  ttvn; /* destination translation table version number */
-       uint8_t  dest[6];
+       uint8_t  dest[ETH_ALEN];
        uint8_t  flags;
        uint8_t  align;
-       uint8_t  orig[6];
+       uint8_t  orig[ETH_ALEN];
        uint16_t seqno;
 } __packed;
 
@@ -156,7 +174,7 @@ struct bcast_packet {
        struct batman_header header;
        uint8_t  reserved;
        uint32_t seqno;
-       uint8_t  orig[6];
+       uint8_t  orig[ETH_ALEN];
 } __packed;
 
 struct vis_packet {
@@ -165,9 +183,9 @@ struct vis_packet {
        uint32_t seqno;          /* sequence number */
        uint8_t  entries;        /* number of entries behind this struct */
        uint8_t  reserved;
-       uint8_t  vis_orig[6];    /* originator that announces its neighbors */
-       uint8_t  target_orig[6]; /* who should receive this packet */
-       uint8_t  sender_orig[6]; /* who sent or rebroadcasted this packet */
+       uint8_t  vis_orig[ETH_ALEN];    /* originator reporting its neighbors */
+       uint8_t  target_orig[ETH_ALEN]; /* who should receive this packet */
+       uint8_t  sender_orig[ETH_ALEN]; /* who sent or forwarded this packet */
 } __packed;
 
 struct tt_query_packet {