Skip to content

Conversation

@lissyx
Copy link
Contributor

@lissyx lissyx commented Dec 19, 2025

No description provided.

@lissyx lissyx requested a review from gcp December 19, 2025 13:08
@lissyx lissyx self-assigned this Dec 19, 2025
@lissyx lissyx requested a review from a team December 19, 2025 13:08
_collectDevicePosture() {
Cc["@mozilla.org/network/network-link-service;1"]
.createInstance()
.QueryInterface(Ci.nsINetworkLinkService);
Copy link
Contributor Author

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

@lissyx lissyx force-pushed the enterprise-network_informations_device_posture branch from f72fa07 to 54e0723 Compare December 19, 2025 13:16
@gcp gcp requested a review from a team December 19, 2025 13:37
@lissyx lissyx force-pushed the enterprise-network_informations_device_posture branch from 54e0723 to 9e16467 Compare December 19, 2025 14:24
@lissyx lissyx force-pushed the enterprise-network_informations_device_posture branch from 9e16467 to eded123 Compare December 19, 2025 14:29
Copy link
Contributor

@gcp gcp left a 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};
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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 */ \
Copy link
Contributor

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);
Copy link
Contributor

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.

Copy link
Contributor

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 {};
Copy link
Contributor

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()) {
Copy link
Contributor

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); ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants