There is a source code for a specialized tftp utility for a busybox router (I don’t cite all the text so as not to tire people with copy-paste) here is a fragment:
#if !defined(SUPPORT_SQN_KTHP) if ((cmd == 0) || (optind == argc) || !(glbUploadType == 'i' || glbUploadType == 'c' || glbUploadType == 'f')) { bb_show_usage(); } #else if ((cmd == 0) || (optind == argc) || !(glbUploadType == 's' || glbUploadType == 'd' || glbUploadType == 'p'|| glbUploadType == 'k' || glbUploadType == 'i')) { bb_show_usage(); } #endif if(!remotefile || remotefile[0] == '\0') bb_show_usage(); if (glbUploadType == 'i' && cmd != tftp_cmd_get){ printf("tftp client only support upgrade firmware\n"); return EXIT_FAILURE; } if ( glbUploadType == 's' || glbUploadType == 'd' || glbUploadType == 'p'|| glbUploadType == 'k' ){ if ( !(andyCheckTftpcEnable()) ){ printf("Can not enable upgrade/download certificate data\n"); return EXIT_FAILURE; } } if (glbUploadType == 'c') fBufType = BUF_CONFIG_DATA;
Theoretically, in the end, there should be a check of the possibility of downloading / unloading corresponding files by tftp. If it does not converge, output the corresponding command: "Can not enable upgrade / download certificate data". After building help tftp writes
Usage: tftp [OPTION]... tftp_server_ip Update certificate data from/or backup certificate. data to a tftp server. Options: -g Get file. (Certificate data) -p Put file. (backup Certificate data) -f remote file name. -ts for server root ,d for device, p for device private and k
I enter the command: tftp –g 192.168.1.2 –f file.pem –ts (similar command for downloading the firmware image - works - tftp –g 192.168.1.2 –f file.bin –ti ) as a result I get "Can not upgrade / download certificate data " And it does not matter –g or –p I guess that the error is here:
if ( glbUploadType == 's' || glbUploadType == 'd' || glbUploadType == 'p'|| glbUploadType == 'k' ){ if ( !(andyCheckTftpcEnable()) ){ printf("Can not enable upgrade/download certificate data\n"); return EXIT_FAILURE; } }
Tell me plz what needs to be fixed if I'm right