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
da59d46e
Commit
da59d46e
authored
Jun 28, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First tack at multihop requests.
parent
c75fc69a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
14 deletions
+31
-14
babel.c
babel.c
+5
-3
babel.h
babel.h
+1
-0
message.c
message.c
+18
-6
message.h
message.h
+4
-2
neighbour.c
neighbour.c
+1
-1
route.c
route.c
+2
-2
No files found.
babel.c
View file @
da59d46e
...
@@ -64,6 +64,8 @@ int wired_hello_interval = -1;
...
@@ -64,6 +64,8 @@ int wired_hello_interval = -1;
int
idle_hello_interval
=
-
1
;
int
idle_hello_interval
=
-
1
;
int
update_interval
=
-
1
;
int
update_interval
=
-
1
;
int
max_hopcount
=
25
;
struct
network
nets
[
MAXNETS
];
struct
network
nets
[
MAXNETS
];
int
numnets
=
0
;
int
numnets
=
0
;
...
@@ -367,14 +369,14 @@ main(int argc, char **argv)
...
@@ -367,14 +369,14 @@ main(int argc, char **argv)
/* Make some noise so others notice us */
/* Make some noise so others notice us */
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
send_hello
(
&
nets
[
i
]);
send_hello
(
&
nets
[
i
]);
send_request
(
&
nets
[
i
],
NULL
);
send_request
(
&
nets
[
i
],
NULL
,
0
);
}
}
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
usleep
(
50000
+
random
()
%
100000
);
usleep
(
50000
+
random
()
%
100000
);
flushbuf
(
&
nets
[
i
]);
flushbuf
(
&
nets
[
i
]);
send_hello
(
&
nets
[
i
]);
send_hello
(
&
nets
[
i
]);
send_self_update
(
&
nets
[
i
],
0
);
send_self_update
(
&
nets
[
i
],
0
);
send_request
(
&
nets
[
i
],
NULL
);
send_request
(
&
nets
[
i
],
NULL
,
0
);
}
}
debugf
(
"Entering main loop.
\n
"
);
debugf
(
"Entering main loop.
\n
"
);
...
@@ -740,7 +742,7 @@ expire_routes(void)
...
@@ -740,7 +742,7 @@ expire_routes(void)
if
(
route
->
installed
&&
route
->
refmetric
<
INFINITY
)
{
if
(
route
->
installed
&&
route
->
refmetric
<
INFINITY
)
{
if
(
route
->
time
<
now
.
tv_sec
-
MAX
(
5
,
route_timeout_delay
-
25
))
if
(
route
->
time
<
now
.
tv_sec
-
MAX
(
5
,
route_timeout_delay
-
25
))
send_unicast_request
(
route
->
nexthop
,
route
->
dest
);
send_unicast_request
(
route
->
nexthop
,
route
->
dest
,
0
);
}
}
i
++
;
i
++
;
}
}
...
...
babel.h
View file @
da59d46e
...
@@ -96,5 +96,6 @@ extern int protocol_port;
...
@@ -96,5 +96,6 @@ extern int protocol_port;
extern
unsigned
char
protocol_group
[
16
];
extern
unsigned
char
protocol_group
[
16
];
extern
int
protocol_socket
;
extern
int
protocol_socket
;
extern
int
kernel_socket
;
extern
int
kernel_socket
;
extern
int
max_hopcount
;
void
update_hello_interval
(
struct
network
*
net
);
void
update_hello_interval
(
struct
network
*
net
);
message.c
View file @
da59d46e
...
@@ -294,13 +294,13 @@ send_hello(struct network *net)
...
@@ -294,13 +294,13 @@ send_hello(struct network *net)
}
}
void
void
send_request
(
struct
network
*
net
,
struct
destination
*
dest
)
send_request
(
struct
network
*
net
,
struct
destination
*
dest
,
int
hopcount
)
{
{
int
i
;
int
i
;
if
(
net
==
NULL
)
{
if
(
net
==
NULL
)
{
for
(
i
=
0
;
i
<
numnets
;
i
++
)
for
(
i
=
0
;
i
<
numnets
;
i
++
)
send_request
(
&
nets
[
i
],
dest
);
send_request
(
&
nets
[
i
],
dest
,
hopcount
);
return
;
return
;
}
}
...
@@ -308,8 +308,14 @@ send_request(struct network *net, struct destination *dest)
...
@@ -308,8 +308,14 @@ send_request(struct network *net, struct destination *dest)
net
->
ifname
,
dest
?
format_address
(
dest
->
address
)
:
"::/0"
);
net
->
ifname
,
dest
?
format_address
(
dest
->
address
)
:
"::/0"
);
start_message
(
net
,
20
);
start_message
(
net
,
20
);
accumulate_byte
(
net
,
1
);
accumulate_byte
(
net
,
1
);
if
(
hopcount
>
0
&&
dest
)
{
accumulate_byte
(
net
,
dest
->
seqno
);
accumulate_byte
(
net
,
hopcount
);
}
else
{
accumulate_byte
(
net
,
0
);
accumulate_byte
(
net
,
0
);
}
accumulate_byte
(
net
,
0
);
accumulate_byte
(
net
,
0
);
accumulate_short
(
net
,
0
);
accumulate_data
(
net
,
dest
?
dest
->
address
:
zeroes
,
16
);
accumulate_data
(
net
,
dest
?
dest
->
address
:
zeroes
,
16
);
schedule_flush
(
net
);
schedule_flush
(
net
);
}
}
...
@@ -340,7 +346,8 @@ send_unicast_packet(struct neighbour *neigh, unsigned char *buf, int buflen)
...
@@ -340,7 +346,8 @@ send_unicast_packet(struct neighbour *neigh, unsigned char *buf, int buflen)
void
void
send_unicast_request
(
struct
neighbour
*
neigh
,
struct
destination
*
dest
)
send_unicast_request
(
struct
neighbour
*
neigh
,
struct
destination
*
dest
,
int
hopcount
)
{
{
unsigned
char
buf
[
20
];
unsigned
char
buf
[
20
];
...
@@ -350,8 +357,13 @@ send_unicast_request(struct neighbour *neigh, struct destination *dest)
...
@@ -350,8 +357,13 @@ send_unicast_request(struct neighbour *neigh, struct destination *dest)
dest
?
format_address
(
dest
->
address
)
:
"::/0"
);
dest
?
format_address
(
dest
->
address
)
:
"::/0"
);
buf
[
0
]
=
1
;
buf
[
0
]
=
1
;
buf
[
1
]
=
0
;
if
(
hopcount
>
0
&&
dest
)
{
buf
[
2
]
=
0
;
buf
[
1
]
=
dest
->
seqno
;
buf
[
2
]
=
hopcount
;
}
else
{
buf
[
1
]
=
0
;
buf
[
2
]
=
0
;
}
buf
[
3
]
=
0
;
buf
[
3
]
=
0
;
if
(
dest
==
NULL
)
if
(
dest
==
NULL
)
memset
(
buf
+
4
,
0
,
16
);
memset
(
buf
+
4
,
0
,
16
);
...
...
message.h
View file @
da59d46e
...
@@ -39,8 +39,10 @@ void parse_packet(const unsigned char *from, struct network *net,
...
@@ -39,8 +39,10 @@ void parse_packet(const unsigned char *from, struct network *net,
const
unsigned
char
*
packet
,
int
len
);
const
unsigned
char
*
packet
,
int
len
);
void
flushbuf
(
struct
network
*
net
);
void
flushbuf
(
struct
network
*
net
);
void
send_hello
(
struct
network
*
net
);
void
send_hello
(
struct
network
*
net
);
void
send_request
(
struct
network
*
net
,
struct
destination
*
dest
);
void
send_request
(
struct
network
*
net
,
struct
destination
*
dest
,
void
send_unicast_request
(
struct
neighbour
*
neigh
,
struct
destination
*
dest
);
int
hopcount
);
void
send_unicast_request
(
struct
neighbour
*
neigh
,
struct
destination
*
dest
,
int
hopcount
);
void
send_update
(
struct
destination
*
dest
,
struct
network
*
net
);
void
send_update
(
struct
destination
*
dest
,
struct
network
*
net
);
void
send_self_update
(
struct
network
*
net
,
int
force_seqno
);
void
send_self_update
(
struct
network
*
net
,
int
force_seqno
);
void
send_self_retract
(
struct
network
*
net
);
void
send_self_retract
(
struct
network
*
net
);
...
...
neighbour.c
View file @
da59d46e
...
@@ -174,7 +174,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
...
@@ -174,7 +174,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
if
(
dest
)
if
(
dest
)
route
=
find_best_route
(
dest
);
route
=
find_best_route
(
dest
);
if
(
!
route
||
route
->
nexthop
==
neigh
)
if
(
!
route
||
route
->
nexthop
==
neigh
)
send_unicast_request
(
neigh
,
NULL
);
send_unicast_request
(
neigh
,
NULL
,
0
);
}
}
}
}
...
...
route.c
View file @
da59d46e
...
@@ -100,7 +100,7 @@ flush_route(struct route *route)
...
@@ -100,7 +100,7 @@ flush_route(struct route *route)
dest
->
seqno
=
(
dest
->
seqno
+
1
)
&
0xFF
;
dest
->
seqno
=
(
dest
->
seqno
+
1
)
&
0xFF
;
}
}
send_update
(
route
->
dest
,
NULL
);
send_update
(
route
->
dest
,
NULL
);
send_request
(
NULL
,
route
->
dest
);
send_request
(
NULL
,
route
->
dest
,
max_hopcount
);
}
}
}
}
}
}
...
@@ -431,6 +431,6 @@ send_triggered_update(struct route *route, int oldmetric)
...
@@ -431,6 +431,6 @@ send_triggered_update(struct route *route, int oldmetric)
if
(
route
->
metric
-
oldmetric
>=
384
)
{
if
(
route
->
metric
-
oldmetric
>=
384
)
{
/* This route's metric has increased a lot -- let's hope we find
/* This route's metric has increased a lot -- let's hope we find
something better */
something better */
send_request
(
NULL
,
route
->
dest
);
send_request
(
NULL
,
route
->
dest
,
0
);
}
}
}
}
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