Send kea-dev mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.isc.org/mailman/listinfo/kea-dev
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of kea-dev digest..."


Today's Topics:

   1.  Hardware ID as classification (Duane Zimmer)
   2. Re:  Hardware ID as classification (Francis Dupont)
   3. Re:  Hardware ID as classification (Duane Zimmer)
   4. Re:  Accessing DHCP options within hooks libs (Francis Dupont)
   5. Re:  Hardware ID as classification (Francis Dupont)
   6. Re:  Hardware ID as classification (Duane Zimmer)
   7. Re:  Hardware ID as classification (Francis Dupont)


----------------------------------------------------------------------

Message: 1
Date: Tue, 21 Jun 2016 17:36:00 +0000
From: Duane Zimmer <[email protected]>
To: "'[email protected]'" <[email protected]>
Subject: [kea-dev] Hardware ID as classification
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="us-ascii"

I'm attempting to classify my users equipment based on the OUI of the MAC 
address.  I'm attempting to substring the value of the hardware address with 
the following command but to no success.  How can I reference the hardware 
address in the

"test": "substring(hwaddr,0,3) == '0a030e'"
and
"test": "substring(hardware,1,3) == '0A:00:3E'"
and
"test": "substring('hw-address',0,6) == '0A:00:3E'"
This last one worked but I would imagine that it is taking hw-address in as a 
string not a reference to a field.

I know that this was available under the bind9 DHCP configuration as a class 
file using
class "Equipment"
{
match if substring (hardware,1,3) = 0a:00:3e;
}

Duane Zimmer
IT Manager
[NEW_YL_LOGO.png]
Connecting our Communities
204 Cardinal Cres.
Saskatoon, SK
S7L 6H8
Ph: 306-955-3122
Toll Free: 1-866-650-5465, ext. 3125


-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<https://lists.isc.org/pipermail/kea-dev/attachments/20160621/61578044/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4384 bytes
Desc: image001.png
URL: 
<https://lists.isc.org/pipermail/kea-dev/attachments/20160621/61578044/attachment-0001.png>

------------------------------

Message: 2
Date: Tue, 21 Jun 2016 17:43:05 +0000
From: Francis Dupont <[email protected]>
To: Duane Zimmer <[email protected]>
Cc: "'[email protected]'" <[email protected]>
Subject: Re: [kea-dev] Hardware ID as classification
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

Please try with a hexstring, i.e.,
"test": "substring(hwaddr,0,3) == 0x0a030e"

Regards

Francis Dupont <[email protected]>

PS: of course hwaddr should be pkt4.chaddr but it is not the point
which blocked you.


------------------------------

Message: 3
Date: Tue, 21 Jun 2016 18:36:16 +0000
From: Duane Zimmer <[email protected]>
To: 'Francis Dupont' <[email protected]>
Cc: "'[email protected]'" <[email protected]>
Subject: Re: [kea-dev] Hardware ID as classification
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="us-ascii"

2016-06-21 22:05:08.072 ERROR [kea-dhcp4.dhcp4/30968] DHCP4_INIT_FAIL failed to 
initialize Kea server: configuration error using file 
'/usr/local/etc/kea/kea.conf': expression: 
[substring(pkt4.chaddr,0,3)==0x0a030e] error: <string>:1.11: Invalid character: 
p at (/usr/local/etc/kea/kea.conf:27:15)

Not liking it.  tried both pkt4.chaddr and hwaddr as the lookup.  Did I maybe 
forget a library when I compiled?

-----Original Message-----
From: Francis Dupont [mailto:[email protected]] 
Sent: Tuesday, June 21, 2016 11:43 AM
To: Duane Zimmer <[email protected]>
Cc: '[email protected]' <[email protected]>
Subject: Re: [kea-dev] Hardware ID as classification

Please try with a hexstring, i.e.,
"test": "substring(hwaddr,0,3) == 0x0a030e"

Regards

Francis Dupont <[email protected]>

PS: of course hwaddr should be pkt4.chaddr but it is not the point which 
blocked you.


------------------------------

Message: 4
Date: Tue, 21 Jun 2016 19:49:07 +0000
From: Francis Dupont <[email protected]>
To: Francis Dupont <[email protected]>
Cc: Kea Dev List <[email protected]>
Subject: Re: [kea-dev] Accessing DHCP options within hooks libs
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

Francis Dupont writes:
> We are using smart pointers, not raw pointers, so perhaps it is
> possible to implement a kind of copy on write?
> 
> PS: usually COW in C++ is done playing on const/not const.

