Page History

Turn Off History

What should be changed?

All the deprecated BSD socket functions. These are complete list. (from Userlevel IPv6 Programming Introduction)


numbers in right denotes lines of code that has the keyword.

struct sockaddr_in : 237
gethostbyname      : 165
gethostbyname2     : 0
getservbyname      : 5
gethostbyaddr      : 23
getservbyport      : 0
inet_addr          : 13
inet_aton          : 7
inet_nsap_addr     : 0
inet_ntoa          : 114
inet_nsap_ntoa     : 0
inet_makeaddr      : 0
inet_netof         : 0
inet_network       : 0
inet_neta          : 0
inet_net_netop     : 0
inet_net_pton      : 0
rcmd               : 10
rexec              : 2
rrsevport          : 0

total 576 lines of code *must* be changed.

IP address is no longer fixed 4 bytes nor fixed 16 bytes. It can be both of them. So, every storage class should be changed. For some of source codes that use 'int' as storage for IP address, this is most troublesome because it could be hidden to simple text search.

Reading and parsing IP address from config file should be changed as well. If an existing code base entirely relied on BSD socket interface such as inet_aton or inet_addr, it would be easier. However, if the code has proprietary parsing/converting functions, every incident should be found and changed.

IPv6 address string is far longer than IPv4 address. IPv6 address [0001:0002:0003:0004:0005:0006:0007:0008], length is 41. IPv4 address 101.202.103.203, length is 15. About 3 times longer.

Printing IP address to log file should be considered since existing layout may not work well.

Current Condor Code Base

As noted earlier, Condor source has 576 lines that uses obsolete BSD functions.

What makes problem complicated is that unsigned long is used to hold IP address. There are many places to change. For example, in sock.h,

unsigned int Sock::get_ip_int()
unsigned int Sock::peer_ip_int()
It uses 'unsigned int' to pass IP address.

class Sock already has abstraction of BSD socket interface. But, IP address escapes from this class by returning it as an 4 byte int and sockaddr_in. It is required to check whether there are codes that directly calls BSD socket interface.

The method of Attack

Having some network abstraction classes, single IP address class that deals both IPv4 and IPv6. So, nobody uses sockaddr, sockaddr_in, or plain int to represent IP address.

Change every IP address storage to that IP address class.

The class itself is convertible to sockaddr_in or sockaddr_in6. However, byte-level compatibility may not be required.

It is not decided whether to have host byte order or network byte order. sockaddr_in always have network byte order in it.

Todo

Manageable daily work-list.

  1. investigate every source code where calls obsolete BSD socket interface.
  2. remove every obsolete interface.
  3. find places where use 'int' as IP address storage. mark and count them.
  4. investigate ipv6 address handling in C++ Boost library
  5. make unified address class
  6. change every incidents where use sockaddr,sockaddr_in, and int.

Note

*** currently, this is just temporary page