Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DNS-Compliance-Testing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
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
ISC Open Source Projects
DNS-Compliance-Testing
Commits
0a6402ea
Commit
0a6402ea
authored
Feb 23, 2018
by
Mark Andrews
Committed by
Ondřej Surý
Feb 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check for struct sockaddr_in.sin_len and struct sockaddr_in6.sin6_len
parent
222ab0d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
configure.ac
configure.ac
+30
-0
genreport.c
genreport.c
+22
-0
No files found.
configure.ac
View file @
0a6402ea
...
...
@@ -27,4 +27,34 @@ AC_DEFINE([HAVE_RES_GETSERVERS], [1],
AC_MSG_RESULT(yes)
],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for struct sockaddr_in.sin_len)
AC_TRY_COMPILE([
#include <sys/socket.h>
#include <netinet/in.h>
],
[
struct sockaddr_in sin;
sin.sin_len = 0;
],
[
AC_DEFINE([HAVE_SIN_LEN], [1],
[Define to 1 struct sockaddr_in has sin_len.])
AC_MSG_RESULT(yes)
],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for struct sockaddr_in6.sin6_len)
AC_TRY_COMPILE([
#include <sys/socket.h>
#include <netinet/in.h>
],
[
struct sockaddr_in6 sin6;
sin6.sin6_len = 0;
],
[
AC_DEFINE([HAVE_SIN6_LEN], [1],
[Define to 1 struct sockaddr_in6 has sin6_len.])
AC_MSG_RESULT(yes)
],
[AC_MSG_RESULT(no)])
AC_OUTPUT
genreport.c
View file @
0a6402ea
...
...
@@ -1059,14 +1059,18 @@ check(char *zone, char *ns, char *address, struct summary *parent) {
memset
(
&
storage
,
0
,
sizeof
(
storage
));
if
(
inet_pton
(
AF_INET6
,
address
,
&
addr6
)
==
1
)
{
struct
sockaddr_in6
*
s
=
(
struct
sockaddr_in6
*
)
&
storage
;
#ifdef HAVE_SIN6_LEN
s
->
sin6_len
=
sizeof
(
struct
sockaddr_in6
);
#endif
s
->
sin6_family
=
AF_INET6
;
s
->
sin6_port
=
htons
(
53
);
s
->
sin6_addr
=
addr6
;
fd
=
udp6
;
}
else
if
(
inet_pton
(
AF_INET
,
address
,
&
addr
)
==
1
)
{
struct
sockaddr_in
*
s
=
(
struct
sockaddr_in
*
)
&
storage
;
#ifdef HAVE_SIN_LEN
s
->
sin_len
=
sizeof
(
struct
sockaddr_in
);
#endif
s
->
sin_family
=
AF_INET
;
s
->
sin_port
=
htons
(
53
);
s
->
sin_addr
=
addr
;
...
...
@@ -2158,7 +2162,9 @@ icmp4read(int fd) {
id
=
(
buf
[
msgdata
]
<<
8
)
+
buf
[
msgdata
+
1
];
memset
(
&
storage
,
0
,
sizeof
(
storage
));
sin
->
sin_family
=
AF_INET
;
#ifdef HAVE_SIN_LEN
sin
->
sin_len
=
sizeof
(
*
sin
);
#endif
sin
->
sin_addr
=
icmp
->
icmp_ip
.
ip_dst
;
sin
->
sin_port
=
udphdr
->
uh_dport
;
item
=
finditem
(
&
storage
,
id
);
...
...
@@ -2172,7 +2178,9 @@ icmp4read(int fd) {
id
=
(
buf
[
msgdata
+
2
]
<<
8
)
+
buf
[
msgdata
+
3
];
memset
(
&
storage
,
0
,
sizeof
(
storage
));
sin
->
sin_family
=
AF_INET
;
#ifdef HAVE_SIN_LEN
sin
->
sin_len
=
sizeof
(
*
sin
);
#endif
sin
->
sin_addr
=
icmp
->
icmp_ip
.
ip_dst
;
sin
->
sin_port
=
tcphdr
->
th_dport
;
item
=
finditem
(
&
storage
,
id
);
...
...
@@ -2241,7 +2249,9 @@ icmp4read(int fd) {
id
=
(
buf
[
msgdata
]
<<
8
)
+
buf
[
msgdata
+
1
];
memset
(
&
storage
,
0
,
sizeof
(
storage
));
sin
->
sin_family
=
AF_INET
;
#ifdef HAVE_SIN_LEN
sin
->
sin_len
=
sizeof
(
*
sin
);
#endif
sin
->
sin_addr
=
icmp
->
icmp_ip
.
ip_dst
;
sin
->
sin_port
=
udphdr
->
uh_dport
;
item
=
finditem
(
&
storage
,
id
);
...
...
@@ -2255,7 +2265,9 @@ icmp4read(int fd) {
id
=
(
buf
[
msgdata
+
2
]
<<
8
)
+
buf
[
msgdata
+
3
];
memset
(
&
storage
,
0
,
sizeof
(
storage
));
sin
->
sin_family
=
AF_INET
;
#ifdef HAVE_SIN_LEN
sin
->
sin_len
=
sizeof
(
*
sin
);
#endif
sin
->
sin_addr
=
icmp
->
icmp_ip
.
ip_dst
;
sin
->
sin_port
=
tcphdr
->
th_dport
;
item
=
finditem
(
&
storage
,
id
);
...
...
@@ -2337,7 +2349,9 @@ icmp6read(int fd) {
id
=
(
buf
[
msgdata
]
<<
8
)
+
buf
[
msgdata
+
1
];
memset
(
&
storage
,
0
,
sizeof
(
storage
));
sin6
->
sin6_family
=
AF_INET6
;
#ifdef HAVE_SIN6_LEN
sin6
->
sin6_len
=
sizeof
(
*
sin6
);
#endif
memcpy
(
&
sin6
->
sin6_addr
,
&
ip6
->
ip6_dst
,
16
);
sin6
->
sin6_port
=
udphdr
->
uh_dport
;
item
=
finditem
(
&
storage
,
id
);
...
...
@@ -2370,7 +2384,9 @@ icmp6read(int fd) {
id
=
(
buf
[
msgdata
]
<<
8
)
+
buf
[
msgdata
+
1
];
memset
(
&
storage
,
0
,
sizeof
(
storage
));
sin6
->
sin6_family
=
AF_INET6
;
#ifdef HAVE_SIN6_LEN
sin6
->
sin6_len
=
sizeof
(
*
sin6
);
#endif
memcpy
(
&
sin6
->
sin6_addr
,
&
ip6
->
ip6_dst
,
16
);
sin6
->
sin6_port
=
udphdr
->
uh_dport
;
item
=
finditem
(
&
storage
,
id
);
...
...
@@ -2384,7 +2400,9 @@ icmp6read(int fd) {
id
=
(
buf
[
msgdata
+
2
]
<<
8
)
+
buf
[
msgdata
+
3
];
memset
(
&
storage
,
0
,
sizeof
(
storage
));
sin6
->
sin6_family
=
AF_INET6
;
#ifdef HAVE_SIN6_LEN
sin6
->
sin6_len
=
sizeof
(
*
sin6
);
#endif
memcpy
(
&
sin6
->
sin6_addr
,
&
ip6
->
ip6_dst
,
16
);
sin6
->
sin6_port
=
tcphdr
->
th_dport
;
item
=
finditem
(
&
storage
,
id
);
...
...
@@ -2431,7 +2449,9 @@ icmp6read(int fd) {
id
=
(
buf
[
msgdata
]
<<
8
)
+
buf
[
msgdata
+
1
];
memset
(
&
storage
,
0
,
sizeof
(
storage
));
sin6
->
sin6_family
=
AF_INET6
;
#ifdef HAVE_SIN6_LEN
sin6
->
sin6_len
=
sizeof
(
*
sin6
);
#endif
memcpy
(
&
sin6
->
sin6_addr
,
&
ip6
->
ip6_dst
,
16
);
sin6
->
sin6_port
=
udphdr
->
uh_dport
;
item
=
finditem
(
&
storage
,
id
);
...
...
@@ -2445,7 +2465,9 @@ icmp6read(int fd) {
id
=
(
buf
[
msgdata
+
2
]
<<
8
)
+
buf
[
msgdata
+
3
];
memset
(
&
storage
,
0
,
sizeof
(
storage
));
sin6
->
sin6_family
=
AF_INET6
;
#ifdef HAVE_SIN6_LEN
sin6
->
sin6_len
=
sizeof
(
*
sin6
);
#endif
memcpy
(
&
sin6
->
sin6_addr
,
&
ip6
->
ip6_dst
,
16
);
sin6
->
sin6_port
=
tcphdr
->
th_dport
;
item
=
finditem
(
&
storage
,
id
);
...
...
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