]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
batman-adv: Prefix packet defines with BATADV_
authorSven Eckelmann <sven@narfation.org>
Sun, 3 Jun 2012 20:19:13 +0000 (22:19 +0200)
committerAntonio Quartulli <ordex@autistici.org>
Thu, 28 Jun 2012 06:45:00 +0000 (08:45 +0200)
Reported-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
net/batman-adv/bat_iv_ogm.c
net/batman-adv/hard-interface.c
net/batman-adv/icmp_socket.c
net/batman-adv/main.c
net/batman-adv/packet.h
net/batman-adv/routing.c
net/batman-adv/send.c
net/batman-adv/soft-interface.c
net/batman-adv/translation-table.c
net/batman-adv/unicast.c
net/batman-adv/vis.c

index ffe9d1d057c1a26336c303f8481ac9585d3b591c..245bb2d7647cb3a7069d5c7cbc24ce3cf8bcfb69 100644 (file)
@@ -64,7 +64,7 @@ static int batadv_iv_ogm_iface_enable(struct hard_iface *hard_iface)
        get_random_bytes(&random_seqno, sizeof(random_seqno));
        atomic_set(&hard_iface->seqno, random_seqno);
 
-       hard_iface->packet_len = BATMAN_OGM_HLEN;
+       hard_iface->packet_len = BATADV_OGM_HLEN;
        hard_iface->packet_buff = kmalloc(hard_iface->packet_len, GFP_ATOMIC);
 
        if (!hard_iface->packet_buff)
@@ -72,7 +72,7 @@ static int batadv_iv_ogm_iface_enable(struct hard_iface *hard_iface)
 
        batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
        batman_ogm_packet->header.packet_type = BAT_IV_OGM;
-       batman_ogm_packet->header.version = COMPAT_VERSION;
+       batman_ogm_packet->header.version = BATADV_COMPAT_VERSION;
        batman_ogm_packet->header.ttl = 2;
        batman_ogm_packet->flags = NO_FLAGS;
        batman_ogm_packet->tq = TQ_MAX_VALUE;
@@ -139,7 +139,7 @@ static int batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len,
 {
        int next_buff_pos = 0;
 
-       next_buff_pos += buff_pos + BATMAN_OGM_HLEN;
+       next_buff_pos += buff_pos + BATADV_OGM_HLEN;
        next_buff_pos += batadv_tt_len(tt_num_changes);
 
        return (next_buff_pos <= packet_len) &&
@@ -191,7 +191,7 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
                           batman_ogm_packet->ttvn, hard_iface->net_dev->name,
                           hard_iface->net_dev->dev_addr);
 
-               buff_pos += BATMAN_OGM_HLEN;
+               buff_pos += BATADV_OGM_HLEN;
                buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes);
                packet_num++;
                batman_ogm_packet = (struct batman_ogm_packet *)
@@ -561,7 +561,7 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
                batman_ogm_packet->flags &= ~DIRECTLINK;
 
        batadv_iv_ogm_queue_add(bat_priv, (unsigned char *)batman_ogm_packet,
-                               BATMAN_OGM_HLEN + batadv_tt_len(tt_num_changes),
+                               BATADV_OGM_HLEN + batadv_tt_len(tt_num_changes),
                                if_incoming, 0, batadv_iv_ogm_fwd_send_time());
 }
 
@@ -579,7 +579,7 @@ static void batadv_iv_ogm_schedule(struct hard_iface *hard_iface)
                tt_num_changes = batadv_tt_append_diff(bat_priv,
                                                       &hard_iface->packet_buff,
                                                       &hard_iface->packet_len,
-                                                      BATMAN_OGM_HLEN);
+                                                      BATADV_OGM_HLEN);
 
        batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
 
@@ -1025,7 +1025,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
        }
        rcu_read_unlock();
 
-       if (batman_ogm_packet->header.version != COMPAT_VERSION) {
+       if (batman_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
                batadv_dbg(DBG_BATMAN, bat_priv,
                           "Drop packet: incompatible batman version (%i)\n",
                           batman_ogm_packet->header.version);
@@ -1227,7 +1227,7 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
        unsigned char *tt_buff, *packet_buff;
        bool ret;
 
-       ret = batadv_check_management_packet(skb, if_incoming, BATMAN_OGM_HLEN);
+       ret = batadv_check_management_packet(skb, if_incoming, BATADV_OGM_HLEN);
        if (!ret)
                return NET_RX_DROP;
 
@@ -1248,12 +1248,12 @@ static int batadv_iv_ogm_receive(struct sk_buff *skb,
 
        /* unpack the aggregated packets and process them one by one */
        do {
-               tt_buff = packet_buff + buff_pos + BATMAN_OGM_HLEN;
+               tt_buff = packet_buff + buff_pos + BATADV_OGM_HLEN;
 
                batadv_iv_ogm_process(ethhdr, batman_ogm_packet, tt_buff,
                                      if_incoming);
 
-               buff_pos += BATMAN_OGM_HLEN;
+               buff_pos += BATADV_OGM_HLEN;
                buff_pos += batadv_tt_len(batman_ogm_packet->tt_num_changes);
 
                batman_ogm_packet = (struct batman_ogm_packet *)
index c1ba6e28a96c9df3d9a9d21cfdc33e7f60742d29..340108411c4dea1544b5d2f64266ea4eb02c8752 100644 (file)
@@ -263,6 +263,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
 {
        struct bat_priv *bat_priv;
        struct net_device *soft_iface;
+       __be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN);
        int ret;
 
        if (hard_iface->if_status != IF_NOT_IN_USE)
@@ -309,7 +310,7 @@ int batadv_hardif_enable_interface(struct hard_iface *hard_iface,
        hard_iface->if_status = IF_INACTIVE;
        batadv_orig_hash_add_if(hard_iface, bat_priv->num_ifaces);
 
-       hard_iface->batman_adv_ptype.type = __constant_htons(ETH_P_BATMAN);
+       hard_iface->batman_adv_ptype.type = ethertype;
        hard_iface->batman_adv_ptype.func = batadv_batman_skb_recv;
        hard_iface->batman_adv_ptype.dev = hard_iface->net_dev;
        dev_add_pack(&hard_iface->batman_adv_ptype);
index 4f45ca72fefc86b0a4629be2a11b60451455eefd..f2f578b1d9f0515f3d2350fd9898c4276ccfef59 100644 (file)
@@ -203,9 +203,9 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
 
        icmp_packet->uid = socket_client->index;
 
-       if (icmp_packet->header.version != COMPAT_VERSION) {
+       if (icmp_packet->header.version != BATADV_COMPAT_VERSION) {
                icmp_packet->msg_type = PARAMETER_PROBLEM;
-               icmp_packet->header.version = COMPAT_VERSION;
+               icmp_packet->header.version = BATADV_COMPAT_VERSION;
                batadv_socket_add_packet(socket_client, icmp_packet,
                                         packet_len);
                goto free_skb;
index 9cf0b38fab8be21cdf022d3dc74c78bda5150927..986be72b51440dfb2c7087ee31fa0b40fd07fb05 100644 (file)
@@ -72,7 +72,7 @@ static int __init batadv_init(void)
        register_netdevice_notifier(&batadv_hard_if_notifier);
 
        pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i) loaded\n",
-               SOURCE_VERSION, COMPAT_VERSION);
+               SOURCE_VERSION, BATADV_COMPAT_VERSION);
 
        return 0;
 }
@@ -238,7 +238,7 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
 
        batman_ogm_packet = (struct batman_ogm_packet *)skb->data;
 
-       if (batman_ogm_packet->header.version != COMPAT_VERSION) {
+       if (batman_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
                batadv_dbg(DBG_BATMAN, bat_priv,
                           "Drop packet: incompatible batman version (%i)\n",
                           batman_ogm_packet->header.version);
index c90219cd648e710945cc0e9f4221c64697128ec3..e562414c29400cc91cdd457e7336bbb3de81a256 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef _NET_BATMAN_ADV_PACKET_H_
 #define _NET_BATMAN_ADV_PACKET_H_
 
-#define ETH_P_BATMAN  0x4305   /* unofficial/not registered Ethertype */
+#define BATADV_ETH_P_BATMAN  0x4305 /* unofficial/not registered Ethertype */
 
 enum bat_packettype {
        BAT_IV_OGM       = 0x01,
@@ -34,7 +34,7 @@ enum bat_packettype {
 };
 
 /* this file is included by batctl which needs these defines */
-#define COMPAT_VERSION 14
+#define BATADV_COMPAT_VERSION 14
 
 enum batman_iv_flags {
        NOT_BEST_NEXT_HOP   = 1 << 3,
@@ -65,7 +65,7 @@ enum unicast_frag_flags {
 };
 
 /* TT_QUERY subtypes */
-#define TT_QUERY_TYPE_MASK 0x3
+#define BATADV_TT_QUERY_TYPE_MASK 0x3
 
 enum tt_query_packettype {
        TT_REQUEST    = 0,
@@ -126,7 +126,7 @@ struct batman_ogm_packet {
        __be16   tt_crc;
 } __packed;
 
-#define BATMAN_OGM_HLEN sizeof(struct batman_ogm_packet)
+#define BATADV_OGM_HLEN sizeof(struct batman_ogm_packet)
 
 struct icmp_packet {
        struct batman_header header;
@@ -138,7 +138,7 @@ struct icmp_packet {
        uint8_t  reserved;
 } __packed;
 
-#define BAT_RR_LEN 16
+#define BATADV_RR_LEN 16
 
 /* icmp_packet_rr must start with all fields from imcp_packet
  * as this is assumed by code that handles ICMP packets
@@ -151,7 +151,7 @@ struct icmp_packet_rr {
        __be16   seqno;
        uint8_t  uid;
        uint8_t  rr_cur;
-       uint8_t  rr[BAT_RR_LEN][ETH_ALEN];
+       uint8_t  rr[BATADV_RR_LEN][ETH_ALEN];
 } __packed;
 
 struct unicast_packet {
index 864692add8081351a037e5b8b3ae5c027597758f..c8fee749eab8e7ac5d54dda42a0ce193921a0de0 100644 (file)
@@ -423,7 +423,7 @@ int batadv_recv_icmp_packet(struct sk_buff *skb, struct hard_iface *recv_if)
 
        /* add record route information if not full */
        if ((hdr_size == sizeof(struct icmp_packet_rr)) &&
-           (icmp_packet->rr_cur < BAT_RR_LEN)) {
+           (icmp_packet->rr_cur < BATADV_RR_LEN)) {
                memcpy(&(icmp_packet->rr[icmp_packet->rr_cur]),
                       ethhdr->h_dest, ETH_ALEN);
                icmp_packet->rr_cur++;
@@ -603,7 +603,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
 
        tt_query = (struct tt_query_packet *)skb->data;
 
-       switch (tt_query->flags & TT_QUERY_TYPE_MASK) {
+       switch (tt_query->flags & BATADV_TT_QUERY_TYPE_MASK) {
        case TT_REQUEST:
                batadv_inc_counter(bat_priv, BAT_CNT_TT_REQUEST_RX);
 
index 3d725e0b1d90450ef0187e689429ddbfc5fd6f08..72542cb01662b1a58470bad75e5ca0692c14ec23 100644 (file)
@@ -58,11 +58,11 @@ int batadv_send_skb_packet(struct sk_buff *skb, struct hard_iface *hard_iface,
        ethhdr = (struct ethhdr *)skb_mac_header(skb);
        memcpy(ethhdr->h_source, hard_iface->net_dev->dev_addr, ETH_ALEN);
        memcpy(ethhdr->h_dest, dst_addr, ETH_ALEN);
-       ethhdr->h_proto = __constant_htons(ETH_P_BATMAN);
+       ethhdr->h_proto = __constant_htons(BATADV_ETH_P_BATMAN);
 
        skb_set_network_header(skb, ETH_HLEN);
        skb->priority = TC_PRIO_CONTROL;
-       skb->protocol = __constant_htons(ETH_P_BATMAN);
+       skb->protocol = __constant_htons(BATADV_ETH_P_BATMAN);
 
        skb->dev = hard_iface->net_dev;
 
index 2de1d742119f026cc5e915813a4c2390b59db951..e726419045e4b3091e27cecffcef18055419affc 100644 (file)
@@ -135,6 +135,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
        struct hard_iface *primary_if = NULL;
        struct bcast_packet *bcast_packet;
        struct vlan_ethhdr *vhdr;
+       __be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN);
        static const uint8_t stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00, 0x00,
                                                   0x00};
        unsigned int header_len = 0;
@@ -152,11 +153,11 @@ static int batadv_interface_tx(struct sk_buff *skb,
                vhdr = (struct vlan_ethhdr *)skb->data;
                vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK;
 
-               if (ntohs(vhdr->h_vlan_encapsulated_proto) != ETH_P_BATMAN)
+               if (vhdr->h_vlan_encapsulated_proto != ethertype)
                        break;
 
                /* fall through */
-       case ETH_P_BATMAN:
+       case BATADV_ETH_P_BATMAN:
                goto dropped;
        }
 
@@ -208,7 +209,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
                        goto dropped;
 
                bcast_packet = (struct bcast_packet *)skb->data;
-               bcast_packet->header.version = COMPAT_VERSION;
+               bcast_packet->header.version = BATADV_COMPAT_VERSION;
                bcast_packet->header.ttl = TTL;
 
                /* batman packet type: broadcast */
@@ -266,6 +267,7 @@ void batadv_interface_rx(struct net_device *soft_iface,
        struct ethhdr *ethhdr;
        struct vlan_ethhdr *vhdr;
        short vid __maybe_unused = -1;
+       __be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN);
 
        /* check if enough space is available for pulling, and pull */
        if (!pskb_may_pull(skb, hdr_size))
@@ -281,11 +283,11 @@ void batadv_interface_rx(struct net_device *soft_iface,
                vhdr = (struct vlan_ethhdr *)skb->data;
                vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK;
 
-               if (ntohs(vhdr->h_vlan_encapsulated_proto) != ETH_P_BATMAN)
+               if (vhdr->h_vlan_encapsulated_proto != ethertype)
                        break;
 
                /* fall through */
-       case ETH_P_BATMAN:
+       case BATADV_ETH_P_BATMAN:
                goto dropped;
        }
 
index 3ca2e48d669e7f852e84aa5b07c8319c9dbba10d..79cd3f76a86544b2e95eebac61cc24e4773531bd 100644 (file)
@@ -1441,7 +1441,7 @@ static int batadv_send_tt_request(struct bat_priv *bat_priv,
                                sizeof(struct tt_query_packet));
 
        tt_request->header.packet_type = BAT_TT_QUERY;
-       tt_request->header.version = COMPAT_VERSION;
+       tt_request->header.version = BATADV_COMPAT_VERSION;
        memcpy(tt_request->src, primary_if->net_dev->dev_addr, ETH_ALEN);
        memcpy(tt_request->dst, dst_orig_node->orig, ETH_ALEN);
        tt_request->header.ttl = TTL;
@@ -1575,7 +1575,7 @@ static bool batadv_send_other_tt_response(struct bat_priv *bat_priv,
        }
 
        tt_response->header.packet_type = BAT_TT_QUERY;
-       tt_response->header.version = COMPAT_VERSION;
+       tt_response->header.version = BATADV_COMPAT_VERSION;
        tt_response->header.ttl = TTL;
        memcpy(tt_response->src, req_dst_orig_node->orig, ETH_ALEN);
        memcpy(tt_response->dst, tt_request->src, ETH_ALEN);
@@ -1696,7 +1696,7 @@ static bool batadv_send_my_tt_response(struct bat_priv *bat_priv,
        }
 
        tt_response->header.packet_type = BAT_TT_QUERY;
-       tt_response->header.version = COMPAT_VERSION;
+       tt_response->header.version = BATADV_COMPAT_VERSION;
        tt_response->header.ttl = TTL;
        memcpy(tt_response->src, primary_if->net_dev->dev_addr, ETH_ALEN);
        memcpy(tt_response->dst, tt_request->src, ETH_ALEN);
@@ -2008,7 +2008,7 @@ static void batadv_send_roam_adv(struct bat_priv *bat_priv, uint8_t *client,
                                        sizeof(struct roam_adv_packet));
 
        roam_adv_packet->header.packet_type = BAT_ROAM_ADV;
-       roam_adv_packet->header.version = COMPAT_VERSION;
+       roam_adv_packet->header.version = BATADV_COMPAT_VERSION;
        roam_adv_packet->header.ttl = TTL;
        primary_if = batadv_primary_if_get_selected(bat_priv);
        if (!primary_if)
index 472436a06d89c5043a8f3739e81325d2a9ea2561..c8da6b0acc38114f740984308cdcc42ae6145534 100644 (file)
@@ -253,7 +253,7 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
        memcpy(frag1, &tmp_uc, sizeof(tmp_uc));
 
        frag1->header.ttl--;
-       frag1->header.version = COMPAT_VERSION;
+       frag1->header.version = BATADV_COMPAT_VERSION;
        frag1->header.packet_type = BAT_UNICAST_FRAG;
 
        memcpy(frag1->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
@@ -319,7 +319,7 @@ find_router:
 
        unicast_packet = (struct unicast_packet *)skb->data;
 
-       unicast_packet->header.version = COMPAT_VERSION;
+       unicast_packet->header.version = BATADV_COMPAT_VERSION;
        /* batman packet type: unicast */
        unicast_packet->header.packet_type = BAT_UNICAST;
        /* set unicast ttl */
index 7dc750670c3477544301d19846ec2b0c2064f38e..596eacc3dd1c8adb10b78a6fa6da7215f8600867 100644 (file)
@@ -873,7 +873,7 @@ int batadv_vis_init(struct bat_priv *bat_priv)
        INIT_LIST_HEAD(&bat_priv->my_vis_info->send_list);
        kref_init(&bat_priv->my_vis_info->refcount);
        bat_priv->my_vis_info->bat_priv = bat_priv;
-       packet->header.version = COMPAT_VERSION;
+       packet->header.version = BATADV_COMPAT_VERSION;
        packet->header.packet_type = BAT_VIS;
        packet->header.ttl = TTL;
        packet->seqno = 0;