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
46134e60
Commit
46134e60
authored
Jan 19, 2018
by
Juliusz Chroboczek
Committed by
Juliusz Chroboczek
Oct 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove token bucket.
This is no longer useful and complicates the code.
parent
b40390cf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
67 deletions
+22
-67
interface.c
interface.c
+0
-2
interface.h
interface.h
+0
-2
message.c
message.c
+22
-60
message.h
message.h
+0
-3
No files found.
interface.c
View file @
46134e60
...
...
@@ -80,8 +80,6 @@ add_interface(char *ifname, struct interface_conf *if_conf)
strncpy
(
ifp
->
name
,
ifname
,
IF_NAMESIZE
);
ifp
->
conf
=
if_conf
?
if_conf
:
default_interface_conf
;
ifp
->
bucket_time
=
now
.
tv_sec
;
ifp
->
bucket
=
BUCKET_TOKENS_MAX
;
ifp
->
hello_seqno
=
(
random
()
&
0xFFFF
);
if
(
interfaces
==
NULL
)
...
...
interface.h
View file @
46134e60
...
...
@@ -114,8 +114,6 @@ struct interface {
struct
buffered_update
*
buffered_updates
;
int
num_buffered_updates
;
int
update_bufsize
;
time_t
bucket_time
;
unsigned
int
bucket
;
time_t
last_update_time
;
time_t
last_specific_update_time
;
unsigned
short
hello_seqno
;
...
...
message.c
View file @
46134e60
...
...
@@ -891,31 +891,6 @@ parse_packet(const unsigned char *from, struct interface *ifp,
return
;
}
/* Under normal circumstances, there are enough moderation mechanisms
elsewhere in the protocol to make sure that this last-ditch check
should never trigger. But I'm superstitious. */
static
int
check_bucket
(
struct
interface
*
ifp
)
{
if
(
ifp
->
bucket
<=
0
)
{
int
seconds
=
now
.
tv_sec
-
ifp
->
bucket_time
;
if
(
seconds
>
0
)
{
ifp
->
bucket
=
MIN
(
BUCKET_TOKENS_MAX
,
seconds
*
BUCKET_TOKENS_PER_SEC
);
}
/* Reset bucket time unconditionally, in case clock is stepped. */
ifp
->
bucket_time
=
now
.
tv_sec
;
}
if
(
ifp
->
bucket
>
0
)
{
ifp
->
bucket
--
;
return
1
;
}
else
{
return
0
;
}
}
static
int
fill_rtt_message
(
struct
interface
*
ifp
)
{
...
...
@@ -949,20 +924,15 @@ flushbuf(struct interface *ifp)
if
(
ifp
->
buf
.
len
>
0
)
{
debugf
(
" (flushing %d buffered bytes on %s)
\n
"
,
ifp
->
buf
.
len
,
ifp
->
name
);
if
(
check_bucket
(
ifp
))
{
DO_HTONS
(
packet_header
+
2
,
ifp
->
buf
.
len
);
fill_rtt_message
(
ifp
);
rc
=
babel_send
(
protocol_socket
,
packet_header
,
sizeof
(
packet_header
),
ifp
->
buf
.
buf
,
ifp
->
buf
.
len
,
(
struct
sockaddr
*
)
&
ifp
->
buf
.
sin6
,
sizeof
(
ifp
->
buf
.
sin6
));
if
(
rc
<
0
)
perror
(
"send"
);
}
else
{
fprintf
(
stderr
,
"Warning: bucket full, dropping packet to %s.
\n
"
,
ifp
->
name
);
}
DO_HTONS
(
packet_header
+
2
,
ifp
->
buf
.
len
);
fill_rtt_message
(
ifp
);
rc
=
babel_send
(
protocol_socket
,
packet_header
,
sizeof
(
packet_header
),
ifp
->
buf
.
buf
,
ifp
->
buf
.
len
,
(
struct
sockaddr
*
)
&
ifp
->
buf
.
sin6
,
sizeof
(
ifp
->
buf
.
sin6
));
if
(
rc
<
0
)
perror
(
"send"
);
}
VALGRIND_MAKE_MEM_UNDEFINED
(
ifp
->
buf
.
buf
,
ifp
->
buf
.
size
);
ifp
->
buf
.
len
=
0
;
...
...
@@ -1194,27 +1164,19 @@ flush_unicast(int dofree)
/* Preserve ordering of messages */
flushbuf
(
unicast_neighbour
->
ifp
);
if
(
check_bucket
(
unicast_neighbour
->
ifp
))
{
memset
(
&
sin6
,
0
,
sizeof
(
sin6
));
sin6
.
sin6_family
=
AF_INET6
;
memcpy
(
&
sin6
.
sin6_addr
,
unicast_neighbour
->
address
,
16
);
sin6
.
sin6_port
=
htons
(
protocol_port
);
sin6
.
sin6_scope_id
=
unicast_neighbour
->
ifp
->
ifindex
;
DO_HTONS
(
packet_header
+
2
,
unicast_buffered
);
fill_rtt_message
(
unicast_neighbour
->
ifp
);
rc
=
babel_send
(
protocol_socket
,
packet_header
,
sizeof
(
packet_header
),
unicast_buffer
,
unicast_buffered
,
(
struct
sockaddr
*
)
&
sin6
,
sizeof
(
sin6
));
if
(
rc
<
0
)
perror
(
"send(unicast)"
);
}
else
{
fprintf
(
stderr
,
"Warning: bucket full, dropping unicast packet "
"to %s if %s.
\n
"
,
format_address
(
unicast_neighbour
->
address
),
unicast_neighbour
->
ifp
->
name
);
}
memset
(
&
sin6
,
0
,
sizeof
(
sin6
));
sin6
.
sin6_family
=
AF_INET6
;
memcpy
(
&
sin6
.
sin6_addr
,
unicast_neighbour
->
address
,
16
);
sin6
.
sin6_port
=
htons
(
protocol_port
);
sin6
.
sin6_scope_id
=
unicast_neighbour
->
ifp
->
ifindex
;
DO_HTONS
(
packet_header
+
2
,
unicast_buffered
);
fill_rtt_message
(
unicast_neighbour
->
ifp
);
rc
=
babel_send
(
protocol_socket
,
packet_header
,
sizeof
(
packet_header
),
unicast_buffer
,
unicast_buffered
,
(
struct
sockaddr
*
)
&
sin6
,
sizeof
(
sin6
));
if
(
rc
<
0
)
perror
(
"send(unicast)"
);
done:
VALGRIND_MAKE_MEM_UNDEFINED
(
unicast_buffer
,
UNICAST_BUFSIZE
);
...
...
message.h
View file @
46134e60
...
...
@@ -22,9 +22,6 @@ THE SOFTWARE.
#define MAX_BUFFERED_UPDATES 200
#define BUCKET_TOKENS_MAX 4000
#define BUCKET_TOKENS_PER_SEC 1000
#define MESSAGE_PAD1 0
#define MESSAGE_PADN 1
#define MESSAGE_ACK_REQ 2
...
...
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