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
aa87d6fe
Commit
aa87d6fe
authored
Mar 31, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Distinguish changes from additions in local language.
parent
fe14685c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
30 deletions
+44
-30
local.c
local.c
+25
-14
local.h
local.h
+7
-3
neighbour.c
neighbour.c
+2
-4
route.c
route.c
+7
-6
xroute.c
xroute.c
+3
-3
No files found.
local.c
View file @
aa87d6fe
...
...
@@ -83,13 +83,13 @@ write_timeout(int fd, const void *buf, int len)
void
local_notify_self
()
{
char
buf
[
512
];
char
buf
[
512
];
int
rc
;
if
(
local_socket
<
0
)
return
;
rc
=
snprintf
(
buf
,
512
,
"self id %s
\n
"
,
format_address
(
myid
));
rc
=
snprintf
(
buf
,
512
,
"
add
self id %s
\n
"
,
format_address
(
myid
));
if
(
rc
<
0
||
rc
>=
512
)
goto
fail
;
...
...
@@ -104,8 +104,19 @@ local_notify_self()
return
;
}
static
char
*
local_kind
(
int
kind
)
{
switch
(
kind
)
{
case
LOCAL_FLUSH
:
return
"flush"
;
case
LOCAL_CHANGE
:
return
"change"
;
case
LOCAL_ADD
:
return
"add"
;
default:
return
"???"
;
}
}
void
local_notify_neighbour
(
struct
neighbour
*
neigh
,
int
flush
)
local_notify_neighbour
(
struct
neighbour
*
neigh
,
int
kind
)
{
char
buf
[
512
];
int
rc
;
...
...
@@ -114,9 +125,9 @@ local_notify_neighbour(struct neighbour *neigh, int flush)
return
;
rc
=
snprintf
(
buf
,
512
,
"%sneighbour id %s address %s "
"%s
neighbour id %s address %s "
"if %s reach %04x rxcost %d txcost %d cost %d
\n
"
,
flush
?
" flush"
:
""
,
local_kind
(
kind
)
,
format_address
(
neigh
->
id
),
format_address
(
neigh
->
address
),
neigh
->
network
->
ifname
,
...
...
@@ -139,7 +150,7 @@ local_notify_neighbour(struct neighbour *neigh, int flush)
}
void
local_notify_xroute
(
struct
xroute
*
xroute
,
int
flush
)
local_notify_xroute
(
struct
xroute
*
xroute
,
int
kind
)
{
char
buf
[
512
];
int
rc
;
...
...
@@ -147,8 +158,8 @@ local_notify_xroute(struct xroute *xroute, int flush)
if
(
local_socket
<
0
)
return
;
rc
=
snprintf
(
buf
,
512
,
"%sxroute prefix %s metric %d
\n
"
,
flush
?
"flush "
:
""
,
rc
=
snprintf
(
buf
,
512
,
"%s
xroute prefix %s metric %d
\n
"
,
local_kind
(
kind
)
,
format_prefix
(
xroute
->
prefix
,
xroute
->
plen
),
xroute
->
metric
);
...
...
@@ -166,7 +177,7 @@ local_notify_xroute(struct xroute *xroute, int flush)
}
void
local_notify_route
(
struct
route
*
route
,
int
flush
)
local_notify_route
(
struct
route
*
route
,
int
kind
)
{
char
buf
[
512
];
int
rc
;
...
...
@@ -175,9 +186,9 @@ local_notify_route(struct route *route, int flush)
return
;
rc
=
snprintf
(
buf
,
512
,
"%sroute prefix %s installed %s "
"%s
route prefix %s installed %s "
"id %s metric %d refmetric %d via %s if %s neigh %s
\n
"
,
flush
?
"flush "
:
""
,
local_kind
(
kind
)
,
format_prefix
(
route
->
src
->
prefix
,
route
->
src
->
plen
),
route
->
installed
?
"yes"
:
"no"
,
format_address
(
route
->
src
->
id
),
...
...
@@ -209,9 +220,9 @@ local_dump()
local_notify_self
();
for
(
i
=
0
;
i
<
numneighs
;
i
++
)
local_notify_neighbour
(
&
neighs
[
i
],
0
);
local_notify_neighbour
(
&
neighs
[
i
],
LOCAL_ADD
);
for
(
i
=
0
;
i
<
numxroutes
;
i
++
)
local_notify_xroute
(
&
xroutes
[
i
],
0
);
local_notify_xroute
(
&
xroutes
[
i
],
LOCAL_ADD
);
for
(
i
=
0
;
i
<
numroutes
;
i
++
)
local_notify_route
(
&
routes
[
i
],
0
);
local_notify_route
(
&
routes
[
i
],
LOCAL_ADD
);
}
local.h
View file @
aa87d6fe
...
...
@@ -24,9 +24,13 @@ struct neighbour;
struct
route
;
struct
xroute
;
#define LOCAL_FLUSH 0
#define LOCAL_ADD 1
#define LOCAL_CHANGE 2
int
local_read
(
int
s
);
void
local_notify_self
(
void
);
void
local_notify_neighbour
(
struct
neighbour
*
neigh
,
int
flush
);
void
local_notify_xroute
(
struct
xroute
*
xroute
,
int
flush
);
void
local_notify_route
(
struct
route
*
route
,
int
flush
);
void
local_notify_neighbour
(
struct
neighbour
*
neigh
,
int
kind
);
void
local_notify_xroute
(
struct
xroute
*
xroute
,
int
kind
);
void
local_notify_route
(
struct
route
*
route
,
int
kind
);
void
local_dump
(
void
);
neighbour.c
View file @
aa87d6fe
...
...
@@ -140,8 +140,6 @@ add_neighbour(const unsigned char *id, const unsigned char *address,
neigh
->
hello_interval
=
0
;
neigh
->
ihu_interval
=
0
;
neigh
->
network
=
net
;
neigh
->
next
=
neighs
;
neighs
=
neigh
;
send_hello
(
net
);
return
neigh
;
}
...
...
@@ -237,7 +235,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
send_unicast_request
(
neigh
,
NULL
,
0
,
0
,
0
,
0
);
}
if
(
rc
)
local_notify_neighbour
(
neigh
,
0
);
local_notify_neighbour
(
neigh
,
LOCAL_CHANGE
);
return
rc
;
}
...
...
@@ -257,7 +255,7 @@ reset_txcost(struct neighbour *neigh)
delay
>=
neigh
->
ihu_interval
*
10
*
10
))
{
neigh
->
txcost
=
INFINITY
;
neigh
->
ihu_time
=
now
;
local_notify_neighbour
(
neigh
,
0
);
local_notify_neighbour
(
neigh
,
LOCAL_CHANGE
);
return
1
;
}
...
...
route.c
View file @
aa87d6fe
...
...
@@ -87,7 +87,7 @@ flush_route(struct route *route)
lost
=
1
;
}
local_notify_route
(
route
,
1
);
local_notify_route
(
route
,
LOCAL_FLUSH
);
src
=
route
->
src
;
...
...
@@ -158,7 +158,7 @@ install_route(struct route *route)
return
;
}
route
->
installed
=
1
;
local_notify_route
(
route
,
0
);
local_notify_route
(
route
,
LOCAL_CHANGE
);
}
void
...
...
@@ -177,7 +177,7 @@ uninstall_route(struct route *route)
perror
(
"kernel_route(FLUSH)"
);
route
->
installed
=
0
;
local_notify_route
(
route
,
0
);
local_notify_route
(
route
,
LOCAL_CHANGE
);
}
/* This is equivalent to uninstall_route followed with install_route,
...
...
@@ -206,8 +206,8 @@ switch_routes(struct route *old, struct route *new)
old
->
installed
=
0
;
new
->
installed
=
1
;
}
local_notify_route
(
old
,
0
);
local_notify_route
(
new
,
0
);
local_notify_route
(
old
,
LOCAL_CHANGE
);
local_notify_route
(
new
,
LOCAL_CHANGE
);
}
void
...
...
@@ -233,7 +233,7 @@ change_route_metric(struct route *route, int newmetric)
}
}
route
->
metric
=
newmetric
;
local_notify_route
(
route
,
0
);
local_notify_route
(
route
,
LOCAL_CHANGE
);
}
int
...
...
@@ -440,6 +440,7 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
route
->
time
=
now
.
tv_sec
;
route
->
installed
=
0
;
numroutes
++
;
local_notify_route
(
route
,
LOCAL_ADD
);
consider_route
(
route
);
}
return
route
;
...
...
xroute.c
View file @
aa87d6fe
...
...
@@ -62,7 +62,7 @@ flush_xroute(struct xroute *xroute)
n
=
xroute
-
xroutes
;
assert
(
n
>=
0
&&
n
<
numxroutes
);
local_notify_xroute
(
xroute
,
1
);
local_notify_xroute
(
xroute
,
LOCAL_FLUSH
);
if
(
n
!=
numxroutes
-
1
)
memcpy
(
xroutes
+
n
,
xroutes
+
numxroutes
-
1
,
sizeof
(
struct
xroute
));
...
...
@@ -100,7 +100,7 @@ add_xroute(int kind, unsigned char prefix[16], unsigned char plen,
if
(
xroute
->
metric
<=
metric
)
return
0
;
xroute
->
metric
=
metric
;
local_notify_xroute
(
xroute
,
0
);
local_notify_xroute
(
xroute
,
LOCAL_CHANGE
);
return
1
;
}
...
...
@@ -123,7 +123,7 @@ add_xroute(int kind, unsigned char prefix[16], unsigned char plen,
xroutes
[
numxroutes
].
ifindex
=
ifindex
;
xroutes
[
numxroutes
].
proto
=
proto
;
numxroutes
++
;
local_notify_xroute
(
&
xroutes
[
numxroutes
-
1
],
0
);
local_notify_xroute
(
&
xroutes
[
numxroutes
-
1
],
LOCAL_ADD
);
return
1
;
}
...
...
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