Skip to content

Commit

Permalink
batman-adv: Prefix packet structs with batadv_
Browse files Browse the repository at this point in the history
Reported-by: Martin Hundebøll <[email protected]>
Signed-off-by: Sven Eckelmann <[email protected]>
  • Loading branch information
ecsv authored and Antonio Quartulli committed Jul 1, 2012
1 parent b4d66b8 commit 9641269
Show file tree
Hide file tree
Showing 19 changed files with 369 additions and 347 deletions.
258 changes: 129 additions & 129 deletions net/batman-adv/bat_iv_ogm.c

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions net/batman-adv/bridge_loop_avoidance.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static void batadv_bla_send_claim(struct bat_priv *bat_priv, uint8_t *mac,
struct hard_iface *primary_if;
struct net_device *soft_iface;
uint8_t *hw_src;
struct bla_claim_dst local_claim_dest;
struct batadv_bla_claim_dst local_claim_dest;
__be32 zeroip = 0;

primary_if = batadv_primary_if_get_selected(bat_priv);
Expand Down Expand Up @@ -759,9 +759,9 @@ static int batadv_check_claim_group(struct bat_priv *bat_priv,
{
uint8_t *backbone_addr;
struct orig_node *orig_node;
struct bla_claim_dst *bla_dst, *bla_dst_own;
struct batadv_bla_claim_dst *bla_dst, *bla_dst_own;

bla_dst = (struct bla_claim_dst *)hw_dst;
bla_dst = (struct batadv_bla_claim_dst *)hw_dst;
bla_dst_own = &bat_priv->claim_dest;

/* check if it is a claim packet in general */
Expand Down Expand Up @@ -832,7 +832,7 @@ static int batadv_bla_process_claim(struct bat_priv *bat_priv,
struct vlan_ethhdr *vhdr;
struct arphdr *arphdr;
uint8_t *hw_src, *hw_dst;
struct bla_claim_dst *bla_dst;
struct batadv_bla_claim_dst *bla_dst;
uint16_t proto;
int headlen;
short vid = -1;
Expand Down Expand Up @@ -876,7 +876,7 @@ static int batadv_bla_process_claim(struct bat_priv *bat_priv,

hw_src = (uint8_t *)arphdr + sizeof(struct arphdr);
hw_dst = hw_src + ETH_ALEN + 4;
bla_dst = (struct bla_claim_dst *)hw_dst;
bla_dst = (struct batadv_bla_claim_dst *)hw_dst;

/* check if it is a claim frame. */
ret = batadv_check_claim_group(bat_priv, primary_if, hw_src, hw_dst,
Expand Down Expand Up @@ -1201,7 +1201,7 @@ int batadv_bla_init(struct bat_priv *bat_priv)
* the same host however as this might be intended.
*/
int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv,
struct bcast_packet *bcast_packet,
struct batadv_bcast_packet *bcast_packet,
int hdr_size)
{
int i, length, curr;
Expand Down
4 changes: 2 additions & 2 deletions net/batman-adv/bridge_loop_avoidance.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int batadv_bla_is_backbone_gw(struct sk_buff *skb,
int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);
int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv, uint8_t *orig);
int batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv,
struct bcast_packet *bcast_packet,
struct batadv_bcast_packet *bcast_packet,
int hdr_size);
void batadv_bla_update_orig_address(struct bat_priv *bat_priv,
struct hard_iface *primary_if,
Expand Down Expand Up @@ -72,7 +72,7 @@ static inline int batadv_bla_is_backbone_gw_orig(struct bat_priv *bat_priv,

static inline int
batadv_bla_check_bcast_duplist(struct bat_priv *bat_priv,
struct bcast_packet *bcast_packet,
struct batadv_bcast_packet *bcast_packet,
int hdr_size)
{
return 0;
Expand Down
4 changes: 2 additions & 2 deletions net/batman-adv/hard-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ batadv_hardif_get_active(const struct net_device *soft_iface)
static void batadv_primary_if_update_addr(struct bat_priv *bat_priv,
struct hard_iface *oldif)
{
struct vis_packet *vis_packet;
struct batadv_vis_packet *vis_packet;
struct hard_iface *primary_if;

primary_if = batadv_primary_if_get_selected(bat_priv);
if (!primary_if)
goto out;

vis_packet = (struct vis_packet *)
vis_packet = (struct batadv_vis_packet *)
bat_priv->my_vis_info->skb_packet->data;
memcpy(vis_packet->vis_orig, primary_if->net_dev->dev_addr, ETH_ALEN);
memcpy(vis_packet->sender_orig,
Expand Down
22 changes: 11 additions & 11 deletions net/batman-adv/icmp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
static struct socket_client *batadv_socket_client_hash[256];

static void batadv_socket_add_packet(struct socket_client *socket_client,
struct icmp_packet_rr *icmp_packet,
struct batadv_icmp_packet_rr *icmp_packet,
size_t icmp_len);

void batadv_socket_init(void)
Expand Down Expand Up @@ -112,7 +112,7 @@ static ssize_t batadv_socket_read(struct file *file, char __user *buf,
if ((file->f_flags & O_NONBLOCK) && (socket_client->queue_len == 0))
return -EAGAIN;

if ((!buf) || (count < sizeof(struct icmp_packet)))
if ((!buf) || (count < sizeof(struct batadv_icmp_packet)))
return -EINVAL;

if (!access_ok(VERIFY_WRITE, buf, count))
Expand Down Expand Up @@ -151,13 +151,13 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
struct bat_priv *bat_priv = socket_client->bat_priv;
struct hard_iface *primary_if = NULL;
struct sk_buff *skb;
struct icmp_packet_rr *icmp_packet;
struct batadv_icmp_packet_rr *icmp_packet;

struct orig_node *orig_node = NULL;
struct neigh_node *neigh_node = NULL;
size_t packet_len = sizeof(struct icmp_packet);
size_t packet_len = sizeof(struct batadv_icmp_packet);

if (len < sizeof(struct icmp_packet)) {
if (len < sizeof(struct batadv_icmp_packet)) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Error - can't send packet from char device: invalid packet size\n");
return -EINVAL;
Expand All @@ -170,8 +170,8 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
goto out;
}

if (len >= sizeof(struct icmp_packet_rr))
packet_len = sizeof(struct icmp_packet_rr);
if (len >= sizeof(struct batadv_icmp_packet_rr))
packet_len = sizeof(struct batadv_icmp_packet_rr);

skb = dev_alloc_skb(packet_len + ETH_HLEN);
if (!skb) {
Expand All @@ -180,7 +180,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
}

skb_reserve(skb, ETH_HLEN);
icmp_packet = (struct icmp_packet_rr *)skb_put(skb, packet_len);
icmp_packet = (struct batadv_icmp_packet_rr *)skb_put(skb, packet_len);

if (copy_from_user(icmp_packet, buff, packet_len)) {
len = -EFAULT;
Expand Down Expand Up @@ -231,7 +231,7 @@ static ssize_t batadv_socket_write(struct file *file, const char __user *buff,
memcpy(icmp_packet->orig,
primary_if->net_dev->dev_addr, ETH_ALEN);

if (packet_len == sizeof(struct icmp_packet_rr))
if (packet_len == sizeof(struct batadv_icmp_packet_rr))
memcpy(icmp_packet->rr,
neigh_node->if_incoming->net_dev->dev_addr, ETH_ALEN);

Expand Down Expand Up @@ -294,7 +294,7 @@ int batadv_socket_setup(struct bat_priv *bat_priv)
}

static void batadv_socket_add_packet(struct socket_client *socket_client,
struct icmp_packet_rr *icmp_packet,
struct batadv_icmp_packet_rr *icmp_packet,
size_t icmp_len)
{
struct socket_packet *socket_packet;
Expand Down Expand Up @@ -336,7 +336,7 @@ static void batadv_socket_add_packet(struct socket_client *socket_client,
wake_up(&socket_client->queue_wait);
}

void batadv_socket_receive_packet(struct icmp_packet_rr *icmp_packet,
void batadv_socket_receive_packet(struct batadv_icmp_packet_rr *icmp_packet,
size_t icmp_len)
{
struct socket_client *hash;
Expand Down
2 changes: 1 addition & 1 deletion net/batman-adv/icmp_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

void batadv_socket_init(void);
int batadv_socket_setup(struct bat_priv *bat_priv);
void batadv_socket_receive_packet(struct icmp_packet_rr *icmp_packet,
void batadv_socket_receive_packet(struct batadv_icmp_packet_rr *icmp_packet,
size_t icmp_len);

#endif /* _NET_BATMAN_ADV_ICMP_SOCKET_H_ */
10 changes: 5 additions & 5 deletions net/batman-adv/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
struct net_device *orig_dev)
{
struct bat_priv *bat_priv;
struct batman_ogm_packet *batman_ogm_packet;
struct batadv_ogm_packet *batadv_ogm_packet;
struct hard_iface *hard_iface;
uint8_t idx;
int ret;
Expand Down Expand Up @@ -237,19 +237,19 @@ int batadv_batman_skb_recv(struct sk_buff *skb, struct net_device *dev,
if (hard_iface->if_status != BATADV_IF_ACTIVE)
goto err_free;

batman_ogm_packet = (struct batman_ogm_packet *)skb->data;
batadv_ogm_packet = (struct batadv_ogm_packet *)skb->data;

if (batman_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
if (batadv_ogm_packet->header.version != BATADV_COMPAT_VERSION) {
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
"Drop packet: incompatible batman version (%i)\n",
batman_ogm_packet->header.version);
batadv_ogm_packet->header.version);
goto err_free;
}

/* all receive handlers return whether they received or reused
* the supplied skb. if not, we have to free the skb.
*/
idx = batman_ogm_packet->header.packet_type;
idx = batadv_ogm_packet->header.packet_type;
ret = (*batadv_rx_handler[idx])(skb, hard_iface);

if (ret == NET_RX_DROP)
Expand Down
44 changes: 22 additions & 22 deletions net/batman-adv/packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,20 @@ enum batadv_bla_claimframe {
/* the destination hardware field in the ARP frame is used to
* transport the claim type and the group id
*/
struct bla_claim_dst {
struct batadv_bla_claim_dst {
uint8_t magic[3]; /* FF:43:05 */
uint8_t type; /* bla_claimframe */
__be16 group; /* group id */
} __packed;

struct batman_header {
struct batadv_header {
uint8_t packet_type;
uint8_t version; /* batman version field */
uint8_t ttl;
} __packed;

struct batman_ogm_packet {
struct batman_header header;
struct batadv_ogm_packet {
struct batadv_header header;
uint8_t flags; /* 0x40: DIRECTLINK flag, 0x20 VIS_SERVER flag... */
__be32 seqno;
uint8_t orig[ETH_ALEN];
Expand All @@ -126,10 +126,10 @@ struct batman_ogm_packet {
__be16 tt_crc;
} __packed;

#define BATADV_OGM_HLEN sizeof(struct batman_ogm_packet)
#define BATADV_OGM_HLEN sizeof(struct batadv_ogm_packet)

struct icmp_packet {
struct batman_header header;
struct batadv_icmp_packet {
struct batadv_header header;
uint8_t msg_type; /* see ICMP message types above */
uint8_t dst[ETH_ALEN];
uint8_t orig[ETH_ALEN];
Expand All @@ -143,8 +143,8 @@ struct icmp_packet {
/* icmp_packet_rr must start with all fields from imcp_packet
* as this is assumed by code that handles ICMP packets
*/
struct icmp_packet_rr {
struct batman_header header;
struct batadv_icmp_packet_rr {
struct batadv_header header;
uint8_t msg_type; /* see ICMP message types above */
uint8_t dst[ETH_ALEN];
uint8_t orig[ETH_ALEN];
Expand All @@ -154,14 +154,14 @@ struct icmp_packet_rr {
uint8_t rr[BATADV_RR_LEN][ETH_ALEN];
} __packed;

struct unicast_packet {
struct batman_header header;
struct batadv_unicast_packet {
struct batadv_header header;
uint8_t ttvn; /* destination translation table version number */
uint8_t dest[ETH_ALEN];
} __packed;

struct unicast_frag_packet {
struct batman_header header;
struct batadv_unicast_frag_packet {
struct batadv_header header;
uint8_t ttvn; /* destination translation table version number */
uint8_t dest[ETH_ALEN];
uint8_t flags;
Expand All @@ -170,15 +170,15 @@ struct unicast_frag_packet {
__be16 seqno;
} __packed;

struct bcast_packet {
struct batman_header header;
struct batadv_bcast_packet {
struct batadv_header header;
uint8_t reserved;
__be32 seqno;
uint8_t orig[ETH_ALEN];
} __packed;

struct vis_packet {
struct batman_header header;
struct batadv_vis_packet {
struct batadv_header header;
uint8_t vis_type; /* which type of vis-participant sent this? */
__be32 seqno; /* sequence number */
uint8_t entries; /* number of entries behind this struct */
Expand All @@ -188,8 +188,8 @@ struct vis_packet {
uint8_t sender_orig[ETH_ALEN]; /* who sent or forwarded this packet */
} __packed;

struct tt_query_packet {
struct batman_header header;
struct batadv_tt_query_packet {
struct batadv_header header;
/* the flag field is a combination of:
* - TT_REQUEST or TT_RESPONSE
* - TT_FULL_TABLE
Expand All @@ -212,15 +212,15 @@ struct tt_query_packet {
__be16 tt_data;
} __packed;

struct roam_adv_packet {
struct batman_header header;
struct batadv_roam_adv_packet {
struct batadv_header header;
uint8_t reserved;
uint8_t dst[ETH_ALEN];
uint8_t src[ETH_ALEN];
uint8_t client[ETH_ALEN];
} __packed;

struct tt_change {
struct batadv_tt_change {
uint8_t flags;
uint8_t addr[ETH_ALEN];
} __packed;
Expand Down
Loading

0 comments on commit 9641269

Please sign in to comment.