Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vendor specific routes #31

Open
morete opened this issue May 23, 2019 · 7 comments
Open

vendor specific routes #31

morete opened this issue May 23, 2019 · 7 comments
Labels

Comments

@morete
Copy link

morete commented May 23, 2019

I can add classless static routes but not vendor specific ones like "ms-classless-static-routes".
Not sure if it is not supported or I'm not able to find a way to make it work.

@cygnusb
Copy link
Contributor

cygnusb commented May 23, 2019

Without more information, I cannot tell also. Need sourcecode snapshot, returned error exceptions and relevant server config parts

@cygnusb
Copy link
Contributor

cygnusb commented May 23, 2019

This is most propably an issue of used datatypes.

For example DHCP Option Definitions are:

option new-static-routes code 249 = string;
option rfc3442-classless-static-routes code 121 = array of integer 8;
option ms-classless-static-routes code 249 = array of integer 8;

My guess would be that you need to match the types.

@morete
Copy link
Author

morete commented May 23, 2019

so I think it is a problem with the format...
we added appending static routes to the "add_host" function like this:

stmts.append('supersede classless-static-routes {0};'.format(static_routes))

and static_routes contains "16.11.11 10.10.10.1"

I think somehow for the regular "classless-static-routes" works as that expects a string but when trying to append a "ms-classless-static-routes" then string is not valid... so the following line does not add anything:
stmts.append('supersede ms-classless-static-routes {0};'.format(static_routes))

@morete
Copy link
Author

morete commented May 23, 2019

the DHCP has the option:
option ms-classless-static-routes code 249 = array of integer 8;

how do I get the data type matching?

@bibix2
Copy link

bibix2 commented May 23, 2019

Hi,
I'm working on the same issue, about adding ms-classless-static-routes. We are having a hard time setting the variable to match the data type. The variable now looks like:

c_ms_route = "16,10,25,10,15,15,1"

and we append it to omapi message like:

stmts.append('supersede ms-classless-static-routes {0};'.format(c_ms_route))

then, the result in dhcpd lease file is:

    supersede ms-classless-static-routes = concat (concat (concat (concat (
                                                                           concat
                                                                          (
                                                                         concat
                                                                          (10
                                                                         ,
                                                                           "d")
                                                                         ,
                                                                           "h")
                                                                           ,
                                                                           "d")
                                                                   , "h"),
                                                           fa), 01);

How can we format our variable so that it would look "better" in the lease file?

@cygnusb
Copy link
Contributor

cygnusb commented May 28, 2019

ms-classless-static-routes is expecting an array of bytes (array of integer 8). So my guess is you would need to convert your routes accordingly. See pack_ip for example for using that on a full ip address. You might need to adapt that function for sizes different than 4 and your list of c_ms_route to be split by comma.
If you do it the right way, this should show up as

supersede ms-classless-static-routes = 10:0a:...;

in the lease file.

@bibix2
Copy link

bibix2 commented May 29, 2019

I see that the pack_ip function returns something like:
>>> pypureomapi.pack_ip("128.132.193.1")
'\x80\x84\xc1\x01'
could this format be compatible with the 'array of integer 8' needed for the ms-classless-static-routes? I've tried different combinations but no success up to now, but the 'supersede ms-classless...' line does not show in my leases file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants