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
6aef600d
Commit
6aef600d
authored
Feb 11, 2012
by
Simon Kelley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct duid generate on FreeBSD
parent
98d76a03
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
38 deletions
+32
-38
src/bpf.c
src/bpf.c
+13
-18
src/dhcp6.c
src/dhcp6.c
+7
-11
src/lease.c
src/lease.c
+10
-6
src/netlink.c
src/netlink.c
+2
-3
No files found.
src/bpf.c
View file @
6aef600d
...
@@ -108,6 +108,10 @@ int iface_enumerate(int family, void *parm, int (*callback)())
...
@@ -108,6 +108,10 @@ int iface_enumerate(int family, void *parm, int (*callback)())
return
0
;
/* need code for Solaris and MacOS*/
return
0
;
/* need code for Solaris and MacOS*/
#endif
#endif
/* AF_LINK doesn't exist in Linux, so we can't use it in our API */
if
(
family
==
AF_LOCAL
)
family
=
AF_LINK
;
if
((
fd
=
socket
(
PF_INET
,
SOCK_DGRAM
,
0
))
==
-
1
)
if
((
fd
=
socket
(
PF_INET
,
SOCK_DGRAM
,
0
))
==
-
1
)
return
0
;
return
0
;
...
@@ -154,24 +158,6 @@ int iface_enumerate(int family, void *parm, int (*callback)())
...
@@ -154,24 +158,6 @@ int iface_enumerate(int family, void *parm, int (*callback)())
ifr
=
(
struct
ifreq
*
)
ifreq
.
iov_base
;
ifr
=
(
struct
ifreq
*
)
ifreq
.
iov_base
;
memcpy
(
ifr
,
ptr
,
len
);
memcpy
(
ifr
,
ptr
,
len
);
#ifdef HAVE_DHCP6
if
(
family
==
AF_LOCAL
)
{
unsigned
int
flags
;
if
(
ioctl
(
fd
,
SIOCGIFFLAGS
,
ifr
)
!=
-
1
)
{
flags
=
ifr
->
ifr_flags
;
ifr
->
ifr_addr
.
sa_family
=
AF_LINK
;
if
(
ioctl
(
fd
,
SIOCGIFADDR
,
ifr
)
!=
-
1
&&
!
((
*
callback
)((
unsigned
int
)
htons
(
ETHERTYPE_IP
),
flags
,
LLADDR
((
struct
sockaddr_dl
*
)
&
ifr
->
ifr_addr
),
ETHER_ADDR_LEN
,
parm
)))
goto
err
;
}
continue
;
}
#endif
if
(
ifr
->
ifr_addr
.
sa_family
==
family
)
if
(
ifr
->
ifr_addr
.
sa_family
==
family
)
{
{
if
(
family
==
AF_INET
)
if
(
family
==
AF_INET
)
...
@@ -208,6 +194,15 @@ int iface_enumerate(int family, void *parm, int (*callback)())
...
@@ -208,6 +194,15 @@ int iface_enumerate(int family, void *parm, int (*callback)())
goto
err
;
goto
err
;
}
}
#endif
#endif
#ifdef HAVE_DHCP6
else
if
(
family
==
AF_LINK
)
{
/* Assume ethernet again here */
struct
sockaddr_dl
*
sdl
=
(
struct
sockaddr_dl
*
)
&
ifr
->
ifr_addr
;
if
(
sdl
->
sdl_alen
!=
0
&&
!
((
*
callback
)(
ARPHRD_ETHER
,
LLADDR
(
sdl
),
sdl
->
sdl_alen
,
parm
)))
goto
err
;
}
#endif
}
}
}
}
...
...
src/dhcp6.c
View file @
6aef600d
...
@@ -34,8 +34,7 @@ static int join_multicast(struct in6_addr *local, int prefix,
...
@@ -34,8 +34,7 @@ static int join_multicast(struct in6_addr *local, int prefix,
static
int
complete_context6
(
struct
in6_addr
*
local
,
int
prefix
,
static
int
complete_context6
(
struct
in6_addr
*
local
,
int
prefix
,
int
scope
,
int
if_index
,
int
dad
,
void
*
vparam
);
int
scope
,
int
if_index
,
int
dad
,
void
*
vparam
);
static
int
make_duid1
(
unsigned
int
type
,
unsigned
int
flags
,
char
*
mac
,
static
int
make_duid1
(
unsigned
int
type
,
char
*
mac
,
size_t
maclen
,
void
*
parm
);
size_t
maclen
,
void
*
parm
);
void
dhcp6_init
(
void
)
void
dhcp6_init
(
void
)
{
{
...
@@ -477,26 +476,23 @@ void make_duid(time_t now)
...
@@ -477,26 +476,23 @@ void make_duid(time_t now)
{
{
/* rebase epoch to 1/1/2000 */
/* rebase epoch to 1/1/2000 */
time_t
newnow
=
now
-
946684800
;
time_t
newnow
=
now
-
946684800
;
iface_enumerate
(
AF_LOCAL
,
&
newnow
,
make_duid1
);
iface_enumerate
(
AF_LOCAL
,
&
newnow
,
make_duid1
);
if
(
!
daemon
->
duid
)
if
(
!
daemon
->
duid
)
die
(
"Cannot create DHCPv6 server DUID"
,
NULL
,
EC_MISC
);
die
(
"Cannot create DHCPv6 server DUID
: %s
"
,
NULL
,
EC_MISC
);
}
}
static
int
make_duid1
(
unsigned
int
type
,
unsigned
int
flags
,
char
*
mac
,
static
int
make_duid1
(
unsigned
int
type
,
char
*
mac
,
size_t
maclen
,
void
*
parm
)
size_t
maclen
,
void
*
parm
)
{
{
/* create DUID as specified in RFC3315. We use the MAC of the
/* create DUID as specified in RFC3315. We use the MAC of the
first interface we find that isn't loopback or P-to-P */
first interface we find that isn't loopback or P-to-P */
unsigned
char
*
p
;
unsigned
char
*
p
;
if
(
flags
&
(
IFF_LOOPBACK
|
IFF_POINTOPOINT
))
return
1
;
daemon
->
duid
=
p
=
safe_malloc
(
maclen
+
8
);
daemon
->
duid
=
p
=
safe_malloc
(
maclen
+
8
);
daemon
->
duid_len
=
maclen
+
8
;
daemon
->
duid_len
=
maclen
+
8
;
#ifdef HAVE_BROKEN_RTC
#ifdef HAVE_BROKEN_RTC
PUTSHORT
(
3
,
p
);
/* DUID_LL */
PUTSHORT
(
3
,
p
);
/* DUID_LL */
#else
#else
...
...
src/lease.c
View file @
6aef600d
...
@@ -147,12 +147,6 @@ void lease_init(time_t now)
...
@@ -147,12 +147,6 @@ void lease_init(time_t now)
the startup synthesised SIGHUP. */
the startup synthesised SIGHUP. */
lease
->
flags
&=
~
(
LEASE_NEW
|
LEASE_CHANGED
);
lease
->
flags
&=
~
(
LEASE_NEW
|
LEASE_CHANGED
);
}
}
#ifdef HAVE_DHCP6
/* If we're not doing DHCPv6, and there are not v6 leases, don't add the DUID to the database */
if
(
!
daemon
->
duid
&&
daemon
->
dhcp6
)
make_duid
(
now
);
#endif
#ifdef HAVE_SCRIPT
#ifdef HAVE_SCRIPT
if
(
!
daemon
->
lease_stream
)
if
(
!
daemon
->
lease_stream
)
...
@@ -181,6 +175,16 @@ void lease_init(time_t now)
...
@@ -181,6 +175,16 @@ void lease_init(time_t now)
file_dirty
=
0
;
file_dirty
=
0
;
lease_prune
(
NULL
,
now
);
lease_prune
(
NULL
,
now
);
dns_dirty
=
1
;
dns_dirty
=
1
;
#ifdef HAVE_DHCP6
/* If we're not doing DHCPv6, and there are not v6 leases, don't add the DUID to the database */
if
(
!
daemon
->
duid
&&
daemon
->
dhcp6
)
{
file_dirty
=
1
;
make_duid
(
now
);
}
#endif
}
}
void
lease_update_from_configs
(
void
)
void
lease_update_from_configs
(
void
)
...
...
src/netlink.c
View file @
6aef600d
...
@@ -282,9 +282,8 @@ int iface_enumerate(int family, void *parm, int (*callback)())
...
@@ -282,9 +282,8 @@ int iface_enumerate(int family, void *parm, int (*callback)())
rta
=
RTA_NEXT
(
rta
,
len1
);
rta
=
RTA_NEXT
(
rta
,
len1
);
}
}
if
(
mac
&&
!
((
*
callback
)((
unsigned
int
)
link
->
ifi_type
,
if
(
mac
&&
!
((
link
->
ifi_flags
&
(
IFF_LOOPBACK
|
IFF_POINTOPOINT
)))
&&
(
unsigned
int
)
link
->
ifi_flags
,
!
((
*
callback
)((
unsigned
int
)
link
->
ifi_type
,
mac
,
maclen
,
parm
)))
mac
,
maclen
,
parm
)))
return
0
;
return
0
;
}
}
#endif
#endif
...
...
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