Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
Dnsmasq
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Dnsmasq
Commits
96fafe2e
Commit
96fafe2e
authored
Mar 07, 2012
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed typos and tested.
parent
08456c61
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
src/bpf.c
src/bpf.c
+9
-8
No files found.
src/bpf.c
View file @
96fafe2e
...
...
@@ -44,7 +44,7 @@ int arp_enumerate(void *parm, int (*callback)())
int
rc
;
buff
.
iov_base
=
NULL
;
buff
.
iov_len
=
0
buff
.
iov_len
=
0
;
mib
[
0
]
=
CTL_NET
;
mib
[
1
]
=
PF_ROUTE
;
...
...
@@ -88,7 +88,8 @@ int arp_enumerate(void *parm, int (*callback)())
int
iface_enumerate
(
int
family
,
void
*
parm
,
int
(
*
callback
)())
{
struct
ifaddrs
*
head
,
*
addrs
;
int
errsav
,
ret
=
0
;
if
(
family
==
AF_UNSPEC
)
#if defined(HAVE_BSD_NETWORK) && !defined(__APPLE__)
return
arp_enumerate
(
parm
,
callback
);
...
...
@@ -105,7 +106,7 @@ int iface_enumerate(int family, void *parm, int (*callback)())
for
(
addrs
=
head
;
addrs
;
addrs
=
addrs
->
ifa_next
)
{
if
(
addrs
->
ifa_addr
.
sa_family
==
family
)
if
(
addrs
->
ifa_addr
->
sa_family
==
family
)
{
int
iface_index
=
if_nametoindex
(
addrs
->
ifa_name
);
...
...
@@ -125,15 +126,15 @@ int iface_enumerate(int family, void *parm, int (*callback)())
else
if
(
family
==
AF_INET6
)
{
struct
in6_addr
*
addr
=
&
((
struct
sockaddr_in6
*
)
addrs
->
ifa_addr
)
->
sin6_addr
;
unsigned
char
*
netmask
=
&
(
unisgned
char
*
)
addrs
->
ifa_netmask
)
->
sin6_addr
;
int
scope_id
=
&
((
struct
sockaddr_in6
*
)
addrs
->
ifa_addr
)
->
sin6_scope_id
;
unsigned
char
*
netmask
=
(
unsigned
char
*
)
&
((
struct
sockaddr_in6
*
)
addrs
->
ifa_netmask
)
->
sin6_addr
;
int
scope_id
=
((
struct
sockaddr_in6
*
)
addrs
->
ifa_addr
)
->
sin6_scope_id
;
int
i
,
j
,
prefix
=
0
;
for
(
i
=
0
;
i
<
IN6
_
ADDRSZ
;
i
++
,
prefix
+=
8
)
for
(
i
=
0
;
i
<
IN6ADDRSZ
;
i
++
,
prefix
+=
8
)
if
(
netmask
[
i
]
!=
0xff
)
break
;
if
(
i
!=
IN6
_
ADDRSZ
&&
netmask
[
i
])
if
(
i
!=
IN6ADDRSZ
&&
netmask
[
i
])
for
(
j
=
7
;
j
>
0
;
j
--
,
prefix
++
)
if
((
netmask
[
i
]
&
(
1
<<
j
))
==
0
)
break
;
...
...
@@ -153,7 +154,7 @@ int iface_enumerate(int family, void *parm, int (*callback)())
else
if
(
family
==
AF_LINK
)
{
/* Assume ethernet again here */
struct
sockaddr_dl
*
sdl
=
(
struct
sockaddr_dl
*
)
&
ifa
->
ifr
_addr
;
struct
sockaddr_dl
*
sdl
=
(
struct
sockaddr_dl
*
)
addrs
->
ifa
_addr
;
if
(
sdl
->
sdl_alen
!=
0
&&
!
((
*
callback
)(
iface_index
,
ARPHRD_ETHER
,
LLADDR
(
sdl
),
sdl
->
sdl_alen
,
parm
)))
goto
err
;
...
...
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