Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcard zone file entries always respond with a zero TTL #1849

Closed
GeldornOfDragonhill opened this issue Dec 2, 2022 · 5 comments · Fixed by #1850
Closed

Wildcard zone file entries always respond with a zero TTL #1849

GeldornOfDragonhill opened this issue Dec 2, 2022 · 5 comments · Fixed by #1850

Comments

@GeldornOfDragonhill
Copy link

Describe the bug
Wildcard zone file entries always respond with a zero TTL.

To Reproduce
Simple zone file (test.local.zone) to reproduce the issue

$TTL 120
@ IN SOA ns.test.local. nobody.localhost. (2022120201 3600 1800 604800 60)
ns IN A 127.0.0.1
simple IN A 10.0.0.1
*.wc IN A 10.0.0.2

Sample program

#[tokio::main]
async fn main() {
    let mut catalog = Catalog::new();

    let config = FileConfig {
        zone_file_path: "test.local.zone".to_string()
    };

    let zone_name = LowerName::from_str("test.local.").unwrap();

    let authority = FileAuthority::try_from_config(Name::from(zone_name.clone()), ZoneType::Primary, false,None, &config).unwrap();
    catalog.upsert(zone_name, Box::new(Arc::new(authority)) as Box<dyn AuthorityObject>);

    let mut server_future = ServerFuture::new(catalog);
    let udp_socket = UdpSocket::bind(SocketAddr::from_str("0.0.0.0:1153").unwrap()).await.unwrap();
    server_future.register_socket(udp_socket);

    server_future.block_until_done().await.unwrap();
}

dig queries

# The simple entry responds as expected
> dig +noall +answer a simple.test.local @127.0.0.1 -p 1153
simple.test.local.	120	IN	A	10.0.0.1

# The wildcard entry responds with zero
> dig +noall +answer a x.wc.test.local @127.0.0.1 -p 1153
x.wc.test.local.	0	IN	A	10.0.0.2

Expected behavior
Wildcard zone file entries should have the same TTL as normal zone file entries.

Version:
Crate: [trust-dns-server]
Version: [0.22.0]

@darnuria
Copy link
Contributor

darnuria commented Dec 3, 2022

Hello! Thanks for the report. I am just an occasional contributor.

I will try to dig into it tomorrow at least try to reproduce it in Test. :)

Sorry for the quick-send edited to say hello!

@darnuria
Copy link
Contributor

darnuria commented Dec 4, 2022

Began to make a minimal test case.

I choose to remove server stuff. What is clear $TTL is not applied everywhere, will continue to dig in.
#1850

As a reference : https://bind9.readthedocs.io/en/v9_18_4/chapter3.html#term-0

Think I found a fix #1850

darnuria added a commit to darnuria/trust-dns that referenced this issue Dec 4, 2022
darnuria added a commit to darnuria/trust-dns that referenced this issue Dec 4, 2022
darnuria added a commit to darnuria/trust-dns that referenced this issue Dec 4, 2022
darnuria added a commit to darnuria/trust-dns that referenced this issue Dec 4, 2022
darnuria added a commit to darnuria/trust-dns that referenced this issue Dec 4, 2022
darnuria added a commit to darnuria/trust-dns that referenced this issue Dec 4, 2022
@darnuria
Copy link
Contributor

darnuria commented Dec 5, 2022

@GeldornOfDragonhill We added a test case reproducing your issue and pin-pointed the problem, if it persist please feel free to reopen! :)

@GeldornOfDragonhill
Copy link
Author

@darnuria Seems to work as expected now, thank you.

@darnuria
Copy link
Contributor

darnuria commented Dec 7, 2022

Great. :)
Thanks also to @bluejekyll for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants