ObjFW  Diff

Differences From Artifact [22aa3a0709]:

To Artifact [8054bd9b01]:


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
configureInterface(OFString *interface, uint16_t network, uint8_t node,
    uint8_t phase, uint16_t rangeStart, uint16_t rangeEnd)
{
	int sock;
	struct ifreq request;
	struct sockaddr_at *sat;

	if (interface.UTF8StringLength > IFNAMSIZ) {
		[OFStdErr writeFormat: @"%@: Interface name too long!\n",
				       [OFApplication programName]];
		[OFApplication terminateWithStatus: 1];
	}

#ifdef OF_MACOS
	if ((sock = socket(AF_APPLETALK, SOCK_RAW, 0)) < 0) {







|







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
configureInterface(OFString *interface, uint16_t network, uint8_t node,
    uint8_t phase, uint16_t rangeStart, uint16_t rangeEnd)
{
	int sock;
	struct ifreq request;
	struct sockaddr_at *sat;

	if (interface.UTF8StringLength > IFNAMSIZ - 1) {
		[OFStdErr writeFormat: @"%@: Interface name too long!\n",
				       [OFApplication programName]];
		[OFApplication terminateWithStatus: 1];
	}

#ifdef OF_MACOS
	if ((sock = socket(AF_APPLETALK, SOCK_RAW, 0)) < 0) {
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
					     @"\"modprobe appletalk\"?"];
#endif

		[OFApplication terminateWithStatus: 1];
	}

	memset(&request, 0, sizeof(request));
	strncpy(request.ifr_name, interface.UTF8String, IFNAMSIZ);
	sat = (struct sockaddr_at *)&request.ifr_addr;
	sat->sat_family = AF_APPLETALK;
	sat->sat_net = OFToBigEndian16(network);
	sat->sat_node = node;
	/*
	 * The netrange is hidden in sat_zero and different OSes use different
	 * struct names for it, so the portable way is setting sat_zero







|







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
					     @"\"modprobe appletalk\"?"];
#endif

		[OFApplication terminateWithStatus: 1];
	}

	memset(&request, 0, sizeof(request));
	strncpy(request.ifr_name, interface.UTF8String, IFNAMSIZ - 1);
	sat = (struct sockaddr_at *)&request.ifr_addr;
	sat->sat_family = AF_APPLETALK;
	sat->sat_net = OFToBigEndian16(network);
	sat->sat_node = node;
	/*
	 * The netrange is hidden in sat_zero and different OSes use different
	 * struct names for it, so the portable way is setting sat_zero