send.c (e23c34bb41da65f354fb7eee04300c56ee48f60c) | send.c (a40d9b075c21f06872de3f05cc2eb3d06665e2ff) |
---|---|
1/* Copyright (C) 2007-2013 B.A.T.M.A.N. contributors: 2 * 3 * Marek Lindner, Simon Wunderlich 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of version 2 of the GNU General Public 7 * License as published by the Free Software Foundation. 8 * --- 147 unchanged lines hidden (view full) --- 156{ 157 struct batadv_unicast_packet *unicast_packet; 158 uint8_t ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn); 159 160 if (batadv_skb_head_push(skb, hdr_size) < 0) 161 return false; 162 163 unicast_packet = (struct batadv_unicast_packet *)skb->data; | 1/* Copyright (C) 2007-2013 B.A.T.M.A.N. contributors: 2 * 3 * Marek Lindner, Simon Wunderlich 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of version 2 of the GNU General Public 7 * License as published by the Free Software Foundation. 8 * --- 147 unchanged lines hidden (view full) --- 156{ 157 struct batadv_unicast_packet *unicast_packet; 158 uint8_t ttvn = (uint8_t)atomic_read(&orig_node->last_ttvn); 159 160 if (batadv_skb_head_push(skb, hdr_size) < 0) 161 return false; 162 163 unicast_packet = (struct batadv_unicast_packet *)skb->data; |
164 unicast_packet->header.version = BATADV_COMPAT_VERSION; | 164 unicast_packet->version = BATADV_COMPAT_VERSION; |
165 /* batman packet type: unicast */ | 165 /* batman packet type: unicast */ |
166 unicast_packet->header.packet_type = BATADV_UNICAST; | 166 unicast_packet->packet_type = BATADV_UNICAST; |
167 /* set unicast ttl */ | 167 /* set unicast ttl */ |
168 unicast_packet->header.ttl = BATADV_TTL; | 168 unicast_packet->ttl = BATADV_TTL; |
169 /* copy the destination for faster routing */ 170 memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); 171 /* set the destination tt version number */ 172 unicast_packet->ttvn = ttvn; 173 174 return true; 175} 176 --- 39 unchanged lines hidden (view full) --- 216 * We can do that because the first member of the uc_4addr_packet 217 * is of type struct unicast_packet 218 */ 219 if (!batadv_send_skb_push_fill_unicast(skb, sizeof(*uc_4addr_packet), 220 orig)) 221 goto out; 222 223 uc_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data; | 169 /* copy the destination for faster routing */ 170 memcpy(unicast_packet->dest, orig_node->orig, ETH_ALEN); 171 /* set the destination tt version number */ 172 unicast_packet->ttvn = ttvn; 173 174 return true; 175} 176 --- 39 unchanged lines hidden (view full) --- 216 * We can do that because the first member of the uc_4addr_packet 217 * is of type struct unicast_packet 218 */ 219 if (!batadv_send_skb_push_fill_unicast(skb, sizeof(*uc_4addr_packet), 220 orig)) 221 goto out; 222 223 uc_4addr_packet = (struct batadv_unicast_4addr_packet *)skb->data; |
224 uc_4addr_packet->u.header.packet_type = BATADV_UNICAST_4ADDR; | 224 uc_4addr_packet->u.packet_type = BATADV_UNICAST_4ADDR; |
225 memcpy(uc_4addr_packet->src, primary_if->net_dev->dev_addr, ETH_ALEN); 226 uc_4addr_packet->subtype = packet_subtype; 227 uc_4addr_packet->reserved = 0; 228 229 ret = true; 230out: 231 if (primary_if) 232 batadv_hardif_free_ref(primary_if); --- 198 unchanged lines hidden (view full) --- 431 goto out_and_inc; 432 433 newskb = skb_copy(skb, GFP_ATOMIC); 434 if (!newskb) 435 goto packet_free; 436 437 /* as we have a copy now, it is safe to decrease the TTL */ 438 bcast_packet = (struct batadv_bcast_packet *)newskb->data; | 225 memcpy(uc_4addr_packet->src, primary_if->net_dev->dev_addr, ETH_ALEN); 226 uc_4addr_packet->subtype = packet_subtype; 227 uc_4addr_packet->reserved = 0; 228 229 ret = true; 230out: 231 if (primary_if) 232 batadv_hardif_free_ref(primary_if); --- 198 unchanged lines hidden (view full) --- 431 goto out_and_inc; 432 433 newskb = skb_copy(skb, GFP_ATOMIC); 434 if (!newskb) 435 goto packet_free; 436 437 /* as we have a copy now, it is safe to decrease the TTL */ 438 bcast_packet = (struct batadv_bcast_packet *)newskb->data; |
439 bcast_packet->header.ttl--; | 439 bcast_packet->ttl--; |
440 441 skb_reset_mac_header(newskb); 442 443 forw_packet->skb = newskb; 444 forw_packet->if_incoming = primary_if; 445 446 /* how often did we send the bcast packet ? */ 447 forw_packet->num_packets = 0; --- 175 unchanged lines hidden --- | 440 441 skb_reset_mac_header(newskb); 442 443 forw_packet->skb = newskb; 444 forw_packet->if_incoming = primary_if; 445 446 /* how often did we send the bcast packet ? */ 447 forw_packet->num_packets = 0; --- 175 unchanged lines hidden --- |