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

feat: Added support for TLV_CODE_VENDOR_NAME #542

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gupurush
Copy link

@gupurush gupurush commented Feb 13, 2025

Description

• Fix Option 60 encoding.
	Update dhclient.conf.j2 templated to add "\0x00" as first character in the string to indicate that included id is a string
• Add support for Option 61
	To add vendor-class unconditionally in each message, updated the dhclient.conf.j2 to included vendor-name:product-name. The value for these variables is retrieved from eeprom. Product name is already available and added the option to retrieve vendor name thru decode-syseeprom utility.

Logs:

# =============== Managed by SONiC Config Engine DO NOT EDIT! ===============
# generated from /usr/share/sonic/templates/dhclient.conf.j2 using sonic-cfggen
# file: /etc/dhcp/dhclient.conf
#
# Configuration file for /sbin/dhclient, which is included in Debian's
#       dhcp3-client package.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
#       man page for more information about the syntax of this file
#       and a more comprehensive list of the parameters understood by
#       dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
#       not leave anything out (like the domain name, for example), then
#       few changes must be made to this file, if any.
#

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
option snmp-community code 224 = text;
option minigraph-url code 225 = text;
option acl-url code 226 = text;
option tftp-server-name code 66 = text;
option bootfile-name code 67 = text;
option user-class code 77 = text;
option provisioning-script-url code 239 = text;
option dhcp6.user-class code 15 = text;
option dhcp6.provisioning-script-url code 239 = text;
option dhcp6.boot-file-url code 59 = text;
option vendor-class code 60 = text;

send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search, interface-mtu, dhcp6.fqdn,
        rfc3442-classless-static-routes, ntp-servers, log-servers,snmp-community, minigraph-url, acl-url;

send vendor-class "Cisco:{MODEL-XXXX}"; 


18:31:56.604658 IP (tos 0x0, ttl 64, id 58732, offset 0, flags [DF], proto UDP (17), length 338)
    10.29.XXX.XXX.bootpc > hostname.example.com.bootps: [udp sum ok] BOOTP/DHCP, Request from 34:73:YY:YY:YY:YY (oui Unknown), length 310, xid 0xff8d9300, Flags [none] (0x0000)
          Client-IP 10.29.XXX.XXX
          Client-Ethernet-Address 34:73:YY:YY:YY:YY (oui Unknown)
          Vendor-rfc1048 Extensions
            Magic Cookie 0x63825363
            DHCP-Message Option 53, length 1: Release
            Server-ID Option 54, length 4: hostname.example.com
            Hostname Option 12, length 5: "sonic"
            Vendor-Class Option 60, length 18: "Cisco:{MODEL-XXXX}"
            Client-ID Option 61, length 31: "SONiC##MODEL-XXXX##XYZ" 
            
            
            
root@sonic:/home/cisco# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::3673:2dff:fe30:70d8  prefixlen 64  scopeid 0x20<link>
        ether 34:73:YY:YY:YY:YY  txqueuelen 1000  (Ethernet)
        RX packets 9939  bytes 2618950 (2.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1219  bytes 203002 (198.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0x95000000-9501ffff 
        ```

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

linux-foundation-easycla bot commented Feb 13, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: gupurush / name: Nanma Purushotam (007e93b)

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -406,6 +406,16 @@ def modelstr(self, e):
return super(TlvInfoDecoder, self).modelstr(e)

return t[2].decode("ascii")


def vendorstr(self, e):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

3 participants