Commit acd34afa authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Antonio Quartulli

batman-adv: Prefix packet enum with BATADV_

Reported-by: default avatarMartin Hundebøll <martin@hundeboll.net>
Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
parent d69909d2
...@@ -71,7 +71,7 @@ static int batadv_iv_ogm_iface_enable(struct hard_iface *hard_iface) ...@@ -71,7 +71,7 @@ static int batadv_iv_ogm_iface_enable(struct hard_iface *hard_iface)
goto out; goto out;
batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff; batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
batman_ogm_packet->header.packet_type = BAT_IV_OGM; batman_ogm_packet->header.packet_type = BATADV_IV_OGM;
batman_ogm_packet->header.version = BATADV_COMPAT_VERSION; batman_ogm_packet->header.version = BATADV_COMPAT_VERSION;
batman_ogm_packet->header.ttl = 2; batman_ogm_packet->header.ttl = 2;
batman_ogm_packet->flags = BATADV_NO_FLAGS; batman_ogm_packet->flags = BATADV_NO_FLAGS;
...@@ -107,7 +107,7 @@ static void batadv_iv_ogm_primary_iface_set(struct hard_iface *hard_iface) ...@@ -107,7 +107,7 @@ static void batadv_iv_ogm_primary_iface_set(struct hard_iface *hard_iface)
struct batman_ogm_packet *batman_ogm_packet; struct batman_ogm_packet *batman_ogm_packet;
batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff; batman_ogm_packet = (struct batman_ogm_packet *)hard_iface->packet_buff;
batman_ogm_packet->flags = PRIMARIES_FIRST_HOP; batman_ogm_packet->flags = BATADV_PRIMARIES_FIRST_HOP;
batman_ogm_packet->header.ttl = BATADV_TTL; batman_ogm_packet->header.ttl = BATADV_TTL;
} }
...@@ -181,9 +181,9 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet, ...@@ -181,9 +181,9 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
*/ */
if ((forw_packet->direct_link_flags & (1 << packet_num)) && if ((forw_packet->direct_link_flags & (1 << packet_num)) &&
(forw_packet->if_incoming == hard_iface)) (forw_packet->if_incoming == hard_iface))
batman_ogm_packet->flags |= DIRECTLINK; batman_ogm_packet->flags |= BATADV_DIRECTLINK;
else else
batman_ogm_packet->flags &= ~DIRECTLINK; batman_ogm_packet->flags &= ~BATADV_DIRECTLINK;
fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ? fwd_str = (packet_num > 0 ? "Forwarding" : (forw_packet->own ?
"Sending own" : "Sending own" :
...@@ -194,7 +194,7 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet, ...@@ -194,7 +194,7 @@ static void batadv_iv_ogm_send_to_if(struct forw_packet *forw_packet,
batman_ogm_packet->orig, batman_ogm_packet->orig,
ntohl(batman_ogm_packet->seqno), ntohl(batman_ogm_packet->seqno),
batman_ogm_packet->tq, batman_ogm_packet->header.ttl, batman_ogm_packet->tq, batman_ogm_packet->header.ttl,
(batman_ogm_packet->flags & DIRECTLINK ? (batman_ogm_packet->flags & BATADV_DIRECTLINK ?
"on" : "off"), "on" : "off"),
batman_ogm_packet->ttvn, hard_iface->net_dev->name, batman_ogm_packet->ttvn, hard_iface->net_dev->name,
hard_iface->net_dev->dev_addr); hard_iface->net_dev->dev_addr);
...@@ -228,7 +228,7 @@ static void batadv_iv_ogm_emit(struct forw_packet *forw_packet) ...@@ -228,7 +228,7 @@ static void batadv_iv_ogm_emit(struct forw_packet *forw_packet)
batman_ogm_packet = (struct batman_ogm_packet *) batman_ogm_packet = (struct batman_ogm_packet *)
(forw_packet->skb->data); (forw_packet->skb->data);
directlink = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0); directlink = (batman_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0);
if (!forw_packet->if_incoming) { if (!forw_packet->if_incoming) {
pr_err("Error - can't forward packet: incoming iface not specified\n"); pr_err("Error - can't forward packet: incoming iface not specified\n");
...@@ -330,7 +330,7 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet, ...@@ -330,7 +330,7 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet,
* are flooded through the net * are flooded through the net
*/ */
if ((!directlink) && if ((!directlink) &&
(!(batman_ogm_packet->flags & DIRECTLINK)) && (!(batman_ogm_packet->flags & BATADV_DIRECTLINK)) &&
(batman_ogm_packet->header.ttl != 1) && (batman_ogm_packet->header.ttl != 1) &&
/* own packets originating non-primary /* own packets originating non-primary
...@@ -353,7 +353,7 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet, ...@@ -353,7 +353,7 @@ batadv_iv_ogm_can_aggregate(const struct batman_ogm_packet *new_bat_ogm_packet,
* own secondary interface packets * own secondary interface packets
* (= secondary interface packets in general) * (= secondary interface packets in general)
*/ */
(batman_ogm_packet->flags & DIRECTLINK || (batman_ogm_packet->flags & BATADV_DIRECTLINK ||
(forw_packet->own && (forw_packet->own &&
forw_packet->if_incoming != primary_if))) { forw_packet->if_incoming != primary_if))) {
res = true; res = true;
...@@ -480,7 +480,7 @@ static void batadv_iv_ogm_queue_add(struct bat_priv *bat_priv, ...@@ -480,7 +480,7 @@ static void batadv_iv_ogm_queue_add(struct bat_priv *bat_priv,
unsigned long max_aggregation_jiffies; unsigned long max_aggregation_jiffies;
batman_ogm_packet = (struct batman_ogm_packet *)packet_buff; batman_ogm_packet = (struct batman_ogm_packet *)packet_buff;
direct_link = batman_ogm_packet->flags & DIRECTLINK ? 1 : 0; direct_link = batman_ogm_packet->flags & BATADV_DIRECTLINK ? 1 : 0;
max_aggregation_jiffies = msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS); max_aggregation_jiffies = msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS);
/* find position for the packet in the forward queue */ /* find position for the packet in the forward queue */
...@@ -547,7 +547,7 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node, ...@@ -547,7 +547,7 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
* simply drop the ogm. * simply drop the ogm.
*/ */
if (is_single_hop_neigh) if (is_single_hop_neigh)
batman_ogm_packet->flags |= NOT_BEST_NEXT_HOP; batman_ogm_packet->flags |= BATADV_NOT_BEST_NEXT_HOP;
else else
return; return;
} }
...@@ -566,11 +566,11 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node, ...@@ -566,11 +566,11 @@ static void batadv_iv_ogm_forward(struct orig_node *orig_node,
batman_ogm_packet->tq, batman_ogm_packet->header.ttl); batman_ogm_packet->tq, batman_ogm_packet->header.ttl);
/* switch of primaries first hop flag when forwarding */ /* switch of primaries first hop flag when forwarding */
batman_ogm_packet->flags &= ~PRIMARIES_FIRST_HOP; batman_ogm_packet->flags &= ~BATADV_PRIMARIES_FIRST_HOP;
if (is_single_hop_neigh) if (is_single_hop_neigh)
batman_ogm_packet->flags |= DIRECTLINK; batman_ogm_packet->flags |= BATADV_DIRECTLINK;
else else
batman_ogm_packet->flags &= ~DIRECTLINK; batman_ogm_packet->flags &= ~BATADV_DIRECTLINK;
batadv_iv_ogm_queue_add(bat_priv, (unsigned char *)batman_ogm_packet, batadv_iv_ogm_queue_add(bat_priv, (unsigned char *)batman_ogm_packet,
BATADV_OGM_HLEN + batadv_tt_len(tt_num_changes), BATADV_OGM_HLEN + batadv_tt_len(tt_num_changes),
...@@ -605,10 +605,10 @@ static void batadv_iv_ogm_schedule(struct hard_iface *hard_iface) ...@@ -605,10 +605,10 @@ static void batadv_iv_ogm_schedule(struct hard_iface *hard_iface)
if (tt_num_changes >= 0) if (tt_num_changes >= 0)
batman_ogm_packet->tt_num_changes = tt_num_changes; batman_ogm_packet->tt_num_changes = tt_num_changes;
if (vis_server == VIS_TYPE_SERVER_SYNC) if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC)
batman_ogm_packet->flags |= VIS_SERVER; batman_ogm_packet->flags |= BATADV_VIS_SERVER;
else else
batman_ogm_packet->flags &= ~VIS_SERVER; batman_ogm_packet->flags &= ~BATADV_VIS_SERVER;
if ((hard_iface == primary_if) && if ((hard_iface == primary_if) &&
(atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER)) (atomic_read(&bat_priv->gw_mode) == BATADV_GW_MODE_SERVER))
...@@ -746,7 +746,7 @@ batadv_iv_ogm_orig_update(struct bat_priv *bat_priv, ...@@ -746,7 +746,7 @@ batadv_iv_ogm_orig_update(struct bat_priv *bat_priv,
*/ */
if (((batman_ogm_packet->orig != ethhdr->h_source) && if (((batman_ogm_packet->orig != ethhdr->h_source) &&
(batman_ogm_packet->header.ttl > 2)) || (batman_ogm_packet->header.ttl > 2)) ||
(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP)) (batman_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP))
batadv_tt_update_orig(bat_priv, orig_node, tt_buff, batadv_tt_update_orig(bat_priv, orig_node, tt_buff,
batman_ogm_packet->tt_num_changes, batman_ogm_packet->tt_num_changes,
batman_ogm_packet->ttvn, batman_ogm_packet->ttvn,
...@@ -993,13 +993,16 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, ...@@ -993,13 +993,16 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
* packet in an aggregation. Here we expect that the padding * packet in an aggregation. Here we expect that the padding
* is always zero (or not 0x01) * is always zero (or not 0x01)
*/ */
if (batman_ogm_packet->header.packet_type != BAT_IV_OGM) if (batman_ogm_packet->header.packet_type != BATADV_IV_OGM)
return; return;
/* could be changed by schedule_own_packet() */ /* could be changed by schedule_own_packet() */
if_incoming_seqno = atomic_read(&if_incoming->seqno); if_incoming_seqno = atomic_read(&if_incoming->seqno);
has_directlink_flag = (batman_ogm_packet->flags & DIRECTLINK ? 1 : 0); if (batman_ogm_packet->flags & BATADV_DIRECTLINK)
has_directlink_flag = 1;
else
has_directlink_flag = 0;
if (batadv_compare_eth(ethhdr->h_source, batman_ogm_packet->orig)) if (batadv_compare_eth(ethhdr->h_source, batman_ogm_packet->orig))
is_single_hop_neigh = true; is_single_hop_neigh = true;
...@@ -1107,7 +1110,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, ...@@ -1107,7 +1110,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
return; return;
} }
if (batman_ogm_packet->flags & NOT_BEST_NEXT_HOP) { if (batman_ogm_packet->flags & BATADV_NOT_BEST_NEXT_HOP) {
batadv_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"Drop packet: ignoring all packets not forwarded from the best next hop (sender: %pM)\n", "Drop packet: ignoring all packets not forwarded from the best next hop (sender: %pM)\n",
ethhdr->h_source); ethhdr->h_source);
...@@ -1299,7 +1302,8 @@ int __init batadv_iv_init(void) ...@@ -1299,7 +1302,8 @@ int __init batadv_iv_init(void)
int ret; int ret;
/* batman originator packet */ /* batman originator packet */
ret = batadv_recv_handler_register(BAT_IV_OGM, batadv_iv_ogm_receive); ret = batadv_recv_handler_register(BATADV_IV_OGM,
batadv_iv_ogm_receive);
if (ret < 0) if (ret < 0)
goto out; goto out;
...@@ -1310,7 +1314,7 @@ int __init batadv_iv_init(void) ...@@ -1310,7 +1314,7 @@ int __init batadv_iv_init(void)
goto out; goto out;
handler_unregister: handler_unregister:
batadv_recv_handler_unregister(BAT_IV_OGM); batadv_recv_handler_unregister(BATADV_IV_OGM);
out: out:
return ret; return ret;
} }
...@@ -283,10 +283,14 @@ static ssize_t batadv_show_vis_mode(struct kobject *kobj, ...@@ -283,10 +283,14 @@ static ssize_t batadv_show_vis_mode(struct kobject *kobj,
{ {
struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj); struct bat_priv *bat_priv = batadv_kobj_to_batpriv(kobj);
int vis_mode = atomic_read(&bat_priv->vis_mode); int vis_mode = atomic_read(&bat_priv->vis_mode);
const char *mode;
return sprintf(buff, "%s\n", if (vis_mode == BATADV_VIS_TYPE_CLIENT_UPDATE)
vis_mode == VIS_TYPE_CLIENT_UPDATE ? mode = "client";
"client" : "server"); else
mode = "server";
return sprintf(buff, "%s\n", mode);
} }
static ssize_t batadv_store_vis_mode(struct kobject *kobj, static ssize_t batadv_store_vis_mode(struct kobject *kobj,
...@@ -301,14 +305,16 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj, ...@@ -301,14 +305,16 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj,
ret = kstrtoul(buff, 10, &val); ret = kstrtoul(buff, 10, &val);
if (((count == 2) && (!ret) && (val == VIS_TYPE_CLIENT_UPDATE)) || if (((count == 2) && (!ret) &&
(val == BATADV_VIS_TYPE_CLIENT_UPDATE)) ||
(strncmp(buff, "client", 6) == 0) || (strncmp(buff, "client", 6) == 0) ||
(strncmp(buff, "off", 3) == 0)) (strncmp(buff, "off", 3) == 0))
vis_mode_tmp = VIS_TYPE_CLIENT_UPDATE; vis_mode_tmp = BATADV_VIS_TYPE_CLIENT_UPDATE;
if (((count == 2) && (!ret) && (val == VIS_TYPE_SERVER_SYNC)) || if (((count == 2) && (!ret) &&
(val == BATADV_VIS_TYPE_SERVER_SYNC)) ||
(strncmp(buff, "server", 6) == 0)) (strncmp(buff, "server", 6) == 0))
vis_mode_tmp = VIS_TYPE_SERVER_SYNC; vis_mode_tmp = BATADV_VIS_TYPE_SERVER_SYNC;
if (vis_mode_tmp < 0) { if (vis_mode_tmp < 0) {
if (buff[count - 1] == '\n') if (buff[count - 1] == '\n')
...@@ -323,12 +329,12 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj, ...@@ -323,12 +329,12 @@ static ssize_t batadv_store_vis_mode(struct kobject *kobj,
if (atomic_read(&bat_priv->vis_mode) == vis_mode_tmp) if (atomic_read(&bat_priv->vis_mode) == vis_mode_tmp)
return count; return count;
if (atomic_read(&bat_priv->vis_mode) == VIS_TYPE_CLIENT_UPDATE) if (atomic_read(&bat_priv->vis_mode) == BATADV_VIS_TYPE_CLIENT_UPDATE)
old_mode = "client"; old_mode = "client";
else else
old_mode = "server"; old_mode = "server";
if (vis_mode_tmp == VIS_TYPE_CLIENT_UPDATE) if (vis_mode_tmp == BATADV_VIS_TYPE_CLIENT_UPDATE)
new_mode = "client"; new_mode = "client";
else else
new_mode = "server"; new_mode = "server";
......
...@@ -292,7 +292,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, ...@@ -292,7 +292,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
/* now we pretend that the client would have sent this ... */ /* now we pretend that the client would have sent this ... */
switch (claimtype) { switch (claimtype) {
case CLAIM_TYPE_ADD: case BATADV_CLAIM_TYPE_ADD:
/* normal claim frame /* normal claim frame
* set Ethernet SRC to the clients mac * set Ethernet SRC to the clients mac
*/ */
...@@ -300,7 +300,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, ...@@ -300,7 +300,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
batadv_dbg(DBG_BLA, bat_priv, batadv_dbg(DBG_BLA, bat_priv,
"bla_send_claim(): CLAIM %pM on vid %d\n", mac, vid); "bla_send_claim(): CLAIM %pM on vid %d\n", mac, vid);
break; break;
case CLAIM_TYPE_DEL: case BATADV_CLAIM_TYPE_DEL:
/* unclaim frame /* unclaim frame
* set HW SRC to the clients mac * set HW SRC to the clients mac
*/ */
...@@ -309,7 +309,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, ...@@ -309,7 +309,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
"bla_send_claim(): UNCLAIM %pM on vid %d\n", mac, "bla_send_claim(): UNCLAIM %pM on vid %d\n", mac,
vid); vid);
break; break;
case CLAIM_TYPE_ANNOUNCE: case BATADV_CLAIM_TYPE_ANNOUNCE:
/* announcement frame /* announcement frame
* set HW SRC to the special mac containg the crc * set HW SRC to the special mac containg the crc
*/ */
...@@ -318,7 +318,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac, ...@@ -318,7 +318,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
"bla_send_claim(): ANNOUNCE of %pM on vid %d\n", "bla_send_claim(): ANNOUNCE of %pM on vid %d\n",
ethhdr->h_source, vid); ethhdr->h_source, vid);
break; break;
case CLAIM_TYPE_REQUEST: case BATADV_CLAIM_TYPE_REQUEST:
/* request frame /* request frame
* set HW SRC to the special mac containg the crc * set HW SRC to the special mac containg the crc
*/ */
...@@ -459,7 +459,7 @@ static void batadv_bla_answer_request(struct bat_priv *bat_priv, ...@@ -459,7 +459,7 @@ static void batadv_bla_answer_request(struct bat_priv *bat_priv,
continue; continue;
batadv_bla_send_claim(bat_priv, claim->addr, claim->vid, batadv_bla_send_claim(bat_priv, claim->addr, claim->vid,
CLAIM_TYPE_ADD); BATADV_CLAIM_TYPE_ADD);
} }
rcu_read_unlock(); rcu_read_unlock();
} }
...@@ -485,7 +485,7 @@ static void batadv_bla_send_request(struct backbone_gw *backbone_gw) ...@@ -485,7 +485,7 @@ static void batadv_bla_send_request(struct backbone_gw *backbone_gw)
/* send request */ /* send request */
batadv_bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig, batadv_bla_send_claim(backbone_gw->bat_priv, backbone_gw->orig,
backbone_gw->vid, CLAIM_TYPE_REQUEST); backbone_gw->vid, BATADV_CLAIM_TYPE_REQUEST);
/* no local broadcasts should be sent or received, for now. */ /* no local broadcasts should be sent or received, for now. */
if (!atomic_read(&backbone_gw->request_sent)) { if (!atomic_read(&backbone_gw->request_sent)) {
...@@ -511,7 +511,7 @@ static void batadv_bla_send_announce(struct bat_priv *bat_priv, ...@@ -511,7 +511,7 @@ static void batadv_bla_send_announce(struct bat_priv *bat_priv,
memcpy(&mac[4], &crc, 2); memcpy(&mac[4], &crc, 2);
batadv_bla_send_claim(bat_priv, mac, backbone_gw->vid, batadv_bla_send_claim(bat_priv, mac, backbone_gw->vid,
CLAIM_TYPE_ANNOUNCE); BATADV_CLAIM_TYPE_ANNOUNCE);
} }
...@@ -694,7 +694,7 @@ static int batadv_handle_unclaim(struct bat_priv *bat_priv, ...@@ -694,7 +694,7 @@ static int batadv_handle_unclaim(struct bat_priv *bat_priv,
if (primary_if && batadv_compare_eth(backbone_addr, if (primary_if && batadv_compare_eth(backbone_addr,
primary_if->net_dev->dev_addr)) primary_if->net_dev->dev_addr))
batadv_bla_send_claim(bat_priv, claim_addr, vid, batadv_bla_send_claim(bat_priv, claim_addr, vid,
CLAIM_TYPE_DEL); BATADV_CLAIM_TYPE_DEL);
backbone_gw = batadv_backbone_hash_find(bat_priv, backbone_addr, vid); backbone_gw = batadv_backbone_hash_find(bat_priv, backbone_addr, vid);
...@@ -730,7 +730,7 @@ static int batadv_handle_claim(struct bat_priv *bat_priv, ...@@ -730,7 +730,7 @@ static int batadv_handle_claim(struct bat_priv *bat_priv,
batadv_bla_add_claim(bat_priv, claim_addr, vid, backbone_gw); batadv_bla_add_claim(bat_priv, claim_addr, vid, backbone_gw);
if (batadv_compare_eth(backbone_addr, primary_if->net_dev->dev_addr)) if (batadv_compare_eth(backbone_addr, primary_if->net_dev->dev_addr))
batadv_bla_send_claim(bat_priv, claim_addr, vid, batadv_bla_send_claim(bat_priv, claim_addr, vid,
CLAIM_TYPE_ADD); BATADV_CLAIM_TYPE_ADD);
/* TODO: we could call something like tt_local_del() here. */ /* TODO: we could call something like tt_local_del() here. */
...@@ -773,12 +773,12 @@ static int batadv_check_claim_group(struct bat_priv *bat_priv, ...@@ -773,12 +773,12 @@ static int batadv_check_claim_group(struct bat_priv *bat_priv,
* otherwise assume it is in the hw_src * otherwise assume it is in the hw_src
*/ */
switch (bla_dst->type) { switch (bla_dst->type) {
case CLAIM_TYPE_ADD: case BATADV_CLAIM_TYPE_ADD:
backbone_addr = hw_src; backbone_addr = hw_src;
break; break;
case CLAIM_TYPE_REQUEST: case BATADV_CLAIM_TYPE_REQUEST:
case CLAIM_TYPE_ANNOUNCE: case BATADV_CLAIM_TYPE_ANNOUNCE:
case CLAIM_TYPE_DEL: case BATADV_CLAIM_TYPE_DEL:
backbone_addr = ethhdr->h_source; backbone_addr = ethhdr->h_source;
break; break;
default: default:
...@@ -894,23 +894,23 @@ static int batadv_bla_process_claim(struct bat_priv *bat_priv, ...@@ -894,23 +894,23 @@ static int batadv_bla_process_claim(struct bat_priv *bat_priv,
/* check for the different types of claim frames ... */ /* check for the different types of claim frames ... */
switch (bla_dst->type) { switch (bla_dst->type) {
case CLAIM_TYPE_ADD: case BATADV_CLAIM_TYPE_ADD:
if (batadv_handle_claim(bat_priv, primary_if, hw_src, if (batadv_handle_claim(bat_priv, primary_if, hw_src,
ethhdr->h_source, vid)) ethhdr->h_source, vid))
return 1; return 1;
break; break;
case CLAIM_TYPE_DEL: case BATADV_CLAIM_TYPE_DEL:
if (batadv_handle_unclaim(bat_priv, primary_if, if (batadv_handle_unclaim(bat_priv, primary_if,
ethhdr->h_source, hw_src, vid)) ethhdr->h_source, hw_src, vid))
return 1; return 1;
break; break;
case CLAIM_TYPE_ANNOUNCE: case BATADV_CLAIM_TYPE_ANNOUNCE:
if (batadv_handle_announce(bat_priv, hw_src, ethhdr->h_source, if (batadv_handle_announce(bat_priv, hw_src, ethhdr->h_source,
vid)) vid))
return 1; return 1;
break; break;
case CLAIM_TYPE_REQUEST: case BATADV_CLAIM_TYPE_REQUEST:
if (batadv_handle_request(bat_priv, primary_if, hw_src, ethhdr, if (batadv_handle_request(bat_priv, primary_if, hw_src, ethhdr,
vid)) vid))
return 1; return 1;
......
...@@ -187,14 +187,14 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff, ...@@ -187,14 +187,14 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
goto free_skb; goto free_skb;
} }
if (icmp_packet->header.packet_type != BAT_ICMP) { if (icmp_packet->header.packet_type != BATADV_ICMP) {
batadv_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n"); "Error - can't send packet from char device: got bogus packet type (expected: BAT_ICMP)\n");
len = -EINVAL; len = -EINVAL;
goto free_skb; goto free_skb;
} }
if (icmp_packet->msg_type != ECHO_REQUEST) { if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) {
batadv_dbg(DBG_BATMAN, bat_priv, batadv_dbg(DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n"); "Error - can't send packet from char device: got bogus message type (expected: ECHO_REQUEST)\n");
len = -EINVAL; len = -EINVAL;
...@@ -204,7 +204,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff, ...@@ -204,7 +204,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
icmp_packet->uid = socket_client->index; icmp_packet->uid = socket_client->index;
if (icmp_packet->header.version != BATADV_COMPAT_VERSION) { if (icmp_packet->header.version != BATADV_COMPAT_VERSION) {
icmp_packet->msg_type = PARAMETER_PROBLEM; icmp_packet->msg_type = BATADV_PARAMETER_PROBLEM;
icmp_packet->header.version = BATADV_COMPAT_VERSION; icmp_packet->header.version = BATADV_COMPAT_VERSION;
batadv_socket_add_packet(socket_client, icmp_packet, batadv_socket_add_packet(socket_client, icmp_packet,
packet_len); packet_len);
...@@ -239,7 +239,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff, ...@@ -239,7 +239,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
goto out; goto out;
dst_unreach: dst_unreach:
icmp_packet->msg_type = DESTINATION_UNREACHABLE; icmp_packet->msg_type = BATADV_DESTINATION_UNREACHABLE;
batadv_socket_add_packet(socket_client, icmp_packet, packet_len); batadv_socket_add_packet(socket_client, icmp_packet, packet_len);
free_skb: free_skb:
kfree_skb(skb); kfree_skb(skb);
......
...@@ -275,19 +275,19 @@ static void batadv_recv_handler_init(void) ...@@ -275,19 +275,19 @@ static void batadv_recv_handler_init(void)
batadv_rx_handler[i] = batadv_recv_unhandled_packet; batadv_rx_handler[i] = batadv_recv_unhandled_packet;
/* batman icmp packet */ /* batman icmp packet */
batadv_rx_handler[BAT_ICMP] = batadv_recv_icmp_packet; batadv_rx_handler[BATADV_ICMP] = batadv_recv_icmp_packet;
/* unicast packet */ /* unicast packet */
batadv_rx_handler[BAT_UNICAST] = batadv_recv_unicast_packet; batadv_rx_handler[BATADV_UNICAST] = batadv_recv_unicast_packet;
/* fragmented unicast packet */ /* fragmented unicast packet */
batadv_rx_handler[BAT_UNICAST_FRAG] = batadv_recv_ucast_frag_packet; batadv_rx_handler[BATADV_UNICAST_FRAG] = batadv_recv_ucast_frag_packet;
/* broadcast packet */ /* broadcast packet */
batadv_rx_handler[BAT_BCAST] = batadv_recv_bcast_packet; batadv_rx_handler[BATADV_BCAST] = batadv_recv_bcast_packet;
/* vis packet */ /* vis packet */
batadv_rx_handler[BAT_VIS] = batadv_recv_vis_packet; batadv_rx_handler[BATADV_VIS] = batadv_recv_vis_packet;
/* Translation table query (request or response) */ /* Translation table query (request or response) */
batadv_rx_handler[BAT_TT_QUERY] = batadv_recv_tt_query; batadv_rx_handler[BATADV_TT_QUERY] = batadv_recv_tt_query;
/* Roaming advertisement */ /* Roaming advertisement */
batadv_rx_handler[BAT_ROAM_ADV] = batadv_recv_roam_adv; batadv_rx_handler[BATADV_ROAM_ADV] = batadv_recv_roam_adv;
} }
int batadv_recv_handler_register(uint8_t packet_type, int batadv_recv_handler_register(uint8_t packet_type,
......
...@@ -22,80 +22,80 @@ ...@@ -22,80 +22,80 @@
#define BATADV_ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */ #define BATADV_ETH_P_BATMAN 0x4305 /* unofficial/not registered Ethertype */
enum bat_packettype { enum batadv_packettype {
BAT_IV_OGM = 0x01, BATADV_IV_OGM = 0x01,
BAT_ICMP = 0x02, BATADV_ICMP = 0x02,
BAT_UNICAST = 0x03, BATADV_UNICAST = 0x03,
BAT_BCAST = 0x04, BATADV_BCAST = 0x04,
BAT_VIS = 0x05, BATADV_VIS = 0x05,
BAT_UNICAST_FRAG = 0x06, BATADV_UNICAST_FRAG = 0x06,
BAT_TT_QUERY = 0x07, BATADV_TT_QUERY = 0x07,
BAT_ROAM_ADV = 0x08 BATADV_ROAM_ADV = 0x08,
}; };
/* this file is included by batctl which needs these defines */ /* this file is included by batctl which needs these defines */
#define BATADV_COMPAT_VERSION 14 #define BATADV_COMPAT_VERSION 14
enum batman_iv_flags { enum batadv_iv_flags {
NOT_BEST_NEXT_HOP = 1 << 3, BATADV_NOT_BEST_NEXT_HOP = 1 << 3,
PRIMARIES_FIRST_HOP = 1 << 4, BATADV_PRIMARIES_FIRST_HOP = 1 << 4,
VIS_SERVER = 1 << 5, BATADV_VIS_SERVER = 1 << 5,
DIRECTLINK = 1 << 6 BATADV_DIRECTLINK = 1 << 6,
}; };
/* ICMP message types */ /* ICMP message types */
enum icmp_packettype { enum batadv_icmp_packettype {
ECHO_REPLY = 0, BATADV_ECHO_REPLY = 0,
DESTINATION_UNREACHABLE = 3, BATADV_DESTINATION_UNREACHABLE = 3,
ECHO_REQUEST = 8, BATADV_ECHO_REQUEST = 8,
TTL_EXCEEDED = 11, BATADV_TTL_EXCEEDED = 11,
PARAMETER_PROBLEM = 12 BATADV_PARAMETER_PROBLEM = 12,
}; };
/* vis defines */ /* vis defines */
enum vis_packettype { enum batadv_vis_packettype {
VIS_TYPE_SERVER_SYNC = 0, BATADV_VIS_TYPE_SERVER_SYNC = 0,
VIS_TYPE_CLIENT_UPDATE = 1 BATADV_VIS_TYPE_CLIENT_UPDATE = 1,
}; };
/* fragmentation defines */ /* fragmentation defines */
enum unicast_frag_flags { enum batadv_unicast_frag_flags {
UNI_FRAG_HEAD = 1 << 0, BATADV_UNI_FRAG_HEAD = 1 << 0,
UNI_FRAG_LARGETAIL = 1 << 1 BATADV_UNI_FRAG_LARGETAIL = 1 << 1,
}; };
/* TT_QUERY subtypes */ /* TT_QUERY subtypes */
#define BATADV_TT_QUERY_TYPE_MASK 0x3 #define BATADV_TT_QUERY_TYPE_MASK 0x3
enum tt_query_packettype { enum batadv_tt_query_packettype {
TT_REQUEST = 0, BATADV_TT_REQUEST = 0,
TT_RESPONSE = 1 BATADV_TT_RESPONSE = 1,
}; };
/* TT_QUERY flags */ /* TT_QUERY flags */
enum tt_query_flags { enum batadv_tt_query_flags {
TT_FULL_TABLE = 1 << 2 BATADV_TT_FULL_TABLE = 1 << 2,
}; };
/* TT_CLIENT flags. /* BATADV_TT_CLIENT flags.
* Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to * Flags from 1 to 1 << 7 are sent on the wire, while flags from 1 << 8 to
* 1 << 15 are used for local computation only * 1 << 15 are used for local computation only
*/ */
enum tt_client_flags { enum batadv_tt_client_flags {
TT_CLIENT_DEL = 1 << 0, BATADV_TT_CLIENT_DEL = 1 << 0,
TT_CLIENT_ROAM = 1 << 1, BATADV_TT_CLIENT_ROAM = 1 << 1,
TT_CLIENT_WIFI = 1 << 2, BATADV_TT_CLIENT_WIFI = 1 << 2,
TT_CLIENT_NOPURGE = 1 << 8, BATADV_TT_CLIENT_NOPURGE = 1 << 8,
TT_CLIENT_NEW = 1 << 9, BATADV_TT_CLIENT_NEW = 1 << 9,
TT_CLIENT_PENDING = 1 << 10 BATADV_TT_CLIENT_PENDING = 1 << 10,
}; };
/* claim frame types for the bridge loop avoidance */ /* claim frame types for the bridge loop avoidance */
enum bla_claimframe { enum batadv_bla_claimframe {
CLAIM_TYPE_ADD = 0x00, BATADV_CLAIM_TYPE_ADD = 0x00,
CLAIM_TYPE_DEL = 0x01, BATADV_CLAIM_TYPE_DEL = 0x01,
CLAIM_TYPE_ANNOUNCE = 0x02, BATADV_CLAIM_TYPE_ANNOUNCE = 0x02,
CLAIM_TYPE_REQUEST = 0x03 BATADV_CLAIM_TYPE_REQUEST = 0x03,
}; };
/* the destination hardware field in the ARP frame is used to /* the destination hardware field in the ARP frame is used to
......
...@@ -219,7 +219,7 @@ batadv_bonding_save_primary(const struct orig_node *orig_node, ...@@ -219,7 +219,7 @@ batadv_bonding_save_primary(const struct orig_node *orig_node,
struct orig_node *orig_neigh_node, struct orig_node *orig_neigh_node,
const struct batman_ogm_packet *batman_ogm_packet) const struct batman_ogm_packet *batman_ogm_packet)
{ {
if (!(batman_ogm_packet->flags & PRIMARIES_FIRST_HOP)) if (!(batman_ogm_packet->flags & BATADV_PRIMARIES_FIRST_HOP))
return; return;
memcpy(orig_neigh_node->primary_addr, orig_node->orig, ETH_ALEN); memcpy(orig_neigh_node->primary_addr, orig_node->orig, ETH_ALEN);
...@@ -290,7 +290,7 @@ static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv, ...@@ -290,7 +290,7 @@ static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv,
icmp_packet = (struct icmp_packet_rr *)skb->data; icmp_packet = (struct icmp_packet_rr *)skb->data;
/* add data to device queue */ /* add data to device queue */
if (icmp_packet->msg_type != ECHO_REQUEST) { if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) {
batadv_socket_receive_packet(icmp_packet, icmp_len); batadv_socket_receive_packet(icmp_packet, icmp_len);
goto out; goto out;
} }
...@@ -317,7 +317,7 @@ static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv, ...@@ -317,7 +317,7 @@ static int batadv_recv_my_icmp_packet(struct bat_priv *bat_priv,
memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN); memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
icmp_packet->msg_type = ECHO_REPLY; icmp_packet->msg_type = BATADV_ECHO_REPLY;
icmp_packet->header.ttl = BATADV_TTL; icmp_packet->header.ttl = BATADV_TTL;
batadv_send_skb_packet(skb, router->if_incoming, router->addr); batadv_send_skb_packet(skb, router->if_incoming, router->addr);
...@@ -345,7 +345,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv, ...@@ -345,7 +345,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
icmp_packet = (struct icmp_packet *)skb->data; icmp_packet = (struct icmp_packet *)skb->data;
/* send TTL exceeded if packet is an echo request (traceroute) */ /* send TTL exceeded if packet is an echo request (traceroute) */
if (icmp_packet->msg_type != ECHO_REQUEST) { if (icmp_packet->msg_type != BATADV_ECHO_REQUEST) {
pr_debug("Warning - can't forward icmp packet from %pM to %pM: ttl exceeded\n", pr_debug("Warning - can't forward icmp packet from %pM to %pM: ttl exceeded\n",
icmp_packet->orig, icmp_packet->dst); icmp_packet->orig, icmp_packet->dst);
goto out; goto out;
...@@ -372,7 +372,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv, ...@@ -372,7 +372,7 @@ static int batadv_recv_icmp_ttl_exceeded(struct bat_priv *bat_priv,
memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN); memcpy(icmp_packet->dst, icmp_packet->orig, ETH_ALEN);
memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN); memcpy(icmp_packet->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
icmp_packet->msg_type = TTL_EXCEEDED; icmp_packet->msg_type = BATADV_TTL_EXCEEDED;
icmp_packet->header.ttl = BATADV_TTL; icmp_packet->header.ttl = BATADV_TTL;
batadv_send_skb_packet(skb, router->if_incoming, router->addr); batadv_send_skb_packet(skb, router->if_incoming, router->addr);
...@@ -606,14 +606,18 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) ...@@ -606,14 +606,18 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
tt_query = (struct tt_query_packet *)skb->data; tt_query = (struct tt_query_packet *)skb->data;
switch (tt_query->flags & BATADV_TT_QUERY_TYPE_MASK) { switch (tt_query->flags & BATADV_TT_QUERY_TYPE_MASK) {
case TT_REQUEST: case BATADV_TT_REQUEST:
batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX); batadv_inc_counter(bat_priv, BATADV_CNT_TT_REQUEST_RX);
/* If we cannot provide an answer the tt_request is /* If we cannot provide an answer the tt_request is
* forwarded * forwarded
*/ */
if (!batadv_send_tt_response(bat_priv, tt_query)) { if (!batadv_send_tt_response(bat_priv, tt_query)) {
tt_flag = tt_query->flags & TT_FULL_TABLE ? 'F' : '.'; if (tt_query->flags & BATADV_TT_FULL_TABLE)
tt_flag = 'F';
else
tt_flag = '.';
batadv_dbg(DBG_TT, bat_priv, batadv_dbg(DBG_TT, bat_priv,
"Routing TT_REQUEST to %pM [%c]\n", "Routing TT_REQUEST to %pM [%c]\n",
tt_query->dst, tt_query->dst,
...@@ -621,7 +625,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) ...@@ -621,7 +625,7 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
return batadv_route_unicast_packet(skb, recv_if); return batadv_route_unicast_packet(skb, recv_if);
} }
break; break;
case TT_RESPONSE: case BATADV_TT_RESPONSE:
batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX); batadv_inc_counter(bat_priv, BATADV_CNT_TT_RESPONSE_RX);
if (batadv_is_my_mac(tt_query->dst)) { if (batadv_is_my_mac(tt_query->dst)) {
...@@ -642,7 +646,10 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if) ...@@ -642,7 +646,10 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
batadv_handle_tt_response(bat_priv, tt_query); batadv_handle_tt_response(bat_priv, tt_query);
} else { } else {
tt_flag = tt_query->flags & TT_FULL_TABLE ? 'F' : '.'; if (tt_query->flags & BATADV_TT_FULL_TABLE)
tt_flag = 'F';
else
tt_flag = '.';
batadv_dbg(DBG_TT, bat_priv, batadv_dbg(DBG_TT, bat_priv,
"Routing TT_RESPONSE to %pM [%c]\n", "Routing TT_RESPONSE to %pM [%c]\n",
tt_query->dst, tt_query->dst,
...@@ -701,7 +708,7 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if) ...@@ -701,7 +708,7 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct hard_iface *recv_if)
roam_adv_packet->src, roam_adv_packet->client); roam_adv_packet->src, roam_adv_packet->client);
batadv_tt_global_add(bat_priv, orig_node, roam_adv_packet->client, batadv_tt_global_add(bat_priv, orig_node, roam_adv_packet->client,
TT_CLIENT_ROAM, BATADV_TT_CLIENT_ROAM,
atomic_read(&orig_node->last_ttvn) + 1); atomic_read(&orig_node->last_ttvn) + 1);
/* Roaming phase starts: I have new information but the ttvn has not /* Roaming phase starts: I have new information but the ttvn has not
...@@ -868,7 +875,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, ...@@ -868,7 +875,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
unicast_packet = (struct unicast_packet *)skb->data; unicast_packet = (struct unicast_packet *)skb->data;
if (unicast_packet->header.packet_type == BAT_UNICAST && if (unicast_packet->header.packet_type == BATADV_UNICAST &&
atomic_read(&bat_priv->fragmentation) && atomic_read(&bat_priv->fragmentation) &&
skb->len > neigh_node->if_incoming->net_dev->mtu) { skb->len > neigh_node->if_incoming->net_dev->mtu) {
ret = batadv_frag_send_skb(skb, bat_priv, ret = batadv_frag_send_skb(skb, bat_priv,
...@@ -877,7 +884,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb, ...@@ -877,7 +884,7 @@ static int batadv_route_unicast_packet(struct sk_buff *skb,
goto out; goto out;
} }
if (unicast_packet->header.packet_type == BAT_UNICAST_FRAG && if (unicast_packet->header.packet_type == BATADV_UNICAST_FRAG &&
batadv_frag_can_reassemble(skb, batadv_frag_can_reassemble(skb,
neigh_node->if_incoming->net_dev->mtu)) { neigh_node->if_incoming->net_dev->mtu)) {
...@@ -1176,12 +1183,12 @@ int batadv_recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if) ...@@ -1176,12 +1183,12 @@ int batadv_recv_vis_packet(struct sk_buff *skb, struct hard_iface *recv_if)
return NET_RX_DROP; return NET_RX_DROP;
switch (vis_packet->vis_type) { switch (vis_packet->vis_type) {
case VIS_TYPE_SERVER_SYNC: case BATADV_VIS_TYPE_SERVER_SYNC:
batadv_receive_server_sync_packet(bat_priv, vis_packet, batadv_receive_server_sync_packet(bat_priv, vis_packet,
skb_headlen(skb)); skb_headlen(skb));
break; break;
case VIS_TYPE_CLIENT_UPDATE: case BATADV_VIS_TYPE_CLIENT_UPDATE:
batadv_receive_client_update_packet(bat_priv, vis_packet, batadv_receive_client_update_packet(bat_priv, vis_packet,
skb_headlen(skb)); skb_headlen(skb));
break; break;
......
...@@ -213,7 +213,7 @@ static int batadv_interface_tx(struct sk_buff *skb, ...@@ -213,7 +213,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
bcast_packet->header.ttl = BATADV_TTL; bcast_packet->header.ttl = BATADV_TTL;
/* batman packet type: broadcast */ /* batman packet type: broadcast */
bcast_packet->header.packet_type = BAT_BCAST; bcast_packet->header.packet_type = BATADV_BCAST;
/* hw address of first interface is the orig mac because only /* hw address of first interface is the orig mac because only
* this mac is known throughout the mesh * this mac is known throughout the mesh
...@@ -387,7 +387,7 @@ struct net_device *batadv_softif_create(const char *name) ...@@ -387,7 +387,7 @@ struct net_device *batadv_softif_create(const char *name)
atomic_set(&bat_priv->bonding, 0); atomic_set(&bat_priv->bonding, 0);
atomic_set(&bat_priv->bridge_loop_avoidance, 0); atomic_set(&bat_priv->bridge_loop_avoidance, 0);
atomic_set(&bat_priv->ap_isolation, 0); atomic_set(&bat_priv->ap_isolation, 0);
atomic_set(&bat_priv->vis_mode, VIS_TYPE_CLIENT_UPDATE); atomic_set(&bat_priv->vis_mode, BATADV_VIS_TYPE_CLIENT_UPDATE);
atomic_set(&bat_priv->gw_mode, BATADV_GW_MODE_OFF); atomic_set(&bat_priv->gw_mode, BATADV_GW_MODE_OFF);
atomic_set(&bat_priv->gw_sel_class, 20); atomic_set(&bat_priv->gw_sel_class, 20);
atomic_set(&bat_priv->gw_bandwidth, 41); atomic_set(&bat_priv->gw_bandwidth, 41);
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ batadv_frag_merge_packet(struct list_head *head, ...@@ -42,7 +42,7 @@ batadv_frag_merge_packet(struct list_head *head,
int uni_diff = sizeof(*up) - hdr_len; int uni_diff = sizeof(*up) - hdr_len;
/* set skb to the first part and tmp_skb to the second part */ /* set skb to the first part and tmp_skb to the second part */
if (up->flags & UNI_FRAG_HEAD) { if (up->flags & BATADV_UNI_FRAG_HEAD) {
tmp_skb = tfp->skb; tmp_skb = tfp->skb;
} else { } else {
tmp_skb = skb; tmp_skb = skb;
...@@ -66,7 +66,7 @@ batadv_frag_merge_packet(struct list_head *head, ...@@ -66,7 +66,7 @@ batadv_frag_merge_packet(struct list_head *head,
memmove(skb->data + uni_diff, skb->data, hdr_len); memmove(skb->data + uni_diff, skb->data, hdr_len);
unicast_packet = (struct unicast_packet *)skb_pull(skb, uni_diff); unicast_packet = (struct unicast_packet *)skb_pull(skb, uni_diff);
unicast_packet->header.packet_type = BAT_UNICAST; unicast_packet->header.packet_type = BATADV_UNICAST;
return skb; return skb;
...@@ -121,7 +121,7 @@ batadv_frag_search_packet(struct list_head *head, ...@@ -121,7 +121,7 @@ batadv_frag_search_packet(struct list_head *head,
struct unicast_frag_packet *tmp_up = NULL; struct unicast_frag_packet *tmp_up = NULL;
uint16_t search_seqno; uint16_t search_seqno;
if (up->flags & UNI_FRAG_HEAD) if (up->flags & BATADV_UNI_FRAG_HEAD)
search_seqno = ntohs(up->seqno)+1; search_seqno = ntohs(up->seqno)+1;
else else
search_seqno = ntohs(up->seqno)-1; search_seqno = ntohs(up->seqno)-1;
...@@ -138,8 +138,8 @@ batadv_frag_search_packet(struct list_head *head, ...@@ -138,8 +138,8 @@ batadv_frag_search_packet(struct list_head *head,
if (tfp->seqno == search_seqno) { if (tfp->seqno == search_seqno) {
if ((tmp_up->flags & UNI_FRAG_HEAD) != if ((tmp_up->flags & BATADV_UNI_FRAG_HEAD) !=
(up->flags & UNI_FRAG_HEAD)) (up->flags & BATADV_UNI_FRAG_HEAD))
return tfp; return tfp;
else else
goto mov_tail; goto mov_tail;
...@@ -254,15 +254,15 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv, ...@@ -254,15 +254,15 @@ int batadv_frag_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv,
frag1->header.ttl--; frag1->header.ttl--;
frag1->header.version = BATADV_COMPAT_VERSION; frag1->header.version = BATADV_COMPAT_VERSION;
frag1->header.packet_type = BAT_UNICAST_FRAG; frag1->header.packet_type = BATADV_UNICAST_FRAG;
memcpy(frag1->orig, primary_if->net_dev->dev_addr, ETH_ALEN); memcpy(frag1->orig, primary_if->net_dev->dev_addr, ETH_ALEN);
memcpy(frag2, frag1, sizeof(*frag2)); memcpy(frag2, frag1, sizeof(*frag2));
if (data_len & 1) if (data_len & 1)
large_tail = UNI_FRAG_LARGETAIL; large_tail = BATADV_UNI_FRAG_LARGETAIL;
frag1->flags = UNI_FRAG_HEAD | large_tail; frag1->flags = BATADV_UNI_FRAG_HEAD | large_tail;
frag2->flags = large_tail; frag2->flags = large_tail;
seqno = atomic_add_return(2, &hard_iface->frag_seqno); seqno = atomic_add_return(2, &hard_iface->frag_seqno);
...@@ -321,7 +321,7 @@ int batadv_unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv) ...@@ -321,7 +321,7 @@ int batadv_unicast_send_skb(struct sk_buff *skb, struct bat_priv *bat_priv)
unicast_packet->header.version = BATADV_COMPAT_VERSION; unicast_packet->header.version = BATADV_COMPAT_VERSION;
/* batman packet type: unicast */ /* batman packet type: unicast */
unicast_packet->header.packet_type = BAT_UNICAST; unicast_packet->header.packet_type = BATADV_UNICAST;
/* set unicast ttl */ /* set unicast ttl */
unicast_packet->header.ttl = BATADV_TTL; unicast_packet->header.ttl = BATADV_TTL;
/* copy the destination for faster routing */ /* copy the destination for faster routing */
......
...@@ -41,8 +41,8 @@ static inline int batadv_frag_can_reassemble(const struct sk_buff *skb, int mtu) ...@@ -41,8 +41,8 @@ static inline int batadv_frag_can_reassemble(const struct sk_buff *skb, int mtu)
unicast_packet = (struct unicast_frag_packet *)skb->data; unicast_packet = (struct unicast_frag_packet *)skb->data;
if (unicast_packet->flags & UNI_FRAG_LARGETAIL) { if (unicast_packet->flags & BATADV_UNI_FRAG_LARGETAIL) {
if (unicast_packet->flags & UNI_FRAG_HEAD) if (unicast_packet->flags & BATADV_UNI_FRAG_HEAD)
uneven_correction = 1; uneven_correction = 1;
else else
uneven_correction = -1; uneven_correction = -1;
......
...@@ -256,7 +256,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset) ...@@ -256,7 +256,7 @@ int batadv_vis_seq_print_text(struct seq_file *seq, void *offset)
if (!primary_if) if (!primary_if)
goto out; goto out;
if (vis_server == VIS_TYPE_CLIENT_UPDATE) if (vis_server == BATADV_VIS_TYPE_CLIENT_UPDATE)
goto out; goto out;
spin_lock_bh(&bat_priv->vis_hash_lock); spin_lock_bh(&bat_priv->vis_hash_lock);
...@@ -437,7 +437,7 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv, ...@@ -437,7 +437,7 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv,
int is_new, make_broadcast; int is_new, make_broadcast;
int vis_server = atomic_read(&bat_priv->vis_mode); int vis_server = atomic_read(&bat_priv->vis_mode);
make_broadcast = (vis_server == VIS_TYPE_SERVER_SYNC); make_broadcast = (vis_server == BATADV_VIS_TYPE_SERVER_SYNC);
spin_lock_bh(&bat_priv->vis_hash_lock); spin_lock_bh(&bat_priv->vis_hash_lock);
info = batadv_add_packet(bat_priv, vis_packet, vis_info_len, info = batadv_add_packet(bat_priv, vis_packet, vis_info_len,
...@@ -448,7 +448,7 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv, ...@@ -448,7 +448,7 @@ void batadv_receive_server_sync_packet(struct bat_priv *bat_priv,
/* only if we are server ourselves and packet is newer than the one in /* only if we are server ourselves and packet is newer than the one in
* hash. * hash.
*/ */
if (vis_server == VIS_TYPE_SERVER_SYNC && is_new) if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC && is_new)
batadv_send_list_add(bat_priv, info); batadv_send_list_add(bat_priv, info);
end: end:
spin_unlock_bh(&bat_priv->vis_hash_lock); spin_unlock_bh(&bat_priv->vis_hash_lock);
...@@ -470,7 +470,7 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv, ...@@ -470,7 +470,7 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv,
return; return;
/* Are we the target for this VIS packet? */ /* Are we the target for this VIS packet? */
if (vis_server == VIS_TYPE_SERVER_SYNC && if (vis_server == BATADV_VIS_TYPE_SERVER_SYNC &&
batadv_is_my_mac(vis_packet->target_orig)) batadv_is_my_mac(vis_packet->target_orig))
are_target = 1; are_target = 1;
...@@ -486,7 +486,7 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv, ...@@ -486,7 +486,7 @@ void batadv_receive_client_update_packet(struct bat_priv *bat_priv,
/* send only if we're the target server or ... */ /* send only if we're the target server or ... */
if (are_target && is_new) { if (are_target && is_new) {
packet->vis_type = VIS_TYPE_SERVER_SYNC; /* upgrade! */ packet->vis_type = BATADV_VIS_TYPE_SERVER_SYNC; /* upgrade! */
batadv_send_list_add(bat_priv, info); batadv_send_list_add(bat_priv, info);
/* ... we're not the recipient (and thus need to forward). */ /* ... we're not the recipient (and thus need to forward). */
...@@ -526,7 +526,7 @@ static int batadv_find_best_vis_server(struct bat_priv *bat_priv, ...@@ -526,7 +526,7 @@ static int batadv_find_best_vis_server(struct bat_priv *bat_priv,
if (!router) if (!router)
continue; continue;
if ((orig_node->flags & VIS_SERVER) && if ((orig_node->flags & BATADV_VIS_SERVER) &&
(router->tq_avg > best_tq)) { (router->tq_avg > best_tq)) {
best_tq = router->tq_avg; best_tq = router->tq_avg;
memcpy(packet->target_orig, orig_node->orig, memcpy(packet->target_orig, orig_node->orig,
...@@ -580,7 +580,7 @@ static int batadv_generate_vis_packet(struct bat_priv *bat_priv) ...@@ -580,7 +580,7 @@ static int batadv_generate_vis_packet(struct bat_priv *bat_priv)
packet->entries = 0; packet->entries = 0;
skb_trim(info->skb_packet, sizeof(*packet)); skb_trim(info->skb_packet, sizeof(*packet));
if (packet->vis_type == VIS_TYPE_CLIENT_UPDATE) { if (packet->vis_type == BATADV_VIS_TYPE_CLIENT_UPDATE) {
best_tq = batadv_find_best_vis_server(bat_priv, info); best_tq = batadv_find_best_vis_server(bat_priv, info);
if (best_tq < 0) if (best_tq < 0)
...@@ -707,7 +707,7 @@ static void batadv_broadcast_vis_packet(struct bat_priv *bat_priv, ...@@ -707,7 +707,7 @@ static void batadv_broadcast_vis_packet(struct bat_priv *bat_priv,
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) { hlist_for_each_entry_rcu(orig_node, node, head, hash_entry) {
/* if it's a vis server and reachable, send it. */ /* if it's a vis server and reachable, send it. */
if (!(orig_node->flags & VIS_SERVER)) if (!(orig_node->flags & BATADV_VIS_SERVER))
continue; continue;
router = batadv_orig_node_get_router(orig_node); router = batadv_orig_node_get_router(orig_node);
...@@ -875,7 +875,7 @@ int batadv_vis_init(struct bat_priv *bat_priv) ...@@ -875,7 +875,7 @@ int batadv_vis_init(struct bat_priv *bat_priv)
kref_init(&bat_priv->my_vis_info->refcount); kref_init(&bat_priv->my_vis_info->refcount);
bat_priv->my_vis_info->bat_priv = bat_priv; bat_priv->my_vis_info->bat_priv = bat_priv;
packet->header.version = BATADV_COMPAT_VERSION; packet->header.version = BATADV_COMPAT_VERSION;
packet->header.packet_type = BAT_VIS; packet->header.packet_type = BATADV_VIS;
packet->header.ttl = BATADV_TTL; packet->header.ttl = BATADV_TTL;
packet->seqno = 0; packet->seqno = 0;
packet->entries = 0; packet->entries = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment