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.  hook library question: parsing DHO_DHCP_AGENT_OPTIONS sub
      options in incoming packets (Angelo Failla)
   2. Re:  [Potential Spoof] hook library question: parsing
      DHO_DHCP_AGENT_OPTIONS sub options in incoming packets (Angelo Failla)


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

Message: 1
Date: Thu, 3 Nov 2016 11:34:05 +0000
From: Angelo Failla <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [kea-dev] hook library question: parsing
        DHO_DHCP_AGENT_OPTIONS sub options in incoming packets
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

Hi,

I have a question about retrieving DHO_DHCP_AGENT_OPTIONS from an incoming 
dhcpv4 DISCOVER packet.

I have this code in my hook library:

  OptionPtr rai = query4_ptr->getOption(DHO_DHCP_AGENT_OPTIONS);
  OptionPtr circuit_id_opt = rai->getOption(RAI_OPTION_AGENT_CIRCUIT_ID);
  OptionPtr remote_id_opt = rai->getOption(RAI_OPTION_REMOTE_ID);
  
But both circuit_id_opt and remote_id_opt are empty.
What am I doing wrong?

Option 82 contains 2 suboptions in my case.
I am writing unit tests for my own hook library:

On the client side:

// Create a sample DHCPv4 option 82 with suboptions. Shamelessly copied from
// KEA test suit.
static OptionBuffer createAgentInformationOption() {
    const uint8_t opt_data[] = {
        0x52, 0x28, // Agent Information Option (length = 40)
        // Suboptions start here...

        0x01, 0x11, // Agent Circuit ID (length = 17)
        // "Ethernet10:2026"
        0x00, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x31, 0x30,
        0x3a, 0x32, 0x30, 0x32, 0x36,

        0x02, 0x13, // Agent Remote ID (length = 19)
        // "00:1c:73:8c:d0:e5"
        0x00, 0x11, 0x30, 0x30, 0x3a, 0x31, 0x63, 0x3a, 0x37, 0x33, 0x3a, 0x38,
        0x63, 0x3a, 0x64, 0x30, 0x3a, 0x65, 0x35
    };
    // total length = 42
    return (OptionBuffer(opt_data, opt_data + sizeof(opt_data)));
}

// add options 82 (both suboptions) to the request.
  OptionBuffer agent_info_buf = createAgentInformationOption();
  auto agent_info = boost::make_shared<Option>(
      Option::V4, DHO_DHCP_AGENT_OPTIONS, agent_info_buf);
  query->addOption(agent_info);


On the server side I am trying to get them but as I wrote before it?s not 
working.
I can write my own code to parse the buffer but before doing that I wanted to 
ask here ?

Regards
-- 
Angelo Failla

Cluster Infrastructure - Dublin
[email protected]


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

Message: 2
Date: Thu, 3 Nov 2016 11:38:09 +0000
From: Angelo Failla <[email protected]>
To: "[email protected]" <[email protected]>
Subject: Re: [kea-dev] [Potential Spoof] hook library question:
        parsing DHO_DHCP_AGENT_OPTIONS sub options in incoming packets
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

I forgot to mention that for various reasons we are still on 0.9.2 (so I am not 
sure if this works on 1.0)

-- 
Angelo Failla

Cluster Infrastructure - Dublin
[email protected]

On 11/3/16, 11:34 AM, "kea-dev on behalf of Angelo Failla" 
<[email protected] on behalf of [email protected]> wrote:

    Hi,
    
    
    
    I have a question about retrieving DHO_DHCP_AGENT_OPTIONS from an incoming 
dhcpv4 DISCOVER packet.
    
    
    
    I have this code in my hook library:
    
    
    
      OptionPtr rai = query4_ptr->getOption(DHO_DHCP_AGENT_OPTIONS);
    
      OptionPtr circuit_id_opt = rai->getOption(RAI_OPTION_AGENT_CIRCUIT_ID);
    
      OptionPtr remote_id_opt = rai->getOption(RAI_OPTION_REMOTE_ID);
    
      
    
    But both circuit_id_opt and remote_id_opt are empty.
    
    What am I doing wrong?
    
    
    
    Option 82 contains 2 suboptions in my case.
    
    I am writing unit tests for my own hook library:
    
    
    
    On the client side:
    
    
    
    // Create a sample DHCPv4 option 82 with suboptions. Shamelessly copied from
    
    // KEA test suit.
    
    static OptionBuffer createAgentInformationOption() {
    
        const uint8_t opt_data[] = {
    
            0x52, 0x28, // Agent Information Option (length = 40)
    
            // Suboptions start here...
    
    
    
            0x01, 0x11, // Agent Circuit ID (length = 17)
    
            // "Ethernet10:2026"
    
            0x00, 0x0f, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x31, 
0x30,
    
            0x3a, 0x32, 0x30, 0x32, 0x36,
    
    
    
            0x02, 0x13, // Agent Remote ID (length = 19)
    
            // "00:1c:73:8c:d0:e5"
    
            0x00, 0x11, 0x30, 0x30, 0x3a, 0x31, 0x63, 0x3a, 0x37, 0x33, 0x3a, 
0x38,
    
            0x63, 0x3a, 0x64, 0x30, 0x3a, 0x65, 0x35
    
        };
    
        // total length = 42
    
        return (OptionBuffer(opt_data, opt_data + sizeof(opt_data)));
    
    }
    
    
    
    // add options 82 (both suboptions) to the request.
    
      OptionBuffer agent_info_buf = createAgentInformationOption();
    
      auto agent_info = boost::make_shared<Option>(
    
          Option::V4, DHO_DHCP_AGENT_OPTIONS, agent_info_buf);
    
      query->addOption(agent_info);
    
    
    
    
    
    On the server side I am trying to get them but as I wrote before it?s not 
working.
    
    I can write my own code to parse the buffer but before doing that I wanted 
to ask here ?
    
    
    
    Regards
    
    -- 
    
    Angelo Failla
    
    
    
    Cluster Infrastructure - Dublin
    
    [email protected]
    
    
    
    _______________________________________________
    kea-dev mailing list
    [email protected]
    
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.isc.org_mailman_listinfo_kea-2Ddev&d=DQIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=XQHjLQh2eTTW8a0c8kaZ9Q&m=2rtYEJ6Ai2r6t0rAfGX1ougjVkyNFkGDoplAUapvryk&s=kfmRQkfDpNpnDc1igpQMv2Z50vKNV89iFbv6E53GAZQ&e=
 


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

Subject: Digest Footer

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

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

End of kea-dev Digest, Vol 32, Issue 1
**************************************

Reply via email to