You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Emmanuel Lécharny (Jira)" <ji...@apache.org> on 2022/08/21 13:37:00 UTC
[jira] [Commented] (DIRSERVER-1931) Dhcp: TftpServerName and BootfileName need NUL termination
[ https://issues.apache.org/jira/browse/DIRSERVER-1931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17582557#comment-17582557 ]
Emmanuel Lécharny commented on DIRSERVER-1931:
----------------------------------------------
Seems like Shevek did moved forward with a DHCP implementation based on what we had:
https://github.com/shevek/dhcp4j
The question being: should we try to integrate this work in ApacheDS, or simply get rid of DHCP support in the server, like what we did with Kerberos?
> 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
> Priority: Major
>
> 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.
> {code}
> /** 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));
> }
> {code}
> 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
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@directory.apache.org
For additional commands, e-mail: dev-help@directory.apache.org