LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-04-2012, 07:18 PM   #1
Rish.Ahm
LQ Newbie
 
Registered: Jun 2009
Posts: 6

Rep: Reputation: 0
Decoding vendor-encapsulated-information in dhclient-script


Hello All,
My question is regarding the dhclient version isc-dhclient-V3.0.5-RedHat.
I need to send some vendor specific information from my DHCP server to its clients. For this to happen, I have done following:

Server side: In dhcpd.conf, following lines have been added:

#option space scf;

set vendor-string = option vendor-class-identifier;
option space Example;
option Example.param code 200 = string;
class "ExampleClass" {
match if option vendor-class-identifier = "ExampleClass";
vendor-option-space Example;
option Example.param "http://www.google.com";
}
_________________________________________________________________________________
Client Side: In /etc/dhclient.conf file, following lines have been added:

option space Example;
option Example.param code 200 = string;

request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers, host-name, ntp-servers, vendor-encapsulated-options;

send vendor-class-identifier "ExampleClass";

_________________________________________________________________________________

After doing this, I am successfully able to receive the data in $new_vendor_encapsulated_options on the client side as I can see through my dhclient-script which runs each time the lease renews/expires.

But my question is regarding, how to decode this information. The information I am receiving is like following:

c8:15:68:74:74:70:3a:2f:2f:77:77:77:2e:67:6f:6f:67:6c:65:2e:63:6f:6d

where first two bytes c8=200 (Example.param's code) and 0x15=21 (Length of the field) and following 21 characters represent the information (http://google.com)

Now I can simply parse the packet and read it in this way. But I am quite positive there has to be a cleaner and standard way of decoding the packet as sometimes these packets are nested into multiple levels.

The following blog mentions a $INP() function that is used for decoding:
http://wsidhcp.blogspot.com/2012/03/...cp-server.html

But if I use the $INP in the given manner, it gives me error. Can someone please help here?
 
Old 06-05-2012, 12:47 PM   #2
Rish.Ahm
LQ Newbie
 
Registered: Jun 2009
Posts: 6

Original Poster
Rep: Reputation: 0
Sorry for the wrong link. The document where information about $INP() is given is following:

http://wsidhcp.blogspot.com/2012/03/...ns-part-2.html
 
Old 09-20-2012, 03:22 AM   #3
Mebuh
LQ Newbie
 
Registered: Jan 2004
Posts: 2

Rep: Reputation: 0
Hi,

dhclient parses the options for you based on the information in your dhclient.conf.

In your case it would set the environment variable 'new_Example_param' to the string value of the Option.

You can check it by calling the 'env'-command in your dhclient-script, which will print all the defined environment variables.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] RPM encapsulated in a shell script vikas027 Linux - Software 2 10-20-2011 01:09 PM
FLAC decoding script jamesan Programming 5 08-05-2009 07:45 AM
Getting SCSI Information in kernel: eg Vendor. shrey_j Programming 0 07-28-2005 08:00 AM
how can i get the hardware vendor information on linux pvnraju Programming 9 01-07-2005 02:57 PM
DHCP vendor-encapsulated-options substring bwilliam79 Linux - Networking 1 10-29-2002 10:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration