Commit 59a1ef8
echoserver: close the agent socket on reset and handle a rekey
The worker drops back to APP_STATE_LISTEN when an agent connection ends,
but never closes the socket. The next accept() overwrites agentFd, so
every agent connection after the first leaks the previous descriptor. The
forward path has the same gap on its connection-reset arm, where the
socket is closed but fwdFd keeps the closed number.
A rekey was treated as a read failure and ended the session. It cannot
just be skipped either: wolfSSH_worker() reports WS_REKEYING in place of
WS_CHAN_RXD while keying, and nothing raises the data report again, so
ignoring it strands whatever arrived in that call and the peer waits on
an answer that never comes. This is the hazard the library already calls
out for WS_EXTDATA, which is exempted from the same override.
- close agentFd and clear it on both the read-zero and the
ECONNRESET/ECONNABORTED arms
- clear fwdFd on the forward reset arm, matching the read-zero arm
- clear agentCtx.appFd and fwdCtx.appFd wherever the worker closes the
socket, so the stored copy cannot outlive the descriptor
- drain the channel on WS_REKEYING as well as WS_CHAN_RXD, and take an
empty read as "nothing buffered" rather than a failure on that path.
wolfSSH_ChannelIdRead() has no isKeying gate and the window credit it
owes is parked until the rekey completes1 parent 26ccac3 commit 59a1ef8
1 file changed
Lines changed: 35 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
999 | 999 | | |
1000 | 1000 | | |
1001 | 1001 | | |
1002 | | - | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
1003 | 1009 | | |
1004 | 1010 | | |
1005 | 1011 | | |
1006 | 1012 | | |
1007 | 1013 | | |
1008 | | - | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
1009 | 1019 | | |
| 1020 | + | |
1010 | 1021 | | |
1011 | 1022 | | |
1012 | 1023 | | |
| |||
1044 | 1055 | | |
1045 | 1056 | | |
1046 | 1057 | | |
1047 | | - | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
1048 | 1063 | | |
| 1064 | + | |
1049 | 1065 | | |
1050 | 1066 | | |
1051 | 1067 | | |
| |||
1063 | 1079 | | |
1064 | 1080 | | |
1065 | 1081 | | |
1066 | | - | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
1067 | 1087 | | |
| 1088 | + | |
1068 | 1089 | | |
1069 | 1090 | | |
1070 | 1091 | | |
| |||
1084 | 1105 | | |
1085 | 1106 | | |
1086 | 1107 | | |
| 1108 | + | |
1087 | 1109 | | |
1088 | 1110 | | |
1089 | 1111 | | |
| |||
1151 | 1173 | | |
1152 | 1174 | | |
1153 | 1175 | | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
1154 | 1179 | | |
1155 | 1180 | | |
1156 | 1181 | | |
| |||
1164 | 1189 | | |
1165 | 1190 | | |
1166 | 1191 | | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
1167 | 1195 | | |
1168 | 1196 | | |
1169 | 1197 | | |
| |||
1215 | 1243 | | |
1216 | 1244 | | |
1217 | 1245 | | |
| 1246 | + | |
1218 | 1247 | | |
1219 | 1248 | | |
1220 | 1249 | | |
| |||
1235 | 1264 | | |
1236 | 1265 | | |
1237 | 1266 | | |
| 1267 | + | |
| 1268 | + | |
1238 | 1269 | | |
1239 | 1270 | | |
1240 | 1271 | | |
| |||
0 commit comments