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
3bd27449
Commit
3bd27449
authored
Aug 16, 2007
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix mask_prefix.
parent
e697c912
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
util.c
util.c
+4
-5
util.h
util.h
+2
-1
No files found.
util.c
View file @
3bd27449
...
@@ -154,17 +154,16 @@ in_prefix(const unsigned char *address,
...
@@ -154,17 +154,16 @@ in_prefix(const unsigned char *address,
}
}
const
unsigned
char
*
const
unsigned
char
*
mask_prefix
(
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
mask_prefix
(
unsigned
char
*
ret
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
{
{
static
unsigned
char
ret
[
16
];
if
(
plen
>
128
)
if
(
plen
>
128
)
plen
=
128
;
plen
=
128
;
memset
(
ret
,
0
,
16
);
memset
(
ret
,
0
,
16
);
memcpy
(
ret
,
prefix
,
plen
/
8
);
memcpy
(
ret
,
prefix
,
plen
/
8
);
if
(
plen
%
8
!=
0
)
if
(
plen
%
8
!=
0
)
ret
[
plen
/
8
]
=
0xFF
<<
(
8
-
(
plen
%
8
));
ret
[
plen
/
8
]
=
(
prefix
[
plen
/
8
]
&
(
0xFF
<<
(
8
-
(
plen
%
8
))
));
return
(
const
unsigned
char
*
)
ret
;
return
(
const
unsigned
char
*
)
ret
;
}
}
...
@@ -236,7 +235,7 @@ parse_net(const char *net, unsigned char *prefix_r, unsigned char *plen_r)
...
@@ -236,7 +235,7 @@ parse_net(const char *net, unsigned char *prefix_r, unsigned char *plen_r)
return
-
1
;
return
-
1
;
}
}
}
}
m
emcpy
(
prefix_r
,
mask_prefix
(
prefix
,
plen
),
16
);
m
ask_prefix
(
prefix_r
,
prefix
,
plen
);
*
plen_r
=
plen
;
*
plen_r
=
plen
;
return
0
;
return
0
;
}
}
...
...
util.h
View file @
3bd27449
...
@@ -38,7 +38,8 @@ void do_debugf(const char *format, ...) ATTRIBUTE ((format (printf, 1, 2)));
...
@@ -38,7 +38,8 @@ void do_debugf(const char *format, ...) ATTRIBUTE ((format (printf, 1, 2)));
int
in_prefix
(
const
unsigned
char
*
address
,
int
in_prefix
(
const
unsigned
char
*
address
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
const
unsigned
char
*
prefix
,
unsigned
char
plen
)
ATTRIBUTE
((
pure
));
ATTRIBUTE
((
pure
));
const
unsigned
char
*
mask_prefix
(
const
unsigned
char
*
prefix
,
const
unsigned
char
*
mask_prefix
(
unsigned
char
*
ret
,
const
unsigned
char
*
prefix
,
unsigned
char
plen
);
unsigned
char
plen
);
const
char
*
format_address
(
const
unsigned
char
*
address
);
const
char
*
format_address
(
const
unsigned
char
*
address
);
const
char
*
format_prefix
(
const
unsigned
char
*
address
,
unsigned
char
prefix
);
const
char
*
format_prefix
(
const
unsigned
char
*
address
,
unsigned
char
prefix
);
...
...
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