d1e6bb4ba7
N-19 FTP 鉴权:
- lftpd_auth(USER/PASS 状态机 + 连续5次失败锁60s)+ SHA-256
(user||pwd) 口令哈希;config.ini [ftp] 段 user/pwd_hash/write,
出厂 admin/admin 在用有启动告警;lftpd_log.c 删除并入 lftpd_auth
- ftp_cfg 配置读写;台架 ftp_auth_bench.py 13/13
N-30 / Trap 25(CH395F_Trap_Records.md 四次定案全记录):
- 修复1 closed-with-data accept:客户端发完正常 FIN 后芯片按
FUN_PARA(0x09) §5.52② 保留 Socket+RX 缓冲,旧代码把 CLOSED 一律
relisten 自毁缓冲 → STOR 必挂 425;改为接受"已关但可读"连接排空
- 修复2 丢 CONNECT 中断探针 net_lost_connect_probe + last_peer_port
幽灵甄别(拆链窗口握手完成但中断丢失,双信源去抖补 accept)
- 修复3 send_list/send_nlst 批量单发:背靠背 ~60B 小段毒化芯片 TX
(芯片报 SEND_OK 但对端全丢),整份目录一次性写入
- 证伪存档:固定沉降/Socket 轮换冷却/listen 门控(台架 v7 矩阵)
- 台架工具 test/board/ch395f_reuse_bench.{c,h} + host 脚本存档
(不注册编译;实验分支 n30-chip-bench 保留)
N-20:Error_Handler 死循环降级(记录+复位路径)
N-23:scripts/check_registration.py 双端注册反向校验(pre-commit)
N-26:GD5F NAND 直 DMA 调用方缓冲窗口断言
验证:BUILD_OK 0/0;ftp_regression 连跑 4 轮 11/11(修复前
LIST#4/#7 100% 挂、STOR#2 曾 100% 425);ftp_auth_bench 13/13;
@test 启动标记 PASS;ci_local L0+L0.5 全过;doc-links 通过。
登记簿 N-30 已销项。
93 lines
2.8 KiB
Python
93 lines
2.8 KiB
Python
# N-30 芯片级复用时序台架:主机端(与 test/board/ch395f_reuse_bench.c 共用变体表)
|
|
# 用法: python ch395f_reuse_host.py [--host IP] [--cycles N]
|
|
# 纯 TCP,无 FTP。按 idx 轮转连接 5000+idx 端口,记录收发结果与时刻。
|
|
import argparse
|
|
import socket
|
|
import sys
|
|
import time
|
|
|
|
# {idx: (tx_len, close_mode)} 与固件表一致
|
|
VARS = {
|
|
0: (100, 0), # 0ms control
|
|
1: (100, 0), # 300ms control
|
|
2: (2000, 0), # 2KB control
|
|
3: (100, 0), # 0ms + ghost-wait fix
|
|
4: (100, 0), # 300ms + ghost-wait fix
|
|
5: (2000, 0), # 2KB + ghost-wait fix
|
|
}
|
|
|
|
|
|
def ts():
|
|
return time.strftime("%H:%M:%S") + ".%03d" % (int(time.time() * 1000) % 1000)
|
|
|
|
|
|
def run_round(host, idx, tx_len, close_mode):
|
|
port = 5000 + idx
|
|
# 等端口监听(芯片还没 open 时连接被拒,重试)
|
|
s = None
|
|
t0 = time.time()
|
|
while time.time() - t0 < 12.0:
|
|
try:
|
|
s = socket.create_connection((host, port), timeout=5)
|
|
break
|
|
except OSError:
|
|
time.sleep(0.2)
|
|
if s is None:
|
|
print("%s r%u CONNECT timeout" % (ts(), idx))
|
|
return False
|
|
|
|
ok = True
|
|
try:
|
|
s.settimeout(5)
|
|
got = 0
|
|
while got < tx_len:
|
|
chunk = s.recv(min(1024, tx_len - got))
|
|
if not chunk:
|
|
break
|
|
got += len(chunk)
|
|
note = ""
|
|
if got != tx_len:
|
|
note = " <<<< SWALLOWED (want %d)" % tx_len
|
|
ok = False
|
|
if close_mode == 1:
|
|
# 等芯片 FIN(mode1 芯片先关)
|
|
try:
|
|
fin = s.recv(1)
|
|
if fin:
|
|
note += " unexpected data after tx: %r" % fin
|
|
except socket.timeout:
|
|
note += " <<<< no FIN from chip (mode1)"
|
|
ok = False
|
|
print("%s r%u connected got=%d/%d%s" % (ts(), idx, got, tx_len, note))
|
|
except socket.timeout:
|
|
print("%s r%u recv timeout <<<< STALL" % (ts(), idx))
|
|
ok = False
|
|
except OSError as e:
|
|
print("%s r%u sock error %r" % (ts(), idx, e))
|
|
ok = False
|
|
finally:
|
|
s.close() # 主机关闭(mode0/2 主机先关)
|
|
return ok
|
|
|
|
|
|
def main():
|
|
ap = argparse.ArgumentParser()
|
|
ap.add_argument("--host", default="192.168.1.100")
|
|
ap.add_argument("--cycles", type=int, default=3)
|
|
args = ap.parse_args()
|
|
|
|
fails = []
|
|
for c in range(args.cycles):
|
|
for idx in sorted(VARS):
|
|
tx_len, mode = VARS[idx]
|
|
print("%s === cycle%u r%u (tx=%d mode=%d) ===" % (ts(), c, idx, tx_len, mode))
|
|
if not run_round(args.host, idx, tx_len, mode):
|
|
fails.append((c, idx))
|
|
time.sleep(0.3)
|
|
print("RESULT: %d failures %s" % (len(fails), fails))
|
|
return 1 if fails else 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|