O'Reilly logo

IPv6 Network Administration by David Malone, Niall Richard Murphy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Case Study: MMDF

As a case study, we consider the changes made to a locally-maintained version of MMDF[2] by one of the authors to make it IPv6-capable. MMDF is a mail transfer agent (MTA), similar in purpose to Sendmail or Postfix. It interacts with the network in three ways.

  • To accept incoming mail by SMTP.

  • To send outgoing mail by SMTP.

  • To look up DNS records for the routing of mail.

These components of MMDF are relatively modularized—there is an SMTP channel daemon that runs from inetd for accepting mail, an SMTP channel program that sends mail by SMTP and a table system for looking up hosts in the DNS.

Incoming SMTP Channel

A server handling an incoming SMTP connection, must get the address of the remote machine so that it can be included in the Received: headers of the email. This address is obtained by calling getpeername, but the code must now expect a response containing an IPv4 or IPv6 address. We achieved this by using a sockaddr_storage rather than a sockaddr_in. MMDF's old code had a limit of 250 bytes for a hostname; we replaced this with the new constant NI_MAXHOST , which is the length of the longest hostname you will need to deal with.

The original MMDF code then called gethostbyaddr to try to convert the address into a hostname. We replaced this call with a getnameinfo call. For the SMTP header, we need to know if the address can be resolved to a hostname or not, so we can first call getnameinfo with the NI_NAMEREQD flag, to determine the hostname. To prevent spoofing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required