-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Netdump library #6518
Netdump library #6518
Conversation
@hreintke There's not a single patch to the ESP8266 Arduino core in the PR, it's a plain old library from what I see, why don't you just make it an Arduino library, available via the library manager? If there's interest in the core team, they can still pick it up as a git submodule and establish fixed version relationships in this way, I would not encourage that, though, speaking from experience with EspSoftwareSerial. |
@hreintke I'm just commenting out of concern over ever-longer build times.
|
Unused libraries are not compiled. |
Re: the longer build times, there is a bug in the arduino-builder that was recently patched that made it scan the entire .git tree (takes 2+ mins and 4GB on my server!) at the start of every build. arduino/arduino-cli#366 . The nightly arduino tarball should have this fixed, or you can build your own arduino-builder executable and install over the existing one from a stable release. This only applies, of course, when you're building from a git clone'd copy and not a board manager install. |
@hreintke trivial failure on the example. Can you run tests/restyle.sh to clean up the formatting to match Arduino standard? |
@earlephilhower |
About build times for libraries, what I mostly had in mind is CI, where the examples are all built. Is the NetdumpLibrary really this essential? |
@hreintke IIRC, examples should be in <lib>/examples/<exampleproj>/<exampleproj>.ino |
@hreintke could you please fix this PR? |
@devyte OK, will fix the issues on the PR. |
It's up to you. If it is an external library you will be the maintainer of it, others will PR on it, we'll import it as a submodule, and it will be usable with other network library if they implement/have a If it is internal, you'll be able to fix/improve it with PRs. Anyway, as a submodule or plainly included, it will be useful for learning and debugging. |
@hreintke there are ongoing networking changes and development, and I expect users will be instructed to make use of it for dumps, so I prefer it in the repo close at hand, at least for now. |
…into NetdumpLibrary
@d-a-v @devyte
|
Add |
@hreintke experimental means beware it might abruptly change and is not fully tested. In other words, it's ok to use internally for our core features, but not ok for exposing to users as supported functionality/api. |
SPIFFS is deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of my comments/questions in my previous review, there are 6 that I think are still valid. All others are resolved.
This review adds 6 additional comments on top of the previous 6.
HTTPChar | ||
}; | ||
|
||
void startSerial(int option) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The switch was changed, but the arg is still received as an int.
WiFi.begin(ssid, password); | ||
|
||
if (WiFi.waitForConnectResult() != WL_CONNECTED) { | ||
Serial.println("WiFi Failed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that what comes next is an infinite loop, I suggest: "WiFiFailed, stopping sketch". I've been confused by these things myself.
void tcpDumpProcess(const NetdumpPacket& np); | ||
void tcpDumpLoop(WiFiServer &tcpDumpServer, NetdumpFilter nf); | ||
|
||
WiFiClient tcpDumpClient; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it also not apply to WiFiClientSecure?
char* packetBuffer = nullptr; | ||
size_t bufferIndex = 0; | ||
|
||
static constexpr int tcpBuffersize = 2048; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tcpBufferSize* (uppercase S)
NetdumpIP::NetdumpIP() | ||
{ | ||
} | ||
|
||
NetdumpIP::~NetdumpIP() | ||
{ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is that these two implement the default behavior, i.e.: they are empty, so you don't need to do it yourself, because the compiler provides them for you. Just remove them (cleaner)
|
||
NetdumpIP::NetdumpIP(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet) | ||
{ | ||
setV4(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is that there doesn't seem to be an equivalent for IPv6, and also: is this constructor valid for the case of a sketch with only IPv6? If the answer to that is "no", then should the constructor have different args? have an overload with different args? something else?
{ | ||
return len; | ||
} | ||
uint16_t ntoh16(uint16_t idx) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant: rather than reimplement here, why not call the lwip functions directly? or wrap the lwip calls in these methods.
PacketType::PacketType() | ||
{ | ||
} | ||
|
||
PacketType::~PacketType() | ||
{ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to implement default constructor/destructor, the compiler provides them.
UKNW, | ||
}; | ||
|
||
PacketType(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this, if the constructor is the default (empty body in the cpp)
PacketType(); | ||
PacketType(PType pt) : ptype(pt) {}; | ||
|
||
~PacketType(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this, if the destructor is the default (empty body in the cpp)
…into NetdumpLibrary
Something did not go the way I wanted. My goal was to sync my branch with the littleFS/unused parameter patches from @d-a-v. Not sure now how to continue. |
Netdump library, initial commit