Re: [Bug Report] key conflict message for create host by

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Bug Report] key conflict message for create host by

Clodoaldo de Borba Lambiase
The problem addressed is another. We are not expecting different devices in different subnets that have the same MAC address. What we want to support is registration of devices, so they can go from a network to another network and use fixed addresses. So, we need host entries with the same MAC address in different subnets.

Also, ARP resolution is not a problem, because we use servers with DHCP relay.  The server is not in the same broadcast domain of the client.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: [Bug Report] key conflict message for create host by OMAPI

Steve van der Burg
Clodoaldo de Borba Lambiase <[hidden email]> wrote:
> The problem addressed is another. We are not expecting different devices in
> different subnets that have the same MAC address. What we want to support is
> registration of devices, so they can go from a network to another network and
> use fixed addresses. So, we need host entries with the same MAC address in
> different subnets.

Why are you assuming that this is done by creating multiple host definitions for the same MAC?

Do you mean that you need to be able to add something like this via OMAPI?

host ec-ff-cc-52-55-f1 {
  dynamic;
  hardware ethernet ee:ff:cc:52:55:f1;
  fixed-address 10.179.48.34,10.179.49.34,10.179.50.34,10.179.51.34;
}

I add, modify and delete host containers on my DHCP servers with omshell and expect, and a little perl code to control it all.  When I first needed to specify multiple fixed addresses for a MAC, I ran into a limitation of either omshell or OMAPI.  Here's how I solved it:

# Deal with multiple IP addresses for the omshell "set ip-address" command:
#
# Multiple addresses can come in either as an array ref or packed in a string, separated by commas.
#
# To keep things simple, we treat single addresses as if they were multiple, and convert them also.
# We convert the addresses to hex, joined with ":", and then pass them back to the caller.
# This is because omshell can do
#      set ip-address=10.11.12.13
# for setting one address in a host container, but needs to do
#      set ip-address=0a:0b:70:f0:0a:88:4c:f0
# to set more than one (two here).
#
sub make_ipstr {
   my $in = shift;

   if ( ref($in) ne 'ARRAY' ) {
      my @ipa = split(/,/,$in);
      $in = \@ipa;
   }

   my @ho;
   foreach my $ipa ( @$in ) {
      my @oc = split(/\./,$ipa);
      push @ho,sprintf("%2.2x",$_) foreach @oc;
   }

   return join(":",@ho);
}

...Steve


--
Steve van der Burg
Information Technology Services
London Health Sciences Centre
& St. Joseph's Health Care London
(519) 685-8500 ext 35559
[hidden email]

 --------------------------------------------------------------------------------
This information is directed in confidence solely to the person named above and may contain confidential and/or privileged material. This information may not otherwise be distributed, copied or disclosed. If you have received this e-mail in error, please notify the sender immediately via a return e-mail and destroy original message. Thank you for your cooperation.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

[Bug Report] key conflict message for create host by OMAPI

Clodoaldo de Borba Lambiase
In reply to this post by Clodoaldo de Borba Lambiase
Hi,
I had first reported my problem on this topic below:
https://lists.isc.org/pipermail/dhcp-users/2015-October/019267.html

There, I have described the server setups, dhcp files and the exact problem.

I would like something like that via OMAPI:

host 10.179.48.34 {
  dynamic;
  hardware ethernet ee:ff:cc:52:55:f1;
  fixed-address 10.179.48.34;
}

host 10.179.49.34{
  dynamic;
  hardware ethernet ee:ff:cc:52:55:f1;
  fixed-address 10.179.49.34;
}

It is a little different from what people have suggested because I would like to be able to remove and insert 'host' entries by omapi using the ip as unique identifier.
Without use the IP as unique identifier I would have to update or remove and reinsert the host entry.

Solution suggested by Steve is a nice idea and seems it works fine. But, nowadays, our system uses ip as unique identifier and it will be hard to change the concept.

I have a patch to solve this problem but I think that is not the best way to solve this problem. I disabled the "key_conflict" test to allow Omapi host entries with the same MAC for different IPs.
Here, I am reproducing the patch if someone want.

Clodoaldo.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
diff -rupN dhcp-4.3.3.original/dhcp-4.3.3/bind/bindvar.tmp dhcp-4.3.3/bind/bindvar.tmp
--- dhcp-4.3.3.original/dhcp-4.3.3/bind/bindvar.tmp     1969-12-31 21:00:00.000000000 -0300
+++ dhcp-4.3.3/bind/bindvar.tmp 2015-10-21 17:23:25.577897768 -0200
@@ -0,0 +1,2 @@
+binddir=/home/clodoaldo/Softwares/dhcp-4.3.3/bind
+GMAKE=make
diff -rupN dhcp-4.3.3.original/dhcp-4.3.3/config.report dhcp-4.3.3/config.report
--- dhcp-4.3.3.original/dhcp-4.3.3/config.report        1969-12-31 21:00:00.000000000 -0300
+++ dhcp-4.3.3/config.report    2015-10-21 17:23:25.581897758 -0200
@@ -0,0 +1,23 @@
+
+     ISC DHCP source configure results:
+    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+Package:
+  Name:          DHCP
+  Version:       4.3.3
+
+C Compiler:      gcc
+
+Flags:
+  DEFS:          -DHAVE_CONFIG_H
+  CFLAGS:        -g -O2  -Wall -Werror -fno-strict-aliasing -I${top_srcdir}/bind/include
+
+Features:
+  debug:         no
+  failover:
+  execute:
+  binary-leases:
+
+Developer:
+  ATF unittests : no
+
diff -rupN dhcp-4.3.3.original/dhcp-4.3.3/omapip/message.c dhcp-4.3.3/omapip/message.c
--- dhcp-4.3.3.original/dhcp-4.3.3/omapip/message.c     2015-08-26 16:13:14.000000000 -0300
+++ dhcp-4.3.3/omapip/message.c 2015-10-21 17:13:03.047372524 -0200
@@ -29,6 +29,7 @@
 #include "dhcpd.h"

 #include <omapip/omapip_p.h>
+#include <omapip/result.h>

 OMAPI_OBJECT_ALLOC (omapi_message,
                    omapi_message_object_t, omapi_type_message)
@@ -536,6 +537,7 @@ omapi_message_process_internal (omapi_ob

                if (status != ISC_R_SUCCESS &&
                    status != ISC_R_NOTFOUND &&
+               status != DHCP_R_KEYCONFLICT &&
                    status != DHCP_R_NOKEYS) {
                        return omapi_protocol_send_status
                                (po, message -> id_object,


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: [Bug Report] key conflict message for create host by OMAPI

Steven Carr
On 5 November 2015 at 18:37, Clodoaldo de Borba Lambiase
<[hidden email]> wrote:
> It is a little different from what people have suggested because I would like to be able to remove and insert 'host' entries by omapi using the ip as unique identifier.
> Without use the IP as unique identifier I would have to update or remove and reinsert the host entry.

How will OMAPI be able to know which one of the many host statements
with the same "name" you want to remove? Did you write a crystal ball
routine? A unique key is there for a reason.

Updating a single host record to include multiple IP addresses is much
cleaner and programatically safer.

Steve
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: [Bug Report] key conflict message for create host by OMAPI

Caciano Machado
Hi Steve,

Clodoaldo is talking about ISC DHCP different behaviors when configuring
host statements in configuration files or through OMAPI.

On 11/06/2015 07:33 AM, Steven Carr wrote:
> On 5 November 2015 at 18:37, Clodoaldo de Borba Lambiase
> <[hidden email]> wrote:
>> It is a little different from what people have suggested because I would like to be able to remove and insert 'host' entries by omapi using the ip as unique identifier.
>> Without use the IP as unique identifier I would have to update or remove and reinsert the host entry.
> How will OMAPI be able to know which one of the many host statements
> with the same "name" you want to remove? Did you write a crystal ball
> routine? A unique key is there for a reason.

Yes, you are right. If this case happens OMAPI will not be able to know
which entry to remove. Although, this case never happens in Clodoaldo
environment. Also, the key conflict is because of the MAC address, not
because of the host statement name. That is what is confusing about ISC
DHCP OMAPI behavior. Why this key conflict doesn't happen when you write
the same configuration in conf files instead of using OMAPI, like
Clodoaldo's example?

>
> Updating a single host record to include multiple IP addresses is much
> cleaner and programatically safer.

I can't see how that could be safer. In some environments this approach
will be definitely less safer and less intuitive than creating/removing
individual host statements with only one IP address, because you will
need more code to check the IPs that already are in host statements
before updating them. Also, one IP address per host statement is
consistent with how DHCP configuration files works.

>
> Steve
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
--
Caciano Machado
Universidade Federal do Rio Grande do Sul
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: [Bug Report] key conflict message for create host by OMAPI

Steve van der Burg


Caciano Machado <[hidden email]> wrote:
>> Updating a single host record to include multiple IP addresses is much
>> cleaner and programatically safer.
>
> I can't see how that could be safer. In some environments this approach
> will be definitely less safer and less intuitive than creating/removing
> individual host statements with only one IP address, because you will
> need more code to check the IPs that already are in host statements
> before updating them. Also, one IP address per host statement is
> consistent with how DHCP configuration files works.

Not really.  The host statements are about *hosts* and you seem to want them to be about IP addresses.  A host can move from network to network, and if it needs a different static address on each one, you need to define that list of addresses for the host.

...Steve


 --------------------------------------------------------------------------------
This information is directed in confidence solely to the person named above and may contain confidential and/or privileged material. This information may not otherwise be distributed, copied or disclosed. If you have received this e-mail in error, please notify the sender immediately via a return e-mail and destroy original message. Thank you for your cooperation.
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: [Bug Report] key conflict message for create host by OMAPI

Caciano Machado

> Not really.  The host statements are about *hosts* and you seem to want them to be about IP addresses.  A host can move from network to network, and if it needs a different static address on each one, you need to define that list of addresses for the host.
>
> ...Steve

Not exactly. The way you suggest is not the only way to configure. ISC
DHCP already work like I explained with configuration files, with
multiple host static statements for the same MAC address. This also
allows hosts moving from network to network. Are you saying that this
behavior is an error in ISC DHCP? If it is an error it should be
reported. But, if it is not an error, why is OMAPI working in a
different way?

Caciano
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users