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
bb33004f
Commit
bb33004f
authored
Jul 13, 2011
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for link-local addresses in a specific function.
parent
02e3db59
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
message.c
message.c
+2
-4
util.c
util.c
+9
-0
util.h
util.h
+1
-0
No files found.
message.c
View file @
bb33004f
...
@@ -58,8 +58,6 @@ struct timeval unicast_flush_timeout = {0, 0};
...
@@ -58,8 +58,6 @@ struct timeval unicast_flush_timeout = {0, 0};
static
const
unsigned
char
v4prefix
[
16
]
=
static
const
unsigned
char
v4prefix
[
16
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0xFF
,
0xFF
,
0
,
0
,
0
,
0
};
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0xFF
,
0xFF
,
0
,
0
,
0
,
0
};
static
const
unsigned
char
ll_prefix
[
16
]
=
{
0xFE
,
0x80
};
static
int
static
int
network_prefix
(
int
ae
,
int
plen
,
unsigned
int
omitted
,
network_prefix
(
int
ae
,
int
plen
,
unsigned
int
omitted
,
...
@@ -176,7 +174,7 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -176,7 +174,7 @@ parse_packet(const unsigned char *from, struct network *net,
unsigned
char
router_id
[
8
],
v4_prefix
[
16
],
v6_prefix
[
16
],
unsigned
char
router_id
[
8
],
v4_prefix
[
16
],
v6_prefix
[
16
],
v4_nh
[
16
],
v6_nh
[
16
];
v4_nh
[
16
],
v6_nh
[
16
];
if
(
!
in_prefix
(
from
,
ll_prefix
,
64
))
{
if
(
!
linklocal
(
from
))
{
fprintf
(
stderr
,
"Received packet from non-local address %s.
\n
"
,
fprintf
(
stderr
,
"Received packet from non-local address %s.
\n
"
,
format_address
(
from
));
format_address
(
from
));
return
;
return
;
...
@@ -1227,7 +1225,7 @@ send_ihu(struct neighbour *neigh, struct network *net)
...
@@ -1227,7 +1225,7 @@ send_ihu(struct neighbour *neigh, struct network *net)
neigh
->
network
->
ifname
,
neigh
->
network
->
ifname
,
format_address
(
neigh
->
address
));
format_address
(
neigh
->
address
));
ll
=
in_prefix
(
neigh
->
address
,
ll_prefix
,
64
);
ll
=
linklocal
(
neigh
->
address
);
if
(
unicast_neighbour
!=
neigh
)
{
if
(
unicast_neighbour
!=
neigh
)
{
start_message
(
net
,
MESSAGE_IHU
,
ll
?
14
:
22
);
start_message
(
net
,
MESSAGE_IHU
,
ll
?
14
:
22
);
...
...
util.c
View file @
bb33004f
...
@@ -220,6 +220,9 @@ mask_prefix(unsigned char *restrict ret,
...
@@ -220,6 +220,9 @@ mask_prefix(unsigned char *restrict ret,
static
const
unsigned
char
v4prefix
[
16
]
=
static
const
unsigned
char
v4prefix
[
16
]
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0xFF
,
0xFF
,
0
,
0
,
0
,
0
};
{
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0xFF
,
0xFF
,
0
,
0
,
0
,
0
};
static
const
unsigned
char
llprefix
[
16
]
=
{
0xFE
,
0x80
};
const
char
*
const
char
*
format_address
(
const
unsigned
char
*
address
)
format_address
(
const
unsigned
char
*
address
)
{
{
...
@@ -406,6 +409,12 @@ martian_prefix(const unsigned char *prefix, int plen)
...
@@ -406,6 +409,12 @@ martian_prefix(const unsigned char *prefix, int plen)
(
plen
>=
100
&&
(
prefix
[
12
]
&
0xE0
)
==
0xE0
)));
(
plen
>=
100
&&
(
prefix
[
12
]
&
0xE0
)
==
0xE0
)));
}
}
int
linklocal
(
const
unsigned
char
*
address
)
{
return
memcmp
(
address
,
llprefix
,
8
)
==
0
;
}
int
int
v4mapped
(
const
unsigned
char
*
address
)
v4mapped
(
const
unsigned
char
*
address
)
{
{
...
...
util.h
View file @
bb33004f
...
@@ -95,6 +95,7 @@ int parse_net(const char *net, unsigned char *prefix_r, unsigned char *plen_r,
...
@@ -95,6 +95,7 @@ int parse_net(const char *net, unsigned char *prefix_r, unsigned char *plen_r,
int
parse_eui64
(
const
char
*
eui
,
unsigned
char
*
eui_r
);
int
parse_eui64
(
const
char
*
eui
,
unsigned
char
*
eui_r
);
int
wait_for_fd
(
int
direction
,
int
fd
,
int
msecs
);
int
wait_for_fd
(
int
direction
,
int
fd
,
int
msecs
);
int
martian_prefix
(
const
unsigned
char
*
prefix
,
int
plen
)
ATTRIBUTE
((
pure
));
int
martian_prefix
(
const
unsigned
char
*
prefix
,
int
plen
)
ATTRIBUTE
((
pure
));
int
linklocal
(
const
unsigned
char
*
address
)
ATTRIBUTE
((
pure
));
int
v4mapped
(
const
unsigned
char
*
address
)
ATTRIBUTE
((
pure
));
int
v4mapped
(
const
unsigned
char
*
address
)
ATTRIBUTE
((
pure
));
void
v4tov6
(
unsigned
char
*
dst
,
const
unsigned
char
*
src
);
void
v4tov6
(
unsigned
char
*
dst
,
const
unsigned
char
*
src
);
int
daemonise
(
void
);
int
daemonise
(
void
);
...
...
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