From af7dcd0a312e19e551aa3a4fe859ba98ddff2769 Mon Sep 17 00:00:00 2001 From: Chris Ballinger Date: Thu, 10 Apr 2014 00:53:11 -0700 Subject: [PATCH] Migrate to Cocoapods --- .gitignore | 2 + PodSpecs/libplist.podspec | 19 + PodSpecs/libusbmuxd.podspec | 20 + Podfile | 4 + Podfile.lock | 30 + Submodules/libplist | 1 - Submodules/libusbmuxd | 1 - Tether.xcodeproj/project.pbxproj | 511 ++--------- Tether.xcworkspace/contents.xcworkspacedata | 1 + .../xcshareddata/Tether.xccheckout | 89 ++ Tether/CBDeviceWindowController.m | 4 + Tether/CBNetworkServiceEditor.h | 14 + Tether/CBNetworkServiceEditor.m | 28 + Tether/CBTunDevice.h | 16 + Tether/CBTunDevice.m | 121 +++ Tether/UTUN.h | 13 + Tether/UTUN.m | 868 ++++++++++++++++++ 17 files changed, 1298 insertions(+), 444 deletions(-) create mode 100644 PodSpecs/libplist.podspec create mode 100644 PodSpecs/libusbmuxd.podspec create mode 100644 Podfile create mode 100644 Podfile.lock delete mode 160000 Submodules/libplist delete mode 160000 Submodules/libusbmuxd create mode 100644 Tether.xcworkspace/contents.xcworkspacedata create mode 100644 Tether.xcworkspace/xcshareddata/Tether.xccheckout create mode 100644 Tether/CBNetworkServiceEditor.h create mode 100644 Tether/CBNetworkServiceEditor.m create mode 100644 Tether/CBTunDevice.h create mode 100644 Tether/CBTunDevice.m create mode 100644 Tether/UTUN.h create mode 100644 Tether/UTUN.m diff --git a/.gitignore b/.gitignore index 47b67c0..1be84df 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ xcuserdata .svn DerivedData *.orig + +Pods/ diff --git a/PodSpecs/libplist.podspec b/PodSpecs/libplist.podspec new file mode 100644 index 0000000..43f634b --- /dev/null +++ b/PodSpecs/libplist.podspec @@ -0,0 +1,19 @@ +Pod::Spec.new do |s| + s.name = 'libplist' + s.version = '1.11' + s.summary = 'A library to handle Apple Property List format in binary or XML' + + s.homepage = 'https://github.com/libimobiledevice/libplist' + s.license = { :type => 'LGPL2.1+', :file => 'COPYING.LESSER' } + + s.authors = { 'Chris Ballinger' => 'chris@chatsecure.org'} # Podspec maintainer + s.platform = :osx, '10.7' + s.source = { :git => 'https://github.com/libimobiledevice/libplist.git', :tag => s.version.to_s} + s.source_files = 'src/*.{h,c,m,cpp}', 'libcnary/*.{h,c,m,cpp}', 'libcnary/include/*.h' + s.public_header_files = 'include/*.h' + s.library = 'xml2' + s.preserve_paths = 'include/plist/*.*' + s.xcconfig = {"HEADER_SEARCH_PATHS" => '"$(SDKROOT)/usr/include/libxml2" "${PODS_ROOT}/libplist/include/"'} + s.requires_arc = false +end + diff --git a/PodSpecs/libusbmuxd.podspec b/PodSpecs/libusbmuxd.podspec new file mode 100644 index 0000000..bbf742b --- /dev/null +++ b/PodSpecs/libusbmuxd.podspec @@ -0,0 +1,20 @@ +Pod::Spec.new do |s| + s.name = 'libusbmuxd' + s.version = '1.0.9' + s.summary = 'A client library to multiplex connections from and to iOS devices' + + s.homepage = 'https://github.com/libimobiledevice/libusbmuxd' + s.license = { :type => 'LGPL2.1+', :file => 'COPYING.LGPLv2.1' } + + s.authors = { 'Chris Ballinger' => 'chris@chatsecure.org'} # Podspec maintainer + s.platform = :osx, '10.7' + s.source = { :git => 'https://github.com/libimobiledevice/libusbmuxd.git', :tag => s.version.to_s} + s.source_files = 'src/*.{h,c}', 'include/*.h' + s.public_header_files = 'include/*.h' + #s.preserve_paths = 'include/*.h' + s.dependency 'libplist', '~> 1.11' + s.xcconfig = {'OTHER_CFLAGS' => '$(inherited) -DHAS_PLIST', + 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/libplist/include/"'} + s.requires_arc = false +end + diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..f6b3ef7 --- /dev/null +++ b/Podfile @@ -0,0 +1,4 @@ +pod 'libplist', :podspec => 'PodSpecs/libplist.podspec' +pod 'libusbmuxd', :podspec => 'PodSpecs/libusbmuxd.podspec' +pod 'CocoaAsyncSocket', '~> 7.3' +pod 'CocoaLumberjack', '~> 1.8' \ No newline at end of file diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000..5b61ddb --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,30 @@ +PODS: + - CocoaAsyncSocket (7.3.4) + - CocoaLumberjack (1.8.1): + - CocoaLumberjack/Extensions + - CocoaLumberjack/Core (1.8.1) + - CocoaLumberjack/Extensions (1.8.1): + - CocoaLumberjack/Core + - libplist (1.11) + - libusbmuxd (1.0.9): + - libplist (~> 1.11) + +DEPENDENCIES: + - CocoaAsyncSocket (~> 7.3) + - CocoaLumberjack (~> 1.8) + - libplist (from `PodSpecs/libplist.podspec`) + - libusbmuxd (from `PodSpecs/libusbmuxd.podspec`) + +EXTERNAL SOURCES: + libplist: + :podspec: PodSpecs/libplist.podspec + libusbmuxd: + :podspec: PodSpecs/libusbmuxd.podspec + +SPEC CHECKSUMS: + CocoaAsyncSocket: 534d09416f992fd51efb23f534742ce70b3a7999 + CocoaLumberjack: 020378ec400d658923bf5887178394f65f052c90 + libplist: 36d0286d0b8adc3f11006f9880a204deac67f017 + libusbmuxd: 28b1bfe677f556970487b644ce2d324f09e13121 + +COCOAPODS: 0.31.1 diff --git a/Submodules/libplist b/Submodules/libplist deleted file mode 160000 index c56c810..0000000 --- a/Submodules/libplist +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c56c8103f51c20c6fcf99e8bc9d83c380f503a1b diff --git a/Submodules/libusbmuxd b/Submodules/libusbmuxd deleted file mode 160000 index fff7741..0000000 --- a/Submodules/libusbmuxd +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fff7741c413711232e4d731d001bc1497f7e3273 diff --git a/Tether.xcodeproj/project.pbxproj b/Tether.xcodeproj/project.pbxproj index 2c76a35..4488811 100644 --- a/Tether.xcodeproj/project.pbxproj +++ b/Tether.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + AD0BD7B13E2B4492A294840F /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CDD1E9FE263401C93089B68 /* libPods.a */; }; D90E3259182F07DC00A6F642 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D90E3258182F07DC00A6F642 /* Cocoa.framework */; }; D90E3263182F07DC00A6F642 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = D90E3261182F07DC00A6F642 /* InfoPlist.strings */; }; D90E3269182F07DC00A6F642 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = D90E3267182F07DC00A6F642 /* Credits.rtf */; }; @@ -15,28 +16,10 @@ D90E3271182F07DC00A6F642 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D90E3270182F07DC00A6F642 /* Images.xcassets */; }; D90E3297182F18CC00A6F642 /* CBDeviceWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = D90E3295182F18CC00A6F642 /* CBDeviceWindowController.m */; }; D90E3298182F18CC00A6F642 /* CBDeviceWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D90E3296182F18CC00A6F642 /* CBDeviceWindowController.xib */; }; - D90E32BF182F638800A6F642 /* base64.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32B2182F638800A6F642 /* base64.c */; }; - D90E32C0182F638800A6F642 /* base64.h in Headers */ = {isa = PBXBuildFile; fileRef = D90E32B3182F638800A6F642 /* base64.h */; }; - D90E32C1182F638800A6F642 /* bplist.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32B4182F638800A6F642 /* bplist.c */; }; - D90E32C2182F638800A6F642 /* bytearray.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32B5182F638800A6F642 /* bytearray.c */; }; - D90E32C3182F638800A6F642 /* bytearray.h in Headers */ = {isa = PBXBuildFile; fileRef = D90E32B6182F638800A6F642 /* bytearray.h */; }; - D90E32C4182F638800A6F642 /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = D90E32B7182F638800A6F642 /* common.h */; }; - D90E32C5182F638800A6F642 /* hashtable.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32B8182F638800A6F642 /* hashtable.c */; }; - D90E32C6182F638800A6F642 /* hashtable.h in Headers */ = {isa = PBXBuildFile; fileRef = D90E32B9182F638800A6F642 /* hashtable.h */; }; - D90E32C7182F638800A6F642 /* plist.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32BA182F638800A6F642 /* plist.c */; }; - D90E32C8182F638800A6F642 /* plist.h in Headers */ = {isa = PBXBuildFile; fileRef = D90E32BB182F638800A6F642 /* plist.h */; }; - D90E32C9182F638800A6F642 /* ptrarray.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32BC182F638800A6F642 /* ptrarray.c */; }; - D90E32CA182F638800A6F642 /* ptrarray.h in Headers */ = {isa = PBXBuildFile; fileRef = D90E32BD182F638800A6F642 /* ptrarray.h */; }; - D90E32CB182F638800A6F642 /* xplist.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32BE182F638800A6F642 /* xplist.c */; }; - D90E32CE182F653300A6F642 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D90E32CD182F653300A6F642 /* libxml2.dylib */; }; - D90E32DD182F663A00A6F642 /* iterator.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32D8182F663A00A6F642 /* iterator.c */; }; - D90E32DE182F663A00A6F642 /* list.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32D9182F663A00A6F642 /* list.c */; }; - D90E32DF182F663A00A6F642 /* node_iterator.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32DA182F663A00A6F642 /* node_iterator.c */; }; - D90E32E0182F663A00A6F642 /* node_list.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32DB182F663A00A6F642 /* node_list.c */; }; - D90E32E1182F663A00A6F642 /* node.c in Sources */ = {isa = PBXBuildFile; fileRef = D90E32DC182F663A00A6F642 /* node.c */; }; - D931A60D1830126D00593FF9 /* GCDAsyncSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = D931A60C1830126D00593FF9 /* GCDAsyncSocket.m */; }; D931A611183012D600593FF9 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D931A610183012D600593FF9 /* Security.framework */; }; D931A61418304D1200593FF9 /* CBDeviceConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = D931A61318304D1200593FF9 /* CBDeviceConnection.m */; }; + D950871618F6836900EF884A /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CDD1E9FE263401C93089B68 /* libPods.a */; }; + D95309DA18CBE31E00393DB4 /* CBTunDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = D95309D918CBE31E00393DB4 /* CBTunDevice.m */; }; D98FA7F7184CA00D006D9AC1 /* SOCKSProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = D98FA7F4184CA00D006D9AC1 /* SOCKSProxy.m */; }; D98FA7F8184CA00D006D9AC1 /* SOCKSProxySocket.m in Sources */ = {isa = PBXBuildFile; fileRef = D98FA7F6184CA00D006D9AC1 /* SOCKSProxySocket.m */; }; D9B7679B184A8734000566D6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D9B7679A184A8734000566D6 /* Foundation.framework */; }; @@ -54,43 +37,14 @@ D9B767C9184A88BA000566D6 /* main-mac.m in Sources */ = {isa = PBXBuildFile; fileRef = D9B767C8184A88BA000566D6 /* main-mac.m */; }; D9B767CC184A8991000566D6 /* CBRootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D9B767CB184A8991000566D6 /* CBRootViewController.m */; }; D9B767D2184A8B32000566D6 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D9B767D1184A8B32000566D6 /* MobileCoreServices.framework */; }; - D9B767D3184A8C22000566D6 /* GCDAsyncSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = D931A60C1830126D00593FF9 /* GCDAsyncSocket.m */; }; D9B767D6184A9432000566D6 /* USBMuxDeviceConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = D9B767D5184A9432000566D6 /* USBMuxDeviceConnection.m */; }; D9B767D9184A978A000566D6 /* USBMuxDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = D9B767D8184A978A000566D6 /* USBMuxDevice.m */; }; - D9D810FD182F6794003DCCBB /* collection.c in Sources */ = {isa = PBXBuildFile; fileRef = D9D810F8182F6794003DCCBB /* collection.c */; }; - D9D810FE182F6794003DCCBB /* collection.h in Headers */ = {isa = PBXBuildFile; fileRef = D9D810F9182F6794003DCCBB /* collection.h */; }; - D9D810FF182F6794003DCCBB /* libusbmuxd.c in Sources */ = {isa = PBXBuildFile; fileRef = D9D810FA182F6794003DCCBB /* libusbmuxd.c */; }; - D9D81100182F6794003DCCBB /* sock_stuff.c in Sources */ = {isa = PBXBuildFile; fileRef = D9D810FB182F6794003DCCBB /* sock_stuff.c */; }; - D9D81101182F6794003DCCBB /* sock_stuff.h in Headers */ = {isa = PBXBuildFile; fileRef = D9D810FC182F6794003DCCBB /* sock_stuff.h */; }; - D9D81104182F8303003DCCBB /* libusbmuxd.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D90E32AA182F629600A6F642 /* libusbmuxd.a */; }; - D9D81105182F83CF003DCCBB /* libcnary.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D90E32D3182F655600A6F642 /* libcnary.a */; }; - D9D81106182F83D2003DCCBB /* libplist.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D90E32A0182F626000A6F642 /* libplist.a */; }; D9D81107182F83DD003DCCBB /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D90E32CD182F653300A6F642 /* libxml2.dylib */; }; D9D8110A182F8B80003DCCBB /* USBMuxClient.m in Sources */ = {isa = PBXBuildFile; fileRef = D9D81109182F8B80003DCCBB /* USBMuxClient.m */; }; + D9FEA98118EA6E6C00EA736D /* CBNetworkServiceEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = D9FEA98018EA6E6C00EA736D /* CBNetworkServiceEditor.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - D90E32AE182F62A200A6F642 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D90E324D182F07DC00A6F642 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D90E329F182F626000A6F642; - remoteInfo = libplist; - }; - D90E32B0182F62A700A6F642 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D90E324D182F07DC00A6F642 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D90E32A9182F629600A6F642; - remoteInfo = libusbmuxd; - }; - D90E32E2182F665300A6F642 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D90E324D182F07DC00A6F642 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D90E32D2182F655500A6F642; - remoteInfo = libcnary; - }; D9B767B6184A8735000566D6 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = D90E324D182F07DC00A6F642 /* Project object */; @@ -101,6 +55,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 2CDD1E9FE263401C93089B68 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 3344A729C1604CC882D91F05 /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = ""; }; D90E3255182F07DC00A6F642 /* TetherMac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TetherMac.app; sourceTree = BUILT_PRODUCTS_DIR; }; D90E3258182F07DC00A6F642 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; D90E325B182F07DC00A6F642 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; @@ -119,34 +75,14 @@ D90E3294182F18CC00A6F642 /* CBDeviceWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBDeviceWindowController.h; sourceTree = ""; }; D90E3295182F18CC00A6F642 /* CBDeviceWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CBDeviceWindowController.m; sourceTree = ""; }; D90E3296182F18CC00A6F642 /* CBDeviceWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CBDeviceWindowController.xib; sourceTree = ""; }; - D90E32A0182F626000A6F642 /* libplist.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libplist.a; sourceTree = BUILT_PRODUCTS_DIR; }; - D90E32AA182F629600A6F642 /* libusbmuxd.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libusbmuxd.a; sourceTree = BUILT_PRODUCTS_DIR; }; - D90E32B2182F638800A6F642 /* base64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = base64.c; path = Submodules/libplist/src/base64.c; sourceTree = ""; }; - D90E32B3182F638800A6F642 /* base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = base64.h; path = Submodules/libplist/src/base64.h; sourceTree = ""; }; - D90E32B4182F638800A6F642 /* bplist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bplist.c; path = Submodules/libplist/src/bplist.c; sourceTree = ""; }; - D90E32B5182F638800A6F642 /* bytearray.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bytearray.c; path = Submodules/libplist/src/bytearray.c; sourceTree = ""; }; - D90E32B6182F638800A6F642 /* bytearray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bytearray.h; path = Submodules/libplist/src/bytearray.h; sourceTree = ""; }; - D90E32B7182F638800A6F642 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = common.h; path = Submodules/libplist/src/common.h; sourceTree = ""; }; - D90E32B8182F638800A6F642 /* hashtable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hashtable.c; path = Submodules/libplist/src/hashtable.c; sourceTree = ""; }; - D90E32B9182F638800A6F642 /* hashtable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hashtable.h; path = Submodules/libplist/src/hashtable.h; sourceTree = ""; }; - D90E32BA182F638800A6F642 /* plist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = plist.c; path = Submodules/libplist/src/plist.c; sourceTree = ""; }; - D90E32BB182F638800A6F642 /* plist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = plist.h; path = Submodules/libplist/src/plist.h; sourceTree = ""; }; - D90E32BC182F638800A6F642 /* ptrarray.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ptrarray.c; path = Submodules/libplist/src/ptrarray.c; sourceTree = ""; }; - D90E32BD182F638800A6F642 /* ptrarray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ptrarray.h; path = Submodules/libplist/src/ptrarray.h; sourceTree = ""; }; - D90E32BE182F638800A6F642 /* xplist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = xplist.c; path = Submodules/libplist/src/xplist.c; sourceTree = ""; }; D90E32CD182F653300A6F642 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; - D90E32D3182F655600A6F642 /* libcnary.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcnary.a; sourceTree = BUILT_PRODUCTS_DIR; }; - D90E32D8182F663A00A6F642 /* iterator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = iterator.c; path = Submodules/libplist/libcnary/iterator.c; sourceTree = ""; }; - D90E32D9182F663A00A6F642 /* list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = list.c; path = Submodules/libplist/libcnary/list.c; sourceTree = ""; }; - D90E32DA182F663A00A6F642 /* node_iterator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = node_iterator.c; path = Submodules/libplist/libcnary/node_iterator.c; sourceTree = ""; }; - D90E32DB182F663A00A6F642 /* node_list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = node_list.c; path = Submodules/libplist/libcnary/node_list.c; sourceTree = ""; }; - D90E32DC182F663A00A6F642 /* node.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = node.c; path = Submodules/libplist/libcnary/node.c; sourceTree = ""; }; - D931A60B1830126D00593FF9 /* GCDAsyncSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GCDAsyncSocket.h; path = Submodules/CocoaAsyncSocket/GCD/GCDAsyncSocket.h; sourceTree = ""; }; - D931A60C1830126D00593FF9 /* GCDAsyncSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GCDAsyncSocket.m; path = Submodules/CocoaAsyncSocket/GCD/GCDAsyncSocket.m; sourceTree = ""; }; D931A610183012D600593FF9 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; D931A61218304D1200593FF9 /* CBDeviceConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBDeviceConnection.h; sourceTree = ""; }; D931A61318304D1200593FF9 /* CBDeviceConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CBDeviceConnection.m; sourceTree = ""; }; - D931A61518307B2900593FF9 /* iproxy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = iproxy.c; path = Submodules/libusbmuxd/tools/iproxy.c; sourceTree = ""; }; + D940D2541855A2D200DBA886 /* UTUN.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UTUN.h; sourceTree = ""; }; + D940D2551855A2D200DBA886 /* UTUN.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UTUN.m; sourceTree = ""; }; + D95309D818CBE31E00393DB4 /* CBTunDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBTunDevice.h; sourceTree = ""; }; + D95309D918CBE31E00393DB4 /* CBTunDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CBTunDevice.m; sourceTree = ""; }; D98FA7F3184CA00D006D9AC1 /* SOCKSProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SOCKSProxy.h; path = Submodules/ProxyKit/ProxyKit/SOCKSProxy.h; sourceTree = SOURCE_ROOT; }; D98FA7F4184CA00D006D9AC1 /* SOCKSProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SOCKSProxy.m; path = Submodules/ProxyKit/ProxyKit/SOCKSProxy.m; sourceTree = SOURCE_ROOT; }; D98FA7F5184CA00D006D9AC1 /* SOCKSProxySocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SOCKSProxySocket.h; path = Submodules/ProxyKit/ProxyKit/SOCKSProxySocket.h; sourceTree = SOURCE_ROOT; }; @@ -174,15 +110,11 @@ D9B767D5184A9432000566D6 /* USBMuxDeviceConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = USBMuxDeviceConnection.m; sourceTree = ""; }; D9B767D7184A978A000566D6 /* USBMuxDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = USBMuxDevice.h; sourceTree = ""; }; D9B767D8184A978A000566D6 /* USBMuxDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = USBMuxDevice.m; sourceTree = ""; }; - D9D810F8182F6794003DCCBB /* collection.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = collection.c; path = Submodules/libusbmuxd/src/collection.c; sourceTree = ""; }; - D9D810F9182F6794003DCCBB /* collection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = collection.h; path = Submodules/libusbmuxd/src/collection.h; sourceTree = ""; }; - D9D810FA182F6794003DCCBB /* libusbmuxd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = libusbmuxd.c; path = Submodules/libusbmuxd/src/libusbmuxd.c; sourceTree = ""; }; - D9D810FB182F6794003DCCBB /* sock_stuff.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sock_stuff.c; path = Submodules/libusbmuxd/src/sock_stuff.c; sourceTree = ""; }; - D9D810FC182F6794003DCCBB /* sock_stuff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sock_stuff.h; path = Submodules/libusbmuxd/src/sock_stuff.h; sourceTree = ""; }; - D9D81102182F8044003DCCBB /* usbmuxd-proto.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "usbmuxd-proto.h"; path = "Submodules/libusbmuxd/include/usbmuxd-proto.h"; sourceTree = ""; }; - D9D81103182F8044003DCCBB /* usbmuxd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = usbmuxd.h; path = Submodules/libusbmuxd/include/usbmuxd.h; sourceTree = ""; }; + D9C40B4718F67BF2005CD748 /* libPods-libplist.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-libplist.a"; path = "../../Library/Developer/Xcode/DerivedData/Tether-fesemxykvcaanucpsmrkosdeoujg/Build/Products/Debug/libPods-libplist.a"; sourceTree = ""; }; D9D81108182F8B80003DCCBB /* USBMuxClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = USBMuxClient.h; sourceTree = ""; }; D9D81109182F8B80003DCCBB /* USBMuxClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = USBMuxClient.m; sourceTree = ""; }; + D9FEA97F18EA6E6C00EA736D /* CBNetworkServiceEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBNetworkServiceEditor.h; sourceTree = ""; }; + D9FEA98018EA6E6C00EA736D /* CBNetworkServiceEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CBNetworkServiceEditor.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -192,32 +124,8 @@ files = ( D931A611183012D600593FF9 /* Security.framework in Frameworks */, D9D81107182F83DD003DCCBB /* libxml2.dylib in Frameworks */, - D9D81106182F83D2003DCCBB /* libplist.a in Frameworks */, - D9D81105182F83CF003DCCBB /* libcnary.a in Frameworks */, - D9D81104182F8303003DCCBB /* libusbmuxd.a in Frameworks */, D90E3259182F07DC00A6F642 /* Cocoa.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D90E329D182F626000A6F642 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D90E32CE182F653300A6F642 /* libxml2.dylib in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D90E32A7182F629600A6F642 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D90E32D0182F655500A6F642 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( + AD0BD7B13E2B4492A294840F /* libPods.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -225,6 +133,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D950871618F6836900EF884A /* libPods.a in Frameworks */, D9B767D2184A8B32000566D6 /* MobileCoreServices.framework in Frameworks */, D9B7679D184A8734000566D6 /* CoreGraphics.framework in Frameworks */, D9B7679F184A8734000566D6 /* UIKit.framework in Frameworks */, @@ -250,12 +159,12 @@ children = ( D9B767C7184A877A000566D6 /* USBMuxClient */, D9B767C6184A8763000566D6 /* ProxyKit */, - D931A60F1830128000593FF9 /* Submodules */, D90E325E182F07DC00A6F642 /* TetherMac */, D9B767A0184A8734000566D6 /* Tether */, D9B767B8184A8735000566D6 /* TetherTests */, D90E3257182F07DC00A6F642 /* Frameworks */, D90E3256182F07DC00A6F642 /* Products */, + 3344A729C1604CC882D91F05 /* Pods.xcconfig */, ); sourceTree = ""; }; @@ -263,9 +172,6 @@ isa = PBXGroup; children = ( D90E3255182F07DC00A6F642 /* TetherMac.app */, - D90E32A0182F626000A6F642 /* libplist.a */, - D90E32AA182F629600A6F642 /* libusbmuxd.a */, - D90E32D3182F655600A6F642 /* libcnary.a */, D9B76799184A8734000566D6 /* Tether.app */, D9B767B2184A8734000566D6 /* TetherTests.xctest */, ); @@ -275,6 +181,7 @@ D90E3257182F07DC00A6F642 /* Frameworks */ = { isa = PBXGroup; children = ( + D9C40B4718F67BF2005CD748 /* libPods-libplist.a */, D9B767D1184A8B32000566D6 /* MobileCoreServices.framework */, D931A610183012D600593FF9 /* Security.framework */, D90E32CD182F653300A6F642 /* libxml2.dylib */, @@ -284,6 +191,7 @@ D9B7679C184A8734000566D6 /* CoreGraphics.framework */, D9B7679E184A8734000566D6 /* UIKit.framework */, D90E325A182F07DC00A6F642 /* Other Frameworks */, + 2CDD1E9FE263401C93089B68 /* libPods.a */, ); name = Frameworks; sourceTree = ""; @@ -301,6 +209,10 @@ D90E325E182F07DC00A6F642 /* TetherMac */ = { isa = PBXGroup; children = ( + D95309D818CBE31E00393DB4 /* CBTunDevice.h */, + D95309D918CBE31E00393DB4 /* CBTunDevice.m */, + D9FEA97F18EA6E6C00EA736D /* CBNetworkServiceEditor.h */, + D9FEA98018EA6E6C00EA736D /* CBNetworkServiceEditor.m */, D90E326A182F07DC00A6F642 /* CBMacAppDelegate.h */, D90E326B182F07DC00A6F642 /* CBMacAppDelegate.m */, D931A61218304D1200593FF9 /* CBDeviceConnection.h */, @@ -329,73 +241,6 @@ name = "Supporting Files"; sourceTree = ""; }; - D90E32CC182F638D00A6F642 /* libplist */ = { - isa = PBXGroup; - children = ( - D90E32D7182F65B100A6F642 /* libcnary */, - D90E32B2182F638800A6F642 /* base64.c */, - D90E32B3182F638800A6F642 /* base64.h */, - D90E32B4182F638800A6F642 /* bplist.c */, - D90E32B5182F638800A6F642 /* bytearray.c */, - D90E32B6182F638800A6F642 /* bytearray.h */, - D90E32B7182F638800A6F642 /* common.h */, - D90E32B8182F638800A6F642 /* hashtable.c */, - D90E32B9182F638800A6F642 /* hashtable.h */, - D90E32BA182F638800A6F642 /* plist.c */, - D90E32BB182F638800A6F642 /* plist.h */, - D90E32BC182F638800A6F642 /* ptrarray.c */, - D90E32BD182F638800A6F642 /* ptrarray.h */, - D90E32BE182F638800A6F642 /* xplist.c */, - ); - name = libplist; - sourceTree = ""; - }; - D90E32D7182F65B100A6F642 /* libcnary */ = { - isa = PBXGroup; - children = ( - D90E32D8182F663A00A6F642 /* iterator.c */, - D90E32D9182F663A00A6F642 /* list.c */, - D90E32DA182F663A00A6F642 /* node_iterator.c */, - D90E32DB182F663A00A6F642 /* node_list.c */, - D90E32DC182F663A00A6F642 /* node.c */, - ); - name = libcnary; - sourceTree = ""; - }; - D90E32E4182F676200A6F642 /* libusbmuxd */ = { - isa = PBXGroup; - children = ( - D931A61518307B2900593FF9 /* iproxy.c */, - D9D81102182F8044003DCCBB /* usbmuxd-proto.h */, - D9D81103182F8044003DCCBB /* usbmuxd.h */, - D9D810F8182F6794003DCCBB /* collection.c */, - D9D810F9182F6794003DCCBB /* collection.h */, - D9D810FA182F6794003DCCBB /* libusbmuxd.c */, - D9D810FB182F6794003DCCBB /* sock_stuff.c */, - D9D810FC182F6794003DCCBB /* sock_stuff.h */, - ); - name = libusbmuxd; - sourceTree = ""; - }; - D931A60E1830127400593FF9 /* CocoaAsyncSocket */ = { - isa = PBXGroup; - children = ( - D931A60B1830126D00593FF9 /* GCDAsyncSocket.h */, - D931A60C1830126D00593FF9 /* GCDAsyncSocket.m */, - ); - name = CocoaAsyncSocket; - sourceTree = ""; - }; - D931A60F1830128000593FF9 /* Submodules */ = { - isa = PBXGroup; - children = ( - D931A60E1830127400593FF9 /* CocoaAsyncSocket */, - D90E32E4182F676200A6F642 /* libusbmuxd */, - D90E32CC182F638D00A6F642 /* libplist */, - ); - name = Submodules; - sourceTree = ""; - }; D9B767A0184A8734000566D6 /* Tether */ = { isa = PBXGroup; children = ( @@ -453,6 +298,8 @@ D9B767C7184A877A000566D6 /* USBMuxClient */ = { isa = PBXGroup; children = ( + D940D2541855A2D200DBA886 /* UTUN.h */, + D940D2551855A2D200DBA886 /* UTUN.m */, D9B767D7184A978A000566D6 /* USBMuxDevice.h */, D9B767D8184A978A000566D6 /* USBMuxDevice.m */, D9B767D4184A9432000566D6 /* USBMuxDeviceConnection.h */, @@ -466,110 +313,26 @@ }; /* End PBXGroup section */ -/* Begin PBXHeadersBuildPhase section */ - D90E329E182F626000A6F642 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D90E32C3182F638800A6F642 /* bytearray.h in Headers */, - D90E32CA182F638800A6F642 /* ptrarray.h in Headers */, - D90E32C8182F638800A6F642 /* plist.h in Headers */, - D90E32C6182F638800A6F642 /* hashtable.h in Headers */, - D90E32C4182F638800A6F642 /* common.h in Headers */, - D90E32C0182F638800A6F642 /* base64.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D90E32A8182F629600A6F642 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D9D810FE182F6794003DCCBB /* collection.h in Headers */, - D9D81101182F6794003DCCBB /* sock_stuff.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D90E32D1182F655500A6F642 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - /* Begin PBXNativeTarget section */ D90E3254182F07DC00A6F642 /* TetherMac */ = { isa = PBXNativeTarget; buildConfigurationList = D90E3286182F07DC00A6F642 /* Build configuration list for PBXNativeTarget "TetherMac" */; buildPhases = ( + DEF537F12E604F69A35A5614 /* Check Pods Manifest.lock */, D90E3251182F07DC00A6F642 /* Sources */, D90E3252182F07DC00A6F642 /* Frameworks */, D90E3253182F07DC00A6F642 /* Resources */, + 551353FA86374048AD71A2B9 /* Copy Pods Resources */, ); buildRules = ( ); dependencies = ( - D90E32B1182F62A700A6F642 /* PBXTargetDependency */, ); name = TetherMac; productName = Tether; productReference = D90E3255182F07DC00A6F642 /* TetherMac.app */; productType = "com.apple.product-type.application"; }; - D90E329F182F626000A6F642 /* libplist */ = { - isa = PBXNativeTarget; - buildConfigurationList = D90E32A1182F626000A6F642 /* Build configuration list for PBXNativeTarget "libplist" */; - buildPhases = ( - D90E329C182F626000A6F642 /* Sources */, - D90E329D182F626000A6F642 /* Frameworks */, - D90E329E182F626000A6F642 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - D90E32E3182F665300A6F642 /* PBXTargetDependency */, - ); - name = libplist; - productName = libplist; - productReference = D90E32A0182F626000A6F642 /* libplist.a */; - productType = "com.apple.product-type.library.static"; - }; - D90E32A9182F629600A6F642 /* libusbmuxd */ = { - isa = PBXNativeTarget; - buildConfigurationList = D90E32AB182F629600A6F642 /* Build configuration list for PBXNativeTarget "libusbmuxd" */; - buildPhases = ( - D90E32A6182F629600A6F642 /* Sources */, - D90E32A7182F629600A6F642 /* Frameworks */, - D90E32A8182F629600A6F642 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - D90E32AF182F62A200A6F642 /* PBXTargetDependency */, - ); - name = libusbmuxd; - productName = libusbmuxd; - productReference = D90E32AA182F629600A6F642 /* libusbmuxd.a */; - productType = "com.apple.product-type.library.static"; - }; - D90E32D2182F655500A6F642 /* libcnary */ = { - isa = PBXNativeTarget; - buildConfigurationList = D90E32D4182F655600A6F642 /* Build configuration list for PBXNativeTarget "libcnary" */; - buildPhases = ( - D90E32CF182F655500A6F642 /* Sources */, - D90E32D0182F655500A6F642 /* Frameworks */, - D90E32D1182F655500A6F642 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = libcnary; - productName = libcnary; - productReference = D90E32D3182F655600A6F642 /* libcnary.a */; - productType = "com.apple.product-type.library.static"; - }; D9B76798184A8734000566D6 /* Tether */ = { isa = PBXNativeTarget; buildConfigurationList = D9B767C0184A8735000566D6 /* Build configuration list for PBXNativeTarget "Tether" */; @@ -612,7 +375,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = CB; - LastUpgradeCheck = 0500; + LastUpgradeCheck = 0510; ORGANIZATIONNAME = "Christopher Ballinger"; TargetAttributes = { D9B76798184A8734000566D6 = { @@ -641,9 +404,6 @@ projectRoot = ""; targets = ( D90E3254182F07DC00A6F642 /* TetherMac */, - D90E329F182F626000A6F642 /* libplist */, - D90E32A9182F629600A6F642 /* libusbmuxd */, - D90E32D2182F655500A6F642 /* libcnary */, D9B76798184A8734000566D6 /* Tether */, D9B767B1184A8734000566D6 /* TetherTests */, ); @@ -682,55 +442,53 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXSourcesBuildPhase section */ - D90E3251182F07DC00A6F642 /* Sources */ = { - isa = PBXSourcesBuildPhase; +/* Begin PBXShellScriptBuildPhase section */ + 551353FA86374048AD71A2B9 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( - D931A60D1830126D00593FF9 /* GCDAsyncSocket.m in Sources */, - D9B767D6184A9432000566D6 /* USBMuxDeviceConnection.m in Sources */, - D9B767C9184A88BA000566D6 /* main-mac.m in Sources */, - D9B767D9184A978A000566D6 /* USBMuxDevice.m in Sources */, - D90E326C182F07DC00A6F642 /* CBMacAppDelegate.m in Sources */, - D90E3297182F18CC00A6F642 /* CBDeviceWindowController.m in Sources */, - D931A61418304D1200593FF9 /* CBDeviceConnection.m in Sources */, - D9D8110A182F8B80003DCCBB /* USBMuxClient.m in Sources */, ); - runOnlyForDeploymentPostprocessing = 0; - }; - D90E329C182F626000A6F642 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D90E32C9182F638800A6F642 /* ptrarray.c in Sources */, - D90E32C5182F638800A6F642 /* hashtable.c in Sources */, - D90E32C7182F638800A6F642 /* plist.c in Sources */, - D90E32BF182F638800A6F642 /* base64.c in Sources */, - D90E32CB182F638800A6F642 /* xplist.c in Sources */, - D90E32C1182F638800A6F642 /* bplist.c in Sources */, - D90E32C2182F638800A6F642 /* bytearray.c in Sources */, + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n"; + showEnvVarsInLog = 0; }; - D90E32A6182F629600A6F642 /* Sources */ = { - isa = PBXSourcesBuildPhase; + DEF537F12E604F69A35A5614 /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( - D9D810FF182F6794003DCCBB /* libusbmuxd.c in Sources */, - D9D810FD182F6794003DCCBB /* collection.c in Sources */, - D9D81100182F6794003DCCBB /* sock_stuff.c in Sources */, + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; }; - D90E32CF182F655500A6F642 /* Sources */ = { +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D90E3251182F07DC00A6F642 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D90E32E1182F663A00A6F642 /* node.c in Sources */, - D90E32DF182F663A00A6F642 /* node_iterator.c in Sources */, - D90E32E0182F663A00A6F642 /* node_list.c in Sources */, - D90E32DD182F663A00A6F642 /* iterator.c in Sources */, - D90E32DE182F663A00A6F642 /* list.c in Sources */, + D9B767D6184A9432000566D6 /* USBMuxDeviceConnection.m in Sources */, + D9B767C9184A88BA000566D6 /* main-mac.m in Sources */, + D9B767D9184A978A000566D6 /* USBMuxDevice.m in Sources */, + D90E326C182F07DC00A6F642 /* CBMacAppDelegate.m in Sources */, + D90E3297182F18CC00A6F642 /* CBDeviceWindowController.m in Sources */, + D931A61418304D1200593FF9 /* CBDeviceConnection.m in Sources */, + D9D8110A182F8B80003DCCBB /* USBMuxClient.m in Sources */, + D9FEA98118EA6E6C00EA736D /* CBNetworkServiceEditor.m in Sources */, + D95309DA18CBE31E00393DB4 /* CBTunDevice.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -738,7 +496,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D9B767D3184A8C22000566D6 /* GCDAsyncSocket.m in Sources */, D98FA7F8184CA00D006D9AC1 /* SOCKSProxySocket.m in Sources */, D9B767A7184A8734000566D6 /* main.m in Sources */, D9B767AB184A8734000566D6 /* CBAppDelegate.m in Sources */, @@ -758,21 +515,6 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - D90E32AF182F62A200A6F642 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = D90E329F182F626000A6F642 /* libplist */; - targetProxy = D90E32AE182F62A200A6F642 /* PBXContainerItemProxy */; - }; - D90E32B1182F62A700A6F642 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = D90E32A9182F629600A6F642 /* libusbmuxd */; - targetProxy = D90E32B0182F62A700A6F642 /* PBXContainerItemProxy */; - }; - D90E32E3182F665300A6F642 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = D90E32D2182F655500A6F642 /* libcnary */; - targetProxy = D90E32E2182F665300A6F642 /* PBXContainerItemProxy */; - }; D9B767B7184A8735000566D6 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = D9B76798184A8734000566D6 /* Tether */; @@ -894,6 +636,7 @@ }; D90E3287182F07DC00A6F642 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 3344A729C1604CC882D91F05 /* Pods.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; @@ -906,6 +649,10 @@ "$(SRCROOT)/Submodules/CocoaAsyncSocket/GCD", ); INFOPLIST_FILE = "Tether/TetherMac-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/Tether-fesemxykvcaanucpsmrkosdeoujg/Build/Products/Debug", + ); PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -913,6 +660,7 @@ }; D90E3288182F07DC00A6F642 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 3344A729C1604CC882D91F05 /* Pods.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; @@ -925,109 +673,18 @@ "$(SRCROOT)/Submodules/CocoaAsyncSocket/GCD", ); INFOPLIST_FILE = "Tether/TetherMac-Info.plist"; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; - D90E32A2182F626000A6F642 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = ""; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/Submodules/libplist/include", - /usr/include/libxml2, - "$(SRCROOT)/Submodules/libplist/libcnary/include", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - D90E32A3182F626000A6F642 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = ""; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/Submodules/libplist/include", - /usr/include/libxml2, - "$(SRCROOT)/Submodules/libplist/libcnary/include", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - D90E32AC182F629600A6F642 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = ""; - GCC_PREPROCESSOR_DEFINITIONS = HAVE_PLIST; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/Submodules/libusbmuxd/include", - "$(SRCROOT)/Submodules/libplist/include", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - D90E32AD182F629600A6F642 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = ""; - GCC_PREPROCESSOR_DEFINITIONS = HAVE_PLIST; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/Submodules/libusbmuxd/include", - "$(SRCROOT)/Submodules/libplist/include", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - D90E32D5182F655600A6F642 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = ""; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", + LIBRARY_SEARCH_PATHS = ( "$(inherited)", - ); - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/Submodules/libplist/libcnary/include", - ); - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - D90E32D6182F655600A6F642 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = ""; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, - "$(SRCROOT)/Submodules/libplist/libcnary/include", + "$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/Tether-fesemxykvcaanucpsmrkosdeoujg/Build/Products/Debug", ); PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; }; name = Release; }; D9B767C1184A8735000566D6 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_ENABLE_MODULES = YES; @@ -1054,7 +711,6 @@ D9B767C2184A8735000566D6 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_ENABLE_MODULES = YES; @@ -1078,7 +734,6 @@ D9B767C4184A8735000566D6 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TetherMac.app/Contents/MacOS/TetherMac"; CLANG_ENABLE_MODULES = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -1104,7 +759,6 @@ D9B767C5184A8735000566D6 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/TetherMac.app/Contents/MacOS/TetherMac"; CLANG_ENABLE_MODULES = YES; FRAMEWORK_SEARCH_PATHS = ( @@ -1145,33 +799,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - D90E32A1182F626000A6F642 /* Build configuration list for PBXNativeTarget "libplist" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D90E32A2182F626000A6F642 /* Debug */, - D90E32A3182F626000A6F642 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D90E32AB182F629600A6F642 /* Build configuration list for PBXNativeTarget "libusbmuxd" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D90E32AC182F629600A6F642 /* Debug */, - D90E32AD182F629600A6F642 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D90E32D4182F655600A6F642 /* Build configuration list for PBXNativeTarget "libcnary" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - D90E32D5182F655600A6F642 /* Debug */, - D90E32D6182F655600A6F642 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; D9B767C0184A8735000566D6 /* Build configuration list for PBXNativeTarget "Tether" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Tether.xcworkspace/contents.xcworkspacedata b/Tether.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d383b8 --- /dev/null +++ b/Tether.xcworkspace/contents.xcworkspacedata @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Tether.xcworkspace/xcshareddata/Tether.xccheckout b/Tether.xcworkspace/xcshareddata/Tether.xccheckout new file mode 100644 index 0000000..cacd2c8 --- /dev/null +++ b/Tether.xcworkspace/xcshareddata/Tether.xccheckout @@ -0,0 +1,89 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 68D77D00-2CCB-40B7-8B7B-AC1AAFC4B246 + IDESourceControlProjectName + Tether + IDESourceControlProjectOriginsDictionary + + 0ED34DCF-5560-47B6-B675-5A8237DA9A1A + ssh://github.com/chrisballinger/Tether-iOS.git + 1B8752AE-100F-4DFD-AA86-355CF0392E0A + ssh://github.com/chrisballinger/ProxyKit.git + 72CEDF93-3DC8-4ED5-8D90-D887BCE9A1C6 + ssh://github.com/robbiehanson/CocoaAsyncSocket.git + B1DFC0A1-0D57-426D-AE3F-E8DABD0942E5 + ssh://github.com/libimobiledevice/libplist.git + C72E8FC4-C6BC-42E4-A89B-F36567CFEAE4 + ssh://github.com/libimobiledevice/libusbmuxd.git + + IDESourceControlProjectPath + Tether.xcworkspace + IDESourceControlProjectRelativeInstallPathDictionary + + 0ED34DCF-5560-47B6-B675-5A8237DA9A1A + .. + 1B8752AE-100F-4DFD-AA86-355CF0392E0A + ../Submodules/ProxyKit + 72CEDF93-3DC8-4ED5-8D90-D887BCE9A1C6 + ../Submodules/CocoaAsyncSocket + B1DFC0A1-0D57-426D-AE3F-E8DABD0942E5 + ../Submodules/libplist + C72E8FC4-C6BC-42E4-A89B-F36567CFEAE4 + ../Submodules/libusbmuxd + + IDESourceControlProjectURL + ssh://github.com/chrisballinger/Tether-iOS.git + IDESourceControlProjectVersion + 110 + IDESourceControlProjectWCCIdentifier + 0ED34DCF-5560-47B6-B675-5A8237DA9A1A + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 72CEDF93-3DC8-4ED5-8D90-D887BCE9A1C6 + IDESourceControlWCCName + CocoaAsyncSocket + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + B1DFC0A1-0D57-426D-AE3F-E8DABD0942E5 + IDESourceControlWCCName + libplist + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + C72E8FC4-C6BC-42E4-A89B-F36567CFEAE4 + IDESourceControlWCCName + libusbmuxd + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 1B8752AE-100F-4DFD-AA86-355CF0392E0A + IDESourceControlWCCName + ProxyKit + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 0ED34DCF-5560-47B6-B675-5A8237DA9A1A + IDESourceControlWCCName + Tether-iOS + + + + diff --git a/Tether/CBDeviceWindowController.m b/Tether/CBDeviceWindowController.m index c491e0e..bd420e0 100644 --- a/Tether/CBDeviceWindowController.m +++ b/Tether/CBDeviceWindowController.m @@ -10,6 +10,7 @@ #import "USBMuxClient.h" #import "USBMuxDevice.h" #import "CBDeviceConnection.h" +#import "CBTunDevice.h" const static uint16_t kDefaultLocalPortNumber = 8000; const static uint16_t kDefaultRemotePortNumber = 8123; @@ -130,6 +131,9 @@ - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn } - (IBAction)refreshButtonPressed:(id)sender { + CBTunDevice *tunDevice = [[CBTunDevice alloc] init]; + [tunDevice openTun]; + if (self.listeningSocket) { NSLog(@"Disconnecting local socket"); [self.listeningSocket disconnect]; diff --git a/Tether/CBNetworkServiceEditor.h b/Tether/CBNetworkServiceEditor.h new file mode 100644 index 0000000..4d8f70d --- /dev/null +++ b/Tether/CBNetworkServiceEditor.h @@ -0,0 +1,14 @@ +// +// CBNetworkServiceEditor.h +// Tether +// +// Created by Christopher Ballinger on 3/31/14. +// Copyright (c) 2014 Christopher Ballinger. All rights reserved. +// +// http://stackoverflow.com/a/6375307/805882 + +#import + +@interface CBNetworkServiceEditor : NSObject + +@end diff --git a/Tether/CBNetworkServiceEditor.m b/Tether/CBNetworkServiceEditor.m new file mode 100644 index 0000000..62a7098 --- /dev/null +++ b/Tether/CBNetworkServiceEditor.m @@ -0,0 +1,28 @@ +// +// CBNetworkServiceEditor.m +// Tether +// +// Created by Christopher Ballinger on 3/31/14. +// Copyright (c) 2014 Christopher Ballinger. All rights reserved. +// + +#import "CBNetworkServiceEditor.h" + +static NSString * const kPreferencesFilePath = @"/Library/Preferences/SystemConfiguration/preferences.plist"; + +@interface CBNetworkServiceEditor() +@property (nonatomic, strong) NSDictionary *preferencesDictionary; +@end + +@implementation CBNetworkServiceEditor + +- (id) init { + if (self = [super init]) { + + } + return self; +} + + + +@end diff --git a/Tether/CBTunDevice.h b/Tether/CBTunDevice.h new file mode 100644 index 0000000..af37b14 --- /dev/null +++ b/Tether/CBTunDevice.h @@ -0,0 +1,16 @@ +// +// CBTunDevice.h +// Tether +// +// Created by Christopher Ballinger on 3/8/14. +// Copyright (c) 2014 Christopher Ballinger. All rights reserved. +// + +#import + +@interface CBTunDevice : NSObject + +- (void) openTun; +- (void) closeTun; + +@end diff --git a/Tether/CBTunDevice.m b/Tether/CBTunDevice.m new file mode 100644 index 0000000..23d1fb1 --- /dev/null +++ b/Tether/CBTunDevice.m @@ -0,0 +1,121 @@ +// +// CBTunDevice.m +// Tether +// +// Created by Christopher Ballinger on 3/8/14. +// Copyright (c) 2014 Christopher Ballinger. All rights reserved. +// + +#import "CBTunDevice.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +int +tun(void) +{ + struct sockaddr_ctl sc; + struct ctl_info ctlInfo; + int fd; + + + memset(&ctlInfo, 0, sizeof(ctlInfo)); + if (strlcpy(ctlInfo.ctl_name, UTUN_CONTROL_NAME, sizeof(ctlInfo.ctl_name)) >= + sizeof(ctlInfo.ctl_name)) { + fprintf(stderr,"UTUN_CONTROL_NAME too long"); + return -1; + } + fd = socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL); + + if (fd == -1) { + perror ("socket(SYSPROTO_CONTROL)"); + return -1; + } + if (ioctl(fd, CTLIOCGINFO, &ctlInfo) == -1) { + perror ("ioctl(CTLIOCGINFO)"); + close(fd); + return -1; + } + + sc.sc_id = ctlInfo.ctl_id; + sc.sc_len = sizeof(sc); + sc.sc_family = AF_SYSTEM; + sc.ss_sysaddr = AF_SYS_CONTROL; + sc.sc_unit = 2; /* Only have one, in this example... */ + + + // If the connect is successful, a tun%d device will be created, where "%d" + // is our unit number -1 + + if (connect(fd, (struct sockaddr *)&sc, sizeof(sc)) == -1) { + perror ("connect(AF_SYS_CONTROL)"); + close(fd); + return -1; + } + return fd; +} + +@interface CBTunDevice() +@property (nonatomic) int utunFileDescriptor; +@end + + +@implementation CBTunDevice + +- (void) dealloc { + [self closeTun]; +} + +- (void) closeTun { + if (!_utunFileDescriptor) { + return; + } + close(_utunFileDescriptor); + _utunFileDescriptor = 0; +} + +- (void) openTun { + [self closeTun]; + self.utunFileDescriptor = tun (); + + if (_utunFileDescriptor == -1) + { + fprintf(stderr,"Unable to establish UTUN descriptor - aborting\n"); + [self closeTun]; + return; + } + + fprintf(stderr,"Utun interface is up.. Configure IPv4 using \"ifconfig utun1 _ipA_ _ipB_\"\n"); + fprintf(stderr," Configure IPv6 using \"ifconfig utun1 inet6 _ip6_\"\n"); + fprintf(stderr,"Then (e.g.) ping _ipB_ (IPv6 will automatically generate ND messages)\n"); + + + // PoC - Just dump the packets... + for (;;) + { + unsigned char c[1500]; + ssize_t len; + int i; + + len = read (_utunFileDescriptor,c, 1500); + + // First 4 bytes of read data are the AF: 2 for AF_INET, 1E for AF_INET6, etc.. + for (i = 4; i< len; i++) + { + printf ("%02x ", c[i]); + if ( (i-4)%16 ==15) printf("\n"); + } + printf ("\n"); + } +} + +@end diff --git a/Tether/UTUN.h b/Tether/UTUN.h new file mode 100644 index 0000000..eb9a9e4 --- /dev/null +++ b/Tether/UTUN.h @@ -0,0 +1,13 @@ +// +// UTUN.h +// Tether +// +// Created by Christopher Ballinger on 12/8/13. +// Copyright (c) 2013 Christopher Ballinger. All rights reserved. +// + +#import + +@interface UTUN : NSObject + +@end diff --git a/Tether/UTUN.m b/Tether/UTUN.m new file mode 100644 index 0000000..73a09c5 --- /dev/null +++ b/Tether/UTUN.m @@ -0,0 +1,868 @@ +// +// UTUN.m +// Tether +// +// Created by Christopher Ballinger on 12/8/13. +// Copyright (c) 2013 Christopher Ballinger. All rights reserved. +// + +#import "UTUN.h" +#import +#import +#import +#import +#import +#import +#import + +/* + * Allocate a string + */ +char * +string_alloc (const char *str) +{ + if (str) + { + const long n = strlen (str) + 1; + char *ret; + + ret = calloc(1, n); + + memcpy (ret, str, n); + return ret; + } + else + return NULL; +} + +#define DEV_TYPE_TUN 2 /* point-to-point IP tunnel */ + + +struct tuntap_options { + /* --ip-win32 options */ + bool ip_win32_defined; + +# define IPW32_SET_MANUAL 0 /* "--ip-win32 manual" */ +# define IPW32_SET_NETSH 1 /* "--ip-win32 netsh" */ +# define IPW32_SET_IPAPI 2 /* "--ip-win32 ipapi" */ +# define IPW32_SET_DHCP_MASQ 3 /* "--ip-win32 dynamic" */ +# define IPW32_SET_ADAPTIVE 4 /* "--ip-win32 adaptive" */ +# define IPW32_SET_N 5 + int ip_win32_type; + + /* --ip-win32 dynamic options */ + bool dhcp_masq_custom_offset; + int dhcp_masq_offset; + int dhcp_lease_time; + + /* --tap-sleep option */ + int tap_sleep; + + /* --dhcp-option options */ + + bool dhcp_options; + + const char *domain; /* DOMAIN (15) */ + + const char *netbios_scope; /* NBS (47) */ + + int netbios_node_type; /* NBT 1,2,4,8 (46) */ + +#define N_DHCP_ADDR 4 /* Max # of addresses allowed for +DNS, WINS, etc. */ + + /* DNS (6) */ + in_addr_t dns[N_DHCP_ADDR]; + int dns_len; + + /* WINS (44) */ + in_addr_t wins[N_DHCP_ADDR]; + int wins_len; + + /* NTP (42) */ + in_addr_t ntp[N_DHCP_ADDR]; + int ntp_len; + + /* NBDD (45) */ + in_addr_t nbdd[N_DHCP_ADDR]; + int nbdd_len; + + /* DISABLE_NBT (43, Vendor option 001) */ + bool disable_nbt; + + bool dhcp_renew; + bool dhcp_pre_release; + bool dhcp_release; + + bool register_dns; +}; + +/* + * Define a TUN/TAP dev. + */ + +struct tuntap +{ +# define TUNNEL_TYPE(tt) ((tt) ? ((tt)->type) : DEV_TYPE_UNDEF) + int type; /* DEV_TYPE_x as defined in proto.h */ + +# define TUNNEL_TOPOLOGY(tt) ((tt) ? ((tt)->topology) : TOP_UNDEF) + int topology; /* one of the TOP_x values */ + + bool did_ifconfig_setup; + bool did_ifconfig_ipv6_setup; + bool did_ifconfig; + + bool ipv6; + + bool persistent_if; /* if existed before, keep on program end */ + + struct tuntap_options options; /* options set on command line */ + + char *actual_name; /* actual name of TUN/TAP dev, usually including unit number */ + + /* number of TX buffers */ + int txqueuelen; + + /* ifconfig parameters */ + in_addr_t local; + in_addr_t remote_netmask; + in_addr_t broadcast; + + struct in6_addr local_ipv6; + struct in6_addr remote_ipv6; + int netbits_ipv6; + + int fd; /* file descriptor for TUN/TAP dev */ + + bool is_utun; + /* used for printing status info only */ + unsigned int rwflags_debug; + + /* Some TUN/TAP drivers like to be ioctled for mtu + after open */ + int post_open_mtu; +}; + + +/* + * OpenBSD and Mac OS X when using utun + * have a slightly incompatible TUN device from + * the rest of the world, in that it prepends a + * uint32 to the beginning of the IP header + * to designate the protocol (why not just + * look at the version field in the IP header to + * determine v4 or v6?). + * + * We strip off this field on reads and + * put it back on writes. + * + * I have not tested TAP devices on OpenBSD, + * but I have conditionalized the special + * TUN handling code described above to + * go away for TAP devices. + */ + + +static inline long +header_modify_read_write_return (long len) +{ + if (len > 0) + return len > sizeof (u_int32_t) ? len - sizeof (u_int32_t) : 0; + else + return len; +} + +long +write_tun (struct tuntap* tt, uint8_t *buf, int len) +{ + if (tt->type == DEV_TYPE_TUN) + { + u_int32_t type; + struct iovec iv[2]; + struct ip *iph; + + iph = (struct ip *) buf; + + if (tt->ipv6 && iph->ip_v == 6) + type = htonl (AF_INET6); + else + type = htonl (AF_INET); + + iv[0].iov_base = &type; + iv[0].iov_len = sizeof (type); + iv[1].iov_base = buf; + iv[1].iov_len = len; + + return header_modify_read_write_return (writev (tt->fd, iv, 2)); + } + else + return write (tt->fd, buf, len); +} + +long +read_tun (struct tuntap* tt, uint8_t *buf, int len) +{ + if (tt->type == DEV_TYPE_TUN) + { + u_int32_t type; + struct iovec iv[2]; + + iv[0].iov_base = &type; + iv[0].iov_len = sizeof (type); + iv[1].iov_base = buf; + iv[1].iov_len = len; + + return header_modify_read_write_return (readv (tt->fd, iv, 2)); + } + else + return read (tt->fd, buf, len); +} + +/* Darwin (MacOS X) is mostly "just use the generic stuff", but there + * is always one caveat...: + * + * If IPv6 is configured, and the tun device is closed, the IPv6 address + * configured to the tun interface changes to a lingering /128 route + * pointing to lo0. Need to unconfigure... (observed on 10.5) + */ + +/* + * utun is the native Darwin tun driver present since at least 10.7 + * Thanks goes to Jonathan Levin for providing an example how to utun + * (http://newosxbook.com/src.jl?tree=listings&file=17-15-utun.c) + */ + +/* Helper functions that tries to open utun device + return -2 on early initialization failures (utun not supported + at all (old OS X) and -1 on initlization failure of utun + device (utun works but utunX is already used */ +static +int utun_open_helper (struct ctl_info ctlInfo, int utunnum) +{ + struct sockaddr_ctl sc; + int fd; + + fd = socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL); + + if (fd < 0) + { + NSLog (@"Opening utun (%s): %s", "socket(SYSPROTO_CONTROL)", + strerror (errno)); + return -2; + } + + if (ioctl(fd, CTLIOCGINFO, &ctlInfo) == -1) + { + close (fd); + NSLog(@"Opening utun (%s): %s", "ioctl(CTLIOCGINFO)", + strerror (errno)); + return -2; + } + + + sc.sc_id = ctlInfo.ctl_id; + sc.sc_len = sizeof(sc); + sc.sc_family = AF_SYSTEM; + sc.ss_sysaddr = AF_SYS_CONTROL; + + sc.sc_unit = utunnum+1; + + + /* If the connect is successful, a utun%d device will be created, where "%d" + * is (sc.sc_unit - 1) */ + + if (connect (fd, (struct sockaddr *)&sc, sizeof(sc)) < 0) + { + NSLog (@"Opening utun (%s): %s", "connect(AF_SYS_CONTROL)", + strerror (errno)); + close(fd); + return -1; + } + + fcntl (fd, F_SETFL, O_NONBLOCK); + fcntl (fd, F_SETFD, FD_CLOEXEC); /* don't pass fd to scripts */ + + return fd; +} + +void +open_darwin_utun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt) +{ + struct ctl_info ctlInfo; + int fd; + char utunname[20]; + int utunnum =-1; + socklen_t utunname_len = sizeof(utunname); + + /* dev_node is simply utun, do the normal dynamic utun + * otherwise try to parse the utun number */ + if (dev_node && !strcmp ("utun", dev_node)==0) + { + if (!sscanf (dev_node, "utun%d", &utunnum)==1) + NSLog(@"Cannot parse 'dev-node %s' please use 'dev-node utunX'" + "to use a utun device number X", dev_node); + } + + + memset(&(ctlInfo), 0, sizeof(ctlInfo)); + if (strlcpy(ctlInfo.ctl_name, UTUN_CONTROL_NAME, sizeof(ctlInfo.ctl_name)) >= + sizeof(ctlInfo.ctl_name)) + { + NSLog(@"Opening utun: UTUN_CONTROL_NAME too long"); + } + + /* try to open first available utun device if no specific utun is requested */ + if (utunnum == -1) + { + for (utunnum=0; utunnum<255; utunnum++) + { + fd = utun_open_helper (ctlInfo, utunnum); + /* Break if the fd is valid, + * or if early initalization failed (-2) */ + if (fd !=-1) + break; + } + } + else + { + fd = utun_open_helper (ctlInfo, utunnum); + } + + /* opening an utun device failed */ + tt->fd = fd; + + if (fd < 0) + return; + + /* Retrieve the assigned interface name. */ + if (getsockopt (fd, SYSPROTO_CONTROL, UTUN_OPT_IFNAME, utunname, &utunname_len)) + NSLog(@"Error retrieving utun interface name"); + + tt->actual_name = string_alloc (utunname); + + NSLog(@"Opened utun device %s", utunname); + tt->is_utun = true; +} + +void +open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt) +{ + /* Try utun first and fall back to normal tun if utun fails + and dev_node is not specified */ + open_darwin_utun(dev, dev_type, dev_node, tt); + + if (!tt->is_utun) + { + NSLog(@"Cannot open utun device"); + } +} + +static void +clear_tuntap (struct tuntap *tuntap) +{ + memset(tuntap, 0, sizeof(*tuntap)); + tuntap->fd = -1; + tuntap->ipv6 = false; +} + +static void +close_tun_generic (struct tuntap *tt) +{ + if (tt->fd >= 0) + close (tt->fd); + if (tt->actual_name) + free (tt->actual_name); + clear_tuntap (tt); +} + +bool +is_dev_type (const char *dev, const char *dev_type, const char *match_type) +{ + if (!dev) + return false; + if (dev_type) + return !strcmp (dev_type, match_type); + else + return !strncmp (dev, match_type, strlen (match_type)); +} + +int +dev_type_enum (const char *dev, const char *dev_type) +{ + if (is_dev_type (dev, dev_type, "tun")) + return DEV_TYPE_TUN; + else + return 0; +} + +const char * +dev_type_string (const char *dev, const char *dev_type) +{ + switch (dev_type_enum (dev, dev_type)) + { + case DEV_TYPE_TUN: + return "tun"; + default: + return "[unknown-dev-type]"; + } +} + +void +close_tun (struct tuntap* tt) +{ + if (tt) + { + if ( tt->ipv6 && tt->did_ifconfig_ipv6_setup ) + { + /* + const char * ifconfig_ipv6_local = + print_in6_addr (tt->local_ipv6, 0, &gc); + + argv_printf (&argv, "%s delete -inet6 %s", + ROUTE_PATH, ifconfig_ipv6_local ); + argv_msg (M_INFO, &argv); + openvpn_execve_check (&argv, NULL, 0, "MacOS X 'remove inet6 route' failed (non-critical)"); + */ + } + close_tun_generic (tt); + free (tt); + } +} + +/* + * Init tun/tap object. + * + * Set up tuntap structure for ifconfig, + * but don't execute yet. + */ +struct tuntap * +init_tun (const char *dev, /* --dev option */ + const char *dev_type, /* --dev-type option */ + int topology, /* one of the TOP_x values */ + const char *ifconfig_local_parm, /* --ifconfig parm 1 */ + const char *ifconfig_remote_netmask_parm, /* --ifconfig parm 2 */ + const char *ifconfig_ipv6_local_parm, /* --ifconfig parm 1 IPv6 */ + int ifconfig_ipv6_netbits_parm, + const char *ifconfig_ipv6_remote_parm, /* --ifconfig parm 2 IPv6 */ + in_addr_t local_public, + in_addr_t remote_public, + const bool strict_warn) +{ + struct tuntap *tt; + + tt = malloc (sizeof (struct tuntap)); + clear_tuntap (tt); + + tt->type = dev_type_enum (dev, dev_type); + tt->topology = topology; + + if (ifconfig_local_parm && ifconfig_remote_netmask_parm) + { + bool tun = false; + const char *ifconfig_local = NULL; + const char *ifconfig_remote_netmask = NULL; + const char *ifconfig_broadcast = NULL; + + /* + * We only handle TUN/TAP devices here, not --dev null devices. + */ + tun = is_tun_p2p (tt); + + /* + * Convert arguments to binary IPv4 addresses. + */ + + tt->local = getaddr ( + GETADDR_RESOLVE + | GETADDR_HOST_ORDER + | GETADDR_FATAL_ON_SIGNAL + | GETADDR_FATAL, + ifconfig_local_parm, + 0, + NULL, + NULL); + + tt->remote_netmask = getaddr ( + (tun ? GETADDR_RESOLVE : 0) + | GETADDR_HOST_ORDER + | GETADDR_FATAL_ON_SIGNAL + | GETADDR_FATAL, + ifconfig_remote_netmask_parm, + 0, + NULL, + NULL); + + /* + * Look for common errors in --ifconfig parms + */ + if (strict_warn) + { + ifconfig_sanity_check (tt->type == DEV_TYPE_TUN, tt->remote_netmask, tt->topology); + + /* + * If local_public or remote_public addresses are defined, + * make sure they do not clash with our virtual subnet. + */ + + check_addr_clash ("local", + tt->type, + local_public, + tt->local, + tt->remote_netmask); + + check_addr_clash ("remote", + tt->type, + remote_public, + tt->local, + tt->remote_netmask); + + if (tt->type == DEV_TYPE_TAP || (tt->type == DEV_TYPE_TUN && tt->topology == TOP_SUBNET)) + check_subnet_conflict (tt->local, tt->remote_netmask, "TUN/TAP adapter"); + else if (tt->type == DEV_TYPE_TUN) + check_subnet_conflict (tt->local, IPV4_NETMASK_HOST, "TUN/TAP adapter"); + } + + + + tt->did_ifconfig_setup = true; + } + + if (ifconfig_ipv6_local_parm && ifconfig_ipv6_remote_parm) + { + const char *ifconfig_ipv6_local = NULL; + const char *ifconfig_ipv6_remote = NULL; + + /* + * Convert arguments to binary IPv6 addresses. + */ + + if ( inet_pton( AF_INET6, ifconfig_ipv6_local_parm, &tt->local_ipv6 ) != 1 || + inet_pton( AF_INET6, ifconfig_ipv6_remote_parm, &tt->remote_ipv6 ) != 1 ) + { + msg( M_FATAL, "init_tun: problem converting IPv6 ifconfig addresses %s and %s to binary", ifconfig_ipv6_local_parm, ifconfig_ipv6_remote_parm ); + } + tt->netbits_ipv6 = ifconfig_ipv6_netbits_parm; + + /* + * Set ifconfig parameters + */ + ifconfig_ipv6_local = print_in6_addr (tt->local_ipv6, 0, &gc); + ifconfig_ipv6_remote = print_in6_addr (tt->remote_ipv6, 0, &gc); + + /* + * Set environmental variables with ifconfig parameters. + */ + if (es) + { + setenv_str (es, "ifconfig_ipv6_local", ifconfig_ipv6_local); + setenv_int (es, "ifconfig_ipv6_netbits", tt->netbits_ipv6); + setenv_str (es, "ifconfig_ipv6_remote", ifconfig_ipv6_remote); + } + tt->did_ifconfig_ipv6_setup = true; + } + + gc_free (&gc); + return tt; +} + +/* + * Platform specific tun initializations + */ +void +init_tun_post (struct tuntap *tt, + const struct frame *frame, + const struct tuntap_options *options) +{ + tt->options = *options; +} + +/* some of the platforms will auto-add a "network route" pointing + * to the interface on "ifconfig tunX 2001:db8::1/64", others need + * an extra call to "route add..." + * -> helper function to simplify code below + */ +void add_route_connected_v6_net(struct tuntap * tt, + const struct env_set *es) +{ + struct route_ipv6 r6; + + r6.defined = true; + r6.network = tt->local_ipv6; + r6.netbits = tt->netbits_ipv6; + r6.gateway = tt->local_ipv6; + r6.metric = 0; /* connected route */ + r6.metric_defined = true; + add_route_ipv6 (&r6, tt, 0, es); +} + +void delete_route_connected_v6_net(struct tuntap * tt, + const struct env_set *es) +{ + struct route_ipv6 r6; + + r6.defined = true; + r6.network = tt->local_ipv6; + r6.netbits = tt->netbits_ipv6; + r6.gateway = tt->local_ipv6; + r6.metric = 0; /* connected route */ + r6.metric_defined = true; + delete_route_ipv6 (&r6, tt, 0, es); +} + +/* + * Open tun/tap device, ifconfig, call up script, etc. + */ + +static bool +do_open_tun () +{ + bool ret = false; + + c->c2.ipv4_tun = (!c->options.tun_ipv6 + && is_dev_type (c->options.dev, c->options.dev_type, "tun")); + +#ifndef TARGET_ANDROID + if (!c->c1.tuntap) + { +#endif + +#ifdef TARGET_ANDROID + /* If we emulate persist-tun on android we still have to open a new tun and + then close the old */ + int oldtunfd=-1; + if (c->c1.tuntap) + oldtunfd = c->c1.tuntap->fd; +#endif + + /* initialize (but do not open) tun/tap object */ + do_init_tun (c); + + /* allocate route list structure */ + do_alloc_route_list (c); + + /* parse and resolve the route option list */ + if (c->options.routes && c->c1.route_list && c->c2.link_socket) + do_init_route_list (&c->options, c->c1.route_list, &c->c2.link_socket->info, false, c->c2.es); + if (c->options.routes_ipv6 && c->c1.route_ipv6_list ) + do_init_route_ipv6_list (&c->options, c->c1.route_ipv6_list, false, c->c2.es); + + /* do ifconfig */ + if (!c->options.ifconfig_noexec + && ifconfig_order () == IFCONFIG_BEFORE_TUN_OPEN) + { + /* guess actual tun/tap unit number that will be returned + by open_tun */ + const char *guess = guess_tuntap_dev (c->options.dev, + c->options.dev_type, + c->options.dev_node, + &gc); + do_ifconfig (c->c1.tuntap, guess, TUN_MTU_SIZE (&c->c2.frame), c->c2.es); + } + + /* possibly add routes */ + if (route_order() == ROUTE_BEFORE_TUN) { + /* Ignore route_delay, would cause ROUTE_BEFORE_TUN to be ignored */ + do_route (&c->options, c->c1.route_list, c->c1.route_ipv6_list, + c->c1.tuntap, c->plugins, c->c2.es); + } + + /* open the tun device */ + open_tun (c->options.dev, c->options.dev_type, c->options.dev_node, + c->c1.tuntap); +#ifdef TARGET_ANDROID + if (oldtunfd>=0) + close(oldtunfd); +#endif + /* set the hardware address */ + if (c->options.lladdr) + set_lladdr(c->c1.tuntap->actual_name, c->options.lladdr, c->c2.es); + + /* do ifconfig */ + if (!c->options.ifconfig_noexec + && ifconfig_order () == IFCONFIG_AFTER_TUN_OPEN) + { + do_ifconfig (c->c1.tuntap, c->c1.tuntap->actual_name, TUN_MTU_SIZE (&c->c2.frame), c->c2.es); + } + + /* run the up script */ + run_up_down (c->options.up_script, + c->plugins, + OPENVPN_PLUGIN_UP, + c->c1.tuntap->actual_name, + dev_type_string (c->options.dev, c->options.dev_type), + TUN_MTU_SIZE (&c->c2.frame), + EXPANDED_SIZE (&c->c2.frame), + print_in_addr_t (c->c1.tuntap->local, IA_EMPTY_IF_UNDEF, &gc), + print_in_addr_t (c->c1.tuntap->remote_netmask, IA_EMPTY_IF_UNDEF, &gc), + "init", + NULL, + "up", + c->c2.es); + + /* possibly add routes */ + if ((route_order() == ROUTE_AFTER_TUN) && (!c->options.route_delay_defined)) + do_route (&c->options, c->c1.route_list, c->c1.route_ipv6_list, + c->c1.tuntap, c->plugins, c->c2.es); + + /* + * Did tun/tap driver give us an MTU? + */ + if (c->c1.tuntap->post_open_mtu) + frame_set_mtu_dynamic (&c->c2.frame, + c->c1.tuntap->post_open_mtu, + SET_MTU_TUN | SET_MTU_UPPER_BOUND); + + ret = true; + static_context = c; +#ifndef TARGET_ANDROID + } + else + { + msg (M_INFO, "Preserving previous TUN/TAP instance: %s", + c->c1.tuntap->actual_name); + + /* run the up script if user specified --up-restart */ + if (c->options.up_restart) + run_up_down (c->options.up_script, + c->plugins, + OPENVPN_PLUGIN_UP, + c->c1.tuntap->actual_name, + dev_type_string (c->options.dev, c->options.dev_type), + TUN_MTU_SIZE (&c->c2.frame), + EXPANDED_SIZE (&c->c2.frame), + print_in_addr_t (c->c1.tuntap->local, IA_EMPTY_IF_UNDEF, &gc), + print_in_addr_t (c->c1.tuntap->remote_netmask, IA_EMPTY_IF_UNDEF, &gc), + "restart", + NULL, + "up", + c->c2.es); + } +#endif + gc_free (&gc); + return ret; +} + +/* + * Close TUN/TAP device + */ + +static void +do_close_tun_simple (struct context *c) +{ + msg (D_CLOSE, "Closing TUN/TAP interface"); + close_tun (c->c1.tuntap); + c->c1.tuntap = NULL; + c->c1.tuntap_owned = false; +#if P2MP + save_pulled_options_digest (c, NULL); /* delete C1-saved pulled_options_digest */ +#endif +} + +static void +do_close_tun (struct context *c, bool force) +{ + struct gc_arena gc = gc_new (); + if (c->c1.tuntap && c->c1.tuntap_owned) + { + const char *tuntap_actual = string_alloc (c->c1.tuntap->actual_name, &gc); + const in_addr_t local = c->c1.tuntap->local; + const in_addr_t remote_netmask = c->c1.tuntap->remote_netmask; + + if (force || !(c->sig->signal_received == SIGUSR1 && c->options.persist_tun)) + { + static_context = NULL; + +#ifdef ENABLE_MANAGEMENT + /* tell management layer we are about to close the TUN/TAP device */ + if (management) + { + management_pre_tunnel_close (management); + management_up_down (management, "DOWN", c->c2.es); + } +#endif + + /* delete any routes we added */ + if (c->c1.route_list || c->c1.route_ipv6_list ) + { + run_up_down (c->options.route_predown_script, + c->plugins, + OPENVPN_PLUGIN_ROUTE_PREDOWN, + tuntap_actual, + NULL, + TUN_MTU_SIZE (&c->c2.frame), + EXPANDED_SIZE (&c->c2.frame), + print_in_addr_t (local, IA_EMPTY_IF_UNDEF, &gc), + print_in_addr_t (remote_netmask, IA_EMPTY_IF_UNDEF, &gc), + "init", + signal_description (c->sig->signal_received, + c->sig->signal_text), + "route-pre-down", + c->c2.es); + + delete_routes (c->c1.route_list, c->c1.route_ipv6_list, + c->c1.tuntap, ROUTE_OPTION_FLAGS (&c->options), c->c2.es); + } + + /* actually close tun/tap device based on --down-pre flag */ + if (!c->options.down_pre) + do_close_tun_simple (c); + + /* Run the down script -- note that it will run at reduced + privilege if, for example, "--user nobody" was used. */ + run_up_down (c->options.down_script, + c->plugins, + OPENVPN_PLUGIN_DOWN, + tuntap_actual, + NULL, + TUN_MTU_SIZE (&c->c2.frame), + EXPANDED_SIZE (&c->c2.frame), + print_in_addr_t (local, IA_EMPTY_IF_UNDEF, &gc), + print_in_addr_t (remote_netmask, IA_EMPTY_IF_UNDEF, &gc), + "init", + signal_description (c->sig->signal_received, + c->sig->signal_text), + "down", + c->c2.es); + + /* actually close tun/tap device based on --down-pre flag */ + if (c->options.down_pre) + do_close_tun_simple (c); + } + else + { + /* run the down script on this restart if --up-restart was specified */ + if (c->options.up_restart) + run_up_down (c->options.down_script, + c->plugins, + OPENVPN_PLUGIN_DOWN, + tuntap_actual, + NULL, + TUN_MTU_SIZE (&c->c2.frame), + EXPANDED_SIZE (&c->c2.frame), + print_in_addr_t (local, IA_EMPTY_IF_UNDEF, &gc), + print_in_addr_t (remote_netmask, IA_EMPTY_IF_UNDEF, &gc), + "restart", + signal_description (c->sig->signal_received, + c->sig->signal_text), + "down", + c->c2.es); + } + } + gc_free (&gc); +} + +void +tun_abort() +{ + struct context *c = static_context; + if (c) + { + static_context = NULL; + do_close_tun (c, true); + } +} + +@implementation UTUN + +@end