diff --git a/src/acquisition.cpp b/src/acquisition.cpp index 7d67af7..c5eaf2d 100644 --- a/src/acquisition.cpp +++ b/src/acquisition.cpp @@ -97,11 +97,17 @@ void Acquisition::set_capture_want(bool want, std::uint32_t slots) { g_mkdir_with_parents(dir.c_str(), 0700); capture_path_ = dir + "/capture.bin"; std::uint32_t addr = 0; - struct ::in_addr a; - if (cfg_.source_kind == "udps" && ::inet_pton(AF_INET, cfg_.server.c_str(), &a) == 1) { - addr = a.s_addr; // already network order, which is what the header wants + std::uint16_t peer_port = 0; + if (cfg_.source_kind == "udps") { + // The source config, not cfg_.server/port: --source-opt overrides only the former. + const SourceConfig sc = cfg_.source_config(); + struct ::in_addr a; + if (::inet_pton(AF_INET, sc.get("server", "127.0.0.1").c_str(), &a) == 1) { + addr = a.s_addr; // already network order, which is what the header wants + } + peer_port = static_cast(sc.get_int("port", 8000)); } - capture_.set_peer(addr, cfg_.source_kind == "udps" ? cfg_.port : 0); + capture_.set_peer(addr, peer_port); } } capture_want_.store(want, std::memory_order_release); diff --git a/src/ui.cpp b/src/ui.cpp index 7780283..e8dfaaa 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -100,9 +100,9 @@ void open_configurations(App& app) { GtkWidget* box = gtk_window_get_child(GTK_WINDOW(window)); GtkWidget* title = gtk_label_new(nullptr); - gtk_label_set_markup(GTK_LABEL(title), - ("" + app.source_title + "") - .c_str()); + char* escaped_title = g_markup_escape_text(app.source_title.c_str(), -1); + gtk_label_set_markup(GTK_LABEL(title), (std::string("") + escaped_title + "").c_str()); + g_free(escaped_title); gtk_widget_set_halign(title, GTK_ALIGN_START); gtk_box_append(GTK_BOX(box), title);