-
Notifications
You must be signed in to change notification settings - Fork 9
Enterprise network informations device posture #300
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
base: enterprise-main
Are you sure you want to change the base?
Enterprise network informations device posture #300
Conversation
| _collectDevicePosture() { | ||
| Cc["@mozilla.org/network/network-link-service;1"] | ||
| .createInstance() | ||
| .QueryInterface(Ci.nsINetworkLinkService); |
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 have seen cases locally while hacking where the instance may not be started, but I'm not sure this is required
f72fa07 to
54e0723
Compare
54e0723 to
9e16467
Compare
9e16467 to
eded123
Compare
eded123 to
1e244d2
Compare
gcp
left a comment
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.
This is very complicated and big, probably needs another set of eyes.
| #if defined(XP_WIN) | ||
| NetworkInterface::NetworkInterface(PIP_ADAPTER_ADDRESSES aAdapter) | ||
| : mName(NS_ConvertUTF16toUTF8(aAdapter->FriendlyName)) { | ||
| uint8_t macAddress[6] = {0, 0, 0, 0, 0, 0}; |
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.
This needs to be MAX_ADAPTER_ADDRESS_LENGTH. Which is not 6 😄
| uint8_t macAddress[6] = {0, 0, 0, 0, 0, 0}; | ||
| memcpy(&macAddress, aAdapter->PhysicalAddress, | ||
| aAdapter->PhysicalAddressLength); | ||
| setMAC(macAddress); |
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 if PhysicalAddressLength was not 6? What if it is 0?
| nsTHashMap<nsCString, nsTArray<std::pair<int, nsCString>>>& aRoutes, | ||
| struct ifaddrs* aIfap) | ||
| : mName(aName) { | ||
| // setMAC(aMac); |
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.
Yes? No? Needed or not? I guess not because it's done explicitly below?
| if (aLink) { | ||
| uint8_t mac_addr[aLink->sdl_alen]; | ||
| memcpy(mac_addr, aLink->sdl_data + aLink->sdl_nlen, aLink->sdl_alen); | ||
| setMAC(mac_addr); |
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.
Probably same issue that this can't cope with unexpected lengths.
| 0x11d3, \ | ||
| {0x93, 0x37, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40}} | ||
| #define NS_IOSERVICE_CID \ | ||
| { /* 9ac9e770-18bc-11d3-9337-00104ba0fd40 */ \ |
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.
Don't do this, this will make merging a pain.
|
|
||
| if (std::find(ifNames.begin(), ifNames.end(), ifa->ifa_name) == | ||
| ifNames.end()) { | ||
| ifNames.emplace_back(ifa->ifa_name); |
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.
std::set?
This works too, it's up to you.
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 ifa_name is a char* and not a std::string, don't you need a string comparison here?
| MOZ_ASSERT(!mIsPending, "Request has been already sent!"); | ||
|
|
||
| struct sockaddr_nl kernel{}; | ||
| struct sockaddr_nl kernel {}; |
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.
Meeh, don't do this.
| nsresult NetlinkService::GetNetworkInterfaces( | ||
| nsTArray<NetworkInterface>& aNetworkInterfaces) { | ||
| nsTArray<NetworkInterface> networkInterfaces; | ||
| for (const auto& linkInfo : mLinks.Values()) { |
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.
Doesn't this need MutexAutoLock lock(mMutex); ?
No description provided.