=> revisiting the #4497 ticket and its associated discussio I add
a point: there is a trivial way to deep copy a packet (or an option):
just pack it and unpack the result, i.e., the opposite of the repack
method of pkt.h:

    /// @brief Copies content of input buffer to output buffer.
    ///
    /// This is mostly a diagnostic function. It is being used for sending
    /// received packet. Received packet is stored in data_, but
    /// transmitted data is stored in buffer_out_. If we want to send packet
    /// that we just received, a copy between those two buffers is necessary.
    void repack();
                            
BTW even it is a reunpack() IMHO something like deepcopy() is a better
(and less misleading) name.

Regards

Francis Dupont <[email protected]>

PS: sample code (with X = 4 or 6) for a packet:

void deepCopy(PktXPtr& pkt) {
    pkt->pack();
    OutputBuffer& buf(pkt->getBuffer());
    pkt.reset(new PktX(&buf[0], buf.size(),
                       pkt->getLocalAddr(),
                       pkt->getRemoteAddr(),
                       pkt->getLocalPort(),
                       pkt->getRemotePort()));
}


------------------------------

Message: 5
Date: Tue, 21 Jun 2016 19:54:49 +0000
From: Francis Dupont <[email protected]>
To: Duane Zimmer <[email protected]>
Cc: "'[email protected]'" <[email protected]>
Subject: Re: [kea-dev] Hardware ID as classification
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

Oops, pkt4.mac (vs pkt4.chaddr). I should have read the unit test code
(vs the include) as I was my first intention.
I apologize.

Francis Dupont <[email protected]>


------------------------------

Message: 6
Date: Tue, 21 Jun 2016 20:31:56 +0000
From: Duane Zimmer <[email protected]>
To: 'Francis Dupont' <[email protected]>
Cc: "'[email protected]'" <[email protected]>
Subject: Re: [kea-dev] Hardware ID as classification
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="us-ascii"

No worries, but I still get an invalid expression.  I don't have to write a 
custom hook for this?  I'm also using Centos 6.7 if that makes any difference.

ERROR [kea-dhcp4.dhcp4/871] DHCP4_INIT_FAIL failed to initialize Kea server: 
configuration error using file '/usr/local/etc/kea/kea.conf': expression: 
[substring(pkt4.mac,0,3)==0x0a030e] error: <string>:1.11: Invalid character: p 
at (/usr/local/etc/kea/kea.conf:27:15)

// CONFIG FILE

  "client-classes": [
    { "name": "Equipment",
      "test": "substring(pkt4.mac,0,3)==0x0a030e"
    }

-----Original Message-----
From: Francis Dupont [mailto:[email protected]] 
Sent: Tuesday, June 21, 2016 1:55 PM
To: Duane Zimmer <[email protected]>
Cc: 'Francis Dupont' <[email protected]>; '[email protected]' 
<[email protected]>
Subject: Re: [kea-dev] Hardware ID as classification

Oops, pkt4.mac (vs pkt4.chaddr). I should have read the unit test code (vs the 
include) as I was my first intention.
I apologize.

Francis Dupont <[email protected]>


------------------------------

Message: 7
Date: Tue, 21 Jun 2016 21:00:41 +0000
From: Francis Dupont <[email protected]>
To: Duane Zimmer <[email protected]>
Cc: "'[email protected]'" <[email protected]>
Subject: Re: [kea-dev] Hardware ID as classification
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

I should have asked first: what version do you use? I added the pkt4 stuff
in change 1110 so it is not in 1.0 (but for sure it will be in 1.1).
github can help you (cf https://github.com/isc-projects/kea.git)

Thanks

Francis Dupont <[email protected]>
Duane Zimmer writes:
> No worries, but I still get an invalid expression.  I don't have to write a=
>  custom hook for this?  I'm also using Centos 6.7 if that makes any differe=
> nce.
> 
> ERROR [kea-dhcp4.dhcp4/871] DHCP4_INIT_FAIL failed to initialize Kea server=
> : configuration error using file '/usr/local/etc/kea/kea.conf': expression:=
>  [substring(pkt4.mac,0,3)=3D=3D0x0a030e] error: <string>:1.11: Invalid char=
> acter: p at (/usr/local/etc/kea/kea.conf:27:15)
> 
> // CONFIG FILE
> 
>   "client-classes": [
>     { "name": "Equipment",
>       "test": "substring(pkt4.mac,0,3)=3D=3D0x0a030e"
>     }

=> the 11th character is the p of pkt4 so the lexer doesn't know the pkt4
keyword.


------------------------------

_______________________________________________
kea-dev mailing list
[email protected]
https://lists.isc.org/mailman/listinfo/kea-dev

End of kea-dev Digest, Vol 27, Issue 6
**************************************

Reply via email to