Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 40134 Details for
Bug 62873
pilot-link fails with net sync
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch from pilot-link bugs sight
net_tickle_patch (text/plain), 4.61 KB, created by
Michael W. Holdeman
on 2004-09-21 17:25:48 UTC
(
hide
)
Description:
patch from pilot-link bugs sight
Filename:
MIME Type:
Creator:
Michael W. Holdeman
Created:
2004-09-21 17:25:48 UTC
Size:
4.61 KB
patch
obsolete
>This fixes a bug where a tickle sent by the other end would >cause net_rx to return prematurely. This bug showed itself in >pi-nredir: when the server sent a tickle to pi-nredir, net_rx in >pi-nredir returned zero because it had received a zero-length packet; >but when net_rx returns zero that means the connection has been >closed, so pi-nredir exited. > >*** net.c 2004/03/13 18:52:43 1.1 >--- net.c 2004/03/13 19:54:13 >*************** >*** 179,187 **** > bytes = next->write(ps, buf, PI_NET_HEADER_LEN, flags); > if (bytes < PI_NET_HEADER_LEN) > return bytes; >! bytes = next->write(ps, msg, len, flags); >! if (bytes < len) > return bytes; > > CHECK(PI_DBG_NET, PI_DBG_LVL_INFO, net_dump_header(buf, 1)); > CHECK(PI_DBG_NET, PI_DBG_LVL_DEBUG, dumpdata(msg, len)); >--- 179,189 ---- > bytes = next->write(ps, buf, PI_NET_HEADER_LEN, flags); > if (bytes < PI_NET_HEADER_LEN) > return bytes; >! if (len > 0) { /* avoid zero-length write on tickle */ >! bytes = next->write(ps, msg, len, flags); >! if (bytes < len) > return bytes; >+ } > > CHECK(PI_DBG_NET, PI_DBG_LVL_INFO, net_dump_header(buf, 1)); > CHECK(PI_DBG_NET, PI_DBG_LVL_DEBUG, dumpdata(msg, len)); >*************** >*** 196,202 **** > total_bytes, > packet_len, > timeout, >! size; > > struct pi_protocol *prot, *next; > struct pi_net_data *data; >--- 198,205 ---- > total_bytes, > packet_len, > timeout, >! size, >! done; > > struct pi_protocol *prot, *next; > struct pi_net_data *data; >*************** >*** 216,255 **** > pi_setsockopt(ps->sd, PI_LEVEL_DEV, PI_DEV_TIMEOUT, > &timeout, &size); > >! total_bytes = 0; >! if (data->txid == 0) { > /* Peek to see if it is a headerless packet */ > bytes = next->read(ps, msg, 1, flags); > if (bytes > 0) { >! LOG ((PI_DBG_NET, PI_DBG_LVL_INFO, >! "NET RX: Checking for headerless packet %d\n", msg[0])); > >! if (msg[0] == 0x90) { >! /* Cause the header bytes to be skipped */ >! LOG ((PI_DBG_NET, PI_DBG_LVL_INFO, >! "NET RX: Headerless packet\n")); >! total_bytes = PI_NET_HEADER_LEN; >! msg[PI_NET_OFFSET_TYPE] = PI_NET_TYPE_DATA; >! msg[PI_NET_OFFSET_TXID] = 0x01; >! set_long (&msg[PI_NET_OFFSET_SIZE], 21); >! } else { >! total_bytes += bytes; >! } > } else { >! return bytes; > } >! } > >! /* Bytes in what's left of the header */ >! while (total_bytes < PI_NET_HEADER_LEN) { > bytes = next->read(ps, msg + total_bytes, PI_NET_HEADER_LEN - total_bytes, flags); > if (bytes <= 0) >! return bytes; > total_bytes += bytes; > } > > /* Bytes in the rest of the packet */ >- packet_len = get_long(&msg[PI_NET_OFFSET_SIZE]); > while (total_bytes < PI_NET_HEADER_LEN + packet_len) { > bytes = next->read(ps, msg + total_bytes, > PI_NET_HEADER_LEN + packet_len - total_bytes, flags); >--- 219,278 ---- > pi_setsockopt(ps->sd, PI_LEVEL_DEV, PI_DEV_TIMEOUT, > &timeout, &size); > >! done = 0; >! while (!done) { >! total_bytes = 0; >! if (data->txid == 0) { > /* Peek to see if it is a headerless packet */ > bytes = next->read(ps, msg, 1, flags); > if (bytes > 0) { >! LOG ((PI_DBG_NET, PI_DBG_LVL_INFO, >! "NET RX: Checking for headerless packet %d\n", msg[0])); > >! if (msg[0] == 0x90) { >! /* Cause the header bytes to be skipped */ >! LOG ((PI_DBG_NET, PI_DBG_LVL_INFO, >! "NET RX: Headerless packet\n")); >! total_bytes = PI_NET_HEADER_LEN; >! msg[PI_NET_OFFSET_TYPE] = PI_NET_TYPE_DATA; >! msg[PI_NET_OFFSET_TXID] = 0x01; >! set_long (&msg[PI_NET_OFFSET_SIZE], 21); >! } else { >! total_bytes += bytes; >! } > } else { >! return bytes; > } >! } > >! /* Bytes in what's left of the header */ >! while (total_bytes < PI_NET_HEADER_LEN) { > bytes = next->read(ps, msg + total_bytes, PI_NET_HEADER_LEN - total_bytes, flags); > if (bytes <= 0) >! return bytes; > total_bytes += bytes; >+ } >+ packet_len = get_long(&msg[PI_NET_OFFSET_SIZE]); >+ data->type = msg[PI_NET_OFFSET_TYPE]; >+ switch (data->type) { >+ case PI_NET_TYPE_TCKL: >+ if (packet_len != 0) { >+ LOG ((PI_DBG_NET, PI_DBG_LVL_ERR, >+ "NET RX: tickle packet with non-zero length\n")); >+ return -1; >+ } >+ /* valid tickle packet; continue reading. */ >+ break; >+ case PI_NET_TYPE_DATA: >+ done = 1; >+ break; >+ default: >+ LOG ((PI_DBG_NET, PI_DBG_LVL_ERR, >+ "NET RX: Unknown packet type\n")); >+ } > } > > /* Bytes in the rest of the packet */ > while (total_bytes < PI_NET_HEADER_LEN + packet_len) { > bytes = next->read(ps, msg + total_bytes, > PI_NET_HEADER_LEN + packet_len - total_bytes, flags);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 62873
: 40134