<html><head></head><body><div class="ydp38bc3f91yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div></div>
        <div dir="ltr" data-setdir="false">My approach was to modify the bootp information in pkt4_send to replace whatever was put there: <a href="https://github.com/michaelgugino/kea-pxe-replace-mod/blob/master/src/pkt4_send.cc" rel="nofollow" target="_blank" class="">https://github.com/michaelgugino/kea-pxe-replace-mod/blob/master/src/pkt4_send.cc</a></div><div dir="ltr" data-setdir="false">(Note: I'm not reading option 43 data, but if I was, I might do the same thing.  If that data isn't accessible in pkt4_send, I'd use a temp file based on mac to store this data and do the manipulation to the bootp bits in pkt4_send)<br></div><div><br></div><div><br></div><div><br></div>
        
        </div><div id="ydpb99a2f45yahoo_quoted_3927088507" class="ydpb99a2f45yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Friday, July 12, 2019, 10:07:11 AM EDT, Ola Thoresen <ola@nytt.no> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div dir="ltr">Hi,<br clear="none"><br clear="none">I have a, rather old now, hook that you might want to look at.<br clear="none"><br clear="none"><a shape="rect" href="https://github.com/Olen/kea_hooks" rel="nofollow" target="_blank">https://github.com/Olen/kea_hooks</a><br clear="none"><br clear="none">Please fork it and take over the project if you want to. As I don't <br clear="none">maintain any kea installations any longer, I have not updated it since a <br clear="none">really early version of Kea.<br clear="none"><br clear="none"><br clear="none"><br clear="none">On 12.07.2019 15:50, Tomek Mrugalski wrote:<br clear="none">> On 29/05/2019 22:32, Dave M wrote:<br clear="none">>> My problem is with the hook. I want to dynamically assign the boot-file<br clear="none">>> and server based on MAC address and model information (option 43,<br clear="none">>> suboption 9) and potentially software version (option 43, suboption 6).<br clear="none">>><br clear="none">>> I will therefore need to extract these in pkt4_receive and then replace<br clear="none">>> the boot-file and server according to my logic in pkt4_send.<br clear="none">>><br clear="none">>> I just don't know how to retrieve and parse the suboptions in option 43.<br clear="none">>> Would anybody have sample code showing how I can extract these?<br clear="none">> Questions about hooks development are generally better addressed at kea-dev.<br clear="none">><br clear="none">> You may want to take a look at<br clear="none">> src/bin/dhcp4/tests/vendor_opts_unittest.cc and possibly also at<br clear="none">> src/lib/dhcp/tests/option_vendor_unittest.cc Overall, you can do<br clear="none">> something similar to this:<br clear="none">><br clear="none">> // check if there's option 43 in the packet.<br clear="none">> Option4Ptr opt43 = pkt->getOption(DHO_VENDOR_ENCAPSULATED_OPTIONS);<br clear="none">> if (!opt43) {<br clear="none">>      return;<br clear="none">> }<br clear="none">><br clear="none">> // Get suboption 6 from the option 43.<br clear="none">> Option4Ptr subopt6 = opt43->getOption(6);<br clear="none">><br clear="none">> // If you have option definitions, you may want to try casting to<br clear="none">> // specific type. That way you'll be able to use type specific, such<br clear="none">> // as getValue() returning a string for OptionString.<br clear="none">> boost::shared_ptr<OptionVendor> str_subopt6 =<br clear="none">>     boost::dynamic_pointer_cast<OptionString>(subopt6);<br clear="none">><br clear="none">> if (str_subopt6) {<br clear="none">>   cout << "opt 43,subopt 6 value is " << str_subopt6->getValue() << endl;<br clear="none">> }<br clear="none">><br clear="none">> You may want to take a look at src/lib/dhcp/option_*.h files.<br clear="none">><br clear="none">> Hope that helps,<br clear="none">> Tomek<br clear="none">> _______________________________________________<br clear="none">> Kea-users mailing list<br clear="none">> <a shape="rect" href="mailto:Kea-users@lists.isc.org" rel="nofollow" target="_blank">Kea-users@lists.isc.org</a><br clear="none">> <a shape="rect" href="https://lists.isc.org/mailman/listinfo/kea-users" rel="nofollow" target="_blank">https://lists.isc.org/mailman/listinfo/kea-users</a><div class="ydpb99a2f45yqt3161198698" id="ydpb99a2f45yqtfd44008"><br clear="none">_______________________________________________<br clear="none">Kea-users mailing list<br clear="none"><a shape="rect" href="mailto:Kea-users@lists.isc.org" rel="nofollow" target="_blank">Kea-users@lists.isc.org</a><br clear="none"><a shape="rect" href="https://lists.isc.org/mailman/listinfo/kea-users" rel="nofollow" target="_blank">https://lists.isc.org/mailman/listinfo/kea-users</a><br clear="none"></div></div></div>
            </div>
        </div></body></html>