Merge pull request #6783 from EricLuehrsen/unbound_1701

[lede-17.01] unbound: drop odhcpd leases with wrong field count
This commit is contained in:
Dirk Brenken 2018-08-18 19:53:35 +02:00 committed by GitHub
commit 6b4862d5ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 60 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=unbound
PKG_VERSION:=1.6.8
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE

View File

@ -37,6 +37,12 @@
sub( /.*\//, "", cdr2 ) ;
if ( hst !~ /^[[:alnum:]]([-[:alnum:]]*[[:alnum:]])?$/ ) {
# that is not a valid host name (RFC1123)
hst = "-" ;
}
if ( bisolt == 1 ) {
# TODO: this might be better with a substituion option,
# or per DHCP pool do-not-DNS option, but its getting busy here.
@ -50,17 +56,9 @@
}
if ( cls == "ipv4" ) {
if ( NF == 8 ) {
# odhcpd errata in field format without host name
adr = $8 ; hst = "-" ; cdr = adr ;
sub( /\/.*/, "", adr ) ;
sub( /.*\//, "", cdr ) ;
}
if (( cdr == 32 ) && ( hst != "-" )) {
# only for provided hostnames and full /32 assignments
if ((cls == "ipv4") && (hst != "-") && (cdr == 32) && (NF == 9)) {
# IPV4 ; only for provided hostnames and full /32 assignments
# NF=9 ; odhcpd errata in field format without host name
ptr = adr ; qpr = "" ; split( ptr, ptr, "." ) ;
slaac = slaac_eui64( id ) ;
@ -68,7 +66,7 @@
if ( bconf == 1 ) {
x = ( "local-data: \"" fqdn ". 120 IN A " adr "\"" ) ;
y = ( "local-data-ptr: \"" adr " 120 " fqdn "\"" ) ;
print ( x "\n" y ) > hostfile ;
print ( x "\n" y "\n" ) > hostfile ;
}
else {
@ -86,14 +84,15 @@
while ( ( cmd | getline adr ) > 0 ) {
if (( substr( adr, 1, 5 ) <= "fd00:" ) \
if (( substr( adr, 1, 5 ) <= "fdff:" ) \
&& ( index( adr, "anycast" ) == 0 ) \
&& ( index( adr, "via" ) == 0 )) {
# GA or ULA routed addresses only (not LL or MC)
sub( /\/.*/, "", adr ) ;
adr = ( adr slaac ) ;
if ( split( adr, tmp0, ":" ) >= 8 ) {
if ( split( adr, tmp0, ":" ) > 8 ) {
sub( "::", ":", adr ) ;
}
@ -101,7 +100,7 @@
if ( bconf == 1 ) {
x = ( "local-data: \"" fqdn ". 120 IN AAAA " adr "\"" ) ;
y = ( "local-data-ptr: \"" adr " 120 " fqdn "\"" ) ;
print ( x "\n" y ) > hostfile ;
print ( x "\n" y "\n" ) > hostfile ;
}
else {
@ -117,14 +116,13 @@
close( cmd ) ;
}
}
}
else {
if (( cdr == 128 ) && ( hst != "-" )) {
else if ((cls != "ipv4") && (hst != "-") && (9 <= NF) && (NF <= 10)) {
if (cdr == 128) {
if ( bconf == 1 ) {
x = ( "local-data: \"" fqdn ". 120 IN AAAA " adr "\"" ) ;
y = ( "local-data-ptr: \"" adr " 120 " fqdn "\"" ) ;
print ( x "\n" y ) > hostfile ;
print ( x "\n" y "\n" ) > hostfile ;
}
else {
@ -136,11 +134,11 @@
}
}
if (( cdr2 == 128 ) && ( hst != "-" )) {
if (cdr2 == 128) {
if ( bconf == 1 ) {
x = ( "local-data: \"" fqdn ". 120 IN AAAA " adr2 "\"" ) ;
y = ( "local-data-ptr: \"" adr2 " 120 " fqdn "\"" ) ;
print ( x "\n" y ) > hostfile ;
print ( x "\n" y "\n" ) > hostfile ;
}
else {
@ -152,6 +150,10 @@
}
}
}
else {
# dump non-conforming lease records
}
}
##############################################################################