svn commit: r318982 - head/lib/libstand

Baptiste Daroussin bapt at FreeBSD.org
Sat May 27 10:50:37 UTC 2017


Author: bapt
Date: Sat May 27 10:50:35 2017
New Revision: 318982
URL: https://svnweb.freebsd.org/changeset/base/318982

Log:
  Pass a "FREEBSD" user-class in PXE dhcp request
  
  rfc3004 allows to pass multiple user classes on dhcp requests
  this is used by dhcp servers to differentiate the caller if needed.
  
  As an example with isc dhcp server it will be possible to make options
  only for the FreeBSD loaders:
  
  if exists user-class and option user-class = "FREEBSD" {
     option root-path "tftp://192.168.42.1/FreeBSD;
  }
  
  Reviewed by:	tsoome
  Differential Revision:	https://reviews.freebsd.org/D10951

Modified:
  head/lib/libstand/bootp.c
  head/lib/libstand/bootp.h

Modified: head/lib/libstand/bootp.c
==============================================================================
--- head/lib/libstand/bootp.c	Sat May 27 08:30:32 2017	(r318981)
+++ head/lib/libstand/bootp.c	Sat May 27 10:50:35 2017	(r318982)
@@ -146,16 +146,20 @@ bootp(int sock, int flag)
 		bp->bp_vend[7] = TAG_CLASSID;
 		bp->bp_vend[8] = 9;
 		bcopy("PXEClient", &bp->bp_vend[9], 9);
-		bp->bp_vend[18] = TAG_PARAM_REQ;
-		bp->bp_vend[19] = 7;
-		bp->bp_vend[20] = TAG_ROOTPATH;
-		bp->bp_vend[21] = TAG_HOSTNAME;
-		bp->bp_vend[22] = TAG_SWAPSERVER;
-		bp->bp_vend[23] = TAG_GATEWAY;
-		bp->bp_vend[24] = TAG_SUBNET_MASK;
-		bp->bp_vend[25] = TAG_INTF_MTU;
-		bp->bp_vend[26] = TAG_SERVERID;
-		bp->bp_vend[27] = TAG_END;
+		bp->bp_vend[18] = TAG_USER_CLASS;
+		bp->bp_vend[19] = 8;
+		bp->bp_vend[20] = 7;
+		bcopy("FREEBSD", &bp->bp_vend[21], 7);
+		bp->bp_vend[28] = TAG_PARAM_REQ;
+		bp->bp_vend[29] = 7;
+		bp->bp_vend[30] = TAG_ROOTPATH;
+		bp->bp_vend[31] = TAG_HOSTNAME;
+		bp->bp_vend[32] = TAG_SWAPSERVER;
+		bp->bp_vend[33] = TAG_GATEWAY;
+		bp->bp_vend[34] = TAG_SUBNET_MASK;
+		bp->bp_vend[35] = TAG_INTF_MTU;
+		bp->bp_vend[36] = TAG_SERVERID;
+		bp->bp_vend[37] = TAG_END;
 	} else
 		bp->bp_vend[7] = TAG_END;
 #else

Modified: head/lib/libstand/bootp.h
==============================================================================
--- head/lib/libstand/bootp.h	Sat May 27 08:30:32 2017	(r318981)
+++ head/lib/libstand/bootp.h	Sat May 27 10:50:35 2017	(r318982)
@@ -108,6 +108,7 @@ struct bootp {
 #define TAG_T2			((unsigned char)  59)
 #define TAG_CLASSID		((unsigned char)  60)
 #define TAG_CLIENTID		((unsigned char)  61)
+#define TAG_USER_CLASS		((unsigned char)  77)
 #endif
 
 #define TAG_END			((unsigned char) 255)


More information about the svn-src-head mailing list