summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-11-13libnm/client: don't reset properties when interface goes awaylr/object-removalLubomir Rintel3-31/+23
In case the D-Bus interfaces start dropping off (typically all off them go one by one when the object is being deleted), don't reset all the properties. In particular, keep most properties around, only tear down "o" and "ao", so that the object dependencies get torn down, but we still get enough properties around to identify what the dead object was its heyday. One example of where this is not good is when the device-removed signal is emmitted, the device no longer has the ifname: $ nmcli monitor <quit NetworkManager> (null): device removed (null): device removed ...
2022-11-13libnm/client/test: test cleanup on service shutdownLubomir Rintel1-6/+16
Currently we assert that properties are reset on client teardown. That is not the right thing to do and we're not going to do that in future. However, what is important to test is that the properties are reset when the daemon goes away. Test that.
2022-11-13libnm/client/test: always run the cleanup testLubomir Rintel1-80/+98
The part where a device was created and its cleanup on client description was only run randomly. This is silly and gave me hard time. No reason not to be always running it.
2022-11-13tests/client: test nmcli monitorLubomir Rintel1-1/+37
Some basic tests for nmcli monitor. Note that they now assert against behavior that I find incorrect. Will be fixed separately.
2022-11-13nmcli/monitor: always print running status on monitor startupLubomir Rintel1-10/+2
Previously we'd note if NM is stopped, but not if it's running. I suppose it's nice for the user to know that the monitor started running, but, it's also important for the monitor to be testable (so that we know that we are ready to start adding mock objects, etc.) This also gets rids of some duplication at expense of a little less nuanced message.
2022-11-11merge: branch 'lr/unbreak-gir'Lubomir Rintel80-201/+460
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1451
2022-11-10libnm/trivial: fix styleThomas Haller1-42/+41
Fixes: 412a5d2d080f ('libnm: show ethtool options in "gen-metadata-nm-settings-libnm-core.xml"')
2022-11-10ifcfg-rh: merge branch 'th/ethtool-ifcfg-fixes'Thomas Haller8-1/+236
https://bugzilla.redhat.com/show_bug.cgi?id=2134569 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1452
2022-11-10core: filter out invalid Wake-On-Lan flagsThomas Haller1-0/+10
NMSettingWired does not reject invalid flags. Filter them out in wake_on_lan_enable(). In practice, it makes no difference, the unknown flags were ignored anyway.
2022-11-10ifcfg-rh: fix persisting all-default NMSettingEthtool with autoneg/wol flagsThomas Haller3-9/+7
Fixes: 26ed9e67140a ('ifcfg-rh: fix persisting all-default NMSettingEthtool settings')
2022-11-10ifcfg-rh: fix persisting ethtool optionsThomas Haller3-4/+4
If there were any pause options and any non-pause options, the created setting was invalid. I don't think it's reasonably possible to parse the broken settings. So there is no workaround trying to read the existing broken settings from disk. Luckily, the broken setting was just silently ignored by the parser, so you simply could not persist certain settings. https://bugzilla.redhat.com/show_bug.cgi?id=2134569 Fixes: 652ddca04c52 ('ethtool: Introducing PAUSE support')
2022-11-10ifcfg-rh/tests: add test checking persisting ethtool settings to ifcfg-rhThomas Haller6-0/+227
There are still various failures. That will be fixed next.
2022-11-10libnm: merge branch 'th/libnm-metadata-xml-ethtool'Thomas Haller5-262/+431
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1453
2022-11-10libnm: show ethtool options in "gen-metadata-nm-settings-libnm-core.xml"Thomas Haller2-39/+413
2022-11-10libnm: skip "name" property for "gen-metadata-nm-settings-libnm-core.xml"Thomas Haller2-208/+3
2022-11-10ethtool: add and use nm_ethtool_id_get_variant_type() helperThomas Haller3-16/+16
2022-11-10wwan/ofono: merge branch 'peat-psuwit:for-upstream/mr773-plus'Thomas Haller3-145/+594
https://bugs.launchpad.net/bugs/1565717 https://bugs.launchpad.net/bugs/1579098 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/771 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/773 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1392
2022-11-10wwan/ofono: cleanup comments and warnings in existing codeRatchanan Srirattanamet1-5/+0
2022-11-10wwan/ofono: fix memory leak in handle_settings()Ratchanan Srirattanamet1-5/+6
[thaller@redhat.com: modified original patch.] Fixes: 58287cbcc0c8 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
2022-11-10wwan/device-modem: re-check device availability after enableRatchanan Srirattanamet1-0/+5
It's possible that the modem is enabled outside of NM. If not re-check, device could stay disabled throughout until something else about the modem changes again.
2022-11-10wwan/modem: return early if set_mm_enable is not implementedRatchanan Srirattanamet1-3/+7
We don't want to e.g. pre-empt the state change signal, because it's not gonna happen.
2022-11-10wwan/device-modem: disabled but not enable-able modem is unavailableRatchanan Srirattanamet1-0/+19
If a modem is disabled, and it has no method to enable it, then by no mean it's "available" to NM.
2022-11-10wwan/ofono: avoid bogus IP failure when not connectingRatchanan Srirattanamet1-0/+8
If modem is not at least "registered", a connection is not happening, which means IP settings change is probably not interesting. Avoid trying to parse it, so that we don't trigger connection failure when there isn't one.
2022-11-10wwan/ofono: clear current_octx on disconnectRatchanan Srirattanamet1-0/+2
This way, we won't signal failure when "PropertyChanged" signal for an empty "Settings" eventually arrive.
2022-11-10wwan/ofono: also recognize connman's "Powered" propertyRatchanan Srirattanamet1-1/+18
This property "controls [oFono] whether packet radio use is allowed". It makes sense to consider the value of FALSE to mean DISABLED.
2022-11-10wwan/ofono: when connect while searching, wait a bitRatchanan Srirattanamet1-1/+47
We don't have to outright refuse to connect if we're not registered. Instead, wait up to 60 seconds for modem to register.
2022-11-10wwan/ofono: create connections based on available contextsBhushan Shah1-131/+483
Downstream patches for this does it through NMSettings plugin, however settings plugin are hard to maintain and complicated architecture wise as well. So directly create a connection profiles in-memory from the nm-modem-ofono side. Those profiles are created in /run, and are not added as a persistent connection, because connection state quite depends on the state of ofono This also allows us to drop the hack where we are keeping track of active context/APN through the connection name, i.e if connection name was in /imsi/context1 format, it was used. Instead now, Connection name is actual context name which is user friendly ("Vodafone Connect" e.g. in my case), and details like IMSI and context are stored internally. [ratchanan@ubports.com: - forward-ported to main branch. - fold "wwan/ofono: handle context removal" into this commit. - track the "preferred"-ness of the context and react accordingly. Creates proxies for all retrived contexts to listen to changes. While at it, also track name and type. - use, instead of ignore, internet APN. Also support internet+mms APN. - correct priv->contexts' value destroy function. - factor out UUID generation as a helper function. - handle the case where context dictionary is missing required keys. - simplify nm_ofono_connection_new's arguments and rename to add_or_update_connection. Makes it handle the case where the connection already exists. - also simplify other functions' arguments. - clean up code and comments. Fix memory problems. Get rid of warnings. ] Co-authored-by: Ratchanan Srirattanamet <ratchanan@ubports.com>
2022-11-09libnm: merge branch 'th/more-libnm-metadata-xml'Thomas Haller5-574/+1827
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1449
2022-11-08libnm: test that Gir data matches actual exportslr/unbreak-girLubomir Rintel4-2/+175
This verifies that what's in our public headers has version nodes, and that they match Since: tags. Not pretty (because python) but discovered a *lot* of issues.
2022-11-08libnm: add nm_utils_ensure_gtypes() helper to APIThomas Haller3-0/+25
"gen-metadata-nm-settings-libnm-core.xml" now contains also the names of the NMSetting types, like "NMSettingConnection". That can be useful to create NMSetting instances generically (that is, without knowing the C API that gets called). So you might be tempted to run #!/bin/python import gi gi.require_version("NM", "1.0") from gi.repository import GObject, NM connection = NM.SimpleConnection() # NM.utils_ensure_gtypes() gtype_name = "NMSetting6Lowpan" gtype = GObject.type_from_name(gtype_name) setting = GObject.new(gtype) connection.add_setting(setting) However, without NM.utils_ensure_gtypes() that would not work, because the GType is not yet created. For a user who doesn't know a priory all setting types, it's not entirely clear how to make this work. Well, a GObject introspection user could iterate over al NM.Setting* names and try to instantiate the classes. However, that is still cumbersome, and not accessible to a C user (without GI) and the currently loaded libnm library may be newer and have unknown setting types. In particular plain C user would need to know to call all the right nm_setting_*_get_type(), functions, so it needs to know all the existing 52 type getters (and cannot support those from a newer libnm version). With nm_utils_ensure_gtypes(), the user can get the typename and create instances generically only using g_type_from_name(). Possible alternatives: - libnm also has _nm_utils_init() which runs as __attribute__((constructor)). We could also always instantiate all GType there. However, I don't like running non-trivial, absolutely necessary code before main(). - hook nm_setting_get_type() to create all GType for the NMSetting subclasses too. The problem is, that it's not entirely trivial to avoid deadlock. - hook nm_connection_get_type() to create all NMSetting types. That would not deadlock, but it still is questionable whether we should automatically, at non-obvious times instantiate all GTypes.
2022-11-08libnm: show NMSetting gtype in "gen-metadata-nm-settings-libnm-core.xml"Thomas Haller2-55/+170
2022-11-08libnm: show gprop-data,is-secret,is-secret-flags in ↵Thomas Haller2-504/+1555
"gen-metadata-nm-settings-libnm-core.xml"
2022-11-08libnm: add code comment in "gen-metadata-nm-settings-libnm-core.xml"Thomas Haller2-0/+61
2022-11-08libnm: use NMStrBuf in "gen-metadata-nm-settings-libnm-core.c"Thomas Haller1-17/+18
It's more convenient to use, because we don't need to keep track (and free) the allocated string.
2022-11-08platform: merge branch 'th/nmp-cleanup'Thomas Haller3-191/+282
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1448
2022-11-08platform: only initialize actual data for stackinit NMPObjectThomas Haller1-2/+1
The NMPObject is a tagged union. There is no need to initialize anything after the size of the actually used union field. Change this, so maybe we get a valgrind warning about uninitialized memory if we wrongly try to access it. On the other hand, the object really is supposed to be a full NMPObject. Previously, we would get a valgrind warning, if we tried to pass fewer data there. It really doesn't matter much, but all other functions don't assume that there is any important data after the size indicated by the class.
2022-11-08platform: add internal helper function to get full NMPObject sizeThomas Haller1-7/+13
2022-11-08platform: extend cmd_obj_{hash_update,cmp}() hooks to check for identityThomas Haller3-51/+81
We will extend IPv4 routes with the list of next hops. This field will be heap allocated and be part of the NMPObjectIP4Route object, while also being part of the identity. To support the ID operator that checks fields of the NMPObject, add a "for_id" argument to the hash/cmp hooks. Also, a function that sets cmd_obj_{hash_update,cmp}() MUST not set cmd_plobj_id_{hashupdate,cmp}(), as it would have overlapping functionality. Therefore, the objects that define cmd_obj_{hash_update,cmp}() need to fully implement the ID comparison.
2022-11-08platform: unify full/id hash/cmp implementations for NMPObjectThomas Haller3-79/+97
2022-11-08platform/tests: add unit test checking consistency of NMPClassThomas Haller1-8/+49
2022-11-08platform: drop redundant hook implementations from NMPObject classesThomas Haller2-66/+64
A NMPClass that has data outside the plobj part, needs to implement the cmd_obj_*() hooks, instead of cmd_plobj_*(). For those objects, reasoning only about the plobj part is not sufficient. Implementing both hooks is also unnecessary and confusing. Ensure that if we have cmd_obj_*() hooks set, that the corresponding cmd_plobj_*() hooks are unset.
2022-11-08platform: fix nmp_object_copy(id_only) for object that don't implement ↵Thomas Haller1-4/+3
cmd_plobj_id_copy() The if-else-if was wrong. It meant that if an object did not implement cmd_plobj_id_copy(), nothign was copied (for id-only). I think this code path was not actually hit, because we never clone an object only by ID. Fixes: c91a4617a102 ('nmp-object: allow missing implementations for certain virtual functions')
2022-11-08Makefile.am: tidy up the introspection conditional partLubomir Rintel1-18/+18
Use of conditionals in makefiles needs to be kept to a necessary minimum otherwise they get out of hand quickly. There's no indentation to aid reading and conditional chunks longer than a screen and nested ones are almost impossible to comprehend. The "if HAVE_INTROSPECTION" part does both. Let's make it a little less horrible. There's generally no point in making unused targets or variable assignment unless they collide with pre-built stuff or have multiple variants.
2022-11-08docs/api: fix ugly things in MakefileLubomir Rintel1-14/+2
Turns out automake doesn't like either that we add dependencies to a target conditionally. Not sure why, but it's a tasteless thing to do nevertheless: gtk-doc.make:174: warning: $(DOC_MAIN_SGML_FILE) was already defined in condition BUILD_DOCS, which is included in condition TRUE ... docs/api/Makefile.am:112: 'gtk-doc.make' included from here docs/api/Makefile.am:14: ... '$(DOC_MAIN_SGML_FILE)' previously defined here In any case, the dependency is wrong in the first place -- the source document doesn't depend on other source. The target (which is a stamp file, since the xslt processor produces multiple files) does! Moreover, there's a dependency of the stamp file on $(content_files) already, so including GENERATED_FILES (like we already do) in content_files should be sufficient. While at that, deal with other not-so-nice things; don't extend "all" target needlessly and don't define a target conditionally.
2022-11-08libnm: actually export a lot of routines that were supposed to be publicLubomir Rintel32-49/+76
Add them to @libnm_1_40_4 as opposed to @libnm_1_42_0 because we now know this is going to be backported to 1.40.4 first.
2022-11-08libnm: export nm_utils_ip_{address,rout}es_{from,to}_variantLubomir Rintel3-2/+18
These are present in a public header yet are not properly commented, versioned or exported. Export them now. Another option would be to move them to a private header; but I suspect someone has intended them to be exported at some point. Add them to @libnm_1_40_4 as opposed to @libnm_1_42_0 because we now know this is going to be backported to 1.40.4 first.
2022-11-08libnm/connection: fix a handful of versioning tagsLubomir Rintel2-10/+11
These are marked as being available sooner than they actually appear in libnm.ver.
2022-11-08libnm: fix a large amount of Since tagsLubomir Rintel48-35/+149
Some comments are malformed, some are missing altogether.
2022-11-08libnm: drop nm_vpn_plugin_old_set_{,ip6_}config()Lubomir Rintel2-22/+6
Remove the functions from a public header. They were missing from libnm.ver and thus never actually exported. There's no point in salvaging them now as the whole NMVpnPluginOld has been replaced NMVpnServicePlugin and new uses are discouraged.
2022-11-08libnm: remove nm_device_wpan_get_hw_address()Lubomir Rintel2-23/+0
Remove the function from a public header. It was missing from libnm.ver and thus never actually exported. There's no point in salvaging it now as it nm_device_get_hw_address() exists as a better option.