Uploaded image for project: 'Directory ApacheDS'
  1. Directory ApacheDS
  2. DIRSERVER-1931

Dhcp: TftpServerName and BootfileName need NUL termination

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • dhcp
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            arren Shevek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: