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
ff148e90
Commit
ff148e90
authored
Oct 09, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add EUI-64 parsing and formatting.
parent
489454e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
util.c
util.c
+24
-0
util.h
util.h
+2
-0
No files found.
util.c
View file @
ff148e90
...
...
@@ -264,6 +264,18 @@ format_prefix(const unsigned char *prefix, unsigned char plen)
return
buf
[
i
];
}
const
char
*
format_eui64
(
const
unsigned
char
*
eui
)
{
static
char
buf
[
4
][
28
];
static
int
i
=
0
;
i
=
(
i
+
1
)
%
4
;
snprintf
(
buf
[
i
],
28
,
"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
,
eui
[
0
],
eui
[
1
],
eui
[
2
],
eui
[
3
],
eui
[
4
],
eui
[
5
],
eui
[
6
],
eui
[
7
]);
return
buf
[
i
];
}
int
parse_address
(
const
char
*
address
,
unsigned
char
*
addr_r
,
int
*
af_r
)
{
...
...
@@ -346,6 +358,18 @@ parse_net(const char *net, unsigned char *prefix_r, unsigned char *plen_r,
return
0
;
}
int
parse_eui64
(
const
char
*
eui
,
unsigned
char
*
eui_r
)
{
int
n
;
n
=
sscanf
(
eui
,
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
,
&
eui_r
[
0
],
&
eui_r
[
1
],
&
eui_r
[
2
],
&
eui_r
[
3
],
&
eui_r
[
4
],
&
eui_r
[
5
],
&
eui_r
[
6
],
&
eui_r
[
7
]);
if
(
n
!=
8
)
return
-
1
;
return
0
;
}
int
wait_for_fd
(
int
direction
,
int
fd
,
int
msecs
)
{
...
...
util.h
View file @
ff148e90
...
...
@@ -65,9 +65,11 @@ const unsigned char *mask_prefix(unsigned char *ret,
unsigned
char
plen
);
const
char
*
format_address
(
const
unsigned
char
*
address
);
const
char
*
format_prefix
(
const
unsigned
char
*
address
,
unsigned
char
prefix
);
const
char
*
format_eui64
(
const
unsigned
char
*
eui
);
int
parse_address
(
const
char
*
address
,
unsigned
char
*
addr_r
,
int
*
af_r
);
int
parse_net
(
const
char
*
net
,
unsigned
char
*
prefix_r
,
unsigned
char
*
plen_r
,
int
*
af_r
);
int
parse_eui64
(
const
char
*
eui
,
unsigned
char
*
eui_r
);
int
wait_for_fd
(
int
direction
,
int
fd
,
int
msecs
);
int
martian_prefix
(
const
unsigned
char
*
prefix
,
int
plen
)
ATTRIBUTE
((
pure
));
int
v4mapped
(
const
unsigned
char
*
address
)
ATTRIBUTE
((
pure
));
...
...
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