diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..47b20bb57d --- /dev/null +++ b/.clang-format @@ -0,0 +1,108 @@ +Language: Cpp + +TabWidth: 4 +IndentWidth: 4 +UseTab: Never +ColumnLimit: 100 +ContinuationIndentWidth: 4 +UseCRLF: false + +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignConsecutiveMacros: true +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Empty +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: AllDefinitions +AlwaysBreakBeforeMultilineStrings: false + +BinPackArguments: false +BinPackParameters: false +BreakBeforeBraces: Custom +BraceWrapping: + AfterCaseLabel: true + AfterControlStatement: Never + AfterEnum: false + AfterFunction: true + AfterStruct: false + AfterUnion: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: false +BreakBeforeBinaryOperators: All +BreakBeforeTernaryOperators: true +BreakStringLiterals: true + +IncludeBlocks: Preserve +IndentCaseLabels: false +IndentGotoLabels: false +IndentPPDirectives: BeforeHash +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: false +MaxEmptyLinesToKeep: 1 + +DerivePointerAlignment: false +PointerAlignment: Right +ReflowComments: false +SortIncludes: false +SpaceAfterCStyleCast: true +SpaceAfterLogicalNot: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: Always +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInCStyleCastParentheses: false +SpacesInContainerLiterals: false +SpacesInParentheses: false + +ForEachMacros: ['c_list_for_each', + 'c_list_for_each_continue', + 'c_list_for_each_entry', + 'c_list_for_each_entry_continue', + 'c_list_for_each_entry_safe', + 'c_list_for_each_entry_safe_continue', + 'c_list_for_each_entry_safe_unlink', + 'c_list_for_each_safe', + 'c_list_for_each_safe_continue', + 'c_list_for_each_safe_unlink', + 'c_rbtree_for_each', + 'c_rbtree_for_each_entry', + 'c_rbtree_for_each_entry_postorder', + 'c_rbtree_for_each_entry_safe', + 'c_rbtree_for_each_entry_safe_postorder', + 'c_rbtree_for_each_entry_safe_postorder_unlink', + 'c_rbtree_for_each_postorder', + 'c_rbtree_for_each_safe', + 'c_rbtree_for_each_safe_postorder', + 'c_rbtree_for_each_safe_postorder_unlink', + 'json_object_foreach_safe', + 'ndp_msg_opt_dnssl_for_each_domain', + 'ndp_msg_opt_for_each_offset', + 'ndp_msg_opt_rdnss_for_each_addr', + 'nla_for_each_attr', + 'nla_for_each_nested', + 'nm_c_list_for_each_entry_prev', + 'nm_dedup_multi_iter_for_each', + 'nm_ip_config_iter_ip4_address_for_each', + 'nm_ip_config_iter_ip4_route_for_each', + 'nm_ip_config_iter_ip6_address_for_each', + 'nm_ip_config_iter_ip6_route_for_each', + 'nm_json_array_foreach', + 'nm_json_object_foreach', + 'nm_manager_for_each_active_connection', + 'nm_manager_for_each_active_connection_safe', + 'nm_manager_for_each_device', + 'nm_manager_for_each_device_safe', + 'nmp_cache_iter_for_each', + 'nmp_cache_iter_for_each_link', + ] diff --git a/.gitignore b/.gitignore index 5cb43a0374..919b1830c9 100644 --- a/.gitignore +++ b/.gitignore @@ -131,6 +131,7 @@ test-*.trs /examples/C/qt/monitor-nm-running /examples/C/qt/monitor-nm-running.moc +/shared/nm-glib-aux/tests/test-json-aux /shared/nm-glib-aux/tests/test-shared-general /shared/nm-version-macros.h diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 389da67218..253bf7593b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -79,7 +79,7 @@ checkpatch: script: - date '+%Y%m%d-%H%M%S'; dnf install -y git black - date '+%Y%m%d-%H%M%S'; NM_CHECKPATCH_FETCH_UPSTREAM=1 contrib/scripts/checkpatch-feature-branch.sh 2>&1 | tee checkpatch-out.txt - - date '+%Y%m%d-%H%M%S'; black --check . + - date '+%Y%m%d-%H%M%S'; black --check . examples/python/gi/nm-wg-set allow_failure: true artifacts: when: on_failure diff --git a/Makefile.am b/Makefile.am index bec61e0405..01fd835e17 100644 --- a/Makefile.am +++ b/Makefile.am @@ -356,6 +356,9 @@ shared_nm_std_aux_libnm_std_aux_la_SOURCES = \ shared/nm-std-aux/c-list-util.c \ shared/nm-std-aux/c-list-util.h \ shared/nm-std-aux/nm-dbus-compat.h \ + shared/nm-std-aux/nm-std-aux.h \ + shared/nm-std-aux/nm-std-utils.c \ + shared/nm-std-aux/nm-std-utils.h \ shared/nm-std-aux/unaligned.h \ $(NULL) @@ -639,6 +642,39 @@ shared_nm_glib_aux_tests_test_shared_general_LDADD = \ ############################################################################### +if WITH_JANSSON + +check_programs += shared/nm-glib-aux/tests/test-json-aux + +shared_nm_glib_aux_tests_test_json_aux_CPPFLAGS = \ + $(dflt_cppflags) \ + -I$(srcdir)/shared \ + -DNETWORKMANAGER_COMPILATION_TEST \ + -DNETWORKMANAGER_COMPILATION='(NM_NETWORKMANAGER_COMPILATION_GLIB|NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG)' \ + $(CODE_COVERAGE_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(JANSSON_CFLAGS) \ + $(SANITIZER_LIB_CFLAGS) \ + $(NULL) + +shared_nm_glib_aux_tests_test_json_aux_LDFLAGS = \ + $(CODE_COVERAGE_LDFLAGS) \ + $(SANITIZER_EXEC_LDFLAGS) \ + $(NULL) + +shared_nm_glib_aux_tests_test_json_aux_LDADD = \ + $(JANSSON_LIBS) \ + shared/nm-glib-aux/libnm-glib-aux.la \ + shared/systemd/libnm-systemd-logging-stub.la \ + shared/nm-std-aux/libnm-std-aux.la \ + shared/libcsiphash.la \ + $(GLIB_LIBS) \ + $(NULL) + +endif + +############################################################################### + noinst_LTLIBRARIES += introspection/libnmdbus.la introspection_libnmdbus_la_CPPFLAGS = $(GLIB_CFLAGS) @@ -1028,13 +1064,6 @@ libnm_core_lib_c_real = \ libnm-core/nm-vpn-plugin-info.c \ $(NULL) -if WITH_JSON_VALIDATION -libnm_core_lib_h_priv += \ - libnm-core/nm-json.h -libnm_core_lib_c_real += \ - libnm-core/nm-json.c -endif - libnm_core_lib_c_mkenums = \ libnm-core/nm-core-enum-types.c @@ -1089,11 +1118,6 @@ libnm_core_libnm_core_la_CPPFLAGS = \ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE \ $(NULL) -if WITH_JSON_VALIDATION -libnm_core_libnm_core_la_CPPFLAGS += $(JANSSON_CFLAGS) -libnm_core_libnm_core_la_CPPFLAGS += -fcommon -endif - libnm_core_libnm_core_la_SOURCES = \ $(libnm_core_lib_h_pub_real) \ $(libnm_core_lib_h_priv) \ @@ -3075,6 +3099,7 @@ EXTRA_DIST += \ src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_Team_Infiniband_Port.cexpected \ src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_Team_Port.cexpected \ src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_VLAN_reorder_hdr.cexpected \ + src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_WiFi_AP_Mode.cexpected \ src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_WiFi_Band_A.cexpected \ src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_WiFi_Hidden.cexpected \ src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-Test_Write_WiFi_MAC_always.cexpected \ @@ -5238,6 +5263,12 @@ CLEANFILES += \ include Makefile.examples +if WITH_PYTHON_BLACK +check-python-black: + test "$$NMTST_SKIP_PYTHON_BLACK" != 1 && $(BLACK) --check $(top_srcdir) $(top_srcdir)/examples/python/gi/nm-wg-set +check_local += check-python-black +endif + ############################################################################### check-local: $(check_local) diff --git a/NEWS b/NEWS index f4207b82b7..ca30fd033d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,13 @@ +============================================= +NetworkManager-1.28 +Overview of changes since NetworkManager-1.26 +============================================= + +This is a snapshot of NetworkManager 1.28 development series. +The API is subject to change and not guaranteed to be compatible +with the later release. +USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE! + ============================================= NetworkManager-1.26 Overview of changes since NetworkManager-1.24 diff --git a/RELICENSE.md b/RELICENSE.md index 4bdea1e7e8..88215e0531 100644 --- a/RELICENSE.md +++ b/RELICENSE.md @@ -73,6 +73,7 @@ Consent/Disapproval List - [Y] Aleksander Morgado - [Y] Alfonso Sánchez-Beato (Canonical, Ltd.) +- [Y] Andrew Zaborowski (Intel Corporation) - [Y] Antoine Faure (Sigfox) - [Y] Antony Mee - [Y] Atul Anand @@ -126,13 +127,13 @@ The contributors above may have contributed the code on behalf of a company that holds the copyright. This list tracks such legal entities. The contributor list above indicates whether a contributor provided code for a legal entity here. -- [?] Intel Corporation - [?] Novell, Inc. - [?] SUSE - [Y] Canonical, Ltd. - [Y] Endless Mobile, Inc. - [Y] Endless OS LLC +- [Y] Intel Corporation - [Y] One Laptop per Child - [Y] Pengutronix - [Y] Red Hat, Inc. diff --git a/TODO b/TODO index e24ef78e26..0732bcc404 100644 --- a/TODO +++ b/TODO @@ -23,7 +23,7 @@ possibly get inspired by nm-connection-editor. * Add Azure support to nm-cloud-setup. -nm-cloud-setup currently only works for EC2 (and only for IPv4). Add support for Azure +Currently, nm-cloud-setup only works for EC2 (and only for IPv4). Add support for Azure cloud. See for example SUSE's cloud-netconfig which supports Azure (https://github.com/SUSE-Enceladus/cloud-netconfig, https://www.suse.com/c/multi-nic-cloud-netconfig-ec2-azure/). Note that cloud-netconfig @@ -33,7 +33,7 @@ anyway be almost impossible, because one is written in bash and the other in C. * Improve our gitlab-ci integration. -Currently our .gitlab-ci starts various base containers and first installs +Currently, our .gitlab-ci starts various base containers and first installs the necessary dependencies. That takes time and consumes bandwidth, we should instead use more suitable containers. We should instead use ci-templates from https://gitlab.freedesktop.org/freedesktop/ci-templates. @@ -110,7 +110,7 @@ connected before the drop. * VPN IP Methods Some VPNs (openvpn with TAP for example) require that DHCP is run on a -pseudo-ethernet device to obtain addressing information. This is not currently +pseudo-ethernet device to obtain addressing information. Currenty, this is not possible, but NM already has all the code for DHCP. Thus, a new "method" key should be defined in include/NetworkManagerVPN.h to allow for DHCP to be performed if the VPN service daemon requests it in the IP4Config or IP6Config diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 2b9c4a25ad..39f8be59f5 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -5372,7 +5372,7 @@ read_properties: const char *slave_type = nm_setting_connection_get_slave_type (s_con); /* If only bother when there's a type, which is not guaranteed at this point. - * Otherwise the validation will fail anyway. */ + * Otherwise, the validation will fail anyway. */ if (type) { gs_free char *try_name = NULL; gs_free char *default_name = NULL; @@ -6709,7 +6709,7 @@ editor_sub_usage (const char *command) g_print (_("remove [||