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
9abe7c66
Commit
9abe7c66
authored
Oct 02, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teach send*request to send multihop requests.
parent
77527e09
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
19 deletions
+35
-19
babel.c
babel.c
+2
-2
message.c
message.c
+21
-11
message.h
message.h
+6
-2
neighbour.c
neighbour.c
+1
-1
route.c
route.c
+5
-3
No files found.
babel.c
View file @
9abe7c66
...
...
@@ -385,7 +385,7 @@ main(int argc, char **argv)
for
(
i
=
0
;
i
<
numnets
;
i
++
)
{
gettimeofday
(
&
now
,
NULL
);
send_hello
(
&
nets
[
i
]);
send_request
(
&
nets
[
i
],
NULL
,
0
);
send_request
(
&
nets
[
i
],
NULL
,
0
,
0
,
0
,
0
);
flushbuf
(
&
nets
[
i
]);
usleep
(
50000
+
random
()
%
100000
);
}
...
...
@@ -394,7 +394,7 @@ main(int argc, char **argv)
gettimeofday
(
&
now
,
NULL
);
send_hello
(
&
nets
[
i
]);
send_self_update
(
&
nets
[
i
],
0
);
send_request
(
&
nets
[
i
],
NULL
,
0
);
send_request
(
&
nets
[
i
],
NULL
,
0
,
0
,
0
,
0
);
flushbuf
(
&
nets
[
i
]);
usleep
(
50000
+
random
()
%
100000
);
}
...
...
message.c
View file @
9abe7c66
...
...
@@ -377,20 +377,23 @@ send_hello(struct network *net)
void
send_request
(
struct
network
*
net
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
char
hop_count
,
unsigned
short
seqno
,
unsigned
short
router_hash
)
{
int
i
;
if
(
net
==
NULL
)
{
for
(
i
=
0
;
i
<
numnets
;
i
++
)
send_request
(
&
nets
[
i
],
prefix
,
plen
);
send_request
(
&
nets
[
i
],
prefix
,
plen
,
hop_count
,
seqno
,
router_hash
);
return
;
}
debugf
(
"Sending request to %s for %s.
\n
"
,
net
->
ifname
,
prefix
?
format_prefix
(
prefix
,
plen
)
:
"any"
);
debugf
(
"Sending request to %s for %s (%d hops).
\n
"
,
net
->
ifname
,
prefix
?
format_prefix
(
prefix
,
plen
)
:
"any"
,
hop_count
);
if
(
prefix
)
send_message
(
net
,
2
,
plen
,
0
,
0
,
0
,
prefix
);
send_message
(
net
,
2
,
plen
,
hop_count
,
seqno
,
router_hash
,
prefix
);
else
send_message
(
net
,
2
,
0xFF
,
0
,
0
,
0
,
ones
);
}
...
...
@@ -421,23 +424,30 @@ send_unicast_packet(struct neighbour *neigh, unsigned char *buf, int buflen)
void
send_unicast_request
(
struct
neighbour
*
neigh
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
char
hop_count
,
unsigned
short
seqno
,
unsigned
short
router_hash
)
{
unsigned
char
buf
[
24
];
debugf
(
"Sending unicast request to %s (%s) for %s.
\n
"
,
debugf
(
"Sending unicast request to %s (%s) for %s
(%d hops)
.
\n
"
,
format_address
(
neigh
->
id
),
format_address
(
neigh
->
address
),
prefix
?
format_prefix
(
prefix
,
plen
)
:
"any"
);
prefix
?
format_prefix
(
prefix
,
plen
)
:
"any"
,
hop_count
);
memset
(
buf
,
0
,
24
);
buf
[
0
]
=
1
;
if
(
prefix
)
{
buf
[
1
]
=
plen
;
buf
[
2
]
=
0
;
buf
[
3
]
=
hop_count
;
*
(
uint16_t
*
)(
buf
+
4
)
=
seqno
;
*
(
uint16_t
*
)(
buf
+
6
)
=
router_hash
;
memcpy
(
buf
+
8
,
prefix
,
16
);
buf
[
7
]
=
plen
;
}
else
{
buf
[
1
]
=
0xFF
;
memset
(
buf
+
2
,
0
,
6
);
memcpy
(
buf
+
8
,
ones
,
16
);
buf
[
7
]
=
0xFF
;
}
send_unicast_packet
(
neigh
,
buf
,
24
);
}
...
...
message.h
View file @
9abe7c66
...
...
@@ -41,9 +41,13 @@ void flushbuf(struct network *net);
void
send_hello_noupdate
(
struct
network
*
net
,
unsigned
interval
);
void
send_hello
(
struct
network
*
net
);
void
send_request
(
struct
network
*
net
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
char
hop_count
,
unsigned
short
seqno
,
unsigned
short
router_hash
);
void
send_unicast_request
(
struct
neighbour
*
neigh
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
char
hop_count
,
unsigned
short
seqno
,
unsigned
short
router_hash
);
void
send_update
(
struct
network
*
net
,
int
urgent
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
void
send_self_update
(
struct
network
*
net
,
int
force_seqno
);
...
...
neighbour.c
View file @
9abe7c66
...
...
@@ -199,7 +199,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
if
(
!
martian_prefix
(
neigh
->
id
,
128
))
route
=
find_installed_route
(
neigh
->
id
,
128
);
if
(
!
route
||
route
->
metric
>=
INFINITY
||
route
->
nexthop
==
neigh
)
send_unicast_request
(
neigh
,
NULL
,
0
);
send_unicast_request
(
neigh
,
NULL
,
0
,
0
,
0
,
0
);
}
return
rc
;
}
...
...
route.c
View file @
9abe7c66
...
...
@@ -460,7 +460,8 @@ send_triggered_update(struct route *route, struct source *oldsrc, int oldmetric)
if
(
oldmetric
<
INFINITY
)
{
if
(
newmetric
>=
INFINITY
||
newmetric
>=
oldmetric
+
384
)
send_request
(
NULL
,
route
->
src
->
prefix
,
route
->
src
->
plen
);
send_request
(
NULL
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
0
,
0
,
0
);
}
}
...
...
@@ -503,7 +504,7 @@ route_lost(struct source *src, int oldmetric)
/* Complain loudly. */
send_update
(
NULL
,
1
,
src
->
prefix
,
src
->
plen
);
if
(
oldmetric
<
INFINITY
)
send_request
(
NULL
,
src
->
prefix
,
src
->
plen
);
send_request
(
NULL
,
src
->
prefix
,
src
->
plen
,
0
,
0
,
0
);
}
}
...
...
@@ -528,7 +529,8 @@ expire_routes(void)
if
(
route
->
installed
&&
route
->
refmetric
<
INFINITY
)
{
if
(
route
->
time
<
now
.
tv_sec
-
MAX
(
10
,
route_timeout_delay
-
25
))
send_unicast_request
(
route
->
nexthop
,
route
->
src
->
prefix
,
route
->
src
->
plen
);
route
->
src
->
prefix
,
route
->
src
->
plen
,
0
,
0
,
0
);
}
i
++
;
}
...
...
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