Return-Path: X-Original-To: apmail-directory-dev-archive@www.apache.org Delivered-To: apmail-directory-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 100BB10C92 for ; Thu, 12 Dec 2013 09:50:11 +0000 (UTC) Received: (qmail 9645 invoked by uid 500); 12 Dec 2013 09:50:08 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 9608 invoked by uid 500); 12 Dec 2013 09:50:08 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 9594 invoked by uid 99); 12 Dec 2013 09:50:07 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Dec 2013 09:50:07 +0000 Date: Thu, 12 Dec 2013 09:50:07 +0000 (UTC) From: "Shevek (JIRA)" To: dev@directory.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (DIRSERVER-1931) Dhcp: TftpServerName and BootfileName need NUL termination MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Shevek created DIRSERVER-1931: --------------------------------- Summary: Dhcp: TftpServerName and BootfileName need NUL termination Key: DIRSERVER-1931 URL: https://issues.apache.org/jira/browse/DIRSERVER-1931 Project: Directory ApacheDS Issue Type: Bug Components: dhcp Reporter: Shevek These are odd options, the PXE spec requires nul termination of the strings in these, but no other options. It also requires the strings to be in NETASCII (best JDK approximation is probably ISO8859_1). ApacheDS fills in simple, nonterminated strings, therefore these options cannot be parsed by many (most?) PXE implementations. /** DHCP options 66 and 67 require nul termination. */ @Nonnull private byte[] toNulTerminatedString(@Nonnull String text) { return ArrayUtils.add(text.getBytes(Charsets.ISO_8859_1), (byte) 0); } protected void addBootParameters(@Nonnull Lease lease, @Nonnull InterfaceAddress interfaceAddress, @Nonnull DhcpMessage request, @Nonnull InetAddress bootServerAddress, @Nonnull String bootFileName) { byte[] bootServerName = toNulTerminatedString(InetAddresses.toAddrString(bootServerAddress)); DhcpUtils.setUnknownOption(lease.getOptions(), new TftpServerName().getTag(), bootServerName); DhcpUtils.setUnknownOption(lease.getOptions(), new BootfileName().getTag(), toNulTerminatedString(bootFileName)); } Note also the only way to get the tags is 'new X().getTag()' since the field tag is not a static public field. -- This message was sent by Atlassian JIRA (v6.1.4#6159)