Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iproute2
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
iproute2
Commits
0b218ab1
Commit
0b218ab1
authored
Mar 15, 2015
by
Eric W. Biederman
Committed by
Stephen Hemminger
Mar 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for printing AF_PACKET addresses
Signed-off-by:
"Eric W. Biederman"
<
ebiederm@xmission.com
>
parent
71b4d59b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
lib/utils.c
lib/utils.c
+16
-5
No files found.
lib/utils.c
View file @
0b218ab1
...
@@ -25,11 +25,12 @@
...
@@ -25,11 +25,12 @@
#include <asm/types.h>
#include <asm/types.h>
#include <linux/pkt_sched.h>
#include <linux/pkt_sched.h>
#include <linux/param.h>
#include <linux/param.h>
#include <linux/if_arp.h>
#include <time.h>
#include <time.h>
#include <sys/time.h>
#include <sys/time.h>
#include <errno.h>
#include <errno.h>
#include "rt_names.h"
#include "utils.h"
#include "utils.h"
#include "namespace.h"
#include "namespace.h"
...
@@ -397,6 +398,18 @@ int get_addr_1(inet_prefix *addr, const char *name, int family)
...
@@ -397,6 +398,18 @@ int get_addr_1(inet_prefix *addr, const char *name, int family)
return
0
;
return
0
;
}
}
if
(
family
==
AF_PACKET
)
{
int
len
;
len
=
ll_addr_a2n
((
char
*
)
&
addr
->
data
,
sizeof
(
addr
->
data
),
name
);
if
(
len
<
0
)
return
-
1
;
addr
->
family
=
AF_PACKET
;
addr
->
bytelen
=
len
;
addr
->
bitlen
=
len
*
8
;
return
0
;
}
if
(
strchr
(
name
,
':'
))
{
if
(
strchr
(
name
,
':'
))
{
addr
->
family
=
AF_INET6
;
addr
->
family
=
AF_INET6
;
if
(
family
!=
AF_UNSPEC
&&
family
!=
AF_INET6
)
if
(
family
!=
AF_UNSPEC
&&
family
!=
AF_INET6
)
...
@@ -497,10 +510,6 @@ done:
...
@@ -497,10 +510,6 @@ done:
int
get_addr
(
inet_prefix
*
dst
,
const
char
*
arg
,
int
family
)
int
get_addr
(
inet_prefix
*
dst
,
const
char
*
arg
,
int
family
)
{
{
if
(
family
==
AF_PACKET
)
{
fprintf
(
stderr
,
"Error:
\"
%s
\"
may be inet address, but it is not allowed in this context.
\n
"
,
arg
);
exit
(
1
);
}
if
(
get_addr_1
(
dst
,
arg
,
family
))
{
if
(
get_addr_1
(
dst
,
arg
,
family
))
{
fprintf
(
stderr
,
"Error: an inet address is expected rather than
\"
%s
\"
.
\n
"
,
arg
);
fprintf
(
stderr
,
"Error: an inet address is expected rather than
\"
%s
\"
.
\n
"
,
arg
);
exit
(
1
);
exit
(
1
);
...
@@ -650,6 +659,8 @@ const char *rt_addr_n2a(int af, int len, const void *addr, char *buf, int buflen
...
@@ -650,6 +659,8 @@ const char *rt_addr_n2a(int af, int len, const void *addr, char *buf, int buflen
memcpy
(
dna
.
a_addr
,
addr
,
2
);
memcpy
(
dna
.
a_addr
,
addr
,
2
);
return
dnet_ntop
(
af
,
&
dna
,
buf
,
buflen
);
return
dnet_ntop
(
af
,
&
dna
,
buf
,
buflen
);
}
}
case
AF_PACKET
:
return
ll_addr_n2a
(
addr
,
len
,
ARPHRD_VOID
,
buf
,
buflen
);
default:
default:
return
"???"
;
return
"???"
;
}
}
...
...
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