Bug 434317 - Firewall module does not support netmasks
Summary: Firewall module does not support netmasks
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_firewall (show other bugs)
Version: 5.21.2
Platform: Arch Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 461725 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-03-12 10:59 UTC by Alve
Modified: 2022-11-12 19:30 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.27


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alve 2021-03-12 10:59:05 UTC
SUMMARY
When trying to enter a perfectly valid rule (source = 192.168.1.0/24), I can't enter the / in the field.

STEPS TO REPRODUCE
1. Open system settings
2. Go to firewall
3. Press "Add rule"
4. Try adding the rule "allow from 192.168.1.0/24"

OBSERVED RESULT
Can't enter the rule correctly

EXPECTED RESULT
Should be allowed to enter the rule

SOFTWARE/OS VERSIONS


Linux/KDE Plasma: Arch Linux with Linux 5.10.21-rt34-xanmod1-1-rt
(available in About System)
KDE Plasma Version: 5.21.2
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

-- Backtrace:
Application: System Settings (systemsettings5), signal: Segmentation fault

[KCrash Handler]
#4  0x00007f6bbe61ccd8 in vtable for __cxxabiv1::__si_class_type_info () at /usr/lib/libstdc++.so.6
#5  0x00007f6ba1772bb6 in  () at /usr/lib/qt/plugins/kcms/kcm_firewall.so
#6  0x00007f6ba177515c in  () at /usr/lib/qt/plugins/kcms/kcm_firewall.so
#7  0x00007f6bbebc8b85 in KPluginFactory::create(char const*, QWidget*, QObject*, QList<QVariant> const&, QString const&) () at /usr/lib/libKF5CoreAddons.so.5
#8  0x00007f6bc0096552 in KCModuleLoader::loadModule(KCModuleInfo const&, KCModuleLoader::ErrorReporting, QWidget*, QStringList const&) () at /usr/lib/libKF5KCMUtils.so.5
#9  0x00007f6bc009ef24 in  () at /usr/lib/libKF5KCMUtils.so.5
#10 0x00007f6bc009f38b in KCModuleProxy::realModule() const () at /usr/lib/libKF5KCMUtils.so.5
#11 0x00007f6bc009fa84 in KCModuleProxy::showEvent(QShowEvent*) () at /usr/lib/libKF5KCMUtils.so.5
#12 0x00007f6bbf4e4b0e in QWidget::event(QEvent*) () at /usr/lib/libQt5Widgets.so.5
#13 0x00007f6bbf4a3752 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#14 0x00007f6bbe8e0a2a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#15 0x00007f6bbf4e1338 in QWidgetPrivate::show_helper() () at /usr/lib/libQt5Widgets.so.5
#16 0x00007f6bbf4e128a in QWidgetPrivate::showChildren(bool) () at /usr/lib/libQt5Widgets.so.5
#17 0x00007f6bbf4e1312 in QWidgetPrivate::show_helper() () at /usr/lib/libQt5Widgets.so.5
#18 0x00007f6bbf4e464d in QWidgetPrivate::setVisible(bool) () at /usr/lib/libQt5Widgets.so.5
#19 0x00007f6bbf4e1273 in QWidgetPrivate::showChildren(bool) () at /usr/lib/libQt5Widgets.so.5
#20 0x00007f6bbf4e1312 in QWidgetPrivate::show_helper() () at /usr/lib/libQt5Widgets.so.5
#21 0x00007f6bbf4e464d in QWidgetPrivate::setVisible(bool) () at /usr/lib/libQt5Widgets.so.5
#22 0x00007f6bbf4c91a2 in QStackedLayout::setCurrentIndex(int) () at /usr/lib/libQt5Widgets.so.5
#23 0x00007f6bbfc402b4 in  () at /usr/lib/libKF5WidgetsAddons.so.5
#24 0x00007f6bbe917dc0 in  () at /usr/lib/libQt5Core.so.5
#25 0x00007f6bbe88a731 in QItemSelectionModel::selectionChanged(QItemSelection const&, QItemSelection const&) () at /usr/lib/libQt5Core.so.5
#26 0x00007f6bbe893551 in QItemSelectionModel::select(QItemSelection const&, QFlags<QItemSelectionModel::SelectionFlag>) () at /usr/lib/libQt5Core.so.5
#27 0x00007f6bbe88e075 in QItemSelectionModel::setCurrentIndex(QModelIndex const&, QFlags<QItemSelectionModel::SelectionFlag>) () at /usr/lib/libQt5Core.so.5
#28 0x00007f6bbfc3e688 in  () at /usr/lib/libKF5WidgetsAddons.so.5
#29 0x00007f6bbfc4012d in  () at /usr/lib/libKF5WidgetsAddons.so.5
#30 0x00007f6bbe917dc0 in  () at /usr/lib/libQt5Core.so.5
#31 0x00007f6bbe87a087 in QAbstractItemModel::layoutChanged(QList<QPersistentModelIndex> const&, QAbstractItemModel::LayoutChangeHint) () at /usr/lib/libQt5Core.so.5
#32 0x00007f6bbfc46a85 in KPageWidgetModel::addPage(KPageWidgetItem*) () at /usr/lib/libKF5WidgetsAddons.so.5
#33 0x00007f6bb130edb0 in  () at /usr/lib/qt/plugins/systemsettingsview/systemsettings_sidebar_mode.so
#34 0x00007f6bb13016dd in  () at /usr/lib/qt/plugins/systemsettingsview/systemsettings_sidebar_mode.so
#35 0x00007f6bb12ff78e in  () at /usr/lib/qt/plugins/systemsettingsview/systemsettings_sidebar_mode.so
#36 0x00007f6bb1300063 in  () at /usr/lib/qt/plugins/systemsettingsview/systemsettings_sidebar_mode.so
#37 0x00007f6bbd9fe56e in  () at /usr/lib/libQt5Qml.so.5
#38 0x00007f6bbd8e409f in  () at /usr/lib/libQt5Qml.so.5
#39 0x00007f6bbd8e5f3a in QV4::QObjectMethod::callInternal(QV4::Value const*, QV4::Value const*, int) const () at /usr/lib/libQt5Qml.so.5
#40 0x00007f6bbd901b37 in  () at /usr/lib/libQt5Qml.so.5
#41 0x00007f6bbd90468f in  () at /usr/lib/libQt5Qml.so.5
#42 0x00007f6bbd89ed2e in QV4::Function::call(QV4::Value const*, QV4::Value const*, int, QV4::ExecutionContext const*) () at /usr/lib/libQt5Qml.so.5
#43 0x00007f6bbda1a916 in QQmlJavaScriptExpression::evaluate(QV4::CallData*, bool*) () at /usr/lib/libQt5Qml.so.5
#44 0x00007f6bbd9cd62d in QQmlBoundSignalExpression::evaluate(void**) () at /usr/lib/libQt5Qml.so.5
#45 0x00007f6bbd9cdb11 in  () at /usr/lib/libQt5Qml.so.5
#46 0x00007f6bbd9fe00d in QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) () at /usr/lib/libQt5Qml.so.5
#47 0x00007f6bbe917905 in  () at /usr/lib/libQt5Core.so.5
#48 0x00007f6bb8a21732 in QQuickAbstractButtonPrivate::handleRelease(QPointF const&) () at /usr/lib/libQt5QuickTemplates2.so.5
#49 0x00007f6bb8a3f011 in QQuickControl::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/libQt5QuickTemplates2.so.5
#50 0x00007f6bbddf2058 in QQuickItem::event(QEvent*) () at /usr/lib/libQt5Quick.so.5
#51 0x00007f6bbf4a3752 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#52 0x00007f6bbe8e0a2a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#53 0x00007f6bbde0e898 in QQuickWindowPrivate::deliverMouseEvent(QQuickPointerMouseEvent*) () at /usr/lib/libQt5Quick.so.5
#54 0x00007f6bbde0fc4c in QQuickWindowPrivate::deliverPointerEvent(QQuickPointerEvent*) () at /usr/lib/libQt5Quick.so.5
#55 0x00007f6bbedc1b95 in QWindow::event(QEvent*) () at /usr/lib/libQt5Gui.so.5
#56 0x00007f6bbf4a3752 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#57 0x00007f6bbe8e0a2a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#58 0x00007f6bbe13435a in QQuickWidget::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/libQt5QuickWidgets.so.5
#59 0x00007f6bbf4e4b0e in QWidget::event(QEvent*) () at /usr/lib/libQt5Widgets.so.5
#60 0x00007f6bbf4a3752 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#61 0x00007f6bbf4aa87b in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#62 0x00007f6bbe8e0a2a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#63 0x00007f6bbf4a987e in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /usr/lib/libQt5Widgets.so.5
#64 0x00007f6bbf4fd249 in  () at /usr/lib/libQt5Widgets.so.5
#65 0x00007f6bbf50063f in  () at /usr/lib/libQt5Widgets.so.5
#66 0x00007f6bbf4a3752 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#67 0x00007f6bbe8e0a2a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#68 0x00007f6bbedb5594 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/libQt5Gui.so.5
#69 0x00007f6bbed8abb5 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Gui.so.5
#70 0x00007f6bb96f416c in  () at /usr/lib/libQt5XcbQpa.so.5
#71 0x00007f6bbc5aab84 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#72 0x00007f6bbc5fec21 in  () at /usr/lib/libglib-2.0.so.0
#73 0x00007f6bbc5a93b1 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#74 0x00007f6bbe939691 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#75 0x00007f6bbe8df3ac in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#76 0x00007f6bbe8e7844 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#77 0x000055dde369b960 in  ()
#78 0x00007f6bbe163b25 in __libc_start_main () at /usr/lib/libc.so.6
#79 0x000055dde369c47e in _start ()
[Inferior 1 (process 73188) detached
Comment 1 Alve 2021-03-12 11:00:15 UTC
(the crash occurs when having added a rule using the command line and then going to the page and then from it and then back to it, the backtrace is therefore partially unrelated to this bug!)
Comment 2 tcanabrava 2021-03-12 11:16:42 UTC
I'm doing this week a firewall mini hackaton where I'll try to add this and other improvements.
Comment 3 Daniel Vrátil 2022-06-20 14:50:42 UTC
Git commit 867e5824387344f0795382b17dcf37ab1b5f5cdc by Daniel Vrátil.
Committed on 20/06/2022 at 14:48.
Pushed by dvratil into branch 'feature/ip-netmask'.

Allow IP addresses with netmask in advanced rule editor

Especially for firewall configuration, it's very much useful to be
able to allow or block subnets (e.g. I want to allow all traffic
originating on trusted part of my home network). Both UFW and
firewalld to accept IP addresses with netmask, so it is just about
allowing them in the input's validtors.

I decided to replace the regular expressions with a custom QValidator
subclass, which uses lib'c inet_pton() to validate the entered IP
address and can also handle optional netmasks.
CHANGELOG: Allow IP addresses with netmask in advanced rule editor

M  +2    -0    CMakeLists.txt
A  +3    -0    autotests/CMakeLists.txt
A  +72   -0    autotests/ipvalidatortest.cpp     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
M  +2    -0    kcm/core/CMakeLists.txt
A  +102  -0    kcm/core/ipvalidator.cpp     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
A  +31   -0    kcm/core/ipvalidator.h     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
M  +2    -0    kcm/kcm.cpp
M  +3    -7    kcm/package/contents/ui/IpTextField.qml

https://invent.kde.org/plasma/plasma-firewall/commit/867e5824387344f0795382b17dcf37ab1b5f5cdc
Comment 4 Bug Janitor Service 2022-06-21 18:48:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-firewall/-/merge_requests/47
Comment 5 Daniel Vrátil 2022-10-19 18:10:36 UTC
Git commit 8bb9853f7fc6ddc8fd72d7bf4079713aa36008c6 by Daniel Vrátil.
Committed on 19/10/2022 at 15:48.
Pushed by dvratil into branch 'master'.

Allow IP addresses with netmask in advanced rule editor

Especially for firewall configuration, it's very much useful to be
able to allow or block subnets (e.g. I want to allow all traffic
originating on trusted part of my home network). Both UFW and
firewalld do accept IP addresses with netmask, so it is just about
allowing them in the input's validtors.

I decided to replace the regular expressions with a custom QValidator
subclass, which uses lib'c inet_pton() to validate the entered IP
address and can also handle optional netmasks.
CHANGELOG: Allow IP addresses with netmask in advanced rule editor

M  +2    -0    CMakeLists.txt
A  +3    -0    autotests/CMakeLists.txt
A  +72   -0    autotests/ipvalidatortest.cpp     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
M  +2    -0    kcm/core/CMakeLists.txt
A  +107  -0    kcm/core/ipvalidator.cpp     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
A  +31   -0    kcm/core/ipvalidator.h     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
M  +2    -0    kcm/kcm.cpp
M  +3    -7    kcm/package/contents/ui/IpTextField.qml

https://invent.kde.org/plasma/plasma-firewall/commit/8bb9853f7fc6ddc8fd72d7bf4079713aa36008c6
Comment 6 Paul Worrall 2022-11-12 19:30:12 UTC
*** Bug 461725 has been marked as a duplicate of this bug. ***