Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
d0b9fd89
Commit
d0b9fd89
authored
Jul 30, 2011
by
Marek Lindner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
batman-adv: move routing packet initialization into corresponding file
Signed-off-by:
Marek Lindner
<
lindner_marek@yahoo.de
>
parent
fc957275
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
32 deletions
+46
-32
net/batman-adv/bat_iv_ogm.c
net/batman-adv/bat_iv_ogm.c
+37
-0
net/batman-adv/bat_ogm.h
net/batman-adv/bat_ogm.h
+3
-0
net/batman-adv/hard-interface.c
net/batman-adv/hard-interface.c
+6
-32
No files found.
net/batman-adv/bat_iv_ogm.c
View file @
d0b9fd89
...
...
@@ -30,6 +30,43 @@
#include "hard-interface.h"
#include "send.h"
void
bat_ogm_init
(
struct
hard_iface
*
hard_iface
)
{
struct
batman_ogm_packet
*
batman_ogm_packet
;
hard_iface
->
packet_len
=
BATMAN_OGM_LEN
;
hard_iface
->
packet_buff
=
kmalloc
(
hard_iface
->
packet_len
,
GFP_ATOMIC
);
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
hard_iface
->
packet_buff
;
batman_ogm_packet
->
packet_type
=
BAT_OGM
;
batman_ogm_packet
->
version
=
COMPAT_VERSION
;
batman_ogm_packet
->
flags
=
NO_FLAGS
;
batman_ogm_packet
->
ttl
=
2
;
batman_ogm_packet
->
tq
=
TQ_MAX_VALUE
;
batman_ogm_packet
->
tt_num_changes
=
0
;
batman_ogm_packet
->
ttvn
=
0
;
}
void
bat_ogm_init_primary
(
struct
hard_iface
*
hard_iface
)
{
struct
batman_ogm_packet
*
batman_ogm_packet
;
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
hard_iface
->
packet_buff
;
batman_ogm_packet
->
flags
=
PRIMARIES_FIRST_HOP
;
batman_ogm_packet
->
ttl
=
TTL
;
}
void
bat_ogm_update_mac
(
struct
hard_iface
*
hard_iface
)
{
struct
batman_ogm_packet
*
batman_ogm_packet
;
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
hard_iface
->
packet_buff
;
memcpy
(
batman_ogm_packet
->
orig
,
hard_iface
->
net_dev
->
dev_addr
,
ETH_ALEN
);
memcpy
(
batman_ogm_packet
->
prev_sender
,
hard_iface
->
net_dev
->
dev_addr
,
ETH_ALEN
);
}
/* is there another aggregated packet here? */
static
int
bat_ogm_aggr_packet
(
int
buff_pos
,
int
packet_len
,
int
tt_num_changes
)
...
...
net/batman-adv/bat_ogm.h
View file @
d0b9fd89
...
...
@@ -24,6 +24,9 @@
#include "main.h"
void
bat_ogm_init
(
struct
hard_iface
*
hard_iface
);
void
bat_ogm_init_primary
(
struct
hard_iface
*
hard_iface
);
void
bat_ogm_update_mac
(
struct
hard_iface
*
hard_iface
);
void
bat_ogm_receive
(
const
struct
ethhdr
*
ethhdr
,
unsigned
char
*
packet_buff
,
int
packet_len
,
struct
hard_iface
*
if_incoming
);
...
...
net/batman-adv/hard-interface.c
View file @
d0b9fd89
...
...
@@ -28,6 +28,7 @@
#include "bat_sysfs.h"
#include "originator.h"
#include "hash.h"
#include "bat_ogm.h"
#include <linux/if_arp.h>
...
...
@@ -131,7 +132,6 @@ static void primary_if_select(struct bat_priv *bat_priv,
struct
hard_iface
*
new_hard_iface
)
{
struct
hard_iface
*
curr_hard_iface
;
struct
batman_ogm_packet
*
batman_ogm_packet
;
ASSERT_RTNL
();
...
...
@@ -147,11 +147,7 @@ static void primary_if_select(struct bat_priv *bat_priv,
if
(
!
new_hard_iface
)
return
;
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
(
new_hard_iface
->
packet_buff
);
batman_ogm_packet
->
flags
=
PRIMARIES_FIRST_HOP
;
batman_ogm_packet
->
ttl
=
TTL
;
bat_ogm_init_primary
(
new_hard_iface
);
primary_if_update_addr
(
bat_priv
);
}
...
...
@@ -163,17 +159,6 @@ static bool hardif_is_iface_up(const struct hard_iface *hard_iface)
return
false
;
}
static
void
update_mac_addresses
(
struct
hard_iface
*
hard_iface
)
{
struct
batman_ogm_packet
*
batman_ogm_packet
;
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
hard_iface
->
packet_buff
;
memcpy
(
batman_ogm_packet
->
orig
,
hard_iface
->
net_dev
->
dev_addr
,
ETH_ALEN
);
memcpy
(
batman_ogm_packet
->
prev_sender
,
hard_iface
->
net_dev
->
dev_addr
,
ETH_ALEN
);
}
static
void
check_known_mac_addr
(
const
struct
net_device
*
net_dev
)
{
const
struct
hard_iface
*
hard_iface
;
...
...
@@ -248,7 +233,7 @@ static void hardif_activate_interface(struct hard_iface *hard_iface)
bat_priv
=
netdev_priv
(
hard_iface
->
soft_iface
);
update_mac_addresses
(
hard_iface
);
bat_ogm_update_mac
(
hard_iface
);
hard_iface
->
if_status
=
IF_TO_BE_ACTIVATED
;
/**
...
...
@@ -287,7 +272,6 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
const
char
*
iface_name
)
{
struct
bat_priv
*
bat_priv
;
struct
batman_ogm_packet
*
batman_ogm_packet
;
struct
net_device
*
soft_iface
;
int
ret
;
...
...
@@ -322,8 +306,8 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
hard_iface
->
soft_iface
=
soft_iface
;
bat_priv
=
netdev_priv
(
hard_iface
->
soft_iface
);
hard_iface
->
packet_len
=
BATMAN_OGM_LEN
;
hard_iface
->
packet_buff
=
kmalloc
(
hard_iface
->
packet_len
,
GFP_ATOMIC
);
bat_ogm_init
(
hard_iface
);
if
(
!
hard_iface
->
packet_buff
)
{
bat_err
(
hard_iface
->
soft_iface
,
"Can't add interface packet "
...
...
@@ -332,16 +316,6 @@ int hardif_enable_interface(struct hard_iface *hard_iface,
goto
err
;
}
batman_ogm_packet
=
(
struct
batman_ogm_packet
*
)
(
hard_iface
->
packet_buff
);
batman_ogm_packet
->
packet_type
=
BAT_OGM
;
batman_ogm_packet
->
version
=
COMPAT_VERSION
;
batman_ogm_packet
->
flags
=
NO_FLAGS
;
batman_ogm_packet
->
ttl
=
2
;
batman_ogm_packet
->
tq
=
TQ_MAX_VALUE
;
batman_ogm_packet
->
tt_num_changes
=
0
;
batman_ogm_packet
->
ttvn
=
0
;
hard_iface
->
if_num
=
bat_priv
->
num_ifaces
;
bat_priv
->
num_ifaces
++
;
hard_iface
->
if_status
=
IF_INACTIVE
;
...
...
@@ -556,7 +530,7 @@ static int hard_if_event(struct notifier_block *this,
goto
hardif_put
;
check_known_mac_addr
(
hard_iface
->
net_dev
);
update_mac_addresses
(
hard_iface
);
bat_ogm_update_mac
(
hard_iface
);
bat_priv
=
netdev_priv
(
hard_iface
->
soft_iface
);
primary_if
=
primary_if_get_selected
(
bat_priv
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment