From mboxrd@z Thu Jan  1 00:00:00 1970
From: Martin Krieger <makrie@posteo.de>
To: development@lists.ipfire.org
Subject: Re: [PATCH] ddns: Add provider Feste-IP.Net
Date: Fri, 28 May 2021 15:09:37 +0000
Message-ID: <03ed1212-d118-6ac1-0081-d4c04c10efe3@posteo.de>
In-Reply-To: <BB959104-3D63-4E90-AF80-4CDA480D715E@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============6665433015561106775=="
List-Id: <development.lists.ipfire.org>

--===============6665433015561106775==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Hello Michael,

I hope this will leave the path of ignoring *any* technical advice.

The (re-)definition of list providers in the derived class seems to be=20
not necessary. Am I right?

Anything left or maybe simply misunderstood by me?

Regards,

Martin Krieger

 From 2e0f9067d04d6250b476a1cb6e5224ba8d91be70 Mon Sep 17 00:00:00 2001
From: Martin Krieger <makrie(a)posteo.de>
Date: Tue, 18 May 2021 19:42:44 +0200
Subject: [PATCH] ddns: Add provider Feste-IP.Net

Provider Feste-IP.Net addapted from class DDNSProviderDesecIO
---
  README                |  1 +
  src/ddns/providers.py | 29 +++++++++++++++++++++++++++++
  2 files changed, 30 insertions(+)

diff --git a/README b/README
index b6decb35c338..fa6ce5e598b8 100644
--- a/README
+++ b/README
@@ -68,6 +68,7 @@ SUPPORTED PROVIDERS:
      easydns.com
      enom.com
      entrydns.net
+    feste-ip.net
      freedns.afraid.org
      inwx.com|de|at|ch|es
      itsdns.de
diff --git a/src/ddns/providers.py b/src/ddns/providers.py
index 56e6620c78ab..e274fb4f7262 100644
--- a/src/ddns/providers.py
+++ b/src/ddns/providers.py
@@ -1179,6 +1179,35 @@ class DDNSProviderEntryDNS(DDNSProvider):
          raise DDNSUpdateError


+class DDNSProviderFesteIPNet(DDNSProtocolDynDNS2, DDNSProvider):
+        handle    =3D "feste-ip.net"
+        name      =3D "Feste-IP.Net"
+        website   =3D "https://www.feste-ip.net/"
+        # protocols =3D ("ipv6", "ipv4",)
+
+        # Information about the format of the request is to be found
+        # https://forum.feste-ip.net/viewtopic.php?f=3D13&t=3D469
+        # ipv4 / ipv6 records are automatically removed when the update
+        # request originates from the respectively other protocol and no
+        # address is explicitly provided for the unused protocol.
+
+        url =3D "https://members.feste-ip.net/nic/update/"
+
+        # feste-ip.net sends the IPv6 and IPv4 address in one request
+
+        def update(self):
+                data =3D DDNSProtocolDynDNS2.prepare_request_data(self,=20
"ipv4")
+
+                # This one supports IPv6
+                myip2 =3D self.get_address("ipv6")
+
+                # Add update information if we have an IPv6 address.
+                if myip2:
+                        data["myip2"] =3D myip2
+
+                self.send_request(data)
+
+
  class DDNSProviderFreeDNSAfraidOrg(DDNSProvider):
      handle    =3D "freedns.afraid.org"
      name      =3D "freedns.afraid.org"
--=20
2.31.0

Michael Tremer:
> Hello Martin,
>=20
>> On 20 May 2021, at 17:51, Martin Krieger <makrie(a)posteo.de> wrote:
>>
>> Hello Michael,
>>
>> this is my latest improvement:
>>
>>  From c745be038550bf66f2c233ff9de1348bcfd99080 Mon Sep 17 00:00:00 2001
>> From: Martin Krieger <makrie(a)posteo.de>
>> Date: Tue, 18 May 2021 19:42:44 +0200
>> Subject: [PATCH] ddns: Add provider Feste-IP.Net
>>
>> Provider supports IPv4, IPv6 & DS (Dual-Stack).
>> Required url parameter myip for IPv4 or IPv6.
>> Optional url parameter myip2 for DS which holds IPv4 or IPv6.
>> Url parameters myip & myip2 will not hold the same record type.
>> ---
>> README                |  1 +
>> src/ddns/providers.py | 40 ++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 41 insertions(+)
>>
>> diff --git a/README b/README
>> index b6decb35c338..fa6ce5e598b8 100644
>> --- a/README
>> +++ b/README
>> @@ -68,6 +68,7 @@ SUPPORTED PROVIDERS:
>> 	easydns.com
>> 	enom.com
>> 	entrydns.net
>> +	feste-ip.net
>> 	freedns.afraid.org
>> 	inwx.com|de|at|ch|es
>> 	itsdns.de
>> diff --git a/src/ddns/providers.py b/src/ddns/providers.py
>> index 56e6620c78ab..8c6da69b6e50 100644
>> --- a/src/ddns/providers.py
>> +++ b/src/ddns/providers.py
>> @@ -1179,6 +1179,46 @@ class DDNSProviderEntryDNS(DDNSProvider):
>> 		raise DDNSUpdateError
>>
>>
>> +class DDNSProviderFesteIPNet(DDNSProtocolDynDNS2, DDNSProvider):
>> +        handle    =3D "feste-ip.net"
>> +        name      =3D "Feste-IP.Net"
>> +        website   =3D "https://www.feste-ip.net/"
>> +
>> +        # Information about the format of the request is to be found
>> +        # https://forum.feste-ip.net/viewtopic.php?f=3D13&t=3D469
>> +
>> +	# myip is required and holds IPv4 or IPv6
>> +	# myip2 is optional for DS and holds IPv4 or Ipv6 but opposite record ty=
pe of myip
>> +        myips =3D ("myip","myip2")
>> +
>> +        url =3D "https://members.feste-ip.net/nic/update/"
>> +
>> +        def update(self):
>> +                data =3D {
>> +                        "hostname" : self.hostname
>> +                }
>> +
>> +		# idx sets index of myips and checks for required url parameter myip
>> +		idx =3D 0
>> +		# Loop through DDNSProvider.protocols list
>> +                for proto in DDNSProvider.protocols:
>> +                        idx =3D 0
>> +                        tmpip =3D self.get_address(proto)
>> +			# Save only valid address response of protocol proto to the actual=20
url parameter...
>> +			# and increase idx
>> +                        if tmpip:
>> +                                data[self.myips[idx]] =3D tmpip
>> +                                idx +=3D 1
>> +
>> +		# Send DynDNS2 update request if the required url parameter myip is=20
given
>> +                if idx:
>> +                        self.send_request(data)
>> +                        return
>> +
>> +		# Raise error if the required if the required url parameter myip gets n=
o valid address
>> +                raise DDNSUpdateError
>> +
>> +
>> class DDNSProviderFreeDNSAfraidOrg(DDNSProvider):
>> 	handle    =3D "freedns.afraid.org"
>> 	name      =3D "freedns.afraid.org"
>> --=20
>> 2.31.0
>>
>> Based on your correct comment idx =3D 0 was on the wrong line, it moved ou=
tside the loop over the protocols (IPv4 & IPv6).
>=20
> You ignored all technical advice that I have given to you. There are soluti=
ons already in the same file that you simply need to copy and paste. They are=
 tested, clean and just work.
>=20
> Your implementation is not very Pythonic and raises a random error if no IP=
 address could be determined.
>=20
>> Pure IPv4 is tested & works as expected. As stated several times I have no=
 option to test IPv6 and DS on my system.
>>
>> The provider serves a test possibility (https://www.feste-ip.net/ddns-serv=
ice/faq-ddns/):
>>
>> "Kann Ich den Dienst testen ohne mich extra anzumelden?
>> Ja. Um zu testen ob Ihr Router bzw. Ihr Updateclient mit unserem Dienst fu=
nktioniert k=C3=B6nnen Sie folgende Testdaten verwenden:
>>
>> DNS-Name: test.feste-ip.net
>> HOST-ID : 13135
>> Passwort: 7sN2KS6L8W
>>
>> Bitte beachten Sie dass diese Daten u.U. von mehreren Testern verwendet we=
rden.
>> Ob Ihr Update erfolgreich war k=C3=B6nnen Sie mit der zeitnahen Eingabe vo=
n "nslookup -query=3Dtxt test.feste-ip.net" pr=C3=BCfen."
>>
>> Could please anybody in the development-team who has the right technical c=
onditions (IPv6 or DS) do test for these cases? That would be nice. Thanks.
>>
>> Should I mark my faulty patch on the ipfire git server as superseded?
>=20
> Yes, please.
>=20
>> Regards,
>>
>> Martin Krieger
>>
>> Michael Tremer:
>>> Hello,
>>>> On 20 May 2021, at 12:02, Martin Krieger <makrie(a)posteo.de> wrote:
>>>>
>>>> Hello Michael,
>>>>
>>>> got it. You are right, sorry for confusion.
>>>>
>>>> But I really read the process description and have read your comments as=
 well as looking in providers.py for examples.
>>>>
>>>> What should I do? Remove anything, improve it,...?
>>> Yes, please improve the patch. If there is anything unclear, you should
>> ask those questions first before sending a fixed version of that patch.
>>>> Simply issue a request to you to implement that?
>>> No, this won=E2=80=99t work because we don=E2=80=99t have an account with=
 this provider to test it.
>>>> One general question: Should a patch be send as uncommited diff from=20
the staging area in before for revision instead of a commited one?
>>> No, you should have a branch in your local git repository and commit to
>> that. You can use =E2=80=9Cgit commit =E2=80=94-amend=E2=80=9D if you need=
 to edit an existing commit.
>>> Best,
>>> -Michael
>>>>
>>>> Regards,
>>>>
>>>> Martin Krieger
>>>>
>>>>
>>>>
>>>> Am 20. Mai 2021 12:00:26 MESZ schrieb Michael Tremer <michael.tremer(a)i=
pfire.org>:
>>>> Hello Martin,
>>>>
>>>> Thanks for working on ddns, but *please* read Peter=E2=80=99s email.
>>>>
>>>> This is now the third patch (I don=E2=80=99t know why you are at number =
6 already) and the idea of the review process is to submit something that at =
least works. You can ask all sorts of questions about anything you need to kn=
ow, but you will have to listen to what people answer.
>>>>
>>>> This patch is fundamentally broken. I will comment on that further below.
>>>>
>>>> Secondly, we cannot even think about merging something that isn=E2=80=99=
t tested at all.
>>>>
>>>> So I would urge you to look at any of the other providers, because what =
you are trying to implement has already been implemented here for example:
>>>>
>>>>    https://git.ipfire.org/?p=3Dddns.git;a=3Dblob;f=3Dsrc/ddns/providers.=
py;h=3D56e6620c78ab3d9de1c945147f86e70a8d8614d7;hb=3DHEAD#l975
>>>>
>>>> @Stefan: We might want to have a class variable in the DynDNS protocol
>> that adds the IPv6 address to a field that is named in that variable. That=
 way, we avoid any code duplication.
>>>>
>>>> On 18 May 2021, at 19:49, Martin Krieger <makrie(a)posteo.de> wrote:
>>>>
>>>>  From 37fb0237932fb12bdd635e9cb5e01b0bf9f03dda Mon Sep 17 00:00:00 2001
>>>> From: Martin Krieger <makrie(a)posteo.de>
>>>> Date: Tue, 18 May 2021 19:42:44 +0200
>>>> Subject: [PATCH v6 1/1] ddns: Add provider Feste-IP.Net
>>>>
>>>> Comments:
>>>> Provider supports IPv4, IPv6 & DS (Dual-Stack)
>>>>
>>>> Changelog:
>>>>
>>>> 18.05.2021
>>>> Improved failure handling.
>>>> IPv6 & DS still not checked, because my network connection is pure IPv4.
>>>>
>>>> 17.05.2021
>>>> 5th attempt ([PATCH v5 1/1])
>>>>
>>>> 16.05.2021
>>>> 4th attempt ([PATCH v4 1/1])
>>>>
>>>> 08.05.2021
>>>> 3rd attempt ([PATCH v3 1/1])
>>>>
>>>> 06.05.2021
>>>> 2nd attempt ([PATCH v2 1/1])
>>>>
>>>> 05.05.2021
>>>> 1st attempt ([PATCH v1 1/1])
>>>>
>>>> Signed-off-by: Martin Krieger <makrie(a)posteo.de>..
>>>> README                |  1 +
>>>> src/ddns/providers.py | 31 +++++++++++++++++++++++++++++++
>>>> 2 files changed, 32 insertions(+)
>>>>
>>>> diff --git a/README b/README
>>>> index b6decb35c338..fa6ce5e598b8 100644
>>>> --- a/README
>>>> +++ b/README
>>>> @@ -68,6 +68,7 @@ SUPPORTED PROVIDERS:
>>>> 	easydns.com
>>>> 	enom.com
>>>> 	entrydns.net
>>>> +	feste-ip.net
>>>> 	freedns.afraid.org
>>>> 	inwx.com|de|at|ch|es
>>>> 	itsdns.de
>>>> diff --git a/src/ddns/providers.py b/src/ddns/providers.py
>>>> index 56e6620c78ab..b7e14482a0b1 100644
>>>> --- a/src/ddns/providers.py
>>>> +++ b/src/ddns/providers.py
>>>> @@ -1179,6 +1179,37 @@ class DDNSProviderEntryDNS(DDNSProvider):
>>>> 		raise DDNSUpdateError
>>>>
>>>>
>>>> +class DDNSProviderFesteIPNet(DDNSProtocolDynDNS2, DDNSProvider):
>>>> +        handle    =3D "feste-ip.net"
>>>> +        name      =3D "Feste-IP.Net"
>>>> +        website   =3D "https://www.feste-ip.net/"
>>>> +
>>>> +        # Information about the format of the request is to be found
>>>> +        # https://forum.feste-ip.net/viewtopic.php?f=3D13&t=3D469
>>>> +
>>>> +        myips =3D ("myip","myip2")
>>>> +
>>>> +        url =3D "https://members.feste-ip.net/nic/update/"
>>>> +
>>>> +        def update(self):
>>>> +                data =3D {
>>>> +                        "hostname" : self.hostname
>>>> +                }
>>>> +
>>>> +                for proto in DDNSProvider.protocols:
>>>> +                        idx =3D 0
>>>> +                        tmpip =3D self.get_address(proto)
>>>> +                        if tmpip:
>>>> +                                data[self.myips[idx]] =3D tmpip
>>>> +                                idx +=3D 1
>>>>
>>>> Setting idx is useless here. You will reset to zero in every iteration
>> of the loop. Since it is being incremented last and then reset to zero, id=
x will *always* be zero.
>>>>
>>>> +
>>>> +                if self.myips[0] in data:
>>>> +                        self.send_request(data)
>>>> +                        return#
>>>>
>>>> You will only send one request here and only if it contains an IPv4 addr=
ess. Why? What happens to systems that only have IPv6?
>>>>
>>>> -Michael
>>>>
>>>> +
>>>> +                raise DDNSUpdateError
>>>> +
>>>> +
>>>> class DDNSProviderFreeDNSAfraidOrg(DDNSProvider):
>>>> 	handle    =3D "freedns.afraid.org"
>>>> 	name      =3D "freedns.afraid.org"
>>>> --=20
>>>> 2.31.0
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --=20
>>>> Diese Nachricht wurde von meinem Android-Ger=C3=A4t mit K-9 Mail gesende=
t.
>>
>=20


--===============6665433015561106775==
Content-Type: application/pgp-signature
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="OpenPGP_signature.sig"
MIME-Version: 1.0

LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSXpCQUVCQ2dBZEZpRUVuV0tqZ2ZoSXBr
anh4Tm1BRWV2RUVOYVpqR01GQW1DeEI3RUFDZ2tRRWV2RUVOYVoKakdNRWJSQUE0U1NydGlmSlNI
bE9GNXR3NktSdDZIQlptUklBMURXTXdYZEhDRVRzRUYzcXdoSlpyamt0UngxVAppYTNPV015Tzc5
RDhmb3R6aFNIVEVpUmZpN0Q3LytrTmh0TER4Z3lwT2NVVHRrK3ZBcm1pSmFjQ0FsSjBxZkoyCllU
aGVuQ29hMkE2R01ydVA0SWhZZEdyRkU2eDR0bXVaVEJWYnlMbXNoNm95c1h2L0F2NndHaWJZTElU
MHZLWWYKMUZwMXRtaGZqRzFTYlpKY1M5azBuZmFrSERsbnFmeUhSajNKUnVubVFMRHpvQTFQMFRt
eXBXNkV3Tm0zMWppbQpQRDl4NmRBbXUxQUlleHJLZDB6ckhxMzdUWmdBR1ZnZ1F5eVhvUFVZSEtR
NUJCU05TSTJlN3BwSEk3cU5QRlpKCldIcy96SURVbWRhSWJLWjR2bWpGTmxFZGpVSi82dm42UldG
eG9UdGFPUU4wT043ZS9VQlZWcTVaVHJHRHg0SkkKTE9nQ0c4M1hzWlJEREVDRFNub2dPK1NZQVZr
c3M5cUdQb1pvWWZKM0pUTVF3WGpuUEo3K0l0TGE0VDg5T0Q5aApmeTN4UUE1c2xkZk53Tm1oTS9i
MjBVNmRTREFtcU1IK3NaeVRTclFoVWkzZ2MxTkljUUFJV09qOVdNeTF6cksxClFXZkZ1Wm9YcXVT
MmRhWEZLbTZ3Njdkem1xZ05UNHBlTXNCemVlcEJrdnAzaWE3N0lRdTlhczNrbHJBNWhoemEKenox
MmtYRHVDZDhpTmpReWt2MnBIR2FNL09MVTAyamxxOTJDb1Z3Ny9DZW1qWXZNRi9nWVJtMkdESk5J
djhUaQpPb2crSlptM0FmSG1zM085bzNKa3QwY1lwWEpYMlFERWlTd1dEM2w0SStYRU8wWTc1cjQ9
Cj1rTENwCi0tLS0tRU5EIFBHUCBTSUdOQVRVUkUtLS0tLQo=

--===============6665433015561106775==--