+ if (connectionPrivate->debug) {
+ SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionCreate (0x%x) succeeded for service : %@"), connectionPrivate, service);
+ }
+
+ /* success, return the connection reference */
+ return connectionPrivate;
+
+ fail:
+
+ if (connectionPrivate->debug)
+ SCLog(TRUE, LOG_DEBUG, CFSTR("SCNetworkConnectionCreate (0x%x) failed for service : %@"), connectionPrivate, service);
+
+ /* failure, clean up and leave */
+ if (connectionPrivate != NULL) {
+ CFRelease(connectionPrivate);
+ }
+
+ _SCErrorSet(kSCStatusFailed);
+ return NULL;
+}
+
+
+static mach_port_t
+__SCNetworkConnectionSessionPort(SCNetworkConnectionPrivateRef connectionPrivate)
+{
+ void *data;
+ CFIndex dataLen;
+ CFDataRef dataRef = NULL;
+ int error = kSCStatusFailed;
+ mach_port_t notify_port = MACH_PORT_NULL;
+ mach_port_t port_old = MACH_PORT_NULL;
+ mach_port_t server = MACH_PORT_NULL;
+ kern_return_t status;
+ mach_port_t unpriv_bootstrap_port = MACH_PORT_NULL;
+
+ if (connectionPrivate->session_port != MACH_PORT_NULL) {
+ return connectionPrivate->session_port;
+ }
+
+ pthread_mutex_lock(&connectionPrivate->lock);
+
+ if (bootstrap_look_up(bootstrap_port, PPPCONTROLLER_SERVER, &server) != BOOTSTRAP_SUCCESS) {
+ SCLog(_sc_verbose, LOG_DEBUG, CFSTR("PPP Controller server not found"));
+ goto done;
+ }
+
+ if (!_SCSerializeString(SCNetworkServiceGetServiceID(connectionPrivate->service), &dataRef, &data, &dataLen)) {
+ goto done;