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

Variables for update of ipv6prefix and ipv6 on dynv6 #485

Open
zilon84 opened this issue May 15, 2024 · 12 comments
Open

Variables for update of ipv6prefix and ipv6 on dynv6 #485

zilon84 opened this issue May 15, 2024 · 12 comments

Comments

@zilon84
Copy link

zilon84 commented May 15, 2024

Hello all,

I am using the following URL to update IPv4 on dynv6 on my unifi controller:

dynv6.com/api/update?hostname=%h&token=%u&ipv4=%i

Now, I also want to update IPv6 and/or its prefix. How to do that? What are the varaible names for IPv6 or the prefix?

Is it possible to combine everything in one URL since unifi does not accept two URLs separated by space.

Thank you!

@Dzinlife
Copy link

Same issue, also want to know about it.

@troglobit
Copy link
Owner

The API for the plugin is available here https://dynv6.com/docs/apis. The plugin, and Inadyn itself, is 100% reliant on users "scratching an itch" to drive the functionality forward. So if you can learn the API and suggest changes, I can at least review the changes and propose a build for you to test.

@troglobit
Copy link
Owner

Anyone had the chance yet to have a look at the API link I referenced? Would be great to get some more insight on this issue from users with dynv6 accounts.

@Dzinlife
Copy link

Dzinlife commented Aug 3, 2024

Anyone had the chance yet to have a look at the API link I referenced? Would be great to get some more insight on this issue from users with dynv6 accounts.

dynv6.com/api/update?hostname=%h&token=%u&ipv4=%i&ipv6={???%}

dynv6 uses the {ipv6} URL parameter to update. I just want to know which keyword% should be used.

@troglobit
Copy link
Owner

Yeah, me too. I have no means of testing this myself, so it's up to the users to help out.

@cross
Copy link

cross commented Aug 7, 2024

Where in the code is the mapping of %n (for any n) to the conceptual value that it represents? From the above example, I can see %h is hostname, %i is IPv4 address. Where are those mappings?

@troglobit
Copy link
Owner

@cross see plugins/generic.c

inadyn/plugins/generic.c

Lines 81 to 139 in b9edfbf

/*
* Fully custom server URL, with % format specifiers
*
* %u - username
* %p - password, if HTTP basic auth is not used
* %h - hostname
* %i - IP address
*/
static int custom_server_url(char *buf, ddns_info_t *info, ddns_alias_t *alias)
{
char *ptr;
while ((ptr = strchr(buf, '%'))) {
if (!strncmp(ptr, "%u", 2)) {
if (strnlen(info->creds.username, USERNAME_LEN) <= 0) {
logit(LOG_ERR, "Format specifier in ddns-path used: '%%u',"
" but 'username' configuration option has not been specified!");
skip_fmt(ptr, 2);
} else {
replace_fmt(ptr, info->creds.username, 2);
}
continue;
}
if (!strncmp(ptr, "%p", 2)) {
if (strnlen(info->creds.password, PASSWORD_LEN) <= 0) {
logit(LOG_ERR, "Format specifier in ddns-path used: '%%p',"
" but 'password' configuration option has not been specified!");
skip_fmt(ptr, 2);
} else {
replace_fmt(ptr, info->creds.password, 2);
}
continue;
}
if (!strncmp(ptr, "%h", 2)) {
replace_fmt(ptr, alias->name, 2);
continue;
}
if (!strncmp(ptr, "%i", 2)) {
replace_fmt(ptr, alias->address, 2);
continue;
}
/* NOTE: This should be the last one */
if (!strncmp(ptr, "%%", 2)) {
replace_fmt(ptr, "%", 2);
continue;
}
logit(LOG_ERR, "Unknown format specifier in ddns-path: '%c'", ptr[1]);
return -1;
}
return strlen(buf);
}

@cross
Copy link

cross commented Aug 7, 2024

Okay, thanks. So for @zilon84 , it is not possible to put it in one URL. There are separate calls inside of the code for each of IPv4 and IPv6.

@troglobit
Copy link
Owner

... or maybe expand on the format specifier implementation? E.g., adding support for %I, or similar, to expand to the IPv6 address? This is software after all, everything is possible, even though it doesn't always come served on a platter.

@cross
Copy link

cross commented Aug 7, 2024

Yeah, but only skimming the code it looks a lot like there are separate paths for IPv4 and IPv6. I didn't know how practical it would be to try to make one pass through the code cover both and not have two calls.
But I haven't really looked that carefully at how it does the combination of v4 and v6.

@troglobit
Copy link
Owner

So ... your comment is more about the amount of time needed to invest in fixing this bug? Not every change is easy, but not everything worthwhile is ever easy, or something like that.

@cross
Copy link

cross commented Aug 7, 2024

So ... your comment is more about the amount of time needed to invest in fixing this bug? Not every change is easy, but not everything worthwhile is ever easy, or something like that.

Apologies. I didn't mean to "comment" on anything. I'm all for people contributing solutions to problems, and happy to hear you are open to even significant changes. I was mostly just thinking out loud without knowing enough about the architecture to know how easy or not things were. I should not have been thinking/commenting without more information or thought. I didn't mean to imply or suggest anything.

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

No branches or pull requests

4 participants