… | |
… | |
169 | if (w_ofs < 2) |
169 | if (w_ofs < 2) |
170 | { |
170 | { |
171 | u16 plen = htons (w_pkt->len); |
171 | u16 plen = htons (w_pkt->len); |
172 | |
172 | |
173 | iovec vec[2]; |
173 | iovec vec[2]; |
|
|
174 | //TODO: char* is the right type? hardly... |
174 | vec[0].iov_base = ((u8 *)&plen) + w_ofs; |
175 | vec[0].iov_base = (char *)((u8 *)&plen) + w_ofs; |
175 | vec[0].iov_len = 2 - w_ofs; |
176 | vec[0].iov_len = 2 - w_ofs; |
176 | vec[1].iov_base = &((*w_pkt)[0]); |
177 | vec[1].iov_base = (char *)&((*w_pkt)[0]); |
177 | vec[1].iov_len = w_len - 2; |
178 | vec[1].iov_len = w_len - 2; |
178 | |
179 | |
179 | len = writev (fd, vec, 2); |
180 | len = writev (fd, vec, 2); |
180 | } |
181 | } |
181 | else |
182 | else |
… | |
… | |
401 | // right thing to do, not using tcp *is* the right thing to do. |
402 | // right thing to do, not using tcp *is* the right thing to do. |
402 | if (!w_pkt) |
403 | if (!w_pkt) |
403 | { |
404 | { |
404 | // how this maps to the underlying tcp packets we don't know |
405 | // how this maps to the underlying tcp packets we don't know |
405 | // and we don't care. at least we tried ;) |
406 | // and we don't care. at least we tried ;) |
|
|
407 | #if defined(SOL_IP) && defined(IP_TOS) |
406 | setsockopt (fd, SOL_IP, IP_TOS, &tos, sizeof tos); |
408 | setsockopt (fd, SOL_IP, IP_TOS, &tos, sizeof tos); |
|
|
409 | #endif |
407 | |
410 | |
408 | w_pkt = pkt; |
411 | w_pkt = pkt; |
409 | w_ofs = 0; |
412 | w_ofs = 0; |
410 | w_len = pkt->len + 2; // length + size header |
413 | w_len = pkt->len + 2; // length + size header |
411 | |
414 | |