Commit graph

802 commits

Author SHA1 Message Date
David Kerr
00ce8bdeb3 Add is_ipv4() and extract_ipv4() functions 2020-06-29 00:19:32 -04:00
Richard Hansen
8b2ede16c0 Revert "Add is_ipv4() and ipv4_match() functions"
Broke `ip=<IPv4 address>`.

This reverts commit 0caed7ca2a.
2020-06-28 23:57:58 -04:00
Richard Hansen
1766313397 Sort %builtinfw entries by key 2020-06-28 19:55:57 -04:00
Richard Hansen
3199f791d8 Sort %services entries by key 2020-06-28 19:55:57 -04:00
Sandro
b85d86795e
Merge pull request #193 from rhansen/config
Delete unused `config` entry
2020-06-29 01:37:29 +02:00
Richard Hansen
959c7154ad
Merge pull request #194 from rhansen/ip-extract
Rename `ipv4_match`, `ipv6_match` to `ipv4_extract`, `ipv6_extract`
2020-06-28 17:14:17 -04:00
Richard Hansen
8a63c5b74f Rename ipv4_match, ipv6_match to extract_ipv4, extract_ipv6
"Match" only implies a boolean return value. While these functions can
be used in boolean context, "extract" more closely matches their
intended purpose.
2020-06-28 17:09:36 -04:00
Richard Hansen
dc47afea38 Delete unused config entry 2020-06-26 21:04:01 -04:00
Richard Hansen
7556aaa5e1
Merge pull request #191 from rhansen/deprecate-banlocal
Turn `fw-banlocal` into a no-op and mark it as deprecated
2020-06-26 21:01:40 -04:00
Richard Hansen
4edecf3dc1 Turn fw-banlocal into a no-op and mark it as deprecated
`fw-banlocal` is problematic:
  * There's not much point to it. Regardless of whether it is enabled,
    the end result is a DNS record that is not being updated to a
    useful value. It does cause a warning to be logged, but because it
    is not enabled by default it doesn't help the poor user who is
    trying to figure out why they can't reach their machine. By the
    time they realize that enabling this option would have saved them
    hours of troubleshooting, they no longer need to enable it because
    they already know what the problem is.
  * It's a misnomer: `fw-banlocal` doesn't just filter out local IP
    addresses from `use=fw`, it also filters them out of all other
    address sources except `use=ip`.
  * It doesn't filter out local IPv6 addresses.
  * The resulting warning ("unable to determine IP address") is
    misleading.

We might want to add a warning whenever a non-global address is
discovered (along with an option to silence the warning), but that
should be done in a future commit if at all.
2020-06-25 23:32:58 -04:00
Sandro
08c7e71352
Merge pull request #187 from rhansen/defined-or-op
Use the `//` operator to simplify code
2020-06-24 20:01:19 +02:00
Richard Hansen
a84015015f Use the // operator to simplify code 2020-06-24 13:34:31 -04:00
Sandro
271f277126
Merge pull request #169 from rhansen/geturl-force-ip-version 2020-06-24 15:15:12 +02:00
Richard Hansen
39bd6fce9e New geturl param to force IPv4 or IPv6
This will be used by the upcoming `webv4` and `webv6` options to
ensure that the checkip service returns the desired type of IP
address.

Addresses #172
2020-06-23 11:55:46 -04:00
Richard Hansen
323a873b22 Change geturl to take a hash of parameters
This makes the call sites more readable, and it will be easier to
extend in the future (to add an option to force IPv4 or IPv6, for
example).
2020-06-23 11:55:46 -04:00
Richard Hansen
7fafb8df7e
Merge pull request #186 from dkerr64/is_ipv4-function
Add is_ipv4() and ipv4_match() functions
2020-06-23 11:54:12 -04:00
David Kerr
0caed7ca2a Add is_ipv4() and ipv4_match() functions 2020-06-23 11:52:27 -04:00
Richard Hansen
aeba95aef4
Merge pull request #182 from rhansen/fix-use-ip
Fix `use=ip` when `ip` is set to an IPv4 address
2020-06-17 12:16:35 -04:00
Richard Hansen
99a60995c4 Fix use=ip when ip is set to an IPv4 address
Before, with `use=ip,ip=1.2.3.4`, `get_ip` would return `undef` and
print a warning:

  WARNING:  found neither ipv4 nor ipv6 address
2020-06-17 12:16:05 -04:00
Sandro
2f26ed5969
Merge pull request #183 from rhansen/bool-parsing
Fix parsing of "true" as a boolean value
2020-06-17 09:43:35 +02:00
Richard Hansen
40f355d05e Fix parsing of "true" as a boolean value
Before, "t" and "ttrue" were accepted as true, but not "true".

Also simplify the true and false regular expressions.
2020-06-16 23:23:02 -04:00
Richard Hansen
7cc36539e7 Move Data::Validate::IP removal note to dependency changes section 2020-06-16 14:23:02 -04:00
Richard Hansen
5b251f3802
Merge pull request #178 from dkerr64/RemoveValidateIP
Remove dependency on Data::Validate::IP
2020-06-15 23:19:03 -04:00
David Kerr
d4c55dd0f5 Remove dependency on Data::Validate::IP
This module is not available by default on many systems, and not
available at all on lightweight embedded systems.
2020-06-15 23:17:12 -04:00
Sandro
35eac827e3
Merge pull request #173 from rhansen/request-body-crlf
Don't replace LF with CRLF in body of HTTP request
2020-06-14 15:59:18 +02:00
Sandro
0b60ce3f94
Merge pull request #174 from rhansen/host-opt
Fix global fallback when host-specific setting is undefined
2020-06-14 02:02:33 +02:00
Richard Hansen
ffb908ab49 Don't replace LF with CRLF in body of HTTP request
Now the Content-Length header matches the actual length of the body.

