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
497eeb51
Commit
497eeb51
authored
Mar 16, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename src->address to src->id.
parent
87e87774
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
32 deletions
+32
-32
babel.c
babel.c
+2
-2
message.c
message.c
+14
-14
route.c
route.c
+9
-9
route.h
route.h
+1
-1
source.c
source.c
+4
-4
source.h
source.h
+2
-2
No files found.
babel.c
View file @
497eeb51
...
...
@@ -894,7 +894,7 @@ dump_tables(FILE *out)
for
(
i
=
0
;
i
<
numroutes
;
i
++
)
{
int
id
=
routes
[
i
].
src
->
plen
!=
128
||
memcmp
(
routes
[
i
].
src
->
prefix
,
routes
[
i
].
src
->
address
,
16
)
!=
0
;
memcmp
(
routes
[
i
].
src
->
prefix
,
routes
[
i
].
src
->
id
,
16
)
!=
0
;
const
unsigned
char
*
nexthop
=
memcmp
(
routes
[
i
].
nexthop
,
routes
[
i
].
neigh
->
address
,
16
)
==
0
?
NULL
:
routes
[
i
].
nexthop
;
...
...
@@ -903,7 +903,7 @@ dump_tables(FILE *out)
format_prefix
(
routes
[
i
].
src
->
prefix
,
routes
[
i
].
src
->
plen
),
routes
[
i
].
metric
,
routes
[
i
].
refmetric
,
id
?
"id "
:
""
,
id
?
format_address
(
routes
[
i
].
src
->
address
)
:
""
,
id
?
format_address
(
routes
[
i
].
src
->
id
)
:
""
,
(
int
)
routes
[
i
].
seqno
,
(
int
)(
now
.
tv_sec
-
routes
[
i
].
time
),
routes
[
i
].
neigh
->
network
->
ifname
,
...
...
message.c
View file @
497eeb51
...
...
@@ -269,7 +269,7 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
if
(
route
&&
(
hop_count
==
0
||
(
route
->
metric
<
INFINITY
&&
(
router_hash
!=
hash_id
(
route
->
src
->
address
)
||
(
router_hash
!=
hash_id
(
route
->
src
->
id
)
||
seqno_compare
(
seqno
,
route
->
seqno
)
<=
0
))))
{
/* We can satisfy this request straight away. Note that in the
hop_count=0 case, we do send a recent retraction, in order to
...
...
@@ -281,7 +281,7 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
if
(
hop_count
<=
1
)
return
;
if
(
route
&&
router_hash
==
hash_id
(
route
->
src
->
address
)
&&
if
(
route
&&
router_hash
==
hash_id
(
route
->
src
->
id
)
&&
seqno_minus
(
seqno
,
route
->
seqno
)
>
100
)
{
/* Hopelessly out-of-date */
return
;
...
...
@@ -594,7 +594,7 @@ message_source_id(struct network *net)
static
void
really_send_update
(
struct
network
*
net
,
const
unsigned
char
*
address
,
const
unsigned
char
*
id
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
metric
)
{
...
...
@@ -603,7 +603,7 @@ really_send_update(struct network *net,
if
(
!
net
->
up
)
return
;
add_metric
=
output_filter
(
address
,
prefix
,
plen
,
net
->
ifindex
);
add_metric
=
output_filter
(
id
,
prefix
,
plen
,
net
->
ifindex
);
if
(
add_metric
<
INFINITY
)
{
if
(
plen
>=
96
&&
v4mapped
(
prefix
))
{
...
...
@@ -616,25 +616,25 @@ really_send_update(struct network *net,
memcpy
(
v4route
+
12
,
prefix
+
12
,
4
);
start_message
(
net
,
48
);
sid
=
message_source_id
(
net
);
if
(
sid
==
NULL
||
memcmp
(
address
,
sid
,
16
)
!=
0
)
send_message
(
net
,
3
,
0xFF
,
0
,
0
,
0xFFFF
,
address
);
if
(
sid
==
NULL
||
memcmp
(
id
,
sid
,
16
)
!=
0
)
send_message
(
net
,
3
,
0xFF
,
0
,
0
,
0xFFFF
,
id
);
send_message
(
net
,
5
,
plen
-
96
,
0
,
seqno
,
metric
+
add_metric
,
v4route
);
}
else
{
if
(
in_prefix
(
address
,
prefix
,
plen
))
{
send_message
(
net
,
3
,
plen
,
0
,
seqno
,
metric
,
address
);
if
(
in_prefix
(
id
,
prefix
,
plen
))
{
send_message
(
net
,
3
,
plen
,
0
,
seqno
,
metric
,
id
);
}
else
{
const
unsigned
char
*
sid
;
start_message
(
net
,
48
);
sid
=
message_source_id
(
net
);
if
(
sid
==
NULL
||
memcmp
(
address
,
sid
,
16
)
!=
0
)
send_message
(
net
,
3
,
0xFF
,
0
,
0
,
0xFFFF
,
address
);
if
(
sid
==
NULL
||
memcmp
(
id
,
sid
,
16
)
!=
0
)
send_message
(
net
,
3
,
0xFF
,
0
,
0
,
0xFFFF
,
id
);
send_message
(
net
,
4
,
plen
,
0
,
seqno
,
metric
+
add_metric
,
prefix
);
}
}
}
satisfy_request
(
prefix
,
plen
,
seqno
,
hash_id
(
address
),
net
);
satisfy_request
(
prefix
,
plen
,
seqno
,
hash_id
(
id
),
net
);
}
void
...
...
@@ -672,7 +672,7 @@ flushupdates(void)
continue
;
seqno
=
route
->
seqno
;
metric
=
route
->
metric
;
really_send_update
(
net
,
route
->
src
->
address
,
really_send_update
(
net
,
route
->
src
->
id
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
seqno
,
metric
);
...
...
@@ -682,7 +682,7 @@ flushupdates(void)
src
=
find_recent_source
(
buffered_updates
[
i
].
prefix
,
buffered_updates
[
i
].
plen
);
if
(
src
)
{
really_send_update
(
net
,
src
->
address
,
src
->
prefix
,
src
->
plen
,
really_send_update
(
net
,
src
->
id
,
src
->
prefix
,
src
->
plen
,
src
->
metric
>=
INFINITY
?
src
->
seqno
:
seqno_plus
(
src
->
seqno
,
1
),
INFINITY
);
...
...
@@ -751,7 +751,7 @@ send_update(struct network *net, int urgent,
if
(
route
)
{
urgent
=
1
;
satisfy_request
(
prefix
,
plen
,
route
->
seqno
,
hash_id
(
route
->
src
->
address
),
net
);
hash_id
(
route
->
src
->
id
),
net
);
}
}
}
...
...
route.c
View file @
497eeb51
...
...
@@ -214,17 +214,17 @@ change_route_metric(struct route *route, int newmetric)
int
route_feasible
(
struct
route
*
route
)
{
return
update_feasible
(
route
->
src
->
address
,
return
update_feasible
(
route
->
src
->
id
,
route
->
src
->
prefix
,
route
->
src
->
plen
,
route
->
seqno
,
route
->
refmetric
);
}
int
update_feasible
(
const
unsigned
char
*
a
,
update_feasible
(
const
unsigned
char
*
id
,
const
unsigned
char
*
p
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
refmetric
)
{
struct
source
*
src
=
find_source
(
a
,
p
,
plen
,
0
,
0
);
struct
source
*
src
=
find_source
(
id
,
p
,
plen
,
0
,
0
);
if
(
src
==
NULL
)
return
1
;
...
...
@@ -404,9 +404,9 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
debugf
(
"Unfeasible update for installed route to %s "
"(%s %d %d -> %s %d %d).
\n
"
,
format_prefix
(
src
->
prefix
,
src
->
plen
),
format_address
(
route
->
src
->
address
),
format_address
(
route
->
src
->
id
),
route
->
seqno
,
route
->
refmetric
,
format_address
(
src
->
address
),
seqno
,
refmetric
);
format_address
(
src
->
id
),
seqno
,
refmetric
);
uninstall_route
(
route
);
lost
=
1
;
}
...
...
@@ -477,7 +477,7 @@ send_unfeasible_request(struct neighbour *neigh,
send_request_resend
(
neigh
,
prefix
,
plen
,
src
->
metric
>=
INFINITY
?
src
->
seqno
:
seqno_plus
(
src
->
seqno
,
1
),
hash_id
(
src
->
address
));
hash_id
(
src
->
id
));
}
}
...
...
@@ -552,7 +552,7 @@ send_triggered_update(struct route *route, struct source *oldsrc, int oldmetric)
/* Make sure that requests are satisfied speedily */
if
(
unsatisfied_request
(
route
->
src
->
prefix
,
route
->
src
->
plen
,
route
->
seqno
,
hash_id
(
route
->
src
->
address
)))
route
->
seqno
,
hash_id
(
route
->
src
->
id
)))
urgent
=
1
;
if
(
urgent
||
...
...
@@ -567,7 +567,7 @@ send_triggered_update(struct route *route, struct source *oldsrc, int oldmetric)
route
->
src
->
metric
>=
INFINITY
?
route
->
src
->
seqno
:
seqno_plus
(
route
->
src
->
seqno
,
1
),
hash_id
(
route
->
src
->
address
));
hash_id
(
route
->
src
->
id
));
}
else
if
(
newmetric
>=
oldmetric
+
288
)
{
/* Ensure that the update goes out before the request */
flushupdates
();
...
...
@@ -618,7 +618,7 @@ route_lost(struct source *src, int oldmetric)
send_request_resend
(
NULL
,
src
->
prefix
,
src
->
plen
,
src
->
metric
>=
INFINITY
?
src
->
seqno
:
seqno_plus
(
src
->
seqno
,
1
),
hash_id
(
src
->
address
));
hash_id
(
src
->
id
));
}
}
...
...
route.h
View file @
497eeb51
...
...
@@ -49,7 +49,7 @@ void uninstall_route(struct route *route);
void
change_route
(
struct
route
*
old
,
struct
route
*
new
);
void
change_route_metric
(
struct
route
*
route
,
int
newmetric
);
int
route_feasible
(
struct
route
*
route
);
int
update_feasible
(
const
unsigned
char
*
a
,
int
update_feasible
(
const
unsigned
char
*
id
,
const
unsigned
char
*
p
,
unsigned
char
plen
,
unsigned
short
seqno
,
unsigned
short
refmetric
);
struct
route
*
find_best_route
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
,
...
...
source.c
View file @
497eeb51
...
...
@@ -34,7 +34,7 @@ struct source srcs[MAXSRCS];
int
numsrcs
=
0
;
struct
source
*
find_source
(
const
unsigned
char
*
a
,
const
unsigned
char
*
p
,
unsigned
char
plen
,
find_source
(
const
unsigned
char
*
id
,
const
unsigned
char
*
p
,
unsigned
char
plen
,
int
create
,
unsigned
short
seqno
)
{
struct
source
*
src
;
...
...
@@ -45,9 +45,9 @@ find_source(const unsigned char *a, const unsigned char *p, unsigned char plen,
continue
;
/* This should really be a hash table. For now, check the
last byte first. */
if
(
srcs
[
i
].
address
[
15
]
!=
a
[
15
])
if
(
srcs
[
i
].
id
[
15
]
!=
id
[
15
])
continue
;
if
(
memcmp
(
srcs
[
i
].
address
,
a
,
16
)
!=
0
)
if
(
memcmp
(
srcs
[
i
].
id
,
id
,
16
)
!=
0
)
continue
;
if
(
source_match
(
&
srcs
[
i
],
p
,
plen
))
return
&
srcs
[
i
];
...
...
@@ -79,7 +79,7 @@ find_source(const unsigned char *a, const unsigned char *p, unsigned char plen,
}
src
->
valid
=
1
;
memcpy
(
src
->
address
,
a
,
16
);
memcpy
(
src
->
id
,
id
,
16
);
memcpy
(
src
->
prefix
,
p
,
16
);
src
->
plen
=
plen
;
src
->
seqno
=
seqno
;
...
...
source.h
View file @
497eeb51
...
...
@@ -23,7 +23,7 @@ THE SOFTWARE.
#define SOURCE_GC_TIME 200
struct
source
{
unsigned
char
address
[
16
];
unsigned
char
id
[
16
];
unsigned
char
prefix
[
16
];
unsigned
char
plen
;
unsigned
char
valid
;
...
...
@@ -34,7 +34,7 @@ struct source {
int
source_match
(
struct
source
*
src
,
const
unsigned
char
*
p
,
unsigned
char
plen
);
struct
source
*
find_source
(
const
unsigned
char
*
a
,
struct
source
*
find_source
(
const
unsigned
char
*
id
,
const
unsigned
char
*
p
,
unsigned
char
plen
,
int
create
,
unsigned
short
seqno
);
...
...
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