-
Notifications
You must be signed in to change notification settings - Fork 229
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
Properties.Get() SIGSEGV(segment violation) #245
Comments
|
@leiless Hello! |
Not quite yet, have no idea what's going on here, I switch to not to use godbus to solve my problem. |
Hey! package main
import (
"fmt"
"os"
"github.com/godbus/dbus/v5"
)
const (
IFACEGETPROP = "org.freedesktop.DBus.Properties.Get"
NMNODE = "org.freedesktop.NetworkManager"
NMOBJPATH = "/org/freedesktop/NetworkManager/DnsManager"
NMIFACECONF = "org.freedesktop.NetworkManager.DnsManager"
NMPROPNAME = "Configuration"
)
func main() {
conn, err := dbus.ConnectSystemBus()
if err != nil {
fmt.Fprintln(os.Stderr, "Failed to connect to system bus:", err)
os.Exit(1)
}
defer conn.Close()
nmObj := conn.Object(NMNODE, NMOBJPATH)
nmConfig := nmObj.Call(IFACEGETPROP, 0, NMIFACECONF, NMPROPNAME).Body[0]
fmt.Printf("NM Config: %+v\n", nmConfig)
} Output: $ go run main.go
NM Config: [{"interface": <"eth0">, "nameservers": <["8.8.8.8", "1.1.1.1"]>, "priority": <100>, "vpn": <false>}] |
@leiless Are you just trying to read this property from NetworkManager, or are you trying to implement a NetworkManager-compatible interface (i.e. "fake" this property to someone else trying to read it)? Because the first part of your example is accomplishing the latter, but the second part does the former. In case of only reading, @esendjer's code is enough. The |
Hi, godbus developers, I have a minimal reproducible code to represent the segment fault.
I believe there certainly some kinda misuse of the
propsSpec
?And I don't know how to present the
Configuration
result according to https://developer.gnome.org/NetworkManager/stable/gdbus-org.freedesktop.NetworkManager.DnsManager.htmlRun result:
The text was updated successfully, but these errors were encountered: