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

Support APNIC inter-RIR IPv4 transfer whois referrals #152

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions whois.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,23 @@ char *do_query(const int sock, const char *query)
*p = '\0';
}

/*APNIC referrals and Inter-RIR transfers:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo.

* descr: Transferred to the RIPE region on 2023-08-17T09:45:47Z.
* descr: Transferred to the ARIN region on 2023-08-17T09:45:47Z.
*/
if (!referral_server && strneq(buf, "descr:", 6)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

descr is a user-controllable attribute also in the RIPE and AFRINIC regions, so I think that it would be safer to move this code to a dedicated function like query_crsnic or else anybody could cause infinite loops.
Then make_ip_del.pl and make_ip6_del.pl would need to be modified to invoke that function for queries for APNIC networks.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you need to check that the record has a mnt-by: APNIC-STUB attribute to be sure that this is a real redirect.

if ((p = strstr(buf, "Transferred to the RIPE region")))
referral_server = "whois.ripe.net";
else if ((p = strstr(buf, "Transferred to the ARIN region")))
referral_server = "whois.arine.net";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo.

else if ((p = strstr(buf, "Transferred to the LACNIC region")))
referral_server = "whois.lacnic.net";
else if ((p = strstr(buf, "Transferred to the AFRINIC region")))
referral_server = "whois.afrinic.net";
if (referral_server && (p = strpbrk(referral_server, "/\r\n")))
*p = '\0';
}

if (hide_line(&hide, buf))
continue;

Expand Down