udp_main(udp_port) is called in two scenarios:
1) The udp physical port udp_port, udp_main()'s only parameter, is being initialized. During the initialization, udp_main() calls ip_open() to open up an ip file descriptor before calling ip_ioctl() twice to configure the newly opened ip file descriptor (the first call) and to get the ip address of the underlying ip port (the second call).
2) After this initial call to udp_main(), all subsequent calls will finish up the udp port's initialization (if necessary). After this initialization is complete, udp_main() attempts to configure (by calling udp_ioctl()) any udp file descriptors whose configuration was previously suspended and then finally calls read_ip_packets() to process any ip packets waiting to be delivered to udp_port.