aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/soft-interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/batman-adv/soft-interface.c')
-rw-r--r--net/batman-adv/soft-interface.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 2de1d742119f..c1b2ab2f37bb 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -108,7 +108,7 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)
108 if (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE) { 108 if (atomic_read(&bat_priv->mesh_state) == MESH_ACTIVE) {
109 batadv_tt_local_remove(bat_priv, dev->dev_addr, 109 batadv_tt_local_remove(bat_priv, dev->dev_addr,
110 "mac address changed", false); 110 "mac address changed", false);
111 batadv_tt_local_add(dev, addr->sa_data, NULL_IFINDEX); 111 batadv_tt_local_add(dev, addr->sa_data, BATADV_NULL_IFINDEX);
112 } 112 }
113 113
114 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); 114 memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
@@ -135,6 +135,7 @@ static int batadv_interface_tx(struct sk_buff *skb,
135 struct hard_iface *primary_if = NULL; 135 struct hard_iface *primary_if = NULL;
136 struct bcast_packet *bcast_packet; 136 struct bcast_packet *bcast_packet;
137 struct vlan_ethhdr *vhdr; 137 struct vlan_ethhdr *vhdr;
138 __be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN);
138 static const uint8_t stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00, 0x00, 139 static const uint8_t stp_addr[ETH_ALEN] = {0x01, 0x80, 0xC2, 0x00, 0x00,
139 0x00}; 140 0x00};
140 unsigned int header_len = 0; 141 unsigned int header_len = 0;
@@ -152,11 +153,11 @@ static int batadv_interface_tx(struct sk_buff *skb,
152 vhdr = (struct vlan_ethhdr *)skb->data; 153 vhdr = (struct vlan_ethhdr *)skb->data;
153 vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK; 154 vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK;
154 155
155 if (ntohs(vhdr->h_vlan_encapsulated_proto) != ETH_P_BATMAN) 156 if (vhdr->h_vlan_encapsulated_proto != ethertype)
156 break; 157 break;
157 158
158 /* fall through */ 159 /* fall through */
159 case ETH_P_BATMAN: 160 case BATADV_ETH_P_BATMAN:
160 goto dropped; 161 goto dropped;
161 } 162 }
162 163
@@ -208,8 +209,8 @@ static int batadv_interface_tx(struct sk_buff *skb,
208 goto dropped; 209 goto dropped;
209 210
210 bcast_packet = (struct bcast_packet *)skb->data; 211 bcast_packet = (struct bcast_packet *)skb->data;
211 bcast_packet->header.version = COMPAT_VERSION; 212 bcast_packet->header.version = BATADV_COMPAT_VERSION;
212 bcast_packet->header.ttl = TTL; 213 bcast_packet->header.ttl = BATADV_TTL;
213 214
214 /* batman packet type: broadcast */ 215 /* batman packet type: broadcast */
215 bcast_packet->header.packet_type = BAT_BCAST; 216 bcast_packet->header.packet_type = BAT_BCAST;
@@ -266,6 +267,7 @@ void batadv_interface_rx(struct net_device *soft_iface,
266 struct ethhdr *ethhdr; 267 struct ethhdr *ethhdr;
267 struct vlan_ethhdr *vhdr; 268 struct vlan_ethhdr *vhdr;
268 short vid __maybe_unused = -1; 269 short vid __maybe_unused = -1;
270 __be16 ethertype = __constant_htons(BATADV_ETH_P_BATMAN);
269 271
270 /* check if enough space is available for pulling, and pull */ 272 /* check if enough space is available for pulling, and pull */
271 if (!pskb_may_pull(skb, hdr_size)) 273 if (!pskb_may_pull(skb, hdr_size))
@@ -281,11 +283,11 @@ void batadv_interface_rx(struct net_device *soft_iface,
281 vhdr = (struct vlan_ethhdr *)skb->data; 283 vhdr = (struct vlan_ethhdr *)skb->data;
282 vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK; 284 vid = ntohs(vhdr->h_vlan_TCI) & VLAN_VID_MASK;
283 285
284 if (ntohs(vhdr->h_vlan_encapsulated_proto) != ETH_P_BATMAN) 286 if (vhdr->h_vlan_encapsulated_proto != ethertype)
285 break; 287 break;
286 288
287 /* fall through */ 289 /* fall through */
288 case ETH_P_BATMAN: 290 case BATADV_ETH_P_BATMAN:
289 goto dropped; 291 goto dropped;
290 } 292 }
291 293
@@ -349,7 +351,7 @@ static void batadv_interface_setup(struct net_device *dev)
349 */ 351 */
350 dev->mtu = ETH_DATA_LEN; 352 dev->mtu = ETH_DATA_LEN;
351 /* reserve more space in the skbuff for our header */ 353 /* reserve more space in the skbuff for our header */
352 dev->hard_header_len = BAT_HEADER_LEN; 354 dev->hard_header_len = BATADV_HEADER_LEN;
353 355
354 /* generate random address */ 356 /* generate random address */
355 eth_hw_addr_random(dev); 357 eth_hw_addr_random(dev);
@@ -392,8 +394,8 @@ struct net_device *batadv_softif_create(const char *name)
392 atomic_set(&bat_priv->hop_penalty, 30); 394 atomic_set(&bat_priv->hop_penalty, 30);
393 atomic_set(&bat_priv->log_level, 0); 395 atomic_set(&bat_priv->log_level, 0);
394 atomic_set(&bat_priv->fragmentation, 1); 396 atomic_set(&bat_priv->fragmentation, 1);
395 atomic_set(&bat_priv->bcast_queue_left, BCAST_QUEUE_LEN); 397 atomic_set(&bat_priv->bcast_queue_left, BATADV_BCAST_QUEUE_LEN);
396 atomic_set(&bat_priv->batman_queue_left, BATMAN_QUEUE_LEN); 398 atomic_set(&bat_priv->batman_queue_left, BATADV_BATMAN_QUEUE_LEN);
397 399
398 atomic_set(&bat_priv->mesh_state, MESH_INACTIVE); 400 atomic_set(&bat_priv->mesh_state, MESH_INACTIVE);
399 atomic_set(&bat_priv->bcast_seqno, 1); 401 atomic_set(&bat_priv->bcast_seqno, 1);
@@ -485,7 +487,7 @@ static void batadv_get_drvinfo(struct net_device *dev,
485 struct ethtool_drvinfo *info) 487 struct ethtool_drvinfo *info)
486{ 488{
487 strcpy(info->driver, "B.A.T.M.A.N. advanced"); 489 strcpy(info->driver, "B.A.T.M.A.N. advanced");
488 strcpy(info->version, SOURCE_VERSION); 490 strcpy(info->version, BATADV_SOURCE_VERSION);
489 strcpy(info->fw_version, "N/A"); 491 strcpy(info->fw_version, "N/A");
490 strcpy(info->bus_info, "batman"); 492 strcpy(info->bus_info, "batman");
491} 493}