Also, don't replace an LF with CRLF if it is already preceeded by CR.
2020-06-13 14:41:30 -04:00
Richard Hansen
f6d5ce3383 Fix global fallback when host-specific setting is undefined
This commit only changes behavior if the hostname is a falsy string
(`''` or `'0'`) and there is a variable that:
  * was not set globally before the host definition,
  * was not set in the host definition,
  * was set globally after the host definition, and
  * is relevant to the host.
2020-06-13 13:38:33 -04:00
Richard Hansen
b3f2f7029d Whitespace fixes 2020-06-13 11:43:33 -04:00
Sandro
38bec6d135
Merge pull request #171 from rhansen/iproute2
Prefer `ip` command from iproute2 over `ifconfig`
2020-06-13 11:23:49 +02:00
Richard Hansen
e3a6cbf1b6 Prefer ip command from iproute2 over ifconfig
On Linux systems, `ifconfig` is long deprecated in favor of the `ip`
command from iproute2. Some systems don't have iproute2 (BSDs in
particular), so ddclient will still attempt `ifconfig` if `ip` is
missing.

Also: Don't hide STDERR because error messages are important for
troubleshooting problems. To avoid STDERR noise on systems without the
`ip` command, the command's existence is checked before it is run.

Notes:
  * The fetched addresses could be limited to IPv4 or IPv6 depending
    on `opt('ipv6')`, and non-global addresses could be filtered out,
    but any filtering risks breaking a nontrivial number of existing
    configurations.
  * This change runs the risk of breaking existing configs that set
    `if-skip`. Due to the deprecation of `ifconfig`, and the belief
    that only a negligible number of users set `if-skip`, the benefits
    of this change are believed to outweigh the config migration
    burden imposed on users.

Fixes #93.
2020-06-12 22:54:49 -04:00
Sandro
20429c1199
Merge pull request #165 from rhansen/multiline-log-space
Remove extra space at beginning of multiline log messages
2020-06-13 00:09:27 +02:00
Richard Hansen
d60a310599 Remove extra space at beginning of multiline log messages 2020-06-12 15:37:30 -04:00
Sandro
eb4b226af0
Merge pull request #153 from rhansen/infer-use 2020-06-12 21:30:16 +02:00
Richard Hansen
e696d57ff2 Prefer ip over if over web when inferring use
If the user passed `-ip` they almost certainly want to use it, even if
they also passed `-if` and `-web`.

Similarly, if the user passed `-if` they almost certainly want to use
it even if they also passed `-web`.
2020-06-12 11:02:48 -04:00
Richard Hansen
1c13c24981 Fix misuse of define() 2020-06-12 11:02:48 -04:00
Sandro
7fa1beb11e
Merge pull request #166 from rhansen/perl-5.10 2020-06-12 12:07:34 +02:00
Richard Hansen
9cd418f79c Bump minimum required Perl to v5.10.1
This allows us to use the `//` and `//=` operators.

v5.10.1 was chosen because that is the oldest version of Perl among
all currently supported releases of Ubuntu, CentOS, RHEL, Fedora, and
Debian.
2020-06-11 23:18:11 -04:00
Richard Hansen
9e672a8c7d
Merge pull request #144 from rhansen/contributing
Start a contributor guide
2020-06-11 23:11:21 -04:00
Richard Hansen
e74797f557 Start a contributor guide
Addreses #122, #129
2020-06-11 23:10:39 -04:00
Richard Hansen
6e8d7e9744
Merge pull request #158 from rhansen/news
Convert RELEASENOTE to a history of notable changes
2020-06-11 23:05:00 -04:00
Richard Hansen
33dc46d8f4 Update ChangeLog.md with recent changes affecting compatibility 2020-06-11 15:33:27 -04:00
Richard Hansen
17707b0cba Note when Data::Validate::IP dependency was added 2020-06-11 15:33:27 -04:00
Richard Hansen
a3c8d581fa Combine RELEASENOTE, ChangeLog, Changelog.old into ChangeLog.md
Create a document whose main purpose is to describe notable changes
between released versions. Populate it with the contents of
RELEASENOTE over time and the entries from ChangeLog and
Changelog.old.

For recent releases, the full announcement text can still be found at
https://github.com/ddclient/ddclient/releases
2020-06-11 15:33:27 -04:00
Richard Hansen
593ed1b7a0 Delete unnecessary double quotes
Also minor style cleanups.
2020-06-11 13:04:09 -04:00
Richard Hansen
e6d1d73a4a Whitespace fixes 2020-06-11 13:02:22 -04:00
Richard Hansen
1d78f5fbe3
Merge pull request #155 from rhansen/content-type-header
Fix regex searching for Content-Type header
2020-06-09 15:01:34 -04:00
Richard Hansen
fe3893e26a Fix regex searching for Content-Type header
* Add the `m` modifier because the `$headers` variable can contain
    multiple headers. If `$headers` contains a Content-Type header but
    it is the second or later header then the regex won't match
    without `m`.
  * Add the `i` modifier because RFC 7230 says that header field names
    are case-insensitive.
  * Don't require a space after the colon because RFC 7230 says that
    the space is optional.
2020-06-09 15:00:01 -04:00
Sandro
7d094c0976
Merge pull request #154 from rhansen/geturl-request-newline
Remove extra newline in HTTP request
2020-06-09 14:41:19 +02:00
Richard Hansen
a12004cc4c Remove extra newline in HTTP request
Before, if there were no custom request headers, the request would end
with three newlines instead of two.
2020-06-09 00:22:05 -04:00