Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
3513e223
Commit
3513e223
authored
Feb 02, 2011
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First implementation of channel diversity with memory.
parent
939c5b34
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
12 deletions
+33
-12
route.c
route.c
+25
-7
route.h
route.h
+8
-5
No files found.
route.c
View file @
3513e223
...
...
@@ -289,6 +289,16 @@ route_expired(struct route *route)
return
route
->
time
<
now
.
tv_sec
-
route
->
hold_time
;
}
static
int
channels_interfere
(
unsigned
char
ch1
,
unsigned
char
ch2
)
{
if
(
ch1
==
NET_CHANNEL_NONINTERFERING
||
ch2
==
NET_CHANNEL_NONINTERFERING
)
return
0
;
if
(
ch1
==
NET_CHANNEL_INTERFERING
||
ch2
==
NET_CHANNEL_INTERFERING
)
return
1
;
return
ch1
==
ch2
;
}
int
route_interferes
(
struct
route
*
route
,
struct
network
*
net
)
{
...
...
@@ -298,14 +308,21 @@ route_interferes(struct route *route, struct network *net)
case
DIVERSITY_INTERFACE_1
:
return
route
->
neigh
->
network
==
net
;
case
DIVERSITY_CHANNEL_1
:
if
(
route
->
neigh
->
network
->
channel
==
NET_CHANNEL_NONINTERFERING
||
net
->
channel
==
NET_CHANNEL_NONINTERFERING
)
return
0
;
else
if
(
route
->
neigh
->
network
->
channel
==
NET_CHANNEL_INTERFERING
||
net
->
channel
==
NET_CHANNEL_INTERFERING
)
case
DIVERSITY_CHANNEL
:
if
(
route
->
neigh
->
network
==
net
)
return
1
;
else
return
route
->
neigh
->
network
->
channel
==
net
->
channel
;
if
(
channels_interfere
(
net
->
channel
,
route
->
neigh
->
network
->
channel
))
return
1
;
if
(
diversity_kind
==
DIVERSITY_CHANNEL
)
{
int
i
;
for
(
i
=
0
;
i
<
DIVERSITY_HOPS
;
i
++
)
{
if
(
route
->
channels
[
i
]
==
0
)
break
;
if
(
channels_interfere
(
net
->
channel
,
route
->
channels
[
i
]))
return
1
;
}
}
return
0
;
default:
fprintf
(
stderr
,
"Unknown kind of diversity.
\n
"
);
return
1
;
...
...
@@ -510,6 +527,7 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
route
->
time
=
now
.
tv_sec
;
route
->
hold_time
=
hold_time
;
route
->
installed
=
0
;
memset
(
&
route
->
channels
,
0
,
sizeof
(
route
->
channels
));
numroutes
++
;
local_notify_route
(
route
,
LOCAL_ADD
);
consider_route
(
route
);
...
...
route.h
View file @
3513e223
...
...
@@ -20,6 +20,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#define DIVERSITY_NONE 0
#define DIVERSITY_INTERFACE_1 1
#define DIVERSITY_CHANNEL_1 2
#define DIVERSITY_CHANNEL 3
#define DIVERSITY_HOPS 8
struct
route
{
struct
source
*
src
;
unsigned
short
refmetric
;
...
...
@@ -31,6 +38,7 @@ struct route {
time_t
time
;
unsigned
short
hold_time
;
/* in seconds */
short
installed
;
unsigned
char
channels
[
DIVERSITY_HOPS
];
};
static
inline
int
...
...
@@ -40,11 +48,6 @@ route_metric(const struct route *route)
return
MIN
(
m
,
INFINITY
);
}
#define DIVERSITY_NONE 0
#define DIVERSITY_INTERFACE_1 1
#define DIVERSITY_CHANNEL_1 2
#define DIVERSITY_CHANNEL 3
extern
struct
route
*
routes
;
extern
int
numroutes
,
maxroutes
;
extern
int
kernel_metric
,
allow_duplicates
;
...
...
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