|
@@ -17,6 +17,7 @@
|
|
|
*
|
|
*
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
|
|
+#import <net/if.h>
|
|
|
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
|
|
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
|
|
|
#import <CoreTelephony/CTCarrier.h>
|
|
#import <CoreTelephony/CTCarrier.h>
|
|
|
#import "LookupIPv6.h"
|
|
#import "LookupIPv6.h"
|
|
@@ -547,7 +548,25 @@
|
|
|
#pragma mark - GoPsiPsiphonProvider protocol implementation (private)
|
|
#pragma mark - GoPsiPsiphonProvider protocol implementation (private)
|
|
|
|
|
|
|
|
- (BOOL)bindToDevice:(long)fileDescriptor error:(NSError **)error {
|
|
- (BOOL)bindToDevice:(long)fileDescriptor error:(NSError **)error {
|
|
|
- // This PsiphonProvider function is only called in TunnelWholeDevice mode
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ This code is not currently used, so we won't leave it in untested. However,
|
|
|
|
|
+ this implementation info will probably be useful later.
|
|
|
|
|
+
|
|
|
|
|
+ // DEBUG
|
|
|
|
|
+ [self logMessage:[NSString stringWithFormat: @"***** DEBUG: bindToDevice called"]];
|
|
|
|
|
+
|
|
|
|
|
+ // This function is only called in TunnelWholeDevice mode
|
|
|
|
|
+
|
|
|
|
|
+ // TODO: Determine if this is robust.
|
|
|
|
|
+ unsigned int interfaceIndex = if_nametoindex("ap1");
|
|
|
|
|
+
|
|
|
|
|
+ int ret = setsockopt(fileDescriptor, IPPROTO_TCP, IP_BOUND_IF, &interfaceIndex, sizeof(interfaceIndex));
|
|
|
|
|
+ if (ret != 0) {
|
|
|
|
|
+ [self logMessage:[NSString stringWithFormat: @"bindToDevice: setsockopt failed; errno: %d", errno]];
|
|
|
|
|
+ return FALSE;
|
|
|
|
|
+ }
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
return TRUE;
|
|
return TRUE;
|
|
|
}
|
|
}
|
|
|
|
|
|