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
7f4bba93
Commit
7f4bba93
authored
Jan 20, 2018
by
Juliusz Chroboczek
Committed by
Juliusz Chroboczek
Oct 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make flusbuf take a struct buffered.
parent
7bac9a7c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
29 deletions
+28
-29
babeld.c
babeld.c
+4
-4
message.c
message.c
+21
-22
message.h
message.h
+1
-1
resend.c
resend.c
+1
-1
xroute.c
xroute.c
+1
-1
No files found.
babeld.c
View file @
7f4bba93
...
@@ -583,7 +583,7 @@ main(int argc, char **argv)
...
@@ -583,7 +583,7 @@ main(int argc, char **argv)
send_wildcard_retraction
(
ifp
);
send_wildcard_retraction
(
ifp
);
send_self_update
(
ifp
);
send_self_update
(
ifp
);
flushupdates
(
ifp
);
flushupdates
(
ifp
);
flushbuf
(
ifp
);
flushbuf
(
&
ifp
->
buf
);
}
}
debugf
(
"Entering main loop.
\n
"
);
debugf
(
"Entering main loop.
\n
"
);
...
@@ -781,7 +781,7 @@ main(int argc, char **argv)
...
@@ -781,7 +781,7 @@ main(int argc, char **argv)
if
(
ifp
->
buf
.
timeout
.
tv_sec
!=
0
)
{
if
(
ifp
->
buf
.
timeout
.
tv_sec
!=
0
)
{
if
(
timeval_compare
(
&
now
,
&
ifp
->
buf
.
timeout
)
>=
0
)
{
if
(
timeval_compare
(
&
now
,
&
ifp
->
buf
.
timeout
)
>=
0
)
{
flushupdates
(
ifp
);
flushupdates
(
ifp
);
flushbuf
(
ifp
);
flushbuf
(
&
ifp
->
buf
);
}
}
}
}
}
}
...
@@ -806,7 +806,7 @@ main(int argc, char **argv)
...
@@ -806,7 +806,7 @@ main(int argc, char **argv)
/* Make sure that we expire quickly from our neighbours'
/* Make sure that we expire quickly from our neighbours'
association caches. */
association caches. */
send_hello_noupdate
(
ifp
,
10
);
send_hello_noupdate
(
ifp
,
10
);
flushbuf
(
ifp
);
flushbuf
(
&
ifp
->
buf
);
usleep
(
roughly
(
1000
));
usleep
(
roughly
(
1000
));
gettime
(
&
now
);
gettime
(
&
now
);
}
}
...
@@ -816,7 +816,7 @@ main(int argc, char **argv)
...
@@ -816,7 +816,7 @@ main(int argc, char **argv)
/* Make sure they got it. */
/* Make sure they got it. */
send_wildcard_retraction
(
ifp
);
send_wildcard_retraction
(
ifp
);
send_hello_noupdate
(
ifp
,
1
);
send_hello_noupdate
(
ifp
,
1
);
flushbuf
(
ifp
);
flushbuf
(
&
ifp
->
buf
);
usleep
(
roughly
(
10000
));
usleep
(
roughly
(
10000
));
gettime
(
&
now
);
gettime
(
&
now
);
interface_up
(
ifp
,
0
);
interface_up
(
ifp
,
0
);
...
...
message.c
View file @
7f4bba93
...
@@ -915,33 +915,32 @@ fill_rtt_message(struct buffered *buf)
...
@@ -915,33 +915,32 @@ fill_rtt_message(struct buffered *buf)
}
}
void
void
flushbuf
(
struct
interface
*
ifp
)
flushbuf
(
struct
buffered
*
buf
)
{
{
int
rc
;
int
rc
;
assert
(
ifp
->
buf
.
len
<=
ifp
->
buf
.
size
);
assert
(
buf
->
len
<=
buf
->
size
);
if
(
ifp
->
buf
.
len
>
0
)
{
if
(
buf
->
len
>
0
)
{
debugf
(
" (flushing %d buffered bytes on %s)
\n
"
,
debugf
(
" (flushing %d buffered bytes)
\n
"
,
buf
->
len
);
ifp
->
buf
.
len
,
ifp
->
name
);
DO_HTONS
(
packet_header
+
2
,
buf
->
len
);
DO_HTONS
(
packet_header
+
2
,
ifp
->
buf
.
len
);
fill_rtt_message
(
buf
);
fill_rtt_message
(
&
ifp
->
buf
);
rc
=
babel_send
(
protocol_socket
,
rc
=
babel_send
(
protocol_socket
,
packet_header
,
sizeof
(
packet_header
),
packet_header
,
sizeof
(
packet_header
),
ifp
->
buf
.
buf
,
ifp
->
buf
.
len
,
buf
->
buf
,
buf
->
len
,
(
struct
sockaddr
*
)
&
ifp
->
buf
.
sin6
,
(
struct
sockaddr
*
)
&
buf
->
sin6
,
sizeof
(
ifp
->
buf
.
sin6
));
sizeof
(
buf
->
sin6
));
if
(
rc
<
0
)
if
(
rc
<
0
)
perror
(
"send"
);
perror
(
"send"
);
}
}
VALGRIND_MAKE_MEM_UNDEFINED
(
ifp
->
buf
.
buf
,
ifp
->
buf
.
size
);
VALGRIND_MAKE_MEM_UNDEFINED
(
buf
->
buf
,
buf
->
size
);
ifp
->
buf
.
len
=
0
;
buf
->
len
=
0
;
ifp
->
buf
.
hello
=
-
1
;
buf
->
hello
=
-
1
;
ifp
->
buf
.
have_id
=
0
;
buf
->
have_id
=
0
;
ifp
->
buf
.
have_nh
=
0
;
buf
->
have_nh
=
0
;
ifp
->
buf
.
have_prefix
=
0
;
buf
->
have_prefix
=
0
;
ifp
->
buf
.
timeout
.
tv_sec
=
0
;
buf
->
timeout
.
tv_sec
=
0
;
ifp
->
buf
.
timeout
.
tv_usec
=
0
;
buf
->
timeout
.
tv_usec
=
0
;
}
}
static
void
static
void
...
@@ -982,14 +981,14 @@ static void
...
@@ -982,14 +981,14 @@ static void
ensure_space
(
struct
interface
*
ifp
,
int
space
)
ensure_space
(
struct
interface
*
ifp
,
int
space
)
{
{
if
(
ifp
->
buf
.
size
-
ifp
->
buf
.
len
<
space
)
if
(
ifp
->
buf
.
size
-
ifp
->
buf
.
len
<
space
)
flushbuf
(
ifp
);
flushbuf
(
&
ifp
->
buf
);
}
}
static
void
static
void
start_message
(
struct
interface
*
ifp
,
int
type
,
int
len
)
start_message
(
struct
interface
*
ifp
,
int
type
,
int
len
)
{
{
if
(
ifp
->
buf
.
size
-
ifp
->
buf
.
len
<
len
+
2
)
if
(
ifp
->
buf
.
size
-
ifp
->
buf
.
len
<
len
+
2
)
flushbuf
(
ifp
);
flushbuf
(
&
ifp
->
buf
);
ifp
->
buf
.
buf
[
ifp
->
buf
.
len
++
]
=
type
;
ifp
->
buf
.
buf
[
ifp
->
buf
.
len
++
]
=
type
;
ifp
->
buf
.
buf
[
ifp
->
buf
.
len
++
]
=
len
;
ifp
->
buf
.
buf
[
ifp
->
buf
.
len
++
]
=
len
;
}
}
...
@@ -1111,7 +1110,7 @@ send_hello_noupdate(struct interface *ifp, unsigned interval)
...
@@ -1111,7 +1110,7 @@ send_hello_noupdate(struct interface *ifp, unsigned interval)
link quality estimation. */
link quality estimation. */
if
(
ifp
->
buf
.
hello
>=
0
)
{
if
(
ifp
->
buf
.
hello
>=
0
)
{
flushupdates
(
ifp
);
flushupdates
(
ifp
);
flushbuf
(
ifp
);
flushbuf
(
&
ifp
->
buf
);
}
}
ifp
->
hello_seqno
=
seqno_plus
(
ifp
->
hello_seqno
,
1
);
ifp
->
hello_seqno
=
seqno_plus
(
ifp
->
hello_seqno
,
1
);
...
@@ -1162,7 +1161,7 @@ flush_unicast(int dofree)
...
@@ -1162,7 +1161,7 @@ flush_unicast(int dofree)
goto
done
;
goto
done
;
/* Preserve ordering of messages */
/* Preserve ordering of messages */
flushbuf
(
unicast_neighbour
->
ifp
);
flushbuf
(
&
unicast_neighbour
->
ifp
->
buf
);
memset
(
&
sin6
,
0
,
sizeof
(
sin6
));
memset
(
&
sin6
,
0
,
sizeof
(
sin6
));
sin6
.
sin6_family
=
AF_INET6
;
sin6
.
sin6_family
=
AF_INET6
;
...
...
message.h
View file @
7f4bba93
...
@@ -57,7 +57,7 @@ extern struct timeval unicast_flush_timeout;
...
@@ -57,7 +57,7 @@ extern struct timeval unicast_flush_timeout;
void
parse_packet
(
const
unsigned
char
*
from
,
struct
interface
*
ifp
,
void
parse_packet
(
const
unsigned
char
*
from
,
struct
interface
*
ifp
,
const
unsigned
char
*
packet
,
int
packetlen
);
const
unsigned
char
*
packet
,
int
packetlen
);
void
flushbuf
(
struct
interface
*
ifp
);
void
flushbuf
(
struct
buffered
*
buf
);
void
flushupdates
(
struct
interface
*
ifp
);
void
flushupdates
(
struct
interface
*
ifp
);
void
send_ack
(
struct
neighbour
*
neigh
,
unsigned
short
nonce
,
void
send_ack
(
struct
neighbour
*
neigh
,
unsigned
short
nonce
,
unsigned
short
interval
);
unsigned
short
interval
);
...
...
resend.c
View file @
7f4bba93
...
@@ -29,10 +29,10 @@ THE SOFTWARE.
...
@@ -29,10 +29,10 @@ THE SOFTWARE.
#include "babeld.h"
#include "babeld.h"
#include "util.h"
#include "util.h"
#include "interface.h"
#include "neighbour.h"
#include "neighbour.h"
#include "resend.h"
#include "resend.h"
#include "message.h"
#include "message.h"
#include "interface.h"
#include "configuration.h"
#include "configuration.h"
struct
timeval
resend_time
=
{
0
,
0
};
struct
timeval
resend_time
=
{
0
,
0
};
...
...
xroute.c
View file @
7f4bba93
...
@@ -30,13 +30,13 @@ THE SOFTWARE.
...
@@ -30,13 +30,13 @@ THE SOFTWARE.
#include "babeld.h"
#include "babeld.h"
#include "kernel.h"
#include "kernel.h"
#include "interface.h"
#include "neighbour.h"
#include "neighbour.h"
#include "message.h"
#include "message.h"
#include "route.h"
#include "route.h"
#include "xroute.h"
#include "xroute.h"
#include "util.h"
#include "util.h"
#include "configuration.h"
#include "configuration.h"
#include "interface.h"
#include "local.h"
#include "local.h"
static
struct
xroute
*
xroutes
;
static
struct
xroute
*
xroutes
;
...
...
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