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
4af65f9a
Commit
4af65f9a
authored
Mar 18, 2020
by
Théophile Bastian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle v4-over-v6 AE in message parser.
parent
83476045
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
11 deletions
+18
-11
message.c
message.c
+11
-11
util.c
util.c
+6
-0
util.h
util.h
+1
-0
No files found.
message.c
View file @
4af65f9a
...
@@ -116,7 +116,7 @@ network_prefix(int ae, int plen, unsigned int omitted,
...
@@ -116,7 +116,7 @@ network_prefix(int ae, int plen, unsigned int omitted,
}
}
normalize_prefix
(
p_r
,
prefix
,
normalize_prefix
(
p_r
,
prefix
,
plen
<
0
?
128
:
ae
==
AE_IPV4
?
plen
+
96
:
plen
);
plen
<
0
?
128
:
ae
_is_v4
(
ae
)
?
plen
+
96
:
plen
);
return
ret
;
return
ret
;
}
}
...
@@ -174,7 +174,7 @@ parse_update_subtlv(struct interface *ifp, int metric, int ae,
...
@@ -174,7 +174,7 @@ parse_update_subtlv(struct interface *ifp, int metric, int ae,
len
-
1
,
src_prefix
);
len
-
1
,
src_prefix
);
if
(
rc
<
0
)
if
(
rc
<
0
)
goto
fail
;
goto
fail
;
if
(
ae
==
1
)
if
(
ae
_is_v4
(
ae
)
)
*
src_plen
=
a
[
i
+
2
]
+
96
;
*
src_plen
=
a
[
i
+
2
]
+
96
;
else
else
*
src_plen
=
a
[
i
+
2
];
*
src_plen
=
a
[
i
+
2
];
...
@@ -341,7 +341,7 @@ parse_request_subtlv(int ae, const unsigned char *a, int alen,
...
@@ -341,7 +341,7 @@ parse_request_subtlv(int ae, const unsigned char *a, int alen,
len
-
1
,
src_prefix
);
len
-
1
,
src_prefix
);
if
(
rc
<
0
)
if
(
rc
<
0
)
goto
fail
;
goto
fail
;
if
(
ae
==
1
)
if
(
ae
_is_v4
(
ae
)
)
*
src_plen
=
a
[
i
+
2
]
+
96
;
*
src_plen
=
a
[
i
+
2
]
+
96
;
else
else
*
src_plen
=
a
[
i
+
2
];
*
src_plen
=
a
[
i
+
2
];
...
@@ -392,7 +392,7 @@ parse_seqno_request_subtlv(int ae, const unsigned char *a, int alen,
...
@@ -392,7 +392,7 @@ parse_seqno_request_subtlv(int ae, const unsigned char *a, int alen,
len
-
1
,
src_prefix
);
len
-
1
,
src_prefix
);
if
(
rc
<
0
)
if
(
rc
<
0
)
goto
fail
;
goto
fail
;
if
(
ae
==
1
)
if
(
ae
_is_v4
(
ae
)
)
(
*
src_plen
)
+=
96
;
(
*
src_plen
)
+=
96
;
}
else
{
}
else
{
debugf
(
"Received unknown%s Route Request sub-TLV %d.
\n
"
,
debugf
(
"Received unknown%s Route Request sub-TLV %d.
\n
"
,
...
@@ -687,7 +687,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -687,7 +687,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
len
-
10
,
prefix
);
len
-
10
,
prefix
);
else
else
rc
=
-
1
;
rc
=
-
1
;
if
(
message
[
2
]
==
1
)
{
if
(
ae_is_v4
(
message
[
2
])
)
{
v4tov6
(
src_prefix
,
zeroes
);
v4tov6
(
src_prefix
,
zeroes
);
src_plen
=
96
;
src_plen
=
96
;
}
else
{
}
else
{
...
@@ -701,7 +701,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -701,7 +701,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
}
}
parsed_len
=
10
+
rc
;
parsed_len
=
10
+
rc
;
plen
=
message
[
4
]
+
(
message
[
2
]
==
1
?
96
:
0
);
plen
=
message
[
4
]
+
(
ae_is_v4
(
message
[
2
])
?
96
:
0
);
if
(
message
[
3
]
&
0x80
)
{
if
(
message
[
3
]
&
0x80
)
{
if
(
message
[
2
]
==
AE_IPV4
)
{
if
(
message
[
2
]
==
AE_IPV4
)
{
...
@@ -713,7 +713,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -713,7 +713,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
}
}
}
}
if
(
message
[
3
]
&
0x40
)
{
if
(
message
[
3
]
&
0x40
)
{
if
(
message
[
2
]
==
1
)
{
if
(
ae_is_v4
(
message
[
2
])
)
{
memset
(
router_id
,
0
,
4
);
memset
(
router_id
,
0
,
4
);
memcpy
(
router_id
+
4
,
prefix
+
12
,
4
);
memcpy
(
router_id
+
4
,
prefix
+
12
,
4
);
}
else
{
}
else
{
...
@@ -791,8 +791,8 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -791,8 +791,8 @@ parse_packet(const unsigned char *from, struct interface *ifp,
rc
=
network_prefix
(
message
[
2
],
message
[
3
],
0
,
rc
=
network_prefix
(
message
[
2
],
message
[
3
],
0
,
message
+
4
,
NULL
,
len
-
2
,
prefix
);
message
+
4
,
NULL
,
len
-
2
,
prefix
);
if
(
rc
<
0
)
goto
fail
;
if
(
rc
<
0
)
goto
fail
;
plen
=
message
[
3
]
+
(
message
[
2
]
==
1
?
96
:
0
);
plen
=
message
[
3
]
+
(
ae_is_v4
(
message
[
2
])
?
96
:
0
);
if
(
message
[
2
]
==
1
)
{
if
(
ae_is_v4
(
message
[
2
])
)
{
v4tov6
(
src_prefix
,
zeroes
);
v4tov6
(
src_prefix
,
zeroes
);
src_plen
=
96
;
src_plen
=
96
;
}
else
{
}
else
{
...
@@ -847,7 +847,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -847,7 +847,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
rc
=
network_prefix
(
message
[
2
],
message
[
3
],
0
,
rc
=
network_prefix
(
message
[
2
],
message
[
3
],
0
,
message
+
16
,
NULL
,
len
-
14
,
prefix
);
message
+
16
,
NULL
,
len
-
14
,
prefix
);
if
(
rc
<
0
)
goto
fail
;
if
(
rc
<
0
)
goto
fail
;
if
(
message
[
2
]
==
1
)
{
if
(
ae_is_v4
(
message
[
2
])
)
{
v4tov6
(
src_prefix
,
zeroes
);
v4tov6
(
src_prefix
,
zeroes
);
src_plen
=
96
;
src_plen
=
96
;
}
else
{
}
else
{
...
@@ -860,7 +860,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
...
@@ -860,7 +860,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
if
(
rc
<
0
)
if
(
rc
<
0
)
goto
done
;
goto
done
;
is_ss
=
!
is_default
(
src_prefix
,
src_plen
);
is_ss
=
!
is_default
(
src_prefix
,
src_plen
);
plen
=
message
[
3
]
+
(
message
[
2
]
==
1
?
96
:
0
);
plen
=
message
[
3
]
+
(
ae_is_v4
(
message
[
2
])
?
96
:
0
);
debugf
(
"Received request (%d) for dst %s%s%s from %s on "
debugf
(
"Received request (%d) for dst %s%s%s from %s on "
"%s (%s, %d).
\n
"
,
"%s (%s, %d).
\n
"
,
message
[
6
],
message
[
6
],
...
...
util.c
View file @
4af65f9a
...
@@ -470,6 +470,12 @@ v4tov6(unsigned char *dst, const unsigned char *src)
...
@@ -470,6 +470,12 @@ v4tov6(unsigned char *dst, const unsigned char *src)
memcpy
(
dst
+
12
,
src
,
4
);
memcpy
(
dst
+
12
,
src
,
4
);
}
}
int
ae_is_v4
(
int
ae
)
{
return
ae
==
1
||
ae
==
240
;
}
int
int
daemonise
()
daemonise
()
{
{
...
...
util.h
View file @
4af65f9a
...
@@ -99,6 +99,7 @@ int wait_for_fd(int direction, int fd, int msecs);
...
@@ -99,6 +99,7 @@ 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
linklocal
(
const
unsigned
char
*
address
)
ATTRIBUTE
((
pure
));
int
v4mapped
(
const
unsigned
char
*
address
)
ATTRIBUTE
((
pure
));
int
v4mapped
(
const
unsigned
char
*
address
)
ATTRIBUTE
((
pure
));
int
ae_is_v4
(
int
ae
)
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
);
int
set_src_prefix
(
unsigned
char
*
src_addr
,
unsigned
char
*
src_plen
);
int
set_src_prefix
(
unsigned
char
*
src_addr
,
unsigned
char
*
src_plen
);
...
...
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