-
Notifications
You must be signed in to change notification settings - Fork 666
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
Add network interface settings for mDNS/LLMNR #5520
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,10 +9,17 @@ | |||||
ConnectionStateType, | ||||||
DeviceType, | ||||||
InterfaceMethod as NMInterfaceMethod, | ||||||
MulticastDnsValue, | ||||||
) | ||||||
from ..dbus.network.connection import NetworkConnection | ||||||
from ..dbus.network.interface import NetworkInterface | ||||||
from .const import AuthMethod, InterfaceMethod, InterfaceType, WifiMode | ||||||
from .const import ( | ||||||
AuthMethod, | ||||||
InterfaceMethod, | ||||||
InterfaceType, | ||||||
MulticastDnsMode, | ||||||
WifiMode, | ||||||
) | ||||||
|
||||||
|
||||||
@dataclass(slots=True) | ||||||
|
@@ -82,6 +89,8 @@ class Interface: | |||||
ipv6setting: IpSetting | None | ||||||
wifi: WifiConfig | None | ||||||
vlan: VlanConfig | None | ||||||
mdns: MulticastDnsMode | None | ||||||
llmnr: MulticastDnsMode | None | ||||||
|
||||||
def equals_dbus_interface(self, inet: NetworkInterface) -> bool: | ||||||
"""Return true if this represents the dbus interface.""" | ||||||
|
@@ -145,6 +154,13 @@ def from_dbus_interface(inet: NetworkInterface) -> "Interface": | |||||
and ConnectionStateFlags.IP6_READY in inet.connection.state_flags | ||||||
) | ||||||
|
||||||
if inet.settings and inet.settings.connection: | ||||||
mdns = inet.settings.connection.mdns | ||||||
lldmp = inet.settings.connection.lldmp | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
else: | ||||||
mdns = None | ||||||
lldmp = None | ||||||
Comment on lines
+157
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix typo in variable name: 'lldmp' should be 'llmnr'. The variable name 'lldmp' should be 'llmnr' for consistency. - lldmp = inet.settings.connection.lldmp
+ llmnr = inet.settings.connection.llmnr
- lldmp = None
+ llmnr = None
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bot is right, this should be corrected as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sairon Yes, I found that the typo appears in multiple places. The correction should be made in:
This will ensure consistency throughout the codebase by using the correct terminology (LLMNR - Link-Local Multicast Name Resolution) everywhere. 🔗 Analysis chain🏁 Scripts executedThe following scripts were executed for the analysis: Script:
Length of output: 71 Script:
Length of output: 536 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
return Interface( | ||||||
inet.name, | ||||||
inet.hw_address, | ||||||
|
@@ -181,6 +197,8 @@ def from_dbus_interface(inet: NetworkInterface) -> "Interface": | |||||
ipv6_setting, | ||||||
Interface._map_nm_wifi(inet), | ||||||
Interface._map_nm_vlan(inet), | ||||||
Interface._map_nm_multicast_dns(mdns), | ||||||
Interface._map_nm_multicast_dns(lldmp), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
) | ||||||
|
||||||
@staticmethod | ||||||
|
@@ -258,3 +276,13 @@ def _map_nm_vlan(inet: NetworkInterface) -> WifiConfig | None: | |||||
return None | ||||||
|
||||||
return VlanConfig(inet.settings.vlan.id, inet.settings.vlan.parent) | ||||||
|
||||||
@staticmethod | ||||||
def _map_nm_multicast_dns(mode: int | None) -> MulticastDnsMode | None: | ||||||
mapping = { | ||||||
MulticastDnsValue.OFF: MulticastDnsMode.OFF, | ||||||
MulticastDnsValue.RESOLVE: MulticastDnsMode.RESOLVE, | ||||||
MulticastDnsValue.ANNOUNCE: MulticastDnsMode.ANNOUNCE, | ||||||
} | ||||||
|
||||||
return mapping[mode] |
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.