2021-10-15 Bad method handle type 7

本文记录了作者在引入Retrofit依赖时遇到的DexPathList问题,通过查找ClassNotFoundException和Badmethodhandletype7错误,发现是Java8特性导致。文章介绍了如何配置sourceCompatibility和targetCompatibility以解决兼容性问题,以及不同系统对版本设置的需求。

 2021年10月15日 填坑笔录

枫叶看着挺美的,但是一大片的红色,让我想起了下面这种情况,顿时就觉得,似乎不是那么美了。

今天创建了一个空的项目,准备了解下Retrofit的源码,刚刚引入

 implementation 'com.squareup.retrofit2:retrofit:2.9.0'

就报错了

 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.baidu.speech.retrofitproject/com.baidu.speech.retrofitproject.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.baidu.speech.retrofitproject.MainActivity" on path: DexPathList[[zip file "/data/app/com.baidu.speech.retrofitproject-FmUzatgSX3o_rUowuZ2yww==/base.apk"],nativeLibraryDirectories=[/data/app/com.baidu.speech.retrofitproject-FmUzatgSX3o_rUowuZ2yww==/lib/arm64, /system/lib64, /vendor/lib64, /product/lib64, /preas/lib64]]
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3201)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3411)
        at android.app.ActivityThread.-wrap12(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1994)
        at android.os.Handler.dispatchMessage(Handler.java:108)
        at android.os.Looper.loop(Looper.java:166)
        at android.app.ActivityThread.main(ActivityThread.java:7529)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.baidu.speech.retrofitproject.MainActivity" on path: DexPathList[[zip file "/data/app/com.baidu.speech.retrofitproject-FmUzatgSX3o_rUowuZ2yww==/base.apk"],nativeLibraryDirectories=[/data/app/com.baidu.speech.retrofitproject-FmUzatgSX3o_rUowuZ2yww==/lib/arm64, /system/lib64, /vendor/lib64, /product/lib64, /preas/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1178)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3191)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3411) 
        at android.app.ActivityThread.-wrap12(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1994) 
        at android.os.Handler.dispatchMessage(Handler.java:108) 
        at android.os.Looper.loop(Looper.java:166) 
        at android.app.ActivityThread.main(ActivityThread.java:7529) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921) 
    	Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.baidu.speech.retrofitproject-FmUzatgSX3o_rUowuZ2yww==/base.apk because: Failure to verify dex file '/data/app/com.baidu.speech.retrofitproject-FmUzatgSX3o_rUowuZ2yww==/base.apk': Bad method handle type 7
        at dalvik.system.DexFile.openDexFileNative(Native Method)
        at dalvik.system.DexFile.openDexFile(DexFile.java:353)
        at dalvik.system.DexFile.<init>(DexFile.java:100)
        at dalvik.system.DexFile.<init>(DexFile.java:74)
        at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
        at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
        at dalvik.system.DexPathList.<init>(DexPathList.java:157)
        at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
        at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
        at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:75)
        at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:38)
        at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:719)
        at android.app.LoadedApk.getClassLoader(LoadedApk.java:752)
        at android.app.LoadedApk.getResources(LoadedApk.java:1005)
        at android.app.ContextImpl.createAppContext(ContextImpl.java:2505)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6497)
        at android.app.ActivityThread.-wrap2(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        		... 6 more

一开始对着上面的错误查找,定位第一句话:

java.lang.ClassNotFoundException: Didn't find class "com.baidu.speech.retrofitproject.MainActivity" on path: DexPathList

启动界面MainActivity在DexPathList中找不到,移除Retofit的依赖可以发现,是app是可以正常运行的,毕竟啥都没有。。。添加依赖就报错了,对着DexPathList这个关键字,尝试添加65535的问题解决方案。引入了MultiDex,发现依然解决不了问题,那就不是方法数超过65535的问题了。网上百度说有人是修改了项目名称,重新删除build文件夹重试后,依然都不行。

往下看这个启动Activity时候的IO异常

java.io.IOException: Failed to open dex files from /data/app/com.baidu.speech.retrofitproject-FmUzatgSX3o_rUowuZ2yww==/base.apk because: Failure to verify dex file '/data/app/com.baidu.speech.retrofitproject-FmUzatgSX3o_rUowuZ2yww==/base.apk': Bad method handle type 7

后面给了一个提示:Bad method handle type 7。

对着这个提示搜索,发现是可能是Retrofit中使用了一些java8的特性,导致的。需要再build.gradle文件中设置

compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

ok,完美运行。

很神奇的是,同样的配置,不用设置java 版本号,在华为10.0的系统可以,在华为8.0的系统却不行,必须配置java的版本号

参考:android - Failed to verify dex: Bad method handle type 7 - Stack Overflow

REPORT ZBISMT_UPDATE. * 定义数据类型 TYPES: BEGIN OF ty_excel_data, matnr TYPE matnr, " 物料号 maktx TYPE maktx, " 物料描述(仅用于读取Excel,不处理) bismt TYPE bismt, " 库格 werks TYPE werks_d, " 工厂 lgort TYPE lgort_d, " 库位 END OF ty_excel_data. * 定义内表和工作区 DATA: gt_excel_data TYPE TABLE OF ty_excel_data, gs_excel_data TYPE ty_excel_data, gt_zmm_bismt TYPE TABLE OF zmm_bismt, gs_zmm_bismt TYPE zmm_bismt, gt_updated TYPE TABLE OF zmm_bismt, " 存储更新的数据 gt_skipped TYPE TABLE OF zmm_bismt. " 存储跳过的数据(库格相同) * 保存结果到全局变量用于显示 DATA: gv_updated TYPE i, gv_skipped TYPE i, gv_inserted TYPE i. * 单物料维护相关变量 DATA: gv_edit_mode TYPE c, " 编辑模式:E=编辑,C=新建 gs_curr_data TYPE zmm_bismt. " 当前编辑的数据 * 选择屏幕定义 SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-t01. PARAMETERS: p_file TYPE rlgrap-filename. " Excel文件路径 PARAMETERS: p_werks TYPE werks_d DEFAULT '1011' OBLIGATORY. " 工厂输入 PARAMETERS: p_lgort TYPE lgort_d DEFAULT 'MT01' OBLIGATORY. " 库位输入 SELECTION-SCREEN SKIP. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN COMMENT 1(20) TEXT-fil. " 文件选择标签 SELECTION-SCREEN PUSHBUTTON 21(15) but_file USER-COMMAND file_sel. " 文件选择按钮 SELECTION-SCREEN END OF LINE. PARAMETERS: p_test AS CHECKBOX DEFAULT 'X' USER-COMMAND test. " 测试模式开关 SELECTION-SCREEN END OF BLOCK b1. SELECTION-SCREEN SKIP. SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT-t02. PARAMETERS: p_matnr TYPE matnr. " 物料号输入 SELECTION-SCREEN SKIP. SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN PUSHBUTTON 1(10) but1 USER-COMMAND query. " 查询按钮 SELECTION-SCREEN PUSHBUTTON 12(10) but2 USER-COMMAND create. " 新建按钮 SELECTION-SCREEN PUSHBUTTON 23(10) but3 USER-COMMAND save. " 保存按钮 SELECTION-SCREEN END OF LINE. SELECTION-SCREEN SKIP. PARAMETERS: p_w_s TYPE werks_d MODIF ID dis, " 工厂(显示用) p_lg_s TYPE lgort_d MODIF ID dis, " 库位(显示用) p_bismt TYPE bismt MODIF ID edt. " 库格(可编辑) SELECTION-SCREEN END OF BLOCK b2. * 文本符号定义 INITIALIZATION. " 设置按钮文本 but1 = '查询'. but2 = '新建'. but3 = '保存'. but_file = '浏览...'. " 文件选择按钮文本 * 主程序 START-OF-SELECTION. " 只有在提供了文件路径时才执行批量更新 IF p_file IS NOT INITIAL. PERFORM read_excel_data. PERFORM process_data. PERFORM show_result. ELSE. " 显示提示信息,只有单物料维护被执行 WRITE: / '未提供Excel文件,跳过批量更新'. WRITE: / '仅执行了单物料维护功能'. ENDIF. *&---------------------------------------------------------------------* *& Form READ_EXCEL_DATA *&---------------------------------------------------------------------* FORM read_excel_data. DATA: lt_raw_data TYPE truxs_t_text_data. DATA: lt_temp_excel TYPE TABLE OF ty_excel_data. " 临时内表 " 检查文件是否存在 PERFORM check_file_existence USING p_file. " 调用函数上传Excel文件 CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP' EXPORTING i_tab_raw_data = lt_raw_data i_filename = p_file TABLES i_tab_converted_data = lt_temp_excel " 先读到临时内表 EXCEPTIONS conversion_failed = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE 'Excel文件读取失败' TYPE 'E'. ENDIF. " 从第二行开始读取数据(跳过标题行) LOOP AT lt_temp_excel INTO gs_excel_data FROM 2. " 使用用户输入的工厂和库位值 gs_excel_data-werks = p_werks. gs_excel_data-lgort = p_lgort. APPEND gs_excel_data TO gt_excel_data. ENDLOOP. " 删除可能存在的空行(仅检查物料号) DELETE gt_excel_data WHERE matnr IS INITIAL. ENDFORM. " READ_EXCEL_DATA *&---------------------------------------------------------------------* *& Form PROCESS_DATA *&---------------------------------------------------------------------* FORM process_data. " 从目标表读取现有数据 SELECT matnr werks lgort bismt FROM zmm_bismt INTO TABLE gt_zmm_bismt. " 处理Excel数据 LOOP AT gt_excel_data INTO gs_excel_data. " 检查目标表中是否已存在相同物料号、工厂和库位的记录 READ TABLE gt_zmm_bismt INTO gs_zmm_bismt WITH KEY matnr = gs_excel_data-matnr werks = gs_excel_data-werks lgort = gs_excel_data-lgort. IF sy-subrc = 0. " 记录已存在,检查库格是否相同 IF gs_zmm_bismt-bismt = gs_excel_data-bismt. " 库格相同,跳过不处理 gv_skipped = gv_skipped + 1. APPEND gs_zmm_bismt TO gt_skipped. ELSE. " 库格不同,准备更新记录 gs_zmm_bismt-bismt = gs_excel_data-bismt. " 仅在非测试模式下执行更新 IF p_test <> 'X'. UPDATE zmm_bismt SET bismt = gs_excel_data-bismt WHERE matnr = gs_excel_data-matnr AND werks = gs_excel_data-werks AND lgort = gs_excel_data-lgort. ENDIF. IF sy-subrc = 0 OR p_test = 'X'. gv_updated = gv_updated + 1. APPEND gs_zmm_bismt TO gt_updated. ENDIF. ENDIF. ELSE. " 新记录,准备插入 gs_zmm_bismt-matnr = gs_excel_data-matnr. gs_zmm_bismt-werks = gs_excel_data-werks. gs_zmm_bismt-lgort = gs_excel_data-lgort. gs_zmm_bismt-bismt = gs_excel_data-bismt. " 仅在非测试模式下执行插入 IF p_test <> 'X'. INSERT zmm_bismt FROM gs_zmm_bismt. ENDIF. IF sy-subrc = 0 OR p_test = 'X'. gv_inserted = gv_inserted + 1. ENDIF. ENDIF. ENDLOOP. " 仅在非测试模式下提交更改 IF p_test <> 'X'. COMMIT WORK. ENDIF. ENDFORM. " PROCESS_DATA *&---------------------------------------------------------------------* *& Form SHOW_RESULT *&---------------------------------------------------------------------* FORM show_result. DATA: lv_total TYPE i. DATA: ls_updated TYPE zmm_bismt. " 工作区用于显示 " 计算总记录数 DESCRIBE TABLE gt_excel_data LINES lv_total. " 显示测试模式提示 IF p_test = 'X'. WRITE: / '当前处于测试模式,不会实际修改数据库'. SKIP 1. ENDIF. WRITE: / '批量更新处理完成'. WRITE: / '总记录数:', lv_total. WRITE: / '更新记录数:', gv_updated. WRITE: / '跳过记录数(库格相同):', gv_skipped. WRITE: / '插入记录数:', gv_inserted. " 仅显示数量,不显示明细 " 显示所有更新记录 IF gv_updated > 0. WRITE: / '所有更新记录:'. WRITE: / '物料号', 20 '工厂', 27 '库位', 35 '原库格', 50 '新库格'. LOOP AT gt_updated INTO ls_updated. " 获取原库格值用于显示 READ TABLE gt_zmm_bismt INTO gs_zmm_bismt WITH KEY matnr = ls_updated-matnr werks = ls_updated-werks lgort = ls_updated-lgort. IF sy-subrc = 0. WRITE: / ls_updated-matnr, 20 ls_updated-werks, 27 ls_updated-lgort, 35 gs_zmm_bismt-bismt, " 原库格 50 ls_updated-bismt. " 新库格 ENDIF. ENDLOOP. ENDIF. " 显示所有跳过记录 IF gv_skipped > 0. WRITE: / '所有跳过记录(库格相同):'. WRITE: / '物料号', 20 '工厂', 27 '库位', 35 '库格'. LOOP AT gt_skipped INTO gs_zmm_bismt. WRITE: / gs_zmm_bismt-matnr, 20 gs_zmm_bismt-werks, 27 gs_zmm_bismt-lgort, 35 gs_zmm_bismt-bismt. ENDLOOP. ENDIF. ENDFORM. " SHOW_RESULT *&---------------------------------------------------------------------* *& Form CHECK_FILE_EXISTENCE *&---------------------------------------------------------------------* FORM check_file_existence USING p_filename. DATA: lv_file TYPE string. DATA: lv_exists TYPE abap_bool. lv_file = p_filename. " 使用GUI前端服务检查文件是否存在 CALL METHOD cl_gui_frontend_services=>file_exist EXPORTING file = lv_file RECEIVING result = lv_exists EXCEPTIONS cntl_error = 1 error_no_gui = 2 OTHERS = 3. IF sy-subrc <> 0 OR lv_exists <> abap_true. MESSAGE '文件不存在或无法访问' TYPE 'E'. ENDIF. ENDFORM. " CHECK_FILE_EXISTENCE *&---------------------------------------------------------------------* *& AT SELECTION-SCREEN OUTPUT *&---------------------------------------------------------------------* AT SELECTION-SCREEN OUTPUT. " 控制单物料维护区域字段状态 PERFORM control_single_mat_fields. *&---------------------------------------------------------------------* *& AT SELECTION-SCREEN *&---------------------------------------------------------------------* AT SELECTION-SCREEN. " 处理按钮事件 CASE sy-ucomm. WHEN 'QUERY'. PERFORM handle_query. WHEN 'CREATE'. PERFORM handle_create. WHEN 'SAVE'. PERFORM handle_save. WHEN 'FILE_SEL'. " 文件选择按钮事件 PERFORM handle_file_selection. ENDCASE. *&---------------------------------------------------------------------* *& Form CONTROL_SINGLE_MAT_FIELDS *&---------------------------------------------------------------------* FORM control_single_mat_fields. " 设置显示字段属性 LOOP AT SCREEN. IF screen-group1 = 'DIS'. " 显示字段设为只读 screen-input = 0. MODIFY SCREEN. ELSEIF screen-group1 = 'EDT'. " 库格字段:编辑模式下可编辑 IF gv_edit_mode IS NOT INITIAL. screen-input = 1. ELSE. screen-input = 0. ENDIF. MODIFY SCREEN. ENDIF. ENDLOOP. ENDFORM. " CONTROL_SINGLE_MAT_FIELDS *&---------------------------------------------------------------------* *& Form HANDLE_QUERY *&---------------------------------------------------------------------* FORM handle_query. " 检查物料号是否输入 IF p_matnr IS INITIAL. MESSAGE '请输入物料号' TYPE 'S' DISPLAY LIKE 'E'. RETURN. ENDIF. " 检查物料号是否存在 PERFORM check_matnr_exists USING p_matnr. " 检查物料在指定工厂和库位是否存在 SELECT SINGLE * FROM zmm_bismt INTO gs_curr_data WHERE matnr = p_matnr AND werks = p_werks AND lgort = p_lgort. IF sy-subrc = 0. " 存在,进入编辑模式 gv_edit_mode = 'E'. p_w_s = gs_curr_data-werks. p_lg_s = gs_curr_data-lgort. p_bismt = gs_curr_data-bismt. MESSAGE s000(zmsg) WITH '物料已存在,进入编辑模式'. ELSE. " 不存在 CLEAR: p_w_s, p_lg_s, p_bismt. gv_edit_mode = ''. MESSAGE '该工厂和库位不存在该物料' TYPE 'S' DISPLAY LIKE 'E'. ENDIF. ENDFORM. " HANDLE_QUERY *&---------------------------------------------------------------------* *& Form HANDLE_CREATE *&---------------------------------------------------------------------* FORM handle_create. " 检查物料号是否输入 IF p_matnr IS INITIAL. MESSAGE '请输入物料号' TYPE 'S' DISPLAY LIKE 'E'. RETURN. ENDIF. " 检查物料号是否存在 PERFORM check_matnr_exists USING p_matnr. " 检查是否已存在 SELECT SINGLE * FROM zmm_bismt INTO gs_curr_data WHERE matnr = p_matnr AND werks = p_werks AND lgort = p_lgort. IF sy-subrc = 0. " 已存在,进入编辑模式 gv_edit_mode = 'E'. p_w_s = gs_curr_data-werks. p_lg_s = gs_curr_data-lgort. p_bismt = gs_curr_data-bismt. MESSAGE s000(zmsg) WITH '物料已存在,自动进入编辑模式'. ELSE. " 不存在,进入新建模式 gv_edit_mode = 'C'. p_w_s = p_werks. p_lg_s = p_lgort. CLEAR p_bismt. MESSAGE s000(zmsg) WITH '进入新建模式,请填写库格'. ENDIF. ENDFORM. " HANDLE_CREATE *&---------------------------------------------------------------------* *& Form HANDLE_SAVE *&---------------------------------------------------------------------* FORM handle_save. " 检查是否在编辑模式 IF gv_edit_mode IS INITIAL. MESSAGE '请先查询或新建物料' TYPE 'S' DISPLAY LIKE 'E'. RETURN. ENDIF. " 检查库格是否填写 IF p_bismt IS INITIAL. MESSAGE '库格不能为空' TYPE 'S' DISPLAY LIKE 'E'. RETURN. ENDIF. " 设置数据 gs_curr_data = VALUE #( matnr = p_matnr werks = p_w_s lgort = p_lg_s bismt = p_bismt ). " 根据模式保存 CASE gv_edit_mode. WHEN 'E'. " 编辑模式 UPDATE zmm_bismt SET bismt = p_bismt WHERE matnr = p_matnr AND werks = p_w_s AND lgort = p_lg_s. IF sy-subrc = 0. MESSAGE '物料更新成功' TYPE 'S'. ELSE. MESSAGE '物料更新失败' TYPE 'S' DISPLAY LIKE 'E'. ENDIF. WHEN 'C'. " 新建模式 INSERT zmm_bismt FROM gs_curr_data. IF sy-subrc = 0. MESSAGE '物料创建成功' TYPE 'S'. ELSE. MESSAGE '物料创建失败' TYPE 'S' DISPLAY LIKE 'E'. ENDIF. ENDCASE. " 重置编辑模式 gv_edit_mode = ''. ENDFORM. " HANDLE_SAVE *&---------------------------------------------------------------------* *& Form CHECK_MATNR_EXISTS *&---------------------------------------------------------------------* FORM check_matnr_exists USING p_matnr. " 检查物料主数据是否存在 SELECT SINGLE matnr FROM mara INTO @DATA(lv_matnr) WHERE matnr = @p_matnr. IF sy-subrc <> 0. MESSAGE '物料号不存在' TYPE 'S' DISPLAY LIKE 'E'. gv_edit_mode = ''. CLEAR: p_w_s, p_lg_s, p_bismt. STOP. ENDIF. " 检查库存视图是否存在 SELECT SINGLE matnr FROM mard INTO @lv_matnr WHERE matnr = @p_matnr AND werks = @p_werks AND lgort = @p_lgort. IF sy-subrc <> 0. MESSAGE '物料在指定工厂和库位的库存视图不存在' TYPE 'S' DISPLAY LIKE 'W'. ENDIF. ENDFORM. " CHECK_MATNR_EXISTS *&---------------------------------------------------------------------* *& Form HANDLE_FILE_SELECTION *&---------------------------------------------------------------------* FORM handle_file_selection. DATA: lt_file_table TYPE filetable, lv_rc TYPE i, lv_action TYPE i. " 调用文件选择对话框 CALL METHOD cl_gui_frontend_services=>file_open_dialog EXPORTING window_title = '选择Excel文件' default_extension = 'XLS' file_filter = 'Excel文件 (*.XLS;*.XLSX)|*.XLS;*.XLSX|所有文件 (*.*)|*.*|' CHANGING file_table = lt_file_table rc = lv_rc user_action = lv_action EXCEPTIONS file_open_dialog_failed = 1 cntl_error = 2 error_no_gui = 3 not_supported_by_gui = 4 OTHERS = 5. IF sy-subrc = 0 AND lv_action = cl_gui_frontend_services=>action_ok. " 获取用户选择的第一个文件 READ TABLE lt_file_table INDEX 1 INTO p_file. IF sy-subrc = 0. " 更新屏幕字段值 p_file = p_file. ENDIF. ENDIF. ENDFORM. " HANDLE_FILE_SELECTION 读取的文件类型改成txt文件,从第一行开始读取,读取的内容只有两列,物料号和库格,物料描述被我去掉了,并且把相关变量的定义名称从excel改成txt
08-28
好,下面是跟在后面的调试信息,帮我描述启动过程等等你能看出的信息。[2025-07-25 15:02:33] [ERROR] ds_handle_method_do():1608 - [DS]not support action get_rtsp_info [2025-07-25 15:02:33] [ERROR] ds_handle():2504 - [DS]Signal handle failed. plug -->DWC_ETH_QOS_setsettings <--DWC_ETH_QOS_setsettings [2025-07-25 15:02:38] [ERROR] system_if_del_gateway_changing MTU from 1500 to 1480 route():267 - [NIFC]Ioctl SIOCDELRT error, ret code is -1, dst =DWC_ETH_QOS_yinit: apb_clk 120000000 Hz 00000000, gateway = 0100a8c0, error info:No such process. Queue0 Tx fifo size 2048, Rx fifo size 2048 Disabled JUMBO pkt Enabled Rx watchdog timer Enabled TSO Disabled Rx Split header mode [2025-07-25 15:02:38] link_status_update():410 - [Information][Network][NIFC]Link status: LINK_DOWN -> LINK_DOWN [2025-07-25 15:02:38] link_status_update():412 - [Information][Network][NIFC]IP: 192.168.0.60, mask: 255.255.255.0, gateway: 192.168.0.1, DNS: 8.8.8.8, 8.8.4.4 [2025-07-25 15:02:38] [ERROR] eap_start():889 - [EAP]g_ieee8021x_enable = 0 timer handle excute times 5, interval 1000 timer handle excute times 5, interval 1000 timer handle excute times 5, interval 1000 timer handle excute times 5, interval 1000 timer handle excute times 5117, interval 1 [2025-07-25 15:02:38] link_status_update():410 - [Information][Network][NIFC]Link status: LINK_DOWN -> LINK_UP [2025-07-25 15:02:38] link_status_update():412 - [Information][Network][NIFC]IP: 192.168.0.60, mask: 255.255.255.0, gateway: 192.168.0.1, DNS: 8.8.8.8, 8.8.4.4 timer handle excute times 3, interval 1 [2025-07-25 15:02:38] [ERROR] eap_reload():912 - [EAP]reload ... g_ether_status:0 phy_status.ether:1 [2025-07-25 15:02:38] [ERROR] ds_handle_method_do():1608 - [DS]not support action get_rtsp_info [2025-07-25 15:02:38] [ERROR] ds_handle():2504 - [DS]Signal handle failed. [2025-07-25 15:02:38] ip_conflict_detect_start():1000 - [Information][Network]Start IP conflict detecting [2025-07-25 15:02:38] [ERROR] ds_handle_method_do():1608 - [DS]not support action get_rtsp_info [2025-07-25 15:02:38] [ERROR] ds_handle():2504 - [DS]Signal handle failed. timer handle excute times 6, interval 1 [2025-07-25 15:02:38] [ERROR] load_user_defined_address():118 - [DIAGNOSE][LTE] add default dns address:8.8.8.8 [2025-07-25 15:02:38] [ERROR] load_user_defined_address():121 - [DIAGNOSE][LTE] add default dns address:www.google.com [2025-07-25 15:02:38] [ERROR] load_user_defined_address():143 - [DIAGNOSE]user defined addrees1:, user define address2:. [2025-07-25 15:02:38] [ERROR] telemetry_post_start():1844 - [telemetry]telemetry post start timer handle excute times 20, interval 1 timer handle excute times 3, interval 1 timer handle excute times 3, interval 1 timer handle excute times 296, interval 1 [2025-07-25 15:02:38] [ERROR] video_stream_load_config():3026 - [AVTS]============stream(0): [2025-07-25 15:02:38] [ERROR] video_stream_load_config():3027 - [AVTS]encode type: H265. [2025-07-25 15:02:38] [ERROR] video_stream_load_config():3028 - [AVTS]resolution: 2560*1440. [2025-07-25 15:02:38] [ERROR] video_stream_load_config():3029 - [AVTS]max resolution: 2560*1440. [2025-07-25 15:02:38] [ERROR] video_stream_load_config():3030 - [AVTS]bitrate type: 2. [2025-07-25 15:02:38] [ERROR] video_stream_load_config():3031 - [AVTS]bitrate: 2560. [2025-07-25 15:02:38] [ERROR] video_stream_load_config():3032 - [AVTS]quality: medium. [2025-07-25 15:02:38] [ERROR] video_stream_load_config():3033 - [AVTS]framerate: 1/25. [2025-07-25 15:02:38] [ERROR] video_stream_load_config():303vprc: enable direct func at in[0] 5 - [AVTS]smart_codec: 1. [2025-07-25 15:02:38] [ERROR]vprc: enable one-buf func at path 0, (3ndr_ref=1) (max_strp=1) video_stream_load_config():3036 - [AVTS]smart_codec_type: 1vcap: enable direct func at out[0] . [2025-07-25 15:02:38] [ERROR] video_stream_load_config():3053 - [AVTS]============================== [2025-07-25 15:02:38] [ERROR] video_stream_load_config():3026 - [AVTS]============stream(1): [2025-07-25 15:02:38] [ERWRN:_isf_vdoprc_oport_do_new() vdoprc0.out[0]! Start single blk mode => blk_id=86001fc0 addr=86002000 ROR] video_stream_load_config():3027 - [AVTS]encode type: H264. [2025-07-25 15:02:38] [ERROR] video_stream_loadERR:nvtanr_setconfig() dB value=0 < 3. Set to 3. _config():3028 - [AVTS]resolution: 848*480. [2025-07-25 15:02:3ERR:nvtanr_setconfig() Bias sensitive value=0 < 1. Set to 1. 8] [ERROR] video_stream_load_config():3029 - [AVTS]m[acap] update cmd 0x2++ ax resolution: 848*576. [2025-07-25 15:02:38] [ERROR]acap] update cmd 0x2-- 0m video_stream_load_config():3030 - [AVTS]bitrate type: 0. [20[acap] update cmd 0x400++ 25-07-25 15:02:38] [ERROR] video_stream_load_config([acap] update cmd 0x400-- ):3031 - [AVTS]bitrate: 512. [2025-07-25 15:02:38] [ERR[acap] update cmd 0x4++ OR] video_stream_load_config():3032 - [AVTS]quality: medium.[acap] update start 1 [2025-07-25 15:02:38] [ERROR] video_stream_load_co[acap] update start 2 nfig():3033 - [AVTS]framerate: 1/25. [2025-07-25 15:02:38] acap] start 1 ;37m[ERROR] video_stream_load_config():3035 - [AVTS]smart_co[acap] start 2 dec: 0. [2025-07-25 15:02:38] [ERROR] video_stream_[acap] start 3 load_config():3036 - [AVTS]smart_codec_type: 0. [2025-07-25 15:[acap] start 4 02:38] [ERROR] video_stream_load_config():3053 - [AV[acap] start 5 TS]============================== [2025-07-25 15:02:38] E_CBMSG_PREVIEWSTABLE_20240320_tp ========== m[ERROR] __audio_stream_init():569 - [MPP]nvt_attr.sample_ra[acap] start 6 te_max:8000 [acap] start 7 [acap] start 15 [acap] start 16 [acap] start 18 [acap] start 20 [acap] start 22 [acap] lb 1 [acap] start 23 [acap] start 24 [acap] start 25 [acap] start 26 [acap] start 27 [acap] start 28 [acap] start 29 [acap] start 30 [acap] update start 3 [acap] update cmd 0x4-- ERR:nvtanr_setconfig() dB value=0 < 3. Set to 3. ERR:nvtanr_setconfig() Bias sensitive value=0 < 1. Set to 1. yanyu uiSetRCMode 2 timer handle excute times 795, interval 1 [2025-07-25 15:02:39] [ERROR] ds_register_op_log_info():720 - [DS]Section harddisk sub_type and func_name is set already. [2025-07-25 15:02:39] [ERROR] processing_linkage_capability():147 - [STM]linkage_capability capability length 30 [2025-07-25 15:02:39] [ERROR] processing_linkage_capability():147 - [STM]linkage_capability capability length 30 [2025-07-25 15:02:39] [ERROR] create_and_init_sem():140 - [STM]creating initial sem... [2025-07-25 15:02:39] [ERROR] init_stm_files_structure():144 - [STM]sizeof(struct stm_file) = 104 [2025-07-25 15:02:39] [ERROR] reload_record_adv_config():2572 - [STM]Set delay time to 10 seconds [2025-07-25 15:02:39] [ERROR] stm_open():2588 - [STM][0] stm_fd is allocated. channel = 0, type = video, flags = 0x1, mode = 0x1 [2025-07-25 15:02:39] [ERROR] data_sync_handle_thread():200 - [STM]register signal handler on thread:0x732e94c0 [2025-07-25 15:02:39] [ERROR] destroy_playback_buf():905 - [STM]Free data_buf 0, size is 0x0 [202ERR:nvtanr_apply() NvtAnr is not opened 5-07-25 15:02:39] [ERROR] destroy_playback_buf():906 - [STM]Free data_buf 1, size is 0x0 [2025-07-25 15:02:39] [ERROR] destroy_playback_buf():905 - [STM]Free data_buf 0, size is 0x0 [2025-07-25 15:02:39] [ERROR] destroy_playback_buf():906 - [STM]Free data_buf 1, size is 0x0 [2025-07-25 15:02:39] [ERROR] destroy_playback_buf():905 - [STM]Free data_buf 0, size is 0x0 [2025-07-25 15:02:39] [ERROR] destroy_playback_buf():906 - [STM]Free data_buf 1, size is 0x0 [2025-07-25 15:02:39] [ERROR] destroy_playback_buf():905 - [STM]Free data_buf 0, size is 0x0 [2025-07-25 15:02:39] [ERROR] destroy_playback_buf():906 - [STM]Free data_buf 1, size is 0x0 [2025-07-25 15:02:39] [ERROR] playback_init():5201 - [STM]playback init over. [2025-07-25 15:02:39] [ERROR] set_auto_delete_timer():713 - [STM]auto delete switch: off [2025-07-25 15:02:39] [ERROR] set_auto_delete_timer():714 - [STM]auto delete record before 7 days [2025-07-25 15:02:39] [ERROR] storage_start():594 - [STM]storage start over. timer handle excute times 15, interval 1 [2025-07-25 15:02:39] [ERROR] ds_convert_init():84 - [DS]ds convert init successed. ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened [2025-07-25 15:02:40] [ERROR] record_stop():4239 - [STM]record stopped ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened DWC_ETH_QOS_adjust_link: start tx/rx DWC_ETH_QOS f02b0000.eth eth0: Link is Up - 100Mbps/Full - flow control rx/tx ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened ERR:nvtanr_apply() NvtAnr is not opened timer handle excute times 3, interval 1000 timer handle excute times 3, interval 1000 [network_send()]:[248]: sendto error: Connection refused [dms_probe_cb()]:[645]: msg mid(1) mlen(196) send failed [network_send()]:[248]: sendto error: Connection refused [dms_sendto()]:[231]: msg mid(36) mlen(0) send failed [2025-07-25 15:02:42] [ERROR] eap_reload():912 - [EAP]reload ... g_ether_status:1 phy_status.ether:0 timer handle excute times 2, interval 1000 timer handle excute times 2, interval 1000 timer handle excute times 2, interval 1000 timer handle excute times 3, interval 1000 [2025-07-25 15:02:42] [ERROR] ds_handle_method_do():1608 - [DS]not support action get_rtsp_info [2025-07-25 15:02:42] [ERROR] ds_handle():2504 - [DS]Signal handle failed. timer handle excute times 3, interval 1000 timer handle excute times 3, interval 1000 timer handle excute times 2819, interval 1 [2025-07-25 15:02:42] [ERROR] rtsp_server_init():224ERR:nvtanr_apply() NvtAnr is not opened 9 - [RTSP]rtsps_support: 0 [2025-07-25 15:02:42] [ERROR] rtsp_server_init():2253 - [RTSP]RTSP Server Port 554 [2025-07-25 15:02:42] [ERROR] rtsp_server_init():2256 - [RTSP]g_tp_rtsp_digest_auth_type: 0 [2025-07-25 15:02:42] [ERROR] rtsp_server_init():2270 - [RTSP]Start RTSP Server on port 554 [2025-07-25 15:02:42] [ERROR] rtsp_server_init():2349 - [RTSP]RTSP Server Init ended [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:0, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:2, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:3, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:4, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:5, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:6, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:7, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:8, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:11, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:12, attach_ringbuffer_enable:0 [2025-07-25 15:02:ERR:nvtanr_apply() NvtAnr is not opened 42] [ERROR] trans_start():2697 - sd_type:14, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:15, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2697 - sd_type:16, attach_ringbuffer_enable:0 [2025-07-25 15:02:42] [ERROR] trans_start():2708 - Try to attach ringbuffer 21000 [2025-07-25 15:02:42] [ERROR] reload_multicast_config():886 - [RTSP][Media Source]: stream type 3 have no multicast config [2025-07-25 15:02:42] [ERROR] reload_multicast_config():886 - [RTSP][Media Source]: stream type 4 have no multicast config [2025-07-25 15:02:42] [ERROR] reload_multicast_config():886 - [RTSP][Media Source]: stream type 5 have no multicast config [2025-07-25 15:02:42] [ERROR] trans_start_loop():1677 - goto send_empty_smart_data [2025-07-25 15:02:42] [ERROR] inetd_register_rtsp_server():2127 - [RTSP]register rtsp server done. [2025-07-25 15:02:42] [ERROR] rtsp_server_start():3548 - [RTSP]trans_attach_to_stream stream_id 7 timer handle excute times 37, interval 1 [2025-07-25 15:02:42] [ERROR] add_rtp_package_info():637 - [RTSP]add package code_type 5 [2025-07-25 15:02:42] [ERROR] init_rtp_package():140 - [RTSP]av_codec = 5 [2025-07-25 15:02:42] [ERROR] init_rtp_packaERR:nvtanr_apply() NvtAnr is not opened ge():185 - [RTSP]jpeg_header width 80 height 45 [2025-07-25 15:02:42] [ERROR] add_rtp_package_info():637 - [RTSP]add package code_type 1 [2025-07-25 15:02:42] [ERROR] init_rtp_package():140 - [RTSP]av_codec = 1 [2025-07-25 15:02:42] [ERROR] RtpAdjustTime():327 - [RTSP]init rtp_base, pts=21285962, utc_ms=1753426962297 [2025-07-25 15:02:42] [ERROR] add_rtp_package_info():637 - [RTSP]add package code_type 0 [2025-07-25 15:02:42] [ERROR] init_rtp_package():140 - [RTSP]av_codec = 0 [2025-07-25 15:02:42] [ERROR] RtpAdjustTime():327 - [RTSP]init rtp_base, pts=21287618, utc_ms=1753426962298 [2025-07-25 15:02:42] [ERROR] add_rtp_package_info():637 - [RTSP]add package code_type 7 [2025-07-25 15:02:42] [ERROR] init_rtp_package():140 - [RTSP]av_codec = 7 [2025-07-25 15:02:42] [ERROR] RtpAdjustTime():327 - [RTSP]init rtp_base, pts=21172583, utc_ms=1753426962183 [2025-07-25 15:02:42] [ERROR] add_rtp_package_info():637 - [RTSP]add package code_type 7 [2025-07-25 15:02:42] [ERROR] init_rtp_package():140 - [RTSP]av_codec = 7 [2025-07-25 15:02:42] [ERROR] trans_register_stream_vtype():2298 - stream srcid = 7 [2025-07-25 15:02:42] [ERROR] RtpAdjustTime():327 - [RTSP]init rtp_base, pts=21172583, utc_ms=1753426962183 [2025-ERR:nvtanr_apply() NvtAnr is not opened 07-25 15:02:42] [ERROR] ds_register_action():824 - [DS]Action [video.force_iframe] has exist. [2025-07-25 15:02:42] link_status_update():410 - [Information][Network][NIFC]Link status: LINK_UP -> LINK_UP [2025-07-25 15:02:42] link_status_update():412 - [Information][Network][NIFC]IP: 192.168.0.60, mask: 255.255.255.0, gateway: 192.168.0.1, DNS: 8.8.8.8, 8.8.4.4 [2025-07-25 15:02:42] [ERROR] eap_reload():912 - [EAP]reload ... g_ether_status:0 phy_status.ether:1 [2025-07-25 15:02:42] [ERROR] ds_handle_method_do():1608 - [DS]not support action get_rtsp_info [2025-07-25 15:02:42] [ERROR] ds_handle():2504 - [DS]Signal handle failed. [2025-07-25 15:02:42] [ERROR] rtsp_reload():3850 - [RTSP]config changes rtsp_reload timer handle excute times 398, interval 1 timer handle excute times 2, interval 1 ERR:nvtanr_apply() NvtAnr is not opened open adc channel 0 error ! open adc channel 1 error ! open adc channel 2 error ! open adc channel 3 error ! open adc channel 0 error ! open adc channel 1 error ! open adc channel 2 error ! open adc channel 3 error ! [2025-07-25 15:02:42] [ERROR] image_3dnr_lv_reconfig():1237 - [CAMERA]image_3dnr_lv_reconfig called [2025-07-25 15:02:42] [ERROR] image_2dnr_lv_reconfig():1313 - [CAMERA]image_2dnr_lv_reconfig called [**************reload isp.cfg **************] [filepath=/tmp/base-files/cfg/day/day_isp.cfg] ERR:nvtanr_apply() NvtAnr is not opened ERR:vos_file_close() vfs_fsync fail, vos_file 0x8283B600 [2025-07-25 15:02:42] [ERROR] image_start():1454 - [IMAGE]Image start over. [2025-07-25 15:02:43] [ERROR] eap_reload():912 - [EAP]reload ... g_ether_status:1 phy_status.ether:0 timer handle excute times 338, interval 1 [2025-07-25 15:02:43] [ERROR] dn_switch_init():1120 - dn_switch,choose IR+WL algorithERR:vos_file_close() vfs_fsync fail, vos_file 0x8283BB00 m [dms_attach_event()]:[782]: callback for mid(28720) exists. [dms_attach_event()]:[782]: callback for mid(28735) exists. timer handle excute times 30, interval 1 timer handle excute times 2, interval 1 [2025-07-25 15:02:43] [ERROR] get_motion_rec_enhance_capability():97 - [RECORD_PLAN]ds_read /smart_analysis/detection fail. [2025-07-25 15:02:43] [ERROR] record_plan_start():385 - [RECORD_PLAN]get_motion_rec_enhance_capability error [2025-07-25 15:02:43] [ERROR] recERR:nvtanr_apply() NvtAnr is not opened ord_plan_start():388 - [RECORD_PLAN]start over, ret[0] [2025-07-25 15:02:43] [ERROR] record_plan_action_callback():1868 - [STM]record_plan new rec type:(motion) timer handle excute times 7, interval 1 [2025-07-25 15:02:43] [ERROR] msg_alarm_update_arming_status():1243 - [MSG_ALARM]alarm type 1, remain 32237s [2025-07-25 15:02:43] [ERROR] msg_alarm_update_arming_status():1285 - [MSG_ALARM]alarm type 0, remain 32237s [2025-07-25 15:02:43] [ERROR] msg_alarm_start():1514 - [MSG_ALARM]msg alarm start over. timer handle excute times 3, interval 1 [2025-07-25 15:02:43] [ERROR] hsr_alarm_start():2616 - [HSR]hsr_alarm start over. timer handle excute times 11, interval 1 [2025-07-25 15:02:43] [ERROR] md_alarm_start():4153 - [MD_ALARM]md alarm start over. timer handle excute times 6, interval 1 [2025-07-25 15:02:43] [ERROR] od_alarm_start():749 - [OD_ALARM]od alarm start over. timer handle excute times 2, interval 1 [2025-07-25 15:02:43] [ERROR] id_alarm_start():4112 - [ID]id_alarm start over. timer handle excute times 16, interval 1 [2025-07-25 15:02:43] [ERROR] cd_alarm_start():3109 - [CD]cd_alarm start over. timer handle excute times 10, interval 1 [2025-07-25 15:02:43] [ERROR] vd_alarm_start():2448 - [VD_ALARM]vd_alarm start over. timer handle excute times 4, interval 1 [2025-07-25 15:02:43] [ERROR] er_alarm_start():3323 - [ER]er_alarm start over. timer handle excute times 17, interval 1 [2025-07-25 15:02:43] [ERROR] lr_alarm_start():3328 - [LR]lr_alarm start over. timer handle excute times 4, interval 1 [2025-07-25 15:02:43] [ERROR] aod_alarm_start():2918 - [AOD]aod_alarm start over. timer handle excute times 20, interval 1 [2025-07-25 15:02:43] [ERROR] aad_alarm_start():1116 - [AAD]aad_alarm start over.ERR:vos_file_open() open [/mnt/app/isp/day_isp_dpc.bin] failed, ret -2 timer handle excute times 3, interval 1 [2025-07-25 15:02:43] [ERROR] hd_alarm_start():3029 - [HD]hd_alarm start over. timer handle excute times 8, interval 1 [2025-07-25 15:02:43] [ERROR] sc_alarm_start():975 - [SC]sc_alarm start over. timer handle excute times 4, interval 1 [2025-07-25 15:02:43] [ERROR] ams_start():557 - [AMS] ams version: 2.0.0.4348-b9f4532-dirty timer handle excute times 5, interval 1 [dms_detach_event()]:[850]: detach mERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs.bin] failed, ret -2 sg[20486] handler[0x3b0fdc] [dms_detach_event()]:[850]: detach msg[20487] handler[0x3b0e90] timer handle excute times 10, interval 1 [2025-07-25 15:02:43] [ERROR] p2p_start():34ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_0.bin] failed, ret -2 - [P2P]p2p module started. version: 2.0 p2p do punch start. timer handle excute times 2, interval 1 timer handle excute times 3, interval 1 error was 0 ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_1.bin] failed, ret -2 over. [2025-07-25 15:02:43] aecns_init():924 - [Alarm][AMS] [TPAECNS] init ok! [2025-07-25 15:02:43] link_status_update():410 - [Information][Network][NIFC]Link status: LINK_UP -> LINK_UP [2025-07-25 15:02:43] [ERROR] dla_context_init_dev():1139 -ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_2.bin] failed, ret -2 [AMS] DLA read TP_MODE_SWITCH failed [2025-07-25 15:02:43] [ERROR] dla_load_alg_on_cfg_dev():2154 - [AMS] read PTD_DETECT failed, PET moduERR:vos_file_open() open [/mnt/app/isp/day_isp_lut2d.bin] failed, ret -2 le config file not found. [2025-07-25 15:02:43] link_status_update():412 - [Information][Network][NIFC]IP: 192.168.0.60, mask: 255.255.255.0, gateway: 192.168.0.1, DNS: 8.8.8.8, 8.8.4.4 [2025-07-25 15:02:43] [ERROR] eap_reload():912 - [EAP]reload ... g_ether_status:0 phy_status.ether:1 [2025-07-25 15:02:43] [ERROR] ds_handle_method_do():1608 - [DS]nERR:vos_file_close() vfs_fsync fail, vos_file 0x83939400 ot support action get_rtsp_info [2025-07-25 15:02:43] [ERROR] ds_handle():2504 - [DS]Signal handle failed. [2025-07-25 15:02:43] [ERROR] dla_ctx_init():138 - [2025-07-25 15:02:43] [ERROR] rtsp_reload():3850 - [RTSP]config changes rtsp_reload [2025-07-25 15:02:43] [ERROR] rtmp_reload():1213 - [RTMP]rtmp reload [2025-07-25 15:02:43] [ERROR] rtmp_reconnect():1182 - [RTMP]stop stream flag:0 pClient->lte_stop_flag:0 timer handle excute times 218, interval 1 [2025-07-25 15:02:43] [ERROR] ftp_record_plan_start():767 - [FTP_RECORD_PLAN]start over, ret[0] [2025-07-25 15:02:43] [ERROR] ftp_record_plan_action_callback():849 - [FTP]ftp_record_plan new rec type:(null) [2025-07-25 15:02:43] [ERROR] openapi_load():672 - [OPENAPI]/opeERR:vos_file_close() vfs_fsync fail, vos_file 0x82945C00 napi/server disable [2025-07-25 15:02:43] [ERROR] openapi_start():1067 - [OPENAPI]openapi disable [libdla] libdla version: 2.0.0.4348-b9f4532-dirty [2025-07-25 15:02:43] [ERROR] update_server_info():2281 - [SMTP]no need to send email timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 update_core_dump_config()-57 - [DEBUG_TOOLS]enable coredump [**************reload isp.cfg **************] [filepath=/tmp/base-files/cfg/day/day_isp.cfg] enable_core_dump()-42 - [DEBUG_TOOLS]new core dump file size: cur 4294967295, max 4294967295 Monitor: receive NVMP_NO_RESTART. (uptime:23) debug_tools_coredump_start()-100 - [DEBUG_TOOLS]USAGE:input "killall -10 main" to enable coredump timer handle excute times 172, interval 1 timer handle excute times 3, interval 1 timer handle excute times 2, interval 1 [2025-ERR:vos_file_close() vfs_fsync fail, vos_file 0x82945D00 07-25 15:02:43] [ERROR] mb_start():4958 - [MB]ringbuffer_attach error:type:0, rb_id:10201 [2025-07-25 15:02:43] [ERROR] mb_start():4958 - [MB]ringbuffer_attach error:type:1, rb_id:10202 [2025-07-25 15:02:43] [ERROR] mb_start():4958 - [MB]ringbuffer_attach error:type:2, rb_id:10200 [2025-07-25 15:02:43] [ERROR] mb_start():4958 - [MB]ringbuffer_attach error:type:3, rb_id:10206 [2025-07-25 15:02:43] [ERROR] mb_update_target_valid():1066 - [MB]mb_update_target_valid[0] [2025-07-25 15:02:43] [ERROR] mb_update_target_valid():1066 - [MB]mb_update_target_valid[0] [2025-07-25 15:02:43] [ERROR] mb_update_target_valid():1066 - [MB]mb_update_target_valid[0] ai - proc[0].trace = 00000000 [2025-07-25 15:02:43] [ERROR] mb_update_target_valid():1066 - [MB]mb_update_target_valid[0] [2025-07-25 15:02:43] [ERROR] qd_update_mb_enabled():3243 - [MB]dsusb 1-1: USB disconnect, device number 2 read /queue_detection/detection error [2025-07-25 15:02:43] [ERROR] mb_start():5025 - [MB]mb start over. timer harndis_host 1-1:1.0 usb0: unregister 'rndis_host' usb-ehci_hcd-1, RNDIS device ndle excute times 23, interval 1 [2025-07-25 15:02:43] [ERROR] dla_get_models():94 - [AMS] rotate type: 3, model list :0, 1, 2, 3 timer handle excute times 15, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 [2025-07-25 15:02:43] [ERROR] update_server_info():322 - [REPORT_EVENT]read report_server_list failed [2025-07-25 15:02:43] [ERROR] update_server_info():322 - [REPORT_EVENT]read report_server_list failed [2025-07-25 15:02:43] [ERROR] update_server_info():322 - [REPORT_EVoption1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0 ENT]read report_server_list failed timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, inteoption 1-1:1.2: device disconnected rval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1 times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 3, interval 1 [2025-07-25 15:02:43] [ERROR] _getsize_model():141 - timer handle excute times 2, interval 1 [libdla] get bin(/etc/plugins/obj_detection_fd.bin) size fail [2025-07-25 15:02:43] [ERROR] _getsize_model():141 - [libdla] ption 1-1:1.3: device disconnected 1mget bin(/etc/plugins/obj_detection_fd_90.bin) size fail [2025-07-25 15:02:43] [ERROR] _getsize_model():141 - [libdla] get bin(/etc/plugins/obj_detection_fdERR:vos_file_open() open [/mnt/app/isp/day_isp_dpc.bin] failed, ret -2 _90.bin) size fail [2025-07-25 15:02:43] [ERROR] hw_network_load():304 - [libdla] ***********option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2 ***** max_blk_size:2948576 ***************** timer handle eERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs.bin] failed, ret -2 xcute times 3, interval 1 option 1-1:1.4: device disconnected ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_0.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_1.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_2.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_lut2d.bin] failed, ret -2 ERR:vos_file_close() vfs_fsync fail, vos_file 0x83939400 nvtim_patch_usbhc enter error was 0 [2025-07-25 15:02:44]lte_start():12016 - [LTE]g_delta_total_flow:0 [2025-07-25 15:02:44] [ERROR] image_3dnr_lv_reconfig():1237 - [CAMERA]image_3dnr_lv_reconfig called [2025-07-25 15:02:44] [ERROR] image_2dnr_lv_reconfig():1313 - [CAMERA]image_2dnr_lv_reconfig called timer handle excute times 1009, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 5, interval 1 timer handle excute times 2, interval 1 timer handle excute times 3, interval 1 timer handle excute times 2, interval 1 timer handle excute times 43, interval 1 timer handle excute times 2, interval 1 timer handle excute times 8, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 [2025-07-25 15:02:44] delay_setting_light_timer_handl():3185 - [Information][Camera]Switch to DAY, WTL OFF [2025-07-25 15:02:44] delay_setting_light_timer_handl():3190 - [Information][Camera]Switch to DAY, IR OFF [**************reload isp.cfg **************] [filepath=/tmp/base-files/cfg/day/day_isp.cfg] timer handle excute times 7, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 timer handle excute times 2, interval 1 [2025-07-25 15:02:44] [ERROR] set_time_date_format():4448 - [CAMERA]change time format:0, change date format:0 [2025-07-25 15:02:44] [ERROR] osd_cal_max_font_size():1824 - [CAMERA]get max main resolusion: 2560, calc main font size:80 , get max minor resolusion: 848, calc minor max font size: 28 [2025-07-25 15:02:44] [ERROR] osd_init_bitmap():2034 - [CAMERA]init bitmap main size:72, char_size:72, res:2560 [2025-07-25 15:02:44] [ERROR] regenerate_mem_font():4029 - [CAMERA]regenerate_mem_font called [2025-07-25 15:02:44] [ERROR] fill_mem_font_head():4101 - [CAMERA]after default write offset:132, data size:100 [2025-07-25 15:02:44] [ERROR] fill_mem_font_head():4177 - [CERR:vos_file_close() vfs_fsync fail, vos_file 0x84241900 AMERA]g write offset:7596 [2025-07-25 15:02:44] [ERROR] camera_osd_start():3932 - [CAMERA]cated string:APSatunMoTehWdFri1234567890 .-:ZVIGI C540-4G 1.20_D936, g_is_font_changed:1 [2025-07-25 15:02:44] [ERROR] osd_cal_max_font_size():1824 - [CAMERA]get max main resolusion: 2560, calc main font size:80 , get max minor resolusion: 848, calc minor max font size: 28 [2025-07-25 15:02:44] [ERROR] get_stampsize():2656 - [CAMERA]chn:0, osd mem size:0x32100 [2025-07-25 15:02:44] [ERROR] set_glyph_info():2674 - [CAMERA]unicode:32, num of vertex:0 [2025-07-25 15:02:44] [ERROR] set_glyph_info():2681 - [CAMERA]vertex pts is NULL [2025-07-25ERR:vos_file_close() vfs_fsync fail, vos_file 0x82945E00 15:02:44] [ERROR] set_glyph_info():2674 - [CAMERA]unicode:32, num of vertex:0 [2025-07-25 15:02:44] [ERROR] set_glyph_info():2681 - [CAMERA]vertex pts is NULL [2025-07-25 15:02:45] [ERROR] osd_cal_max_font_size():1824 - [CAMERA]get max main resolusion: 2560, calc main font size:80 , get max minor resolusion: 848, calc minor max font size: 28 [2025-07-25 15:02:45] [ERROR] get_stampsize():2656 - [CAMERA]chn:0, osd mem size:0x32100 [2025-07-25 15:02:45] [ERROR] set_time_date_format():4448 - [CAMERA]change time format:0, change date format:0 [2025-07-25 15:02:45] [ERROR] osd_cal_max_font_size():1824 - [CAMERA]get max main resolusion: 2560, calc main font size:80 , get max minor resolusion: 848, calc minor max font size: 28 [2025-07-25 15:02:45] [ERROR] osd_init_bitmap():1997 - [CAMERA]minor res:848, main size:72, height:24, width:24 [2025-07-25 15:02:45] [ERROR] camera_osd_start():3932 - [CAMERA]cated string:APSatunMoTehWdFri1234567890 .-:ZVIGI C540-4G 1.20_D936, g_is_font_changed:0 [2025-07-25 15:02:45] [ERROR] osd_cal_max_font_size():1824 - [CAMERA]get max main resolusion: 2560, calc main font size:80 , get max minor resolusion: 848, calc minor max font size: 28 [2025-07-25 15:02:45] [ERROR] get_stampsize():2670 - [CAMERA]chn:1, osd mem size:0x6300 [2025-07-25 15:02:45] [ERROR] osd_cal_max_font_size():1824 - [CAMERA]get max main resolusion: 2560, calc main font size:80 , get max minor resolusion: 848, calc minor max font size: 28 [2025-07-25 15:02:45] [ERROR] get_stampsize():2670 - [CAMERA]chn:1, osd mem size:0x6300 [2025-07-25 15:02:45] [ERROR] osd_start():2285 - [OSD]Osd start over. ERR:vos_file_open() open [/mnt/app/isp/day_isp_dpc.bin] failed, ret -2 error was 0 ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_0.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_1.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_2.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_lut2d.bin] failed, ret -2 ERR:vos_file_close() vfs_fsync fail, vos_file 0x83939700 [**************reload isp.cfg **************] [filepath=/tmp/base-files/cfg/day/day_isp.cfg] ERR:vos_file_close() vfs_fsync fail, vos_file 0x83939A00 [2025-07-25 15:02:45] [ERROR] udp_send_dev_advertisement():1794 - [IPCD]udp data send error ret = -1 ERR:vos_file_close() vfs_fsync fail, vos_file 0x83909500 usb 1-1: new high-speed USB device number 3 using ehci-nvtivot [2025-07-25 15:02:45] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idVendor. [2025-07-25 15:02:45] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idProduct. [2025-07-25 15:02:45] [ERROR] usbdevice_detect():663 - [LTE]find USB device fail ERR:vos_file_open() open [/mnt/app/isp/day_isp_dpc.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_0.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_1.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_ecs_auto_2.bin] failed, ret -2 ERR:vos_file_open() open [/mnt/app/isp/day_isp_lut2d.bin] failed, ret -2 usb 1-1: New USB device found, idVendor=2ecc, idProduct=3001, bcdDevice= 0.00 ERR:vos_file_close() vfs_fsync fail, vos_file 0x82945B00 usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0 usb 1-1: Product: WUKONG usb 1-1: Manufacturer: MARVELL usb 1-1: USB disconnect, device number 3 error was 0 [2025-07-25 15:02:46] [ERROR] image_3dnr_lv_reconfignvtim_patch_usbhc enter ():1237 - [CAMERA]image_3dnr_lv_reconfig called [2025-07-25 15:02:46] [ERROR] image_2dnr_lv_reconfig():1313 - [CAMERA]image_2dnr_lv_reconfig called [2025-07-25 15:02:46] delay_setting_light_timer_handl():3185 - [Information][Camera]Switch to DAY, WTL OFF [2025-07-25 15:02:46] delay_setting_light_timer_handl():3190 - [Information][Camera]Switch to DAY, IR OFF [2025-07-25 15:02:46] [ERROR] hw_network_load():462 - [libdla] ************* load network 7 success [2025-07-25 15:02:46] [ERROR] smart_box_reload_det():309 - [AMS] read PTD_DETECT failed, PTD module config file not found. [2025-07-25 15:02:46] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idVendor. [2025-07-25 15:02:46] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idProduct. [2025-07-25 15:02:46] [ERROR] usbdevice_detect():663 - [LTE]find USB device fail [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. error was 0 [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idVendor. [2025-07-25 15:02:47] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idProduct. [2025-07-25 15:02:47] [ERROR] usbdevice_detect():663 - [LTE]find USB device fail [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_vd_result():506 - [AMS] mark_motion_vd_result: empty fg! [2025-07-25 15:02:47] [ERROR] vd_dla_process():931 - [AMS] mark_motion_vd_result error. [2025-07-25 15:02:47] [ERROR] vd_dla_trigger():1079 - [AMS] vd_dla_process failed. [2025-07-25 15:02:47] [ERROR] mark_motion_pd_result():495 - [AMS] mark_motion_pd_result: empty fg! [2025-07-25 15:02:47] [ERROR] pd_dla_process():751 - [AMS] mark_motion_pd_result error. [2025-07-25 15:02:47] [ERROR] pd_dla_trigger():1064 - [AMS] pd_dla_process failed. [2025-07-25 15:02:48] [ERROR] ftp_record_start_delay():29 - [FTP]ftp_record_start_delay error was 0 [2025-07-25 15:02:48] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idVendor. [2025-07-25 15:02:48] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idProduct. [2025-07-25 15:02:48] [ERROR] usbdevice_detect():663 - [LTE]find USB device fail error was 0 [2025-07-25 15:02:49] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idVendor. [2025-07-25 15:02:49] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idProduct. [2025-07-25 15:02:49] [ERROR] usbdevice_detect():663 - [LTE]find USB device fail error was 0 [2025-07-25 15:02:50] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idVendor. [2025-07-25 15:02:50] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idProduct. [2025-07-25 15:02:50] [ERROR] usbdevice_detect():663 - [LTE]find USB device fail error was 0 [2025-07-25 15:02:51] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idVendor. [2025-07-25 15:02:51] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idProduct. [2025-07-25 15:02:51] [ERROR] usbdevice_detect():663 - [LTE]find USB device fail [2025-07-25 15:02:52] md_alarm_start_effect():2769 - [Alarm][Motion Detection]Motion detection start [2025-07-25 15:02:52] [ERROR] change_record_status():1238 - [STM]rec status change: pre => recording error was 0 [2025-07-25 15:02:52] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idVendor. [2025-07-25 15:02:52] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idProduct. [2025-07-25 15:02:52] [ERROR] usbdevice_detect():663 - [LTE]find USB device fail error was 0 [2025-07-25 15:02:53] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idVendor. [2025-07-25 15:02:53] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idProduct. [2025-07-25 15:02:53] [ERROR] usbdevice_detect():663 - [LTE]find USB device fail error was 0 usb 1-1: new high-speed USB device number 4 using ehci-nvtivot [2025-07-25 15:02:54] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idVendor. [2025-07-25 15:02:54] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-0:1.0/idProduct. [2025-07-25 15:02:54] [ERROR] usbdevice_detect():663 - [LTE]find USB device fail usb 1-1: New USB device found, idVendor=2c7c, idProduct=6005, bcdDevice= 3.18 usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 1-1: Product: Android usb 1-1: Manufacturer: Android usb 1-1: SerialNumber: 0000 rndis_host 1-1:1.0 usb0: register 'rndis_host' at usb-ehci_hcd-1, RNDIS device, 5a:e6:53:d5:1a:0c option 1-1:1.2: GSM modem (1-port) converter detected usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0 option 1-1:1.3: GSM modem (1-port) converter detected usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1 option 1-1:1.4: GSM modem (1-port) converter detected usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2 [2025-07-25 15:02:55] md_alarm_end_effect():2837 - [Alarm][Motion Detection]Motion detection end error was 0 [2025-07-25 15:02:55] [ERROR] __enlarge_udesc_list():703 - [AVDM]avdm0 udesc list enlarge 200 to 600 [2025-07-25 15:02:55] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-1:1.3/idVendor. [2025-07-25 15:02:55] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-1:1.3/idProduct. [2025-07-25 15:02:55] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-1:1.1/idVendor. [2025-07-25 15:02:55] [ERROR] get_value_from_file():600 - [LTE]Fail to open /sys/bus/usb/devices/1-1:1.1/idProduct. [2025-07-25 15:02:55] [ERROR] usbdevice_detect():651 - [LTE]Find /sys/bus/usb/devices/1-1 idVendor=0x2c7c idProduct=0x6005 [2025-07-25 15:02:55]lte_timer_handle():10906 - [LTE]Now create lte_main_loop thread. [2025-07-25 15:02:55]openport():58 - [LTE]Starting serial communication process. [2025-07-25 15:02:55] [ERROR] openport():68 - [LTE]Open /dev/ttyUSB1 successfully. [2025-07-25 15:02:55]config_AT_port():3375 - [LTE]opened the device /dev/ttyUSB1 [2025-07-25 15:02:55]setport():207 - [LTE]Comport Init Successfully ...... [2025-07-25 15:02:55] [ERROR] readport():451 - [LTE]urc not found, recv [RDY ] [2025-07-25 15:02:55] [ERROR] readport():451 - [LTE]urc not found, recv [+CFUN: 1 ] [2025-07-25 15:02:55] [ERROR] readport():451 - [LTE]urc not found, recv [+QSIMSTAT: 1,1 ] error was 0 [2025-07-25 15:02:57] [ERROR] config_AT_port():3396 - [LTE]Serial Port:/dev/ttyUSB1 does not repsonse! wait and try later error was 0 [2025-07-25 15:02:58]openport():58 - [LTE]Starting serial communication process. [2025-07-25 15:02:58] [ERROR] openport():68 - [LTE]Open /dev/ttyUSB1 successfully. [2025-07-25 15:02:58]config_AT_port():3375 - [LTE]opened the device /dev/ttyUSB1 [2025-07-25 15:02:58]setport():207 - [LTE]Comport Init Successfully ...... [2025-07-25 15:02:58] [ERROR] readport():451 - [LTE]urc not found, recv [AT ] [2025-07-25 15:02:58]config_AT_port():3404 - [LTE]Find AT_PROT:/dev/ttyUSB1 success [2025-07-25 15:02:58]openport():58 - [LTE]Starting serial communication process. [2025-07-25 15:02:58] [ERROR] openport():68 - [LTE]Open /dev/ttyUSB1 successfully. [2025-07-25 15:02:58]setport():207 - [LTE]Comport Init Successfully ...... [2025-07-25 15:02:58]lte_start_main_loop():6111 - [LTE]lte_main_loop thread start running. [2025-07-25 15:02:58]update_led_state():11558 - [LTE]LED send led event 20 [2025-07-25 15:02:58] [ERROR] lte_start_main_loop():6136 - [LTE]disable echo characters error was 0 [2025-07-25 15:02:58] [ERROR] readport():451 - [LTE]urc not found, recv [ATE0 ] [2025-07-25 15:02:58] [ERROR] readport():451 - [LTE]urc not found, recv [+QIND: SMS DONE ] [2025-07-25 15:02:58] [ERROR] lte_start_main_loop():6146 - [LTE]set ATE0 success. [2025-07-25 15:02:58]lte_start_main_loop():6155 - [LTE]Check if the 4G module is in network interface mode. [2025-07-25 15:02:58]lte_start_main_loop():6186 - [LTE]AT+QCFG="nat" return +QCFG: "nat",1 [2025-07-25 15:02:58]lte_start_main_loop():6218 - [LTE]Check if the 4G module is in rndis mode. [2025-07-25 15:02:58]lte_start_main_loop():6249 - [LTE]AT+QCFG="usbnet" return +QCFG: "usbnet",3 error was 0 error was 0 [2025-07-25 15:03:00]lte_start_main_loop():6643 - [LTE]Main loop init 4G ... [2025-07-25 15:03:00] [ERROR] ping_start():508 - [DIAGNOSE]start ping:8.8.8.8 [2025-07-25 15:03:00] [ERROR] ping_start():508 - [DIAGNOSE]start ping:www.google.com [2025-07-25 15:03:00]clearProfileForESM():3557 - [LTE]clear Profile For default success! [2025-07-25 15:03:00] [ERROR] readport():451 - [LTE]urc not found, recv [+QUSIM: 1 ] [2025-07-25 15:03:00] [ERROR] set_module_properties():3881 - [LTE]SET DDR CLK to 1066 [2025-07-25 15:03:01] [ERROR] set_module_properties():3902 - [LTE]Close SIM write [2025-07-25 15:03:01]waiting_for_sim_det_ctrl():3683 - [LTE]ignored SimDetection set! error was 0 [2025-07-25 15:03:01] md_alarm_start_effect():2769 - [Alarm][Motion Detection]Motion detection start [2025-07-25 15:03:01]update_module_info_param():2931 - [LTE]update_module_info_param now! [2025-07-25 15:03:01]update_module_info_param():2934 - [LTE][vender]Quectel [2025-07-25 15:03:01]update_module_info_param():2935 - [LTE][product]EC200A [2025-07-25 15:03:01]update_module_info_param():2936 - [LTE][revision]EC200AELLAR01A05M16_TP [2025-07-25 15:03:01]update_module_info_param():2937 - [LTE][version]05 [2025-07-25 15:03:01]update_module_info_param():2938 - [LTE][imei]864042070769390 [2025-07-25 15:03:01]update_module_info_param():2967 - [LTE]update_module_info_param now! [2025-07-25 15:03:01] [ERROR] handle_4g_internet_status():9733 - [LTE]4G internet not connected [2025-07-25 15:03:01]lte_start_main_loop():6788 - [LTE]Main loop sim check... [2025-07-25 15:03:01]lte_start_main_loop():6806 - [LTE]start do sim check [2025-07-25 15:03:01] [ERROR] get_sim_card_status():11292 - [LTE]get_sim_card_status cpinLine:+CPIN: READY [2025-07-25 15:03:01]get_cme_err_code():3491 - [LTE]get_cme_err_code cme_err_reply:+CPIN: READY [2025-07-25 15:03:01]get_sim_card_status():11391 - [LTE]SIM card status changed(1 -> 2) [2025-07-25 15:03:01]iccid_manager_handle():11209 - [LTE]4G not connected. [2025-07-25 15:03:01]iccid_manager_handle():11232 - [LTE]lte iccid updated ... [2025-07-25 15:03:01]handle_iccid():11158 - [LTE]SIM_QCCID:89861124640282341661 [2025-07-25 15:03:01] [ERROR] iccid_manager_handle():11251 - [LTE]sim card iccid change. [2025-07-25 15:03:01] [ERROR] iccid_manager_handle():11252 - [LTE]update data_traffic_count and data_traffic_count_start_time. [2025-07-25 15:03:01]iccid_manager_handle():11267 - [LTE]update_iccid now! [2025-07-25 15:03:01] [ERROR] ds_pack_config():978 - [DS]encrypt_key_type:0 [2025-07-25 15:03:02]update_module_info_param():2909 - [LTE]lte module_info is already updated. [2025-07-25 15:03:02] [ERROR] readport():451 - [LTE]urc not found, recv [+QIND: SMS DONE ] [2025-07-25 15:03:02] md_alarm_start_effect():2769 - [Alarm][Motion Detection]Motion detection start [2025-07-25 15:03:02] [ERROR] urc_CGREG():214 - [LTE]ps_net_info.pcid:9B21, ps_net_info.cellID:858BD03 [2025-07-25 15:03:02] [ERROR] readport():451 - [LTE]urc not found, recv [+CGEV: EPS PDN ACT 1 ] error was 0 [2025-07-25 15:03:02] md_alarm_end_effect():2837 - [Alarm][Motion Detection]Motion detection end [2025-07-25 15:03:02] [ERROR] get_cimi_info_param():2894 - [LTE]imsi:460115279906397 [2025-07-25 15:03:02]update_module_info_param():2957 - [LTE][imsi]460115279906397 [2025-07-25 15:03:02]update_module_info_param():2967 - [LTE]update_module_info_param now! [2025-07-25 15:03:02] [ERROR] handle_4g_internet_status():9733 - [LTE]4G internet not connected [2025-07-25 15:03:02]lte_start_main_loop():7293 - [LTE]Main loop search for internet. [2025-07-25 15:03:02]update_led_state():11558 - [LTE]LED send led event 20 [2025-07-25 15:03:02] [ERROR] readport():446 - [LTE]urc 0x10000019 have no proc fun, [+CTZV: "+32" ] [2025-07-25 15:03:02] [ERROR] lte_start_main_loop():7423 - [LTE]err = 5, cgreg_status:1 [2025-07-25 15:03:03] [ERROR] urc_CNEC_ESM_GSM():453 - [LTE]err_code:51,err_cid:8 [2025-07-25 15:03:03] [ERROR] urc_CNEC_ESM_GSM():454 - [LTE]Network side rejection occurred [2025-07-25 15:03:03] [ERROR] urc_CNEC_ESM_GSM():470 - [LTE]no need to Switch profile [2025-07-25 15:03:03] [ERROR] readport():451 - [LTE]urc not found, recv [+CGEV: ME PDN ACT 8,1 ] [2025-07-25 15:03:03] [ERROR] lte_start_main_loop():7470 - [LTE]err = 2, cereg_status:1 [2025-07-25 15:03:03] [ERROR] lte_start_main_loop():7514 - [LTE]ps network register successs, get profile now. [2025-07-25 15:03:03] [ERROR] get_sim_spn_info():524 - [LTE]AT_Response_buf:^SPN: 1,1,▒N-V▒u5O▒ [2025-07-25 15:03:03] [ERROR] get_sim_spn_info():528 - [LTE]short_eons:▒N-V▒u5O▒ [2025-07-25 15:03:03] [ERROR] get_sim_spn_info():531 - [LTE]SIM short_spn is ▒N-V▒u5O▒, coding =1 [2025-07-25 15:03:03] [ERROR] get_sim_gid1_info():474 - [LTE]Sim GID1 Response Error! [2025-07-25 15:03:03] [ERROR] get_sim_gid1_info():478 - [LTE]SIM GID1 is ff len = 0 [2025-07-25 15:03:03] link_up_timer_handle():1993 - [Exception][Network][NIFC]link up timeout! error was 0 [2025-07-25 15:03:03] [ERROR] get_profile():4174 - [LTE]isp:46011. [2025-07-25 15:03:03] [ERROR] get_profile():4177 - [LTE]mcc:460 mnc:11. [2025-07-25 15:03:03] [ERROR] __enlarge_udesc_list():703 - [AVDM]avdm0 udesc list enlarge 200 to 800 [2025-07-25 15:03:03] [ERROR] get_profile():4264 - [LTE]g_apn_conf_index:0 [2025-07-25 15:03:03] [ERROR] get_profile():4266 - [LTE]g_profile_pos:2310 [2025-07-25 15:03:03] [ERROR] get_profile():4281 - [LTE]###########is mvno ERROR######### [2025-07-25 15:03:03] get_profile():4343 - [Information][Network][4G]cur_profile apn:ctnet ip_version:2 username: password: authentication:0 pkg_name:China Telecom (4G) [2025-07-25 15:03:03] [ERROR] get_profile():4354 - [LTE]g_apn_conf_index:1868 [2025-07-25 15:03:03] [ERROR] get_profile():4355 - [LTE]g_profile_pos:1868 [2025-07-25 15:03:03]get_default_bearer_apn():4666 - [LTE]AT*CGDFLT? return:*CGDFLT: "IPV4V6","",0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0. [2025-07-25 15:03:03] [ERROR] get_default_bearer_apn():4668 - [LTE]pdp_type_str:IPV4V6, apn_str: [2025-07-25 15:03:03] [ERROR] get_default_bearer_apn():4672 - [LTE]parse AT*CGDFLT success. [2025-07-25 15:03:03]lte_start_main_loop():7561 - [LTE]isEsmAPN:0, g_prof_config.apn:ctnet,apn_str:,g_prof_config.ip_ver:2,pdp_type:2 [2025-07-25 15:03:03] [ERROR] lte_start_main_loop():7572 - [LTE]ps network register successs, go to APN_SET status. [2025-07-25 15:03:03]iccid_manager_handle():11209 - [LTE]4G not connected. [2025-07-25 15:03:03]iccid_manager_handle():11232 - [LTE]lte iccid updated ... [2025-07-25 15:03:03] [ERROR] iccid_manager_handle():11236 - [LTE]lte module_info is already updated. [2025-07-25 15:03:03] [ERROR] iccid_manager_handle():11237 - [LTE]no need to upload iccid:89861124640282341661. [2025-07-25 15:03:03]lte_start_main_loop():7796 - [LTE]Main loop apn set ...(1) [2025-07-25 15:03:03] [ERROR] handle_4g_internet_status():9733 - [LTE]4G internet not connected [2025-07-25 15:03:03] [ERROR] long_connect_reload():4392 - [LONG_CONNECT]4g internet link_status change to :2 [2025-07-25 15:03:03]lte_start_main_loop():7841 - [LTE]Will not set user apn! [2025-07-25 15:03:03] [ERROR] try_to_set_apn():9463 - [LTE]cmd:AT+CGDCONT=2,"IPV4V6","ctnet" [2025-07-25 15:03:03] [ERROR] remote_log_reload():434 - [REMOTE_LOG]4g internet link_status change to :2 [2025-07-25 15:03:03] [ERROR] ddns_reload():693 - [DDNS]LTE mode: link_status change to :2 error was 0 [2025-07-25 15:03:04] [ERROR] try_to_set_apn():9478 - [LTE]cmd:AT*AUTHREQ=2,0,"","" [2025-07-25 15:03:04] [ERROR] diagnose_msg_send():846 - [DIAGNOSE]send lte model diagnose msg out id:2 [2025-07-25 15:03:04] [ERROR] diagnose_result_save_config():1055 - [DIAGNOSE]internet status has changed: [0] ===> [4] [2025-07-25 15:03:04]lte_net_detection_callback():11759 - [LTE]4G internet not connected [2025-07-25 15:03:04]lte_start_main_loop():7850 - [LTE]set default apn success [2025-07-25 15:03:04] [ERROR] lte_start_main_loop():7888 - [LTE]4G model start attach. [2025-07-25 15:03:04] start_attach_process():795 - [Information][Network][4G]4G model attach successful error was 0 [2025-07-25 15:03:05] [ERROR] lte_status_check_process():10381 - [LTE]sig_lvl:4 [2025-07-25 15:03:05] [ERROR] get_flow_bytes():4076 - [LTE]read_buf:0,data:0 [2025-07-25 15:03:05] [ERROR] get_flow_bytes():4076 - [LTE]read_buf:0,data:0 [2025-07-25 15:03:05]lte_start_main_loop():7925 - [LTE]Main loop start dial... [2025-07-25 15:03:05] [ERROR] udp_send_dev_advertisement():1794 - [IPCD]udp data send error ret = -1 error was 0 [2025-07-25 15:03:06] [ERROR] smart_box_reload_det():309 - [AMS] read PTD_DETECT failed, PTD module config file not found. [2025-07-25 15:03:07] [ERROR] soap_update_global():126 - [ONVIF]device_model VIGI-C540-4G-1.20 [2025-07-25 15:03:07] [ERROR] onvif_start():646 - [ONVIF]g_onvif_port 80 [2025-07-25 15:03:07] [ERROR] onvif_start():649 - [ONVIF]g_onvif_connection_type 0 [2025-07-25 15:03:07] [ERROR] onvif_start():657 - [ONVIF]###### onvif support ###### [2025-07-25 15:03:07] [ERROR] onvif_start():668 - [ONVIF]###### Automatically set static IP ###### [2025-07-25 inet_loop (271): drop_caches: 3 15:03:07] [ERROR] soap_event_create_rb():4644 - [ONVIF]Create http socket 38. [2025-07-25 15:03:07] [ERROR] get_md_capability():4200 - [ONVIF]onvif_mdconf.events is [2025-07-25 15:03:07] [ERROR] get_md_capability():4216 - [ONVIF]md_capability.topic_type is 0 [2025-07-25 15:03:07] [ERROR] onvif_discv_start():172 - [ONVIF]Onvif discovery start [2025-07-25 15:03:07] [ERROR] onvif_srv_start():630 - [ONVIF]Onvif services start, listen_port 2020 [2025-07-25 15:03:07] [ERROR] soap_out_wsdd_hello_type():246 - [ONVIF]g_onvif_port 80 Monitor: ignore <NVMP_START_DONE, 271> because nvmp_no_restart. [2025-07-25 15:03:07] nvmp_print_start_done():317 - [Information][System]Main progress start done error was 0 [2025-07-25 15:03:07] [ERROR] handle_4g_internet_status():9733 - [LTE]4G internet not connected [2025-07-25 15:03:07]lte_start_main_loop():8070 - [LTE]Waiting for usb0 ... [2025-07-25 15:03:07]lte_start_main_loop():8097 - [LTE]Interface usb0 up [2025-07-25 15:03:07] [ERROR] limit_network_speed():1889 - [LTE]cmd:iptables -t filter -I FORWARD 1 -m limit --limit=2000/s --limit-burst=1000 -j ACCEPT; [2025-07-25 15:03:08] [ERROR] limit_network_speed():1893 - [LTE]cmd:iptables -t filter -A FORWARD -j DROP; error was 0 [2025-07-25 15:03:08] [ERROR] readport():451 - [LTE]urc not found, recv [+QIND: PB DONE ] (c540-4g_1.20) login: [2025-07-25 15:03:08] [ERROR] lte_status_check_process():10381 - [LTE]sig_lvl:4 [2025-07-25 15:03:09] [ERROR] get_flow_bytes():4076 - [LTE]read_buf:438,data:438 [2025-07-25 15:03:09] [ERROR] get_flow_bytes():4076 - [LTE]read_buf:300,data:300 [2025-07-25 15:03:09]lte_start_main_loop():8133 - [LTE]Main loop net connecting ... [2025-07-25 15:03:09] [ERROR] handle_4g_internet_status():9733 - [LTE]4G internet not connected error was 0 [2025-07-25 15:03:09] [ERROR] __enlarge_bdesc_ring():596 - [AVDM]avdm0 bdesc ring enlarge 5 to 20 [2025-07-25 15:03:09] [ERROR] lte_status_check_process():10381 - [LTE]sig_lvl:4 [2025-07-25 15:03:09] [ERROR] get_flow_bytes():4076 - [LTE]read_buf:876,data:876 [2025-07-25 15:03:09] [ERROR] get_flow_bytes():4076 - [LTE]read_buf:372,data:372 [2025-07-25 15:03:10] [ERROR] get_runtime_param():1328 - [LTE]start:+CGCONTRDP: 2,5,"ctnet","10.76.50.247","","218.6.200.139","61.139.2.69","","",0,0 +CGCONTRDP: 2,5,"ctnet","254.128.0.0.0.0.0.0.0.0.0.0.0.0.0.1","","36.14.0.86.64.0.128.0.0.0.0.0.0.0.0.105","36.14.0.86.64.0.0.0.0.0.0.0.0.0.2.24","","",0,0 OK . [2025-07-25 15:03:10] [ERROR] get_runtime_param():1402 - [LTE]ipv6:fe80::1 [2025-07-25 15:03:10] [ERROR] get_runtime_param():1412 - [LTE]dnsv6_1:240e:56:4000:8000::69 [2025-07-25 15:03:10] [ERROR] get_runtime_param():1427 - [LTE]dnsv6_2:240e:56:4000::218 [2025-07-25 15:03:10]lte_reload():12064 - [LTE]lte_reload [2025-07-25 15:03:10] [ERROR] ds_pack_config():978 - [DS]encrypt_key_type:0 error was 0 [2025-07-25 15:03:10] [ERROR] get_runtime_mtu():1206 - [LTE]mtu_val:0, old_mtu_val:1480, ret_cnt:1 [2025-07-25 15:03:10] [ERROR] get_runtime_mtu():1216 - [LTE]get lte ipv6 dns config [2025-07-25 15:03:10] [ERROR] get_runtime_mtu():1240 - [LTE]Could not get MTU value by command AT*PCO=2, keep old mtu value. [2025-07-25 15:03:10] [ERROR] lte_start_main_loop():8333 - [LTE]get ipv4 successful, get_ipaddr_flag:17 [2025-07-25 15:03:10] [ERROR] lte_start_main_loop():8338 - [LTE]get ipv6 successful, get_ipaddr_flag:17 [2025-07-25 15:03:10] [ERROR] lte_start_main_loop():8344 - [LTE]info_internet.ipv6_link_status:2 [2025-07-25 15:03:10] [ERROR] ds_pack_config():978 - [DS]encrypt_key_type:0 [2025-07-25 15:03:10] [ERROR] lte_start_main_loop():8378 - [LTE]dhcpc_process_cur_time - dhcpc_process_start_time:0 s [2025-07-25 15:03:10]lte_start_main_loop():8133 - [LTE]Main loop net connecting ... [2025-07-25 15:03:10] [ERROR] onvif_cfg_monitor_reload():111 - [ONVIF]config /protocol/ipv6 changed [2025-07-25 15:03:10] ipv6_enabled():649 - [Information][Network][IPV6]Start IPv6 stateless successful [2025-07-25 15:03:10] ipv6_reload():826 - [Information][Network][IPV6]Enable IPv6 [2025-07-25 15:03:10] [ERROR] nifc_set_if_usb0_info_callback():899 - [NIFC]get usb0 information success [2025-07-25 15:03:10] [ERROR] nifc_set_if_usb0_info_callback():900 - [NIFC]Start set usb0 network information [2025-07-25 15:03:10] [ERROR] nifc_set_if_usb0_info_callback():911 - [NIFC]start set usb0 ipv4 net. [2025-07-25 15:03:10] [ERROR] system_if_del_mac_of_gateway():502 - [NIFC]Ioctl SIOCDARP error, error info:No such device or address [2025-07-25 15:03:10] [ERROR] nifc_set_usb0_net():1579 - [NIFC][LTE] bridge.host_route:0.0.0.0 [2025-07-25 15:03:10] [ERROR] nifc_set_usb0_net():1637 - [NIFC]set usb0 net success [2025-07-25 15:03:10] [ERROR] write_dns():249 - [NIFC]start write ipv6 dns nameserver. [2025-07-25 15:03:11] [ERROR] handle_4g_internet_status():9733 - [LTE]4G internet not connected [2025-07-25 15:03:11] [ERROR] __enlarge_udesc_list():703 - [AVDM]avdm0 udesc list enlarge 200 to 1000 [2025-07-25 15:03:11] md_alarm_start_effect():2769 - [Alarm][Motion Detection]Motion detection start [2025-07-25 15:03:11] [ERROR] lte_status_check_process():10381 - [LTE]sig_lvl:4 [2025-07-25 15:03:11] [ERROR] get_flow_bytes():4076 - [LTE]read_buf:4382,data:4382 [2025-07-25 15:03:11] [ERROR] get_flow_bytes():4076 - [LTE]read_buf:5176,data:5176 [2025-07-25 15:03:11] [ERROR] lte_wan6_stopXlat():5673 - [LTE]lte_wan6_stopXlat begin. [2025-07-25 15:03:11] [ERROR] lte_wan6_stopXlat():5685 - [LTE]virtualIpv4:192.0.0.2 [2025-07-25 15:03:11] [ERROR] lte_wan6_stopXlat():5693 - [LTE]cmd:ip6tables -D FORWARD -t filter -i clatd -j ACCEPT. ip6tables: Bad rule (does a matching rule exist in that chain?). [2025-07-25 15:03:11] [ERROR] lte_wan6_stopXlat():5697 - [LTE]cmd:ip6tables -D FORWARD -t filter -i usb0 -j ACCEPT. ip6tables: Bad rule (does a matching rule exist in that chain?). [2025-07-25 15:03:12] [ERROR] lte_wan6_stopXlat():5701 - [LTE]cmd:iptables -D FORWARD -t filter -i eth0 -j ACCEPT. [2025-07-25 15:03:12] [ERROR] validate_recv_handle():155 - [cloud-service]validate "err_code":-20501, msg:Device id not found. iptables: Bad rule (does a matching rule exist in that chain?). [2025-07-25 15:03:12] [ERROR] lte_wan6_stopXlat():5705 - [LTE]cmd:iptables -D POSTROUTING -t nat -o clatd -j SNAT --to-source 192.0.0.2. iptables: No chain/target/match by that name. [2025-07-25 15:03:12] [ERROR] lte_wan6_stopXlat():5709 - [LTE]cmd:echo "del clatd" > /proc/net/nat46/control. nat46: deleting device (clatd) Could not find device 'clatd' [2025-07-25 15:03:12] [ERROR] lte_wan6_stopXlat():5712 - [LTE]lte_wan6_stopXlat end. [2025-07-25 15:03:12] [ERROR] lte_dhcps_start():687 - [LTE]dev_name:eth0 [2025-07-25 15:03:12] [ERROR] start_ipv4_nat_conversion():1790 - [LTE]cmd:echo '1' > /proc/sys/net/ipv4/ip_forward [2025-07-25 15:03:12] dhcps_start_cb():1044 - [Information][Network][DHCP]Start DHCP server [2025-07-25 15:03:12] [ERROR] start_ipv4_nat_conversion():1826 - [LTE]cmd:iptables -t nat -A PREROUTING -d 192.168.43.1 -p udp -m udp --dport 53 -j DNAT --to-destination 218.6.200.139; [2025-07-25 15:03:12] [ERROR] start_ipv4_nat_conversion():1855 - [LTE]cmd:iptables -t nat -A PREROUTING -d 192.168.43.1 -p tcp -m tcp --dport 53 -j DNAT --to-destination 218.6.200.139; [2025-07-25 15:03:12] [ERROR] start_ipv4_nat_conversion():1863 - [LTE]cmd:iptables -t nat -A POSTROUTING -s 192.168.43.0/255.255.255.0 -o usb0 -j MASQUERADE; [2025-07-25 15:03:12]update_led_state():11558 - [LTE]LED send led event 21 [2025-07-25 15:03:12]lte_start_main_loop():8582 - [LTE]Main loop net check ... [2025-07-25 15:03:12] lte_start_main_loop():8554 - [Information][Network][4G]*** 4g internet connected. [2025-07-25 15:03:12] [ERROR] long_connect_reload():4392 - [LONG_CONNECT]4g internet link_status change to :1 [2025-07-25 15:03:12] [ERROR] remote_log_reload():434 - [REMOTE_LOG]4g internet link_status change to :1 [2025-07-25 15:03:12] [ERROR] ddns_reload():693 - [DDNS]LTE mode: link_status change to :1 [2025-07-25 15:03:12] [ERROR] start_ddns_process():579 - [DDNS]DDNS start [2025-07-25 15:03:12] [ERROR] start_ddns_process():582 - [DDNS]dns is not enable [2025-07-25 15:03:13] md_alarm_end_effect():2837 - [Alarm][Motion Detection]Motion detection end
最新发布
09-20
请为我修改为标准的C语言注释、代码中大括号上下要对齐// // webserver.c — Minimal multithreaded HTTP static file server (Linux) // Build: gcc webserver.c -o webserver -lpthread // Run: ./webserver // Browse: http://localhost:8080/ // // Serves files under the WEB_ROOT directory. Defaults to "Index.html". // Supports keep-alive on GET, basic content-type mapping, and zero-copy sendfile. // #include <arpa/inet.h> #include <fcntl.h> #include <netinet/in.h> #include <pthread.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/sendfile.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> #define PORT 8080 #define BUFFER_SIZE 8192 #define WEB_ROOT "web/" // ------------------------------- // Request structure & parsing // ------------------------------- typedef struct { char method[16]; char path[1024]; } Request; static Request parse_request(const char *buffer) { Request req; memset(&req, 0, sizeof(req)); strcpy(req.method, ""); // default empty strcpy(req.path, "/"); // default root // Very simple parse: METHOD PATH HTTP/1.1 // e.g., "GET /index.html HTTP/1.1" sscanf(buffer, "%15s %1023s", req.method, req.path); return req; } // ------------------------------- // Utilities // ------------------------------- static const char *guess_content_type(const char *path) { // crude extension check const char *ext = strrchr(path, '.'); if (!ext) return "text/html"; if (!strcmp(ext, ".html") || !strcmp(ext, ".htm")) return "text/html; charset=utf-8"; if (!strcmp(ext, ".css")) return "text/css; charset=utf-8"; if (!strcmp(ext, ".js")) return "application/javascript; charset=utf-8"; if (!strcmp(ext, ".json")) return "application/json; charset=utf-8"; if (!strcmp(ext, ".png")) return "image/png"; if (!strcmp(ext, ".jpg") || !strcmp(ext, ".jpeg")) return "image/jpeg"; if (!strcmp(ext, ".gif")) return "image/gif"; if (!strcmp(ext, ".svg")) return "image/svg+xml"; if (!strcmp(ext, ".ico")) return "image/x-icon"; if (!strcmp(ext, ".txt")) return "text/plain; charset=utf-8"; return "application/octet-stream"; } static bool contains_dotdot(const char *p) { return strstr(p, "..") != NULL; } // ------------------------------- // Client handler // ------------------------------- static void *handle_client(void *arg) { int client_fd = *((int *)arg); free(arg); int keep_alive = 1; // default keep-alive unless "Connection: close" char buffer[BUFFER_SIZE]; while (keep_alive) { memset(buffer, 0, sizeof(buffer)); ssize_t bytes_read = read(client_fd, buffer, sizeof(buffer) - 1); if (bytes_read <= 0) break; // closed or error // Basic keep-alive check if (strstr(buffer, "Connection: close")) { keep_alive = 0; } Request req = parse_request(buffer); // Only support GET/HEAD for static content; POST placeholder if (!strcmp(req.method, "GET") || !strcmp(req.method, "HEAD")) { char full_path[2048]; struct stat st; // Directory traversal guard if (contains_dotdot(req.path)) { const char *bad = "HTTP/1.1 400 Bad Request\r\n" "Content-Type: text/plain; charset=utf-8\r\n" "Connection: close\r\n\r\n" "Bad Request"; write(client_fd, bad, strlen(bad)); break; } if (!strcmp(req.path, "/")) { snprintf(full_path, sizeof(full_path), "%sIndex.html", WEB_ROOT); } else { // strip leading '/' for local file path const char *sub = req.path[0] == '/' ? req.path + 1 : req.path; snprintf(full_path, sizeof(full_path), "%s%s", WEB_ROOT, sub); } if (stat(full_path, &st) < 0 || S_ISDIR(st.st_mode)) { const char *not_found = "HTTP/1.1 404 Not Found\r\n" "Content-Type: text/html; charset=utf-8\r\n" "Connection: keep-alive\r\n\r\n" "<!doctype html><html><body><h1>404 Not Found</h1></body></html>"; write(client_fd, not_found, strlen(not_found)); continue; } else { const char *content_type = guess_content_type(full_path); // Headers char headers[512]; int n = snprintf(headers, sizeof(headers), "HTTP/1.1 200 OK\r\n" "Connection: keep-alive\r\n" "Content-Type: %s\r\n" "Content-Length: %ld\r\n\r\n", content_type, (long)st.st_size); write(client_fd, headers, (size_t)n); if (!strcmp(req.method, "HEAD")) { continue; // header only } int file_fd = open(full_path, O_RDONLY); if (file_fd != -1) { off_t offset = 0; size_t remaining = (size_t)st.st_size; while (remaining > 0) { ssize_t sent = sendfile(client_fd, file_fd, &offset, remaining); if (sent <= 0) break; remaining -= (size_t)sent; } close(file_fd); } } } else if (!strcmp(req.method, "POST")) { // Placeholder: echo 204 No Content (not implemented) char* contentLengthstr = strstr(buffer,"Content-Length"); if(!contentLengthstr) { printf("No content-length key\n"); } else { int contentLength; sscanf(contentLengthstr+14,":%d",&contentLength); char*payload = strstr(buffer, "\r\n\r\n"); for(int i=0;i<contentLength;i++) printf("%c",*(payload+4+i)); printf("\n"); } const char *resp = "HTTP/1.1 204 No Content\r\n" "Connection: keep-alive\r\n\r\n"; write(client_fd, resp, strlen(resp)); } else { const char *method_not_allowed = "HTTP/1.1 405 Method Not Allowed\r\n" "Allow: GET, HEAD, POST\r\n" "Connection: keep-alive\r\n\r\n"; write(client_fd, method_not_allowed, strlen(method_not_allowed)); } // Optional: break if the client sent only one request without keep-alive // (Most modern browsers default to keep-alive; we keep the loop.) } close(client_fd); return NULL; } // ------------------------------- // Main entry // ------------------------------- int main(void) { int server_fd; struct sockaddr_in address; int opt = 1; // Create socket if ((server_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { perror("socket failed"); exit(EXIT_FAILURE); } // SO_REUSEADDR if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) { perror("setsockopt"); close(server_fd); exit(EXIT_FAILURE); } // Bind memset(&address, 0, sizeof(address)); address.sin_family = AF_INET; address.sin_addr.s_addr = INADDR_ANY; address.sin_port = htons(PORT); if (bind(server_fd, (struct sockaddr *)&address, sizeof(address)) < 0) { perror("bind failed"); close(server_fd); exit(EXIT_FAILURE); } // Listen if (listen(server_fd, 10) < 0) { perror("listen"); close(server_fd); exit(EXIT_FAILURE); } printf("WebServer running on port %d\n", PORT); printf("Access at: http://localhost:%d/\n", PORT); // Accept loop while (1) { int *client_fd = (int *)malloc(sizeof(int)); if (!client_fd) { perror("malloc"); continue; } struct sockaddr_in client_addr; socklen_t addr_len = sizeof(client_addr); *client_fd = accept(server_fd, (struct sockaddr *)&client_addr, &addr_len); if (*client_fd < 0) { perror("accept"); free(client_fd); continue; } // Client info (optional) char client_ip[INET_ADDRSTRLEN]; inet_ntop(AF_INET, &(client_addr.sin_addr), client_ip, INET_ADDRSTRLEN); // printf("New connection from: %s:%d\n", client_ip, ntohs(client_addr.sin_port)); pthread_t thread_id; if (pthread_create(&thread_id, NULL, handle_client, client_fd) != 0) { perror("pthread_create"); close(*client_fd); free(client_fd); continue; } pthread_detach(thread_id); // resources auto-released when thread exits } // Not reached close(server_fd); return 0; }
08-15
/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at https://curl.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * * SPDX-License-Identifier: curl * ***************************************************************************/ #include "curl_setup.h" #include "urldata.h" #include <curl/curl.h> #include <stddef.h> #ifdef HAVE_LIBZ #include <zlib.h> #endif #ifdef HAVE_BROTLI #include <brotli/decode.h> #endif #ifdef HAVE_ZSTD #include <zstd.h> #endif #include "sendf.h" #include "http.h" #include "content_encoding.h" #include "strdup.h" #include "strcase.h" #include "curl_memory.h" #include "memdebug.h" #define CONTENT_ENCODING_DEFAULT "identity" #ifndef CURL_DISABLE_HTTP #define DSIZ CURL_MAX_WRITE_SIZE /* buffer size for decompressed data */ #ifdef HAVE_LIBZ /* Comment this out if zlib is always going to be at least ver. 1.2.0.4 (doing so will reduce code size slightly). */ #define OLD_ZLIB_SUPPORT 1 #define GZIP_MAGIC_0 0x1f #define GZIP_MAGIC_1 0x8b /* gzip flag byte */ #define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ #define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ #define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ #define ORIG_NAME 0x08 /* bit 3 set: original file name present */ #define COMMENT 0x10 /* bit 4 set: file comment present */ #define RESERVED 0xE0 /* bits 5..7: reserved */ typedef enum { ZLIB_UNINIT, /* uninitialized */ ZLIB_INIT, /* initialized */ ZLIB_INFLATING, /* inflating started. */ ZLIB_EXTERNAL_TRAILER, /* reading external trailer */ ZLIB_GZIP_HEADER, /* reading gzip header */ ZLIB_GZIP_INFLATING, /* inflating gzip stream */ ZLIB_INIT_GZIP /* initialized in transparent gzip mode */ } zlibInitState; /* Deflate and gzip writer. */ struct zlib_writer { struct contenc_writer super; zlibInitState zlib_init; /* zlib init state */ uInt trailerlen; /* Remaining trailer byte count. */ z_stream z; /* State structure for zlib. */ }; static voidpf zalloc_cb(voidpf opaque, unsigned int items, unsigned int size) { (void) opaque; /* not a typo, keep it calloc() */ return (voidpf) calloc(items, size); } static void zfree_cb(voidpf opaque, voidpf ptr) { (void) opaque; free(ptr); } static CURLcode process_zlib_error(struct Curl_easy *data, z_stream *z) { if(z->msg) failf(data, "Error while processing content unencoding: %s", z->msg); else failf(data, "Error while processing content unencoding: " "Unknown failure within decompression software."); return CURLE_BAD_CONTENT_ENCODING; } static CURLcode exit_zlib(struct Curl_easy *data, z_stream *z, zlibInitState *zlib_init, CURLcode result) { if(*zlib_init == ZLIB_GZIP_HEADER) Curl_safefree(z->next_in); if(*zlib_init != ZLIB_UNINIT) { if(inflateEnd(z) != Z_OK && result == CURLE_OK) result = process_zlib_error(data, z); *zlib_init = ZLIB_UNINIT; } return result; } static CURLcode process_trailer(struct Curl_easy *data, struct zlib_writer *zp) { z_stream *z = &zp->z; CURLcode result = CURLE_OK; uInt len = z->avail_in < zp->trailerlen? z->avail_in: zp->trailerlen; /* Consume expected trailer bytes. Terminate stream if exhausted. Issue an error if unexpected bytes follow. */ zp->trailerlen -= len; z->avail_in -= len; z->next_in += len; if(z->avail_in) result = CURLE_WRITE_ERROR; if(result || !zp->trailerlen) result = exit_zlib(data, z, &zp->zlib_init, result); else { /* Only occurs for gzip with zlib < 1.2.0.4 or raw deflate. */ zp->zlib_init = ZLIB_EXTERNAL_TRAILER; } return result; } static CURLcode inflate_stream(struct Curl_easy *data, struct contenc_writer *writer, zlibInitState started) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ uInt nread = z->avail_in; Bytef *orig_in = z->next_in; bool done = FALSE; CURLcode result = CURLE_OK; /* Curl_client_write status */ char *decomp; /* Put the decompressed data here. */ /* Check state. */ if(zp->zlib_init != ZLIB_INIT && zp->zlib_init != ZLIB_INFLATING && zp->zlib_init != ZLIB_INIT_GZIP && zp->zlib_init != ZLIB_GZIP_INFLATING) return exit_zlib(data, z, &zp->zlib_init, CURLE_WRITE_ERROR); /* Dynamically allocate a buffer for decompression because it's uncommonly large to hold on the stack */ decomp = malloc(DSIZ); if(!decomp) return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY); /* because the buffer size is fixed, iteratively decompress and transfer to the client via downstream_write function. */ while(!done) { int status; /* zlib status */ done = TRUE; /* (re)set buffer for decompressed output for every iteration */ z->next_out = (Bytef *) decomp; z->avail_out = DSIZ; #ifdef Z_BLOCK /* Z_BLOCK is only available in zlib ver. >= 1.2.0.5 */ status = inflate(z, Z_BLOCK); #else /* fallback for zlib ver. < 1.2.0.5 */ status = inflate(z, Z_SYNC_FLUSH); #endif /* Flush output data if some. */ if(z->avail_out != DSIZ) { if(status == Z_OK || status == Z_STREAM_END) { zp->zlib_init = started; /* Data started. */ result = Curl_unencode_write(data, writer->downstream, decomp, DSIZ - z->avail_out); if(result) { exit_zlib(data, z, &zp->zlib_init, result); break; } } } /* Dispatch by inflate() status. */ switch(status) { case Z_OK: /* Always loop: there may be unflushed latched data in zlib state. */ done = FALSE; break; case Z_BUF_ERROR: /* No more data to flush: just exit loop. */ break; case Z_STREAM_END: result = process_trailer(data, zp); break; case Z_DATA_ERROR: /* some servers seem to not generate zlib headers, so this is an attempt to fix and continue anyway */ if(zp->zlib_init == ZLIB_INIT) { /* Do not use inflateReset2(): only available since zlib 1.2.3.4. */ (void) inflateEnd(z); /* don't care about the return code */ if(inflateInit2(z, -MAX_WBITS) == Z_OK) { z->next_in = orig_in; z->avail_in = nread; zp->zlib_init = ZLIB_INFLATING; zp->trailerlen = 4; /* Tolerate up to 4 unknown trailer bytes. */ done = FALSE; break; } zp->zlib_init = ZLIB_UNINIT; /* inflateEnd() already called. */ } result = exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z)); break; default: result = exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z)); break; } } free(decomp); /* We're about to leave this call so the `nread' data bytes won't be seen again. If we are in a state that would wrongly allow restart in raw mode at the next call, assume output has already started. */ if(nread && zp->zlib_init == ZLIB_INIT) zp->zlib_init = started; /* Cannot restart anymore. */ return result; } /* Deflate handler. */ static CURLcode deflate_init_writer(struct Curl_easy *data, struct contenc_writer *writer) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ if(!writer->downstream) return CURLE_WRITE_ERROR; /* Initialize zlib */ z->zalloc = (alloc_func) zalloc_cb; z->zfree = (free_func) zfree_cb; if(inflateInit(z) != Z_OK) return process_zlib_error(data, z); zp->zlib_init = ZLIB_INIT; return CURLE_OK; } static CURLcode deflate_unencode_write(struct Curl_easy *data, struct contenc_writer *writer, const char *buf, size_t nbytes) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ /* Set the compressed input when this function is called */ z->next_in = (Bytef *) buf; z->avail_in = (uInt) nbytes; if(zp->zlib_init == ZLIB_EXTERNAL_TRAILER) return process_trailer(data, zp); /* Now uncompress the data */ return inflate_stream(data, writer, ZLIB_INFLATING); } static void deflate_close_writer(struct Curl_easy *data, struct contenc_writer *writer) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ exit_zlib(data, z, &zp->zlib_init, CURLE_OK); } static const struct content_encoding deflate_encoding = { "deflate", NULL, deflate_init_writer, deflate_unencode_write, deflate_close_writer, sizeof(struct zlib_writer) }; /* Gzip handler. */ static CURLcode gzip_init_writer(struct Curl_easy *data, struct contenc_writer *writer) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ if(!writer->downstream) return CURLE_WRITE_ERROR; /* Initialize zlib */ z->zalloc = (alloc_func) zalloc_cb; z->zfree = (free_func) zfree_cb; if(strcmp(zlibVersion(), "1.2.0.4") >= 0) { /* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */ if(inflateInit2(z, MAX_WBITS + 32) != Z_OK) { return process_zlib_error(data, z); } zp->zlib_init = ZLIB_INIT_GZIP; /* Transparent gzip decompress state */ } else { /* we must parse the gzip header and trailer ourselves */ if(inflateInit2(z, -MAX_WBITS) != Z_OK) { return process_zlib_error(data, z); } zp->trailerlen = 8; /* A CRC-32 and a 32-bit input size (RFC 1952, 2.2) */ zp->zlib_init = ZLIB_INIT; /* Initial call state */ } return CURLE_OK; } #ifdef OLD_ZLIB_SUPPORT /* Skip over the gzip header */ static enum { GZIP_OK, GZIP_BAD, GZIP_UNDERFLOW } check_gzip_header(unsigned char const *data, ssize_t len, ssize_t *headerlen) { int method, flags; const ssize_t totallen = len; /* The shortest header is 10 bytes */ if(len < 10) return GZIP_UNDERFLOW; if((data[0] != GZIP_MAGIC_0) || (data[1] != GZIP_MAGIC_1)) return GZIP_BAD; method = data[2]; flags = data[3]; if(method != Z_DEFLATED || (flags & RESERVED) != 0) { /* Can't handle this compression method or unknown flag */ return GZIP_BAD; } /* Skip over time, xflags, OS code and all previous bytes */ len -= 10; data += 10; if(flags & EXTRA_FIELD) { ssize_t extra_len; if(len < 2) return GZIP_UNDERFLOW; extra_len = (data[1] << 8) | data[0]; if(len < (extra_len + 2)) return GZIP_UNDERFLOW; len -= (extra_len + 2); data += (extra_len + 2); } if(flags & ORIG_NAME) { /* Skip over NUL-terminated file name */ while(len && *data) { --len; ++data; } if(!len || *data) return GZIP_UNDERFLOW; /* Skip over the NUL */ --len; ++data; } if(flags & COMMENT) { /* Skip over NUL-terminated comment */ while(len && *data) { --len; ++data; } if(!len || *data) return GZIP_UNDERFLOW; /* Skip over the NUL */ --len; } if(flags & HEAD_CRC) { if(len < 2) return GZIP_UNDERFLOW; len -= 2; } *headerlen = totallen - len; return GZIP_OK; } #endif static CURLcode gzip_unencode_write(struct Curl_easy *data, struct contenc_writer *writer, const char *buf, size_t nbytes) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ if(zp->zlib_init == ZLIB_INIT_GZIP) { /* Let zlib handle the gzip decompression entirely */ z->next_in = (Bytef *) buf; z->avail_in = (uInt) nbytes; /* Now uncompress the data */ return inflate_stream(data, writer, ZLIB_INIT_GZIP); } #ifndef OLD_ZLIB_SUPPORT /* Support for old zlib versions is compiled away and we are running with an old version, so return an error. */ return exit_zlib(data, z, &zp->zlib_init, CURLE_WRITE_ERROR); #else /* This next mess is to get around the potential case where there isn't * enough data passed in to skip over the gzip header. If that happens, we * malloc a block and copy what we have then wait for the next call. If * there still isn't enough (this is definitely a worst-case scenario), we * make the block bigger, copy the next part in and keep waiting. * * This is only required with zlib versions < 1.2.0.4 as newer versions * can handle the gzip header themselves. */ switch(zp->zlib_init) { /* Skip over gzip header? */ case ZLIB_INIT: { /* Initial call state */ ssize_t hlen; switch(check_gzip_header((unsigned char *) buf, nbytes, &hlen)) { case GZIP_OK: z->next_in = (Bytef *) buf + hlen; z->avail_in = (uInt) (nbytes - hlen); zp->zlib_init = ZLIB_GZIP_INFLATING; /* Inflating stream state */ break; case GZIP_UNDERFLOW: /* We need more data so we can find the end of the gzip header. It's * possible that the memory block we malloc here will never be freed if * the transfer abruptly aborts after this point. Since it's unlikely * that circumstances will be right for this code path to be followed in * the first place, and it's even more unlikely for a transfer to fail * immediately afterwards, it should seldom be a problem. */ z->avail_in = (uInt) nbytes; z->next_in = malloc(z->avail_in); if(!z->next_in) { return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY); } memcpy(z->next_in, buf, z->avail_in); zp->zlib_init = ZLIB_GZIP_HEADER; /* Need more gzip header data state */ /* We don't have any data to inflate yet */ return CURLE_OK; case GZIP_BAD: default: return exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z)); } } break; case ZLIB_GZIP_HEADER: { /* Need more gzip header data state */ ssize_t hlen; z->avail_in += (uInt) nbytes; z->next_in = Curl_saferealloc(z->next_in, z->avail_in); if(!z->next_in) { return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY); } /* Append the new block of data to the previous one */ memcpy(z->next_in + z->avail_in - nbytes, buf, nbytes); switch(check_gzip_header(z->next_in, z->avail_in, &hlen)) { case GZIP_OK: /* This is the zlib stream data */ free(z->next_in); /* Don't point into the malloced block since we just freed it */ z->next_in = (Bytef *) buf + hlen + nbytes - z->avail_in; z->avail_in = (uInt) (z->avail_in - hlen); zp->zlib_init = ZLIB_GZIP_INFLATING; /* Inflating stream state */ break; case GZIP_UNDERFLOW: /* We still don't have any data to inflate! */ return CURLE_OK; case GZIP_BAD: default: return exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z)); } } break; case ZLIB_EXTERNAL_TRAILER: z->next_in = (Bytef *) buf; z->avail_in = (uInt) nbytes; return process_trailer(data, zp); case ZLIB_GZIP_INFLATING: default: /* Inflating stream state */ z->next_in = (Bytef *) buf; z->avail_in = (uInt) nbytes; break; } if(z->avail_in == 0) { /* We don't have any data to inflate; wait until next time */ return CURLE_OK; } /* We've parsed the header, now uncompress the data */ return inflate_stream(data, writer, ZLIB_GZIP_INFLATING); #endif } static void gzip_close_writer(struct Curl_easy *data, struct contenc_writer *writer) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ exit_zlib(data, z, &zp->zlib_init, CURLE_OK); } static const struct content_encoding gzip_encoding = { "gzip", "x-gzip", gzip_init_writer, gzip_unencode_write, gzip_close_writer, sizeof(struct zlib_writer) }; #endif /* HAVE_LIBZ */ #ifdef HAVE_BROTLI /* Brotli writer. */ struct brotli_writer { struct contenc_writer super; BrotliDecoderState *br; /* State structure for brotli. */ }; static CURLcode brotli_map_error(BrotliDecoderErrorCode be) { switch(be) { case BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: case BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: case BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: case BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: case BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: case BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: case BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: case BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: case BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: case BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: case BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: case BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: case BROTLI_DECODER_ERROR_FORMAT_PADDING_1: case BROTLI_DECODER_ERROR_FORMAT_PADDING_2: #ifdef BROTLI_DECODER_ERROR_COMPOUND_DICTIONARY case BROTLI_DECODER_ERROR_COMPOUND_DICTIONARY: #endif #ifdef BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET case BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: #endif case BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: return CURLE_BAD_CONTENT_ENCODING; case BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: case BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: case BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: case BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: case BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: case BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: return CURLE_OUT_OF_MEMORY; default: break; } return CURLE_WRITE_ERROR; } static CURLcode brotli_init_writer(struct Curl_easy *data, struct contenc_writer *writer) { struct brotli_writer *bp = (struct brotli_writer *) writer; (void) data; if(!writer->downstream) return CURLE_WRITE_ERROR; bp->br = BrotliDecoderCreateInstance(NULL, NULL, NULL); return bp->br? CURLE_OK: CURLE_OUT_OF_MEMORY; } static CURLcode brotli_unencode_write(struct Curl_easy *data, struct contenc_writer *writer, const char *buf, size_t nbytes) { struct brotli_writer *bp = (struct brotli_writer *) writer; const uint8_t *src = (const uint8_t *) buf; char *decomp; uint8_t *dst; size_t dstleft; CURLcode result = CURLE_OK; BrotliDecoderResult r = BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT; if(!bp->br) return CURLE_WRITE_ERROR; /* Stream already ended. */ decomp = malloc(DSIZ); if(!decomp) return CURLE_OUT_OF_MEMORY; while((nbytes || r == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) && result == CURLE_OK) { dst = (uint8_t *) decomp; dstleft = DSIZ; r = BrotliDecoderDecompressStream(bp->br, &nbytes, &src, &dstleft, &dst, NULL); result = Curl_unencode_write(data, writer->downstream, decomp, DSIZ - dstleft); if(result) break; switch(r) { case BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: case BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: break; case BROTLI_DECODER_RESULT_SUCCESS: BrotliDecoderDestroyInstance(bp->br); bp->br = NULL; if(nbytes) result = CURLE_WRITE_ERROR; break; default: result = brotli_map_error(BrotliDecoderGetErrorCode(bp->br)); break; } } free(decomp); return result; } static void brotli_close_writer(struct Curl_easy *data, struct contenc_writer *writer) { struct brotli_writer *bp = (struct brotli_writer *) writer; (void) data; if(bp->br) { BrotliDecoderDestroyInstance(bp->br); bp->br = NULL; } } static const struct content_encoding brotli_encoding = { "br", NULL, brotli_init_writer, brotli_unencode_write, brotli_close_writer, sizeof(struct brotli_writer) }; #endif #ifdef HAVE_ZSTD /* Zstd writer. */ struct zstd_writer { struct contenc_writer super; ZSTD_DStream *zds; /* State structure for zstd. */ void *decomp; }; static CURLcode zstd_init_writer(struct Curl_easy *data, struct contenc_writer *writer) { struct zstd_writer *zp = (struct zstd_writer *) writer; (void)data; if(!writer->downstream) return CURLE_WRITE_ERROR; zp->zds = ZSTD_createDStream(); zp->decomp = NULL; return zp->zds ? CURLE_OK : CURLE_OUT_OF_MEMORY; } static CURLcode zstd_unencode_write(struct Curl_easy *data, struct contenc_writer *writer, const char *buf, size_t nbytes) { CURLcode result = CURLE_OK; struct zstd_writer *zp = (struct zstd_writer *) writer; ZSTD_inBuffer in; ZSTD_outBuffer out; size_t errorCode; if(!zp->decomp) { zp->decomp = malloc(DSIZ); if(!zp->decomp) return CURLE_OUT_OF_MEMORY; } in.pos = 0; in.src = buf; in.size = nbytes; for(;;) { out.pos = 0; out.dst = zp->decomp; out.size = DSIZ; errorCode = ZSTD_decompressStream(zp->zds, &out, &in); if(ZSTD_isError(errorCode)) { return CURLE_BAD_CONTENT_ENCODING; } if(out.pos > 0) { result = Curl_unencode_write(data, writer->downstream, zp->decomp, out.pos); if(result) break; } if((in.pos == nbytes) && (out.pos < out.size)) break; } return result; } static void zstd_close_writer(struct Curl_easy *data, struct contenc_writer *writer) { struct zstd_writer *zp = (struct zstd_writer *) writer; (void)data; if(zp->decomp) { free(zp->decomp); zp->decomp = NULL; } if(zp->zds) { ZSTD_freeDStream(zp->zds); zp->zds = NULL; } } static const struct content_encoding zstd_encoding = { "zstd", NULL, zstd_init_writer, zstd_unencode_write, zstd_close_writer, sizeof(struct zstd_writer) }; #endif /* Identity handler. */ static CURLcode identity_init_writer(struct Curl_easy *data, struct contenc_writer *writer) { (void) data; return writer->downstream? CURLE_OK: CURLE_WRITE_ERROR; } static CURLcode identity_unencode_write(struct Curl_easy *data, struct contenc_writer *writer, const char *buf, size_t nbytes) { return Curl_unencode_write(data, writer->downstream, buf, nbytes); } static void identity_close_writer(struct Curl_easy *data, struct contenc_writer *writer) { (void) data; (void) writer; } static const struct content_encoding identity_encoding = { "identity", "none", identity_init_writer, identity_unencode_write, identity_close_writer, sizeof(struct contenc_writer) }; /* supported content encodings table. */ static const struct content_encoding * const encodings[] = { &identity_encoding, #ifdef HAVE_LIBZ &deflate_encoding, &gzip_encoding, #endif #ifdef HAVE_BROTLI &brotli_encoding, #endif #ifdef HAVE_ZSTD &zstd_encoding, #endif NULL }; /* Return a list of comma-separated names of supported encodings. */ char *Curl_all_content_encodings(void) { size_t len = 0; const struct content_encoding * const *cep; const struct content_encoding *ce; char *ace; for(cep = encodings; *cep; cep++) { ce = *cep; if(!strcasecompare(ce->name, CONTENT_ENCODING_DEFAULT)) len += strlen(ce->name) + 2; } if(!len) return strdup(CONTENT_ENCODING_DEFAULT); ace = malloc(len); if(ace) { char *p = ace; for(cep = encodings; *cep; cep++) { ce = *cep; if(!strcasecompare(ce->name, CONTENT_ENCODING_DEFAULT)) { strcpy(p, ce->name); p += strlen(p); *p++ = ','; *p++ = ' '; } } p[-2] = '\0'; } return ace; } /* Real client writer: no downstream. */ static CURLcode client_init_writer(struct Curl_easy *data, struct contenc_writer *writer) { (void) data; return writer->downstream? CURLE_WRITE_ERROR: CURLE_OK; } static CURLcode client_unencode_write(struct Curl_easy *data, struct contenc_writer *writer, const char *buf, size_t nbytes) { struct SingleRequest *k = &data->req; (void) writer; if(!nbytes || k->ignorebody) return CURLE_OK; return Curl_client_write(data, CLIENTWRITE_BODY, (char *) buf, nbytes); } static void client_close_writer(struct Curl_easy *data, struct contenc_writer *writer) { (void) data; (void) writer; } static const struct content_encoding client_encoding = { NULL, NULL, client_init_writer, client_unencode_write, client_close_writer, sizeof(struct contenc_writer) }; /* Deferred error dummy writer. */ static CURLcode error_init_writer(struct Curl_easy *data, struct contenc_writer *writer) { (void) data; return writer->downstream? CURLE_OK: CURLE_WRITE_ERROR; } static CURLcode error_unencode_write(struct Curl_easy *data, struct contenc_writer *writer, const char *buf, size_t nbytes) { char *all = Curl_all_content_encodings(); (void) writer; (void) buf; (void) nbytes; if(!all) return CURLE_OUT_OF_MEMORY; failf(data, "Unrecognized content encoding type. " "libcurl understands %s content encodings.", all); free(all); return CURLE_BAD_CONTENT_ENCODING; } static void error_close_writer(struct Curl_easy *data, struct contenc_writer *writer) { (void) data; (void) writer; } static const struct content_encoding error_encoding = { NULL, NULL, error_init_writer, error_unencode_write, error_close_writer, sizeof(struct contenc_writer) }; /* Create an unencoding writer stage using the given handler. */ static struct contenc_writer * new_unencoding_writer(struct Curl_easy *data, const struct content_encoding *handler, struct contenc_writer *downstream, int order) { struct contenc_writer *writer; DEBUGASSERT(handler->writersize >= sizeof(struct contenc_writer)); writer = (struct contenc_writer *) calloc(1, handler->writersize); if(writer) { writer->handler = handler; writer->downstream = downstream; writer->order = order; if(handler->init_writer(data, writer)) { free(writer); writer = NULL; } } return writer; } /* Write data using an unencoding writer stack. "nbytes" is not allowed to be 0. */ CURLcode Curl_unencode_write(struct Curl_easy *data, struct contenc_writer *writer, const char *buf, size_t nbytes) { if(!nbytes) return CURLE_OK; return writer->handler->unencode_write(data, writer, buf, nbytes); } /* Close and clean-up the connection's writer stack. */ void Curl_unencode_cleanup(struct Curl_easy *data) { struct SingleRequest *k = &data->req; struct contenc_writer *writer = k->writer_stack; while(writer) { k->writer_stack = writer->downstream; writer->handler->close_writer(data, writer); free(writer); writer = k->writer_stack; } } /* Find the content encoding by name. */ static const struct content_encoding *find_encoding(const char *name, size_t len) { const struct content_encoding * const *cep; for(cep = encodings; *cep; cep++) { const struct content_encoding *ce = *cep; if((strncasecompare(name, ce->name, len) && !ce->name[len]) || (ce->alias && strncasecompare(name, ce->alias, len) && !ce->alias[len])) return ce; } return NULL; } /* allow no more than 5 "chained" compression steps */ #define MAX_ENCODE_STACK 5 /* Set-up the unencoding stack from the Content-Encoding header value. * See RFC 7231 section 3.1.2.2. */ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data, const char *enclist, int is_transfer) { struct SingleRequest *k = &data->req; unsigned int order = is_transfer? 2: 1; do { const char *name; size_t namelen; /* Parse a single encoding name. */ while(ISBLANK(*enclist) || *enclist == ',') enclist++; name = enclist; for(namelen = 0; *enclist && *enclist != ','; enclist++) if(!ISSPACE(*enclist)) namelen = enclist - name + 1; /* Special case: chunked encoding is handled at the reader level. */ if(is_transfer && namelen == 7 && strncasecompare(name, "chunked", 7)) { k->chunk = TRUE; /* chunks coming our way. */ Curl_httpchunk_init(data); /* init our chunky engine. */ } else if(namelen) { const struct content_encoding *encoding = find_encoding(name, namelen); struct contenc_writer *writer; if(!k->writer_stack) { k->writer_stack = new_unencoding_writer(data, &client_encoding, NULL, 0); if(!k->writer_stack) return CURLE_OUT_OF_MEMORY; } if(!encoding) encoding = &error_encoding; /* Defer error at stack use. */ if(k->writer_stack_depth++ >= MAX_ENCODE_STACK) { failf(data, "Reject response due to more than %u content encodings", MAX_ENCODE_STACK); return CURLE_BAD_CONTENT_ENCODING; } /* Stack the unencoding stage. */ if(order >= k->writer_stack->order) { writer = new_unencoding_writer(data, encoding, k->writer_stack, order); if(!writer) return CURLE_OUT_OF_MEMORY; k->writer_stack = writer; } else { struct contenc_writer *w = k->writer_stack; while(w->downstream && order < w->downstream->order) w = w->downstream; writer = new_unencoding_writer(data, encoding, w->downstream, order); if(!writer) return CURLE_OUT_OF_MEMORY; w->downstream = writer; } } } while(*enclist); return CURLE_OK; } #else /* Stubs for builds without HTTP. */ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data, const char *enclist, int is_transfer) { (void) data; (void) enclist; (void) is_transfer; return CURLE_NOT_BUILT_IN; } CURLcode Curl_unencode_write(struct Curl_easy *data, struct contenc_writer *writer, const char *buf, size_t nbytes) { (void) data; (void) writer; (void) buf; (void) nbytes; return CURLE_NOT_BUILT_IN; } void Curl_unencode_cleanup(struct Curl_easy *data) { (void) data; } char *Curl_all_content_encodings(void) { return strdup(CONTENT_ENCODING_DEFAULT); /* Satisfy caller. */ } #endif /* CURL_DISABLE_HTTP */ 上边的是patch 下边的是源码: From 76f83f0db23846e254d940ec7fe141010077eb88 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg <daniel@haxx.se> Date: Fri, 24 Jan 2025 11:13:24 +0100 Subject: [PATCH] content_encoding: drop support for zlib before 1.2.0.4 zlib 1.2.0.4 was released on 10 August 2003 Closes #16079 --- docs/INTERNALS.md | 2 +- lib/content_encoding.c | 276 ++++------------------------------------- 2 files changed, 25 insertions(+), 253 deletions(-) diff --git a/docs/INTERNALS.md b/docs/INTERNALS.md index ae77f0e54b05..4e42f4fd1015 100644 --- a/docs/INTERNALS.md +++ b/docs/INTERNALS.md @@ -23,7 +23,7 @@ versions of libs and build tools. - OpenSSL 0.9.7 - GnuTLS 3.1.10 - - zlib 1.1.4 + - zlib 1.2.0.4 - libssh2 1.0 - c-ares 1.16.0 - libidn2 2.0.0 diff --git a/lib/content_encoding.c b/lib/content_encoding.c index e19595d5ec42..d2b17297890d 100644 --- a/lib/content_encoding.c +++ b/lib/content_encoding.c @@ -55,33 +55,13 @@ #define DSIZ CURL_MAX_WRITE_SIZE /* buffer size for decompressed data */ - #ifdef HAVE_LIBZ -/* Comment this out if zlib is always going to be at least ver. 1.2.0.4 - (doing so will reduce code size slightly). */ -#define OLD_ZLIB_SUPPORT 1 - -#define GZIP_MAGIC_0 0x1f -#define GZIP_MAGIC_1 0x8b - -/* gzip flag byte */ -#define CURL_GZIPFLAG_ASCII 0x01 /* bit 0 set: file probably ASCII - text */ -#define CURL_GZIPFLAG_HEAD_CRC 0x02 /* bit 1 set: header CRC present */ -#define CURL_GZIPFLAG_EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ -#define CURL_GZIPFLAG_ORIG_NAME 0x08 /* bit 3 set: original filename - present */ -#define CURL_GZIPFLAG_COMMENT 0x10 /* bit 4 set: file comment present */ -#define CURL_GZIPFLAG_RESERVED 0xE0 /* bits 5..7: reserved */ - typedef enum { ZLIB_UNINIT, /* uninitialized */ ZLIB_INIT, /* initialized */ ZLIB_INFLATING, /* inflating started. */ ZLIB_EXTERNAL_TRAILER, /* reading external trailer */ - ZLIB_GZIP_HEADER, /* reading gzip header */ - ZLIB_GZIP_INFLATING, /* inflating gzip stream */ ZLIB_INIT_GZIP /* initialized in transparent gzip mode */ } zlibInitState; @@ -139,9 +119,6 @@ static CURLcode exit_zlib(struct Curl_easy *data, z_stream *z, zlibInitState *zlib_init, CURLcode result) { - if(*zlib_init == ZLIB_GZIP_HEADER) - Curl_safefree(z->next_in); - if(*zlib_init != ZLIB_UNINIT) { if(inflateEnd(z) != Z_OK && result == CURLE_OK) result = process_zlib_error(data, z); @@ -190,8 +167,7 @@ static CURLcode inflate_stream(struct Curl_easy *data, /* Check state. */ if(zp->zlib_init != ZLIB_INIT && zp->zlib_init != ZLIB_INFLATING && - zp->zlib_init != ZLIB_INIT_GZIP && - zp->zlib_init != ZLIB_GZIP_INFLATING) + zp->zlib_init != ZLIB_INIT_GZIP) return exit_zlib(data, z, &zp->zlib_init, CURLE_WRITE_ERROR); /* Dynamically allocate a buffer for decompression because it is uncommonly @@ -280,7 +256,7 @@ static CURLcode inflate_stream(struct Curl_easy *data, /* Deflate handler. */ static CURLcode deflate_do_init(struct Curl_easy *data, - struct Curl_cwriter *writer) + struct Curl_cwriter *writer) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ @@ -296,8 +272,8 @@ static CURLcode deflate_do_init(struct Curl_easy *data, } static CURLcode deflate_do_write(struct Curl_easy *data, - struct Curl_cwriter *writer, int type, - const char *buf, size_t nbytes) + struct Curl_cwriter *writer, int type, + const char *buf, size_t nbytes) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ @@ -317,7 +293,7 @@ static CURLcode deflate_do_write(struct Curl_easy *data, } static void deflate_do_close(struct Curl_easy *data, - struct Curl_cwriter *writer) + struct Curl_cwriter *writer) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ @@ -337,124 +313,34 @@ static const struct Curl_cwtype deflate_encoding = { /* Gzip handler. */ static CURLcode gzip_do_init(struct Curl_easy *data, - struct Curl_cwriter *writer) + struct Curl_cwriter *writer) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ + const char *v = zlibVersion(); /* Initialize zlib */ z->zalloc = (alloc_func) zalloc_cb; z->zfree = (free_func) zfree_cb; - if(strcmp(zlibVersion(), "1.2.0.4") >= 0) { - /* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */ + if(strcmp(v, "1.2.0.4") >= 0) { + /* zlib version >= 1.2.0.4 supports transparent gzip decompressing */ if(inflateInit2(z, MAX_WBITS + 32) != Z_OK) { return process_zlib_error(data, z); } zp->zlib_init = ZLIB_INIT_GZIP; /* Transparent gzip decompress state */ } else { - /* we must parse the gzip header and trailer ourselves */ - if(inflateInit2(z, -MAX_WBITS) != Z_OK) { - return process_zlib_error(data, z); - } - zp->trailerlen = 8; /* A CRC-32 and a 32-bit input size (RFC 1952, 2.2) */ - zp->zlib_init = ZLIB_INIT; /* Initial call state */ + failf(data, "too old zlib version: %s", v); + return CURLE_FAILED_INIT; } return CURLE_OK; } -#ifdef OLD_ZLIB_SUPPORT -/* Skip over the gzip header */ -typedef enum { - GZIP_OK, - GZIP_BAD, - GZIP_UNDERFLOW -} gzip_status; - -static gzip_status check_gzip_header(unsigned char const *data, ssize_t len, - ssize_t *headerlen) -{ - int method, flags; - const ssize_t totallen = len; - - /* The shortest header is 10 bytes */ - if(len < 10) - return GZIP_UNDERFLOW; - - if((data[0] != GZIP_MAGIC_0) || (data[1] != GZIP_MAGIC_1)) - return GZIP_BAD; - - method = data[2]; - flags = data[3]; - - if(method != Z_DEFLATED || (flags & CURL_GZIPFLAG_RESERVED) != 0) { - /* cannot handle this compression method or unknown flag */ - return GZIP_BAD; - } - - /* Skip over time, xflags, OS code and all previous bytes */ - len -= 10; - data += 10; - - if(flags & CURL_GZIPFLAG_EXTRA_FIELD) { - ssize_t extra_len; - - if(len < 2) - return GZIP_UNDERFLOW; - - extra_len = (data[1] << 8) | data[0]; - - if(len < (extra_len + 2)) - return GZIP_UNDERFLOW; - - len -= (extra_len + 2); - data += (extra_len + 2); - } - - if(flags & CURL_GZIPFLAG_ORIG_NAME) { - /* Skip over NUL-terminated filename */ - while(len && *data) { - --len; - ++data; - } - if(!len || *data) - return GZIP_UNDERFLOW; - - /* Skip over the NUL */ - --len; - ++data; - } - - if(flags & CURL_GZIPFLAG_COMMENT) { - /* Skip over NUL-terminated comment */ - while(len && *data) { - --len; - ++data; - } - if(!len || *data) - return GZIP_UNDERFLOW; - - /* Skip over the NUL */ - --len; - } - - if(flags & CURL_GZIPFLAG_HEAD_CRC) { - if(len < 2) - return GZIP_UNDERFLOW; - - len -= 2; - } - - *headerlen = totallen - len; - return GZIP_OK; -} -#endif - static CURLcode gzip_do_write(struct Curl_easy *data, - struct Curl_cwriter *writer, int type, - const char *buf, size_t nbytes) + struct Curl_cwriter *writer, int type, + const char *buf, size_t nbytes) { struct zlib_writer *zp = (struct zlib_writer *) writer; z_stream *z = &zp->z; /* zlib state structure */ @@ -470,117 +356,8 @@ static CURLcode gzip_do_write(struct Curl_easy *data, return inflate_stream(data, writer, type, ZLIB_INIT_GZIP); } -#ifndef OLD_ZLIB_SUPPORT - /* Support for old zlib versions is compiled away and we are running with - an old version, so return an error. */ + /* We are running with an old version: return error. */ return exit_zlib(data, z, &zp->zlib_init, CURLE_WRITE_ERROR); - -#else - /* This next mess is to get around the potential case where there is not - * enough data passed in to skip over the gzip header. If that happens, we - * malloc a block and copy what we have then wait for the next call. If - * there still is not enough (this is definitely a worst-case scenario), we - * make the block bigger, copy the next part in and keep waiting. - * - * This is only required with zlib versions < 1.2.0.4 as newer versions - * can handle the gzip header themselves. - */ - - switch(zp->zlib_init) { - /* Skip over gzip header? */ - case ZLIB_INIT: - { - /* Initial call state */ - ssize_t hlen; - - switch(check_gzip_header((unsigned char *) buf, nbytes, &hlen)) { - case GZIP_OK: - z->next_in = (Bytef *) buf + hlen; - z->avail_in = (uInt) (nbytes - hlen); - zp->zlib_init = ZLIB_GZIP_INFLATING; /* Inflating stream state */ - break; - - case GZIP_UNDERFLOW: - /* We need more data so we can find the end of the gzip header. it is - * possible that the memory block we malloc here will never be freed if - * the transfer abruptly aborts after this point. Since it is unlikely - * that circumstances will be right for this code path to be followed in - * the first place, and it is even more unlikely for a transfer to fail - * immediately afterwards, it should seldom be a problem. - */ - z->avail_in = (uInt) nbytes; - z->next_in = malloc(z->avail_in); - if(!z->next_in) { - return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY); - } - memcpy(z->next_in, buf, z->avail_in); - zp->zlib_init = ZLIB_GZIP_HEADER; /* Need more gzip header data state */ - /* We do not have any data to inflate yet */ - return CURLE_OK; - - case GZIP_BAD: - default: - return exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z)); - } - - } - break; - - case ZLIB_GZIP_HEADER: - { - /* Need more gzip header data state */ - ssize_t hlen; - z->avail_in += (uInt) nbytes; - z->next_in = Curl_saferealloc(z->next_in, z->avail_in); - if(!z->next_in) { - return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY); - } - /* Append the new block of data to the previous one */ - memcpy(z->next_in + z->avail_in - nbytes, buf, nbytes); - - switch(check_gzip_header(z->next_in, (ssize_t)z->avail_in, &hlen)) { - case GZIP_OK: - /* This is the zlib stream data */ - free(z->next_in); - /* Do not point into the malloced block since we just freed it */ - z->next_in = (Bytef *) buf + hlen + nbytes - z->avail_in; - z->avail_in = z->avail_in - (uInt)hlen; - zp->zlib_init = ZLIB_GZIP_INFLATING; /* Inflating stream state */ - break; - - case GZIP_UNDERFLOW: - /* We still do not have any data to inflate! */ - return CURLE_OK; - - case GZIP_BAD: - default: - return exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z)); - } - - } - break; - - case ZLIB_EXTERNAL_TRAILER: - z->next_in = (Bytef *) buf; - z->avail_in = (uInt) nbytes; - return process_trailer(data, zp); - - case ZLIB_GZIP_INFLATING: - default: - /* Inflating stream state */ - z->next_in = (Bytef *) buf; - z->avail_in = (uInt) nbytes; - break; - } - - if(z->avail_in == 0) { - /* We do not have any data to inflate; wait until next time */ - return CURLE_OK; - } - - /* We have parsed the header, now uncompress the data */ - return inflate_stream(data, writer, type, ZLIB_GZIP_INFLATING); -#endif } static void gzip_do_close(struct Curl_easy *data, @@ -603,7 +380,6 @@ static const struct Curl_cwtype gzip_encoding = { #endif /* HAVE_LIBZ */ - #ifdef HAVE_BROTLI /* Brotli writer. */ struct brotli_writer { @@ -650,7 +426,7 @@ static CURLcode brotli_map_error(BrotliDecoderErrorCode be) } static CURLcode brotli_do_init(struct Curl_easy *data, - struct Curl_cwriter *writer) + struct Curl_cwriter *writer) { struct brotli_writer *bp = (struct brotli_writer *) writer; (void) data; @@ -660,8 +436,8 @@ static CURLcode brotli_do_init(struct Curl_easy *data, } static CURLcode brotli_do_write(struct Curl_easy *data, - struct Curl_cwriter *writer, int type, - const char *buf, size_t nbytes) + struct Curl_cwriter *writer, int type, + const char *buf, size_t nbytes) { struct brotli_writer *bp = (struct brotli_writer *) writer; const uint8_t *src = (const uint8_t *) buf; @@ -733,7 +509,6 @@ static const struct Curl_cwtype brotli_encoding = { }; #endif - #ifdef HAVE_ZSTD /* Zstd writer. */ struct zstd_writer { @@ -757,7 +532,7 @@ static void Curl_zstd_free(void *opaque, void *address) #endif static CURLcode zstd_do_init(struct Curl_easy *data, - struct Curl_cwriter *writer) + struct Curl_cwriter *writer) { struct zstd_writer *zp = (struct zstd_writer *) writer; @@ -778,8 +553,8 @@ static CURLcode zstd_do_init(struct Curl_easy *data, } static CURLcode zstd_do_write(struct Curl_easy *data, - struct Curl_cwriter *writer, int type, - const char *buf, size_t nbytes) + struct Curl_cwriter *writer, int type, + const char *buf, size_t nbytes) { CURLcode result = CURLE_OK; struct zstd_writer *zp = (struct zstd_writer *) writer; @@ -810,7 +585,7 @@ static CURLcode zstd_do_write(struct Curl_easy *data, } if(out.pos > 0) { result = Curl_cwriter_write(data, writer->next, type, - zp->decomp, out.pos); + zp->decomp, out.pos); if(result) break; } @@ -848,7 +623,6 @@ static const struct Curl_cwtype zstd_encoding = { }; #endif - /* Identity handler. */ static const struct Curl_cwtype identity_encoding = { "identity", @@ -859,7 +633,6 @@ static const struct Curl_cwtype identity_encoding = { sizeof(struct Curl_cwriter) }; - /* supported general content decoders. */ static const struct Curl_cwtype * const general_unencoders[] = { &identity_encoding, @@ -923,7 +696,7 @@ void Curl_all_content_encodings(char *buf, size_t blen) /* Deferred error dummy writer. */ static CURLcode error_do_init(struct Curl_easy *data, - struct Curl_cwriter *writer) + struct Curl_cwriter *writer) { (void)data; (void)writer; @@ -931,8 +704,8 @@ static CURLcode error_do_init(struct Curl_easy *data, } static CURLcode error_do_write(struct Curl_easy *data, - struct Curl_cwriter *writer, int type, - const char *buf, size_t nbytes) + struct Curl_cwriter *writer, int type, + const char *buf, size_t nbytes) { (void) writer; (void) buf; @@ -1107,5 +880,4 @@ void Curl_all_content_encodings(char *buf, size_t blen) strcpy(buf, CONTENT_ENCODING_DEFAULT); } - #endif /* CURL_DISABLE_HTTP */ 现在就是想做的就是根据源码相应的函数的行数来修改patch中要修复的行数,不修改源码
09-12
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值