import nispor-1.1.1-1.el8

This commit is contained in:
CentOS Sources 2021-11-09 04:55:59 -05:00 committed by Stepan Oksanichenko
parent 2f4f7dae49
commit 07708c4442
5 changed files with 101 additions and 862 deletions

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/nispor-1.0.1-vendor.tar.xz
SOURCES/nispor-1.0.1.tar.gz
SOURCES/nispor-1.1.1-vendor.tar.xz
SOURCES/nispor-1.1.1.tar.gz

View File

@ -1,2 +1,2 @@
2af16151bd7a523bb228c3e0bb3462bf71b4a740 SOURCES/nispor-1.0.1-vendor.tar.xz
4a9585f8dd2ca52248dd8a26881b21e0cd104493 SOURCES/nispor-1.0.1.tar.gz
ab6b879911102b36b276d080de78967279016b02 SOURCES/nispor-1.1.1-vendor.tar.xz
c4bff5488cde6eaf881d510e463f6c3f0e13aae2 SOURCES/nispor-1.1.1.tar.gz

View File

@ -1,47 +0,0 @@
From 32e5d0a2e217322e144fe1ffe916e217133c2b74 Mon Sep 17 00:00:00 2001
From: Fernando Fernandez Mancera <ffmancera@riseup.net>
Date: Mon, 25 Jan 2021 13:59:40 +0100
Subject: [PATCH] bond: add support to vlan+srcmac tx hashing option
The new vlan+srcmac tx hashing option is now available at kernel
upstream. Nispor should support it.
Ref: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=7b8fc0103bb51d1d3e1fb5fd67958612e709f883
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
---
src/lib/ifaces/bond.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lib/ifaces/bond.rs b/src/lib/ifaces/bond.rs
index d3a3b6c..63fafeb 100644
--- a/src/lib/ifaces/bond.rs
+++ b/src/lib/ifaces/bond.rs
@@ -171,6 +171,7 @@ const BOND_XMIT_POLICY_LAYER34: u8 = 1;
const BOND_XMIT_POLICY_LAYER23: u8 = 2;
const BOND_XMIT_POLICY_ENCAP23: u8 = 3;
const BOND_XMIT_POLICY_ENCAP34: u8 = 4;
+const BOND_XMIT_POLICY_VLAN_SRCMAC: u8 = 5;
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
#[serde(rename_all = "lowercase")]
@@ -185,6 +186,8 @@ pub enum BondXmitHashPolicy {
Encap23,
#[serde(rename = "encap3+4")]
Encap34,
+ #[serde(rename = "vlan+srcmac")]
+ VlanSrcMac,
Other(u8),
}
@@ -196,6 +199,7 @@ impl From<u8> for BondXmitHashPolicy {
BOND_XMIT_POLICY_LAYER23 => Self::Layer23,
BOND_XMIT_POLICY_ENCAP23 => Self::Encap23,
BOND_XMIT_POLICY_ENCAP34 => Self::Encap34,
+ BOND_XMIT_POLICY_VLAN_SRCMAC => Self::VlanSrcMac,
_ => Self::Other(d),
}
}
--
2.29.2

View File

@ -1,807 +0,0 @@
From 6655f63d3c8d5a551925a43b1fbf16a153a5c4cc Mon Sep 17 00:00:00 2001
From: Fernando Fernandez Mancera <ffmancera@riseup.net>
Date: Tue, 16 Feb 2021 12:06:18 +0100
Subject: [PATCH] varlink: remove the varlink support
There is no real user for varlink support on nispor. This patch is
removing the varlink support and all the documentation related to it.
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
---
Cargo.toml | 1 -
DEVEL.md | 5 -
Makefile | 35 +---
README.md | 14 --
src/varlink/Cargo.toml | 17 --
src/varlink/info.nispor.varlink | 263 -----------------------------
src/varlink/info_nispor.rs | 228 -------------------------
src/varlink/npd.rs | 51 ------
src/varlink/systemd/nispor.service | 10 --
src/varlink/systemd/nispor.socket | 10 --
10 files changed, 5 insertions(+), 629 deletions(-)
delete mode 100644 src/varlink/Cargo.toml
delete mode 100644 src/varlink/info.nispor.varlink
delete mode 100644 src/varlink/info_nispor.rs
delete mode 100644 src/varlink/npd.rs
delete mode 100644 src/varlink/systemd/nispor.service
delete mode 100644 src/varlink/systemd/nispor.socket
diff --git a/Cargo.toml b/Cargo.toml
index b03c824..59a55be 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,5 @@
[workspace]
members = [
- "src/varlink",
"src/lib",
"src/cli",
"src/clib",
diff --git a/DEVEL.md b/DEVEL.md
index bd96064..0ebcc1f 100644
--- a/DEVEL.md
+++ b/DEVEL.md
@@ -9,7 +9,6 @@
* [Design](#design)
* [Rust module](#rust-module)
* [Command line tool](#command-line-tool)
- * [Varlink service](#varlink-service)
* [Python binding](#python-binding)
* [Check list for creating PR:](#check-list-for-creating-pr)
* [Release workflow](#release-workflow)
@@ -43,10 +42,6 @@ Path: `src/lib`
Path: `src/cli`
-### Varlink service
-
-Path: `src/varlink`
-
### Python binding
Path: `src/python`
diff --git a/Makefile b/Makefile
index b628944..2e92906 100644
--- a/Makefile
+++ b/Makefile
@@ -2,9 +2,6 @@ include ./Makefile.inc
RUST_DEBUG_BIN_DIR=./target/debug
RUST_RELEASE_BIN_DIR=./target/release
-VARLINK_SRV_EXEC=npd
-VARLINK_SRV_EXEC_DEBUG=$(RUST_DEBUG_BIN_DIR)/$(VARLINK_SRV_EXEC)
-VARLINK_SRV_EXEC_RELEASE=$(RUST_RELEASE_BIN_DIR)/$(VARLINK_SRV_EXEC)
CLI_EXEC=npc
CLI_EXEC_DEBUG=$(RUST_DEBUG_BIN_DIR)/$(CLI_EXEC)
CLIB_HEADER=nispor.h
@@ -18,8 +15,6 @@ CLI_EXEC_RELEASE=$(RUST_RELEASE_BIN_DIR)/$(CLI_EXEC)
SOCKET_FILE=/run/nispor/nispor.so
SOCKET_DIR=$(dir $(SOCKET_FILE))
SOCKET_ADDR=unix:$(SOCKET_FILE)
-SYSTEMD_SERVICE_FILE=src/varlink/systemd/nispor.service
-SYSTEMD_SOCKET_FILE=src/varlink/systemd/nispor.socket
PREFIX ?= /usr/local
CPU_BITS = $(shell getconf LONG_BIT)
@@ -34,8 +29,7 @@ PKG_CONFIG_LIBDIR ?= $(LIBDIR)/pkgconfig
SKIP_PYTHON_INSTALL ?=0
-all: $(VARLINK_SRV_EXEC_DEBUG) $(CLI_EXEC_DEBUG) \
- $(VARLINK_SRV_EXEC_RELEASE) $(CLI_EXEC_RELEASE)
+all: $(CLI_EXEC_DEBUG) $(CLI_EXEC_RELEASE)
SYSTEMD_SYS_UNIT_DIR ?= $(shell \
pkg-config --variable=systemdsystemunitdir systemd)
@@ -46,16 +40,16 @@ PYTHON3_SITE_DIR ?=$(shell \
print(get_python_lib())")
# Always invoke cargo build for debug
-.PHONY: $(VARLINK_SRV_EXEC_DEBUG) $(CLI_EXEC_DEBUG)
+.PHONY: $(CLI_EXEC_DEBUG)
debug: $(CLI_EXEC_DEBUG)
$(CLI_EXEC_DEBUG) $(ARGS)
-$(CLI_EXEC_DEBUG) $(VARLINK_SRV_EXEC_DEBUG):
+$(CLI_EXEC_DEBUG):
cargo build --all
-$(CLI_EXEC_RELEASE) $(VARLINK_SRV_EXEC_RELEASE) $(CLIB_SO_DEV_RELEASE):
+$(CLI_EXEC_RELEASE) $(CLIB_SO_DEV_RELEASE):
cargo build --all --release
check:
@@ -65,30 +59,13 @@ check:
fi
make check -C test/clib
-srv: $(VARLINK_SRV_EXEC_DEBUG)
- echo $(SOCKET_DIR)
- if [ ! -d $(SOCKET_DIR) ]; then \
- sudo mkdir $(SOCKET_DIR); \
- sudo chmod 0777 $(SOCKET_DIR); \
- fi
- $(VARLINK_SRV_EXEC_DEBUG) $(SOCKET_ADDR)
-
-cli:
- varlink call $(SOCKET_ADDR)/info.nispor.Get
-
clean:
cargo clean
make clean -C test/clib
-install: $(VARLINK_SRV_EXEC_RELEASE) $(CLI_EXEC_RELEASE)
- install -p -v -D -m755 $(VARLINK_SRV_EXEC_RELEASE) \
- $(DESTDIR)$(PREFIX)/bin/$(VARLINK_SRV_EXEC)
+install: $(CLI_EXEC_RELEASE)
install -p -v -D -m755 $(CLI_EXEC_RELEASE) \
$(DESTDIR)$(PREFIX)/bin/$(CLI_EXEC)
- install -p -v -D -m644 $(SYSTEMD_SOCKET_FILE) \
- $(DESTDIR)$(SYSTEMD_SYS_UNIT_DIR)/nispor.socket
- install -p -D -m644 $(SYSTEMD_SERVICE_FILE) \
- $(DESTDIR)$(SYSTEMD_SYS_UNIT_DIR)/nispor.service
install -p -D -m755 $(CLIB_SO_DEV_RELEASE) \
$(DESTDIR)$(LIBDIR)/$(CLIB_SO_FULL)
ln -sfv $(CLIB_SO_FULL) $(DESTDIR)$(LIBDIR)/$(CLIB_SO_MAN)
@@ -120,9 +97,7 @@ install: $(VARLINK_SRV_EXEC_RELEASE) $(CLI_EXEC_RELEASE)
uninstall:
- - rm -fv $(DESTDIR)$(PREFIX)/bin/$(VARLINK_SRV_EXEC)
- rm -fv $(DESTDIR)$(PREFIX)/bin/$(CLI_EXEC)
- - rm -fv $(DESTDIR)$(SYSTEMD_SYS_UNIT_DIR)/nispor*
- rm -fv $(DESTDIR)$(LIBDIR)/$(CLIB_SO_DEV)
- rm -fv $(DESTDIR)$(LIBDIR)/$(CLIB_SO_MAN)
- rm -fv $(DESTDIR)$(LIBDIR)/$(CLIB_SO_MIN)
diff --git a/README.md b/README.md
index 4a50e5e..c1eda2c 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,6 @@ Currently providing:
* Rust crate
* Python binding
* C binding
- * Varlink interface -- `npd`
* Command line tool -- `npc`
## Install
@@ -35,19 +34,6 @@ npc bond99
npc route
```
-### Varlink service
-
-```bash
-systemctl start nispor.socket
-```
-
-### Varlink client
-
-```bash
-# Please install `libvarlink-util` pacakge beforehand
-varlink call unix:/run/nispor/nispor.so/info.nispor.Get
-```
-
## Supported features
* IPv4/IPv6 address
* Bond
diff --git a/src/varlink/Cargo.toml b/src/varlink/Cargo.toml
deleted file mode 100644
index c8775d4..0000000
--- a/src/varlink/Cargo.toml
+++ /dev/null
@@ -1,17 +0,0 @@
-[package]
-name = "npd"
-version = "1.0.1"
-authors = ["Gris Ge <cnfourt@gmail.com>"]
-edition = "2018"
-
-[[bin]]
-name = "npd"
-path = "npd.rs"
-
-[dependencies]
-varlink = "11"
-serde = "1.0"
-serde_derive = "1.0"
-serde_json = "1.0"
-nispor = { path = "../lib" }
-libc = "0.2.71"
diff --git a/src/varlink/info.nispor.varlink b/src/varlink/info.nispor.varlink
deleted file mode 100644
index cc9b7d4..0000000
--- a/src/varlink/info.nispor.varlink
+++ /dev/null
@@ -1,263 +0,0 @@
-interface info.nispor
-
-type BondInfo (
- subordinates: []string,
- mode: []string,
- options: [string]string
-)
-
-type BridgeInfo (
- stp_state: (disabled, kernel_stp, user_stp, unknown),
- hello_time: int,
- forward_delay: int,
- max_age: int,
- priority: int,
- subordinates: []string,
- ageing_time: int,
- bridge_id: string,
- group_fwd_mask: int,
- root_id: string,
- root_port: int,
- root_path_cost: int,
- topology_change: bool,
- topology_change_detected: bool,
- hello_timer: int,
- tcn_timer: int,
- topology_change_timer: int,
- multicast_router: (disabled, temp_query, perm, temp, unknown),
- multicast_snooping: bool,
- multicast_query_use_ifaddr: bool,
- multicast_querier: bool,
- multicast_stats_enabled: bool,
- multicast_hash_elasticity: int,
- multicast_hash_max: int,
- multicast_last_member_count: int,
- multicast_startup_query_count: int,
- multicast_last_member_interval: int,
- multicast_membership_interval: int,
- multicast_querier_interval: int,
- multicast_query_interval: int,
- multicast_query_response_interval: int,
- multicast_startup_query_interval: int,
- multicast_igmp_version: int,
- multicast_mld_version: int,
- gc_timer: int,
- group_addr: string,
- nf_call_iptables: bool,
- nf_call_ip6tables: bool,
- nf_call_arptables: bool,
- vlan_filtering: bool,
- vlan_protocol: (802.1q, 802.1ad),
- ?default_pvid: int,
-)
-
-type BridgeVlanEntry (
- ?vid: int,
- ?vid_range: []int,
- is_pvid: bool,
- is_egress_untagged: bool,
-)
-
-type BridgePortInfo (
- stp_state: (disabled, listening, learning, forwarding, blocking, unknown),
- stp_priority: int,
- stp_path_cost: int,
- hairpin_mode: bool,
- bpdu_guard: bool,
- root_block: bool,
- multicast_fast_leave: bool,
- learning: bool,
- unicast_flood: bool,
- proxyarp: bool,
- proxyarp_wifi: bool,
- designated_root: string,
- designated_bridge: string,
- designated_port: int,
- designated_cost: int,
- port_id: string,
- port_no: string,
- change_ack: bool,
- config_pending: bool,
- message_age_timer: int,
- forward_delay_timer: int,
- hold_timer: int,
- multicast_router: (disabled, temp_query, perm, temp, unknown),
- multicast_flood: bool,
- multicast_to_unicast: bool,
- vlan_tunnel: bool,
- broadcast_flood: bool,
- group_fwd_mask: int,
- neigh_suppress: bool,
- isolated: bool,
- ?backup_port: string,
- ?vlans: []BridgeVlanEntry,
-)
-
-type Ipv4Info (
- addresses: []Ipv4AddrInfo
-)
-
-type Ipv4AddrInfo (
- address: string,
- prefix_len: int,
- ?peer: string,
- valid_lft: string,
- preferred_lft: string
-)
-
-type Ipv6Info (
- addresses: []Ipv6AddrInfo
-)
-
-type Ipv6AddrInfo (
- address: string,
- prefix_len: int,
- valid_lft: string,
- preferred_lft: string
-)
-
-type VlanInfo (
- vlan_id: int,
- protocol: (802.1q, 802.1ad, unknown),
- base_iface: string,
- is_reorder_hdr: bool,
- is_gvrp: bool,
- is_loose_binding: bool,
- is_mvrp: bool,
- is_bridge_binding: bool,
-)
-
-type VfState (
- rx_packets: int,
- tx_packets: int,
- rx_bytes: int,
- tx_bytes: int,
- broadcast: int,
- multicast: int,
- rx_dropped: int,
- tx_dropped: int,
-)
-
-type VfInfo (
- id: int,
- mac: string,
- broadcast: string,
- vlan_id: int,
- qos: int,
- tx_rate: int,
- spoof_check: int,
- link_state: (auto, enable, disable, unknown),
- min_tx_rate: int,
- max_tx_rate: int,
- query_rss: bool,
- state: VfState,
- trust: bool,
- ?ib_node_guid: string,
- ?ib_port_guid: string,
-)
-
-type SriovInfo (
- vfs: []VfInfo,
-)
-
-type TunInfo (
- mode: (tun, tap, unknown),
- pi: bool,
- vnet_hdr: bool,
- multi_queue: bool,
- persist: bool,
- ?owner: int,
- ?group: int,
- ?num_queues: int,
- ?num_disabled_queues: int,
-)
-
-type VethInfo (
- peer: string,
-)
-
-type VxlanInfo (
- remote: string,
- vxlan_id: int,
- base_iface: string,
- local: string,
- ttl: int,
- tos: int,
- learning: bool,
- ageing: int,
- max_address: int,
- src_port_min: int,
- src_port_max: int,
- proxy: bool,
- rsc: bool,
- l2miss: bool,
- l3miss: bool,
- dst_port: int,
- udp_check_sum: bool,
- udp6_zero_check_sum_tx: bool,
- udp6_zero_check_sum_rx: bool,
- remote_check_sum_tx: bool,
- remote_check_sum_rx: bool,
- gbp: bool,
- remote_check_sum_no_partial: bool,
- collect_metadata: bool,
- label: int,
- gpe: bool,
- ttl_inherit: bool,
- df: int,
-)
-
-type VrfInfo (
- table_id: int,
- subordinates: []string,
-)
-
-type VrfSubordinateInfo (
- table_id: int,
-)
-
-type MacVlanInfo (
- base_iface: string,
- mode: (private, vepa, bridge, passthru, source, unknown),
- flags: int,
- ?allowed_mac_addresses: []string,
-)
-
-type MacVtapInfo (
- base_iface: string,
- mode: (private, vepa, bridge, passthru, source, unknown),
- flags: int,
- ?allowed_mac_addresses: []string,
-)
-
-type Iface (
- name: string,
- iface_type: string,
- state: (Up, Down, Unknown),
- mtu: int,
- ?bond: BondInfo,
- ?bond_subordinate: [string]string,
- ?bridge: BridgeInfo,
- ?bridge_port: BridgePortInfo,
- ?vlan: VlanInfo,
- ?vxlan: VxlanInfo,
- ?sriov: SriovInfo,
- ?tun: TunInfo,
- ?veth: VethInfo,
- ?vrf: VrfInfo,
- ?vrf_subordinate: VrfSubordinateInfo,
- ?mac_vlan: MacVlanInfo,
- ?mac_vtap: MacVtapInfo,
- ?controller: string,
- ?controller_type: (bond, unknown),
- ?ipv4: Ipv4Info,
- ?ipv6: Ipv6Info
-)
-
-type NetState (
- ifaces: [string]Iface
-)
-
-method Get() -> (net_state: NetState)
-
-error InternalError(msg: string)
diff --git a/src/varlink/info_nispor.rs b/src/varlink/info_nispor.rs
deleted file mode 100644
index 1d614b5..0000000
--- a/src/varlink/info_nispor.rs
+++ /dev/null
@@ -1,228 +0,0 @@
-#![doc = "This file was automatically generated by the varlink rust generator"]
-#![allow(non_camel_case_types)]
-#![allow(non_snake_case)]
-use nispor::NetState;
-use serde_derive::{Deserialize, Serialize};
-use serde_json;
-use std::io::BufRead;
-use std::sync::{Arc, RwLock};
-use varlink::{self, CallTrait};
-
-#[allow(dead_code)]
-#[derive(Clone, PartialEq, Debug)]
-pub enum ErrorKind {
- Varlink_Error,
- VarlinkReply_Error,
- InternalError(Option<InternalError_Args>),
-}
-impl ::std::fmt::Display for ErrorKind {
- fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- match self {
- ErrorKind::Varlink_Error => write!(f, "Varlink Error"),
- ErrorKind::VarlinkReply_Error => write!(f, "Varlink error reply"),
- ErrorKind::InternalError(v) => {
- write!(f, "info.nispor.InternalError: {:#?}", v)
- }
- }
- }
-}
-pub struct Error(
- pub ErrorKind,
- pub Option<Box<dyn std::error::Error + 'static + Send + Sync>>,
- pub Option<&'static str>,
-);
-impl Error {
- #[allow(dead_code)]
- pub fn kind(&self) -> &ErrorKind {
- &self.0
- }
-}
-impl From<ErrorKind> for Error {
- fn from(e: ErrorKind) -> Self {
- Error(e, None, None)
- }
-}
-impl std::error::Error for Error {
- fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
- self.1
- .as_ref()
- .map(|e| e.as_ref() as &(dyn std::error::Error + 'static))
- }
-}
-impl std::fmt::Display for Error {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- std::fmt::Display::fmt(&self.0, f)
- }
-}
-impl std::fmt::Debug for Error {
- fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
- use std::error::Error as StdError;
- if let Some(ref o) = self.2 {
- std::fmt::Display::fmt(o, f)?;
- }
- std::fmt::Debug::fmt(&self.0, f)?;
- if let Some(e) = self.source() {
- std::fmt::Display::fmt("\nCaused by:\n", f)?;
- std::fmt::Debug::fmt(&e, f)?;
- }
- Ok(())
- }
-}
-#[allow(dead_code)]
-pub type Result<T> = std::result::Result<T, Error>;
-impl From<varlink::Error> for Error {
- fn from(e: varlink::Error) -> Self {
- match e.kind() {
- varlink::ErrorKind::VarlinkErrorReply(r) => Error(
- ErrorKind::from(r),
- Some(Box::from(e)),
- Some(concat!(file!(), ":", line!(), ": ")),
- ),
- _ => Error(
- ErrorKind::Varlink_Error,
- Some(Box::from(e)),
- Some(concat!(file!(), ":", line!(), ": ")),
- ),
- }
- }
-}
-#[allow(dead_code)]
-impl Error {
- pub fn source_varlink_kind(&self) -> Option<&varlink::ErrorKind> {
- use std::error::Error as StdError;
- let mut s: &dyn StdError = self;
- while let Some(c) = s.source() {
- let k = self
- .source()
- .and_then(|e| e.downcast_ref::<varlink::Error>())
- .and_then(|e| Some(e.kind()));
- if k.is_some() {
- return k;
- }
- s = c;
- }
- None
- }
-}
-impl From<&varlink::Reply> for ErrorKind {
- #[allow(unused_variables)]
- fn from(e: &varlink::Reply) -> Self {
- match e {
- varlink::Reply {
- error: Some(ref t), ..
- } if t == "info.nispor.InternalError" => match e {
- varlink::Reply {
- parameters: Some(p),
- ..
- } => match serde_json::from_value(p.clone()) {
- Ok(v) => ErrorKind::InternalError(v),
- Err(_) => ErrorKind::InternalError(None),
- },
- _ => ErrorKind::InternalError(None),
- },
- _ => ErrorKind::VarlinkReply_Error,
- }
- }
-}
-pub trait VarlinkCallError: varlink::CallTrait {
- fn reply_internal_error(&mut self, r#msg: String) -> varlink::Result<()> {
- self.reply_struct(varlink::Reply::error(
- "info.nispor.InternalError",
- Some(
- serde_json::to_value(InternalError_Args { r#msg })
- .map_err(varlink::map_context!())?,
- ),
- ))
- }
-}
-impl<'a> VarlinkCallError for varlink::Call<'a> {}
-#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
-pub struct InternalError_Args {
- pub r#msg: String,
-}
-#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
-pub struct Get_Reply {
- pub r#net_state: NetState,
-}
-impl varlink::VarlinkReply for Get_Reply {}
-#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
-pub struct Get_Args {}
-pub trait Call_Get: VarlinkCallError {
- fn reply(&mut self, r#net_state: NetState) -> varlink::Result<()> {
- self.reply_struct(Get_Reply { r#net_state }.into())
- }
-
- // TODO: Need better stuff
- fn fail(&mut self, msg: &str) -> varlink::Result<()> {
- self.reply_struct(varlink::Reply {
- continues: None,
- error: Some(format!("info.nispor.InternalError: {}", msg).into()),
- parameters: None,
- })
- }
-}
-impl<'a> Call_Get for varlink::Call<'a> {}
-pub trait VarlinkInterface {
- fn get(&self, call: &mut dyn Call_Get) -> varlink::Result<()>;
- fn call_upgraded(
- &self,
- _call: &mut varlink::Call,
- _bufreader: &mut dyn BufRead,
- ) -> varlink::Result<Vec<u8>> {
- Ok(Vec::new())
- }
-}
-pub trait VarlinkClientInterface {
- fn get(&mut self) -> varlink::MethodCall<Get_Args, Get_Reply, Error>;
-}
-#[allow(dead_code)]
-pub struct VarlinkClient {
- connection: Arc<RwLock<varlink::Connection>>,
-}
-impl VarlinkClient {
- #[allow(dead_code)]
- pub fn new(connection: Arc<RwLock<varlink::Connection>>) -> Self {
- VarlinkClient { connection }
- }
-}
-impl VarlinkClientInterface for VarlinkClient {
- fn get(&mut self) -> varlink::MethodCall<Get_Args, Get_Reply, Error> {
- varlink::MethodCall::<Get_Args, Get_Reply, Error>::new(
- self.connection.clone(),
- "info.nispor.Get",
- Get_Args {},
- )
- }
-}
-#[allow(dead_code)]
-pub struct VarlinkInterfaceProxy {
- inner: Box<dyn VarlinkInterface + Send + Sync>,
-}
-#[allow(dead_code)]
-pub fn new(
- inner: Box<dyn VarlinkInterface + Send + Sync>,
-) -> VarlinkInterfaceProxy {
- VarlinkInterfaceProxy { inner }
-}
-impl varlink::Interface for VarlinkInterfaceProxy {
- fn get_description(&self) -> &'static str {
- "interface info.nispor\n\ntype IfaceState (\n name: string,\n iface_type: string,\n state: (UP, DOWN, UNKNOWN),\n mtu: int\n)\n\ntype NetState (\n iface_states: [string]IfaceState\n)\n\n\nmethod Get() -> (net_state: NetState)\n\nerror InternalError(msg: string)\n"
- }
- fn get_name(&self) -> &'static str {
- "info.nispor"
- }
- fn call_upgraded(
- &self,
- call: &mut varlink::Call,
- bufreader: &mut dyn BufRead,
- ) -> varlink::Result<Vec<u8>> {
- self.inner.call_upgraded(call, bufreader)
- }
- fn call(&self, call: &mut varlink::Call) -> varlink::Result<()> {
- let req = call.request.unwrap();
- match req.method.as_ref() {
- "info.nispor.Get" => self.inner.get(call as &mut dyn Call_Get),
- m => call.reply_method_not_found(String::from(m)),
- }
- }
-}
diff --git a/src/varlink/npd.rs b/src/varlink/npd.rs
deleted file mode 100644
index 49e5d9b..0000000
--- a/src/varlink/npd.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-use libc::umask;
-use nispor::NetState;
-use std::process::exit;
-use varlink::{ListenConfig, VarlinkService};
-
-use crate::info_nispor::*;
-
-mod info_nispor;
-
-fn print_usage(program: &str) {
- println!("Usage: {} <varlink_address>", program);
-}
-
-fn main() {
- let args: Vec<_> = std::env::args().collect();
- if args.len() <= 1 {
- print_usage(&args[0]);
- exit(1);
- }
- run_server(&args[1]).unwrap();
- exit(0);
-}
-
-struct MyInfoGrisgeNispor {}
-
-impl VarlinkInterface for MyInfoGrisgeNispor {
- fn get(&self, call: &mut dyn Call_Get) -> varlink::Result<()> {
- match NetState::retrieve() {
- Ok(s) => call.reply(s),
- Err(e) => call.fail(&e.msg),
- }
- }
-}
-
-fn run_server(address: &str) -> varlink::Result<()> {
- let my_varlink_iface = info_nispor::new(Box::new(MyInfoGrisgeNispor {}));
- let service = VarlinkService::new(
- "info.nispor",
- "Network status query service",
- "0.1",
- "http://nispor.info",
- vec![Box::new(my_varlink_iface)],
- );
- // Make sure the socket file been created with permission 0666.
- let old_umask = unsafe { umask(0o111) };
- varlink::listen(service, &address, &ListenConfig::default())?;
- unsafe {
- umask(old_umask);
- }
- Ok(())
-}
diff --git a/src/varlink/systemd/nispor.service b/src/varlink/systemd/nispor.service
deleted file mode 100644
index 134cd88..0000000
--- a/src/varlink/systemd/nispor.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Network Inspector(nispor) varlink service
-
-[Service]
-ExecStart=/usr/bin/npd unix:/run/nispor/nispor.so
-DynamicUser=yes
-RuntimeDirectory=nispor
-
-[Install]
-Also=nispor.socket
diff --git a/src/varlink/systemd/nispor.socket b/src/varlink/systemd/nispor.socket
deleted file mode 100644
index f7d681b..0000000
--- a/src/varlink/systemd/nispor.socket
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Network Inspector(nispor) varlink service
-PartOf=nispor.service
-
-[Socket]
-ListenStream=/run/nispor/nispor.so
-SocketMode=0666
-
-[Install]
-WantedBy=sockets.target
--
2.29.2

View File

@ -1,19 +1,100 @@
Name: nispor
Version: 1.0.1
Release: 4%{?dist}
Version: 1.1.1
Release: 1%{?dist}
Summary: API for network status querying
License: ASL 2.0
URL: https://github.com/nispor/nispor
Source: https://github.com/nispor/nispor/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: %{name}-%{version}-vendor.tar.xz
Patch0: BZ_1919986-bond-add-support-to-vlan-srcmac-tx-hashing-option.patch
Patch1: BZ_1926941-remove-the-varlink-support.patch
BuildRequires: pkg-config
BuildRequires: python3-devel
BuildRequires: rust-toolset
BuildRequires: systemd-rpm-macros
BuildRequires: systemd-devel
Provides: bundled(crate(aho-corasick)) = 0.7.15
Provides: bundled(crate(ansi_term)) = 0.11.0
Provides: bundled(crate(anyhow)) = 1.0.34
Provides: bundled(crate(atty)) = 0.2.14
Provides: bundled(crate(autocfg)) = 1.0.1
Provides: bundled(crate(bitflags)) = 1.2.1
Provides: bundled(crate(byteorder)) = 1.3.4
Provides: bundled(crate(byteordered)) = 0.5.0
Provides: bundled(crate(bytes)) = 0.5.6
Provides: bundled(crate(bytes)) = 1.0.1
Provides: bundled(crate(cc)) = 1.0.66
Provides: bundled(crate(cfg-if)) = 1.0.0
Provides: bundled(crate(clap)) = 2.33.3
Provides: bundled(crate(ctor)) = 0.1.16
Provides: bundled(crate(difference)) = 2.0.0
Provides: bundled(crate(dtoa)) = 0.4.6
Provides: bundled(crate(env_logger)) = 0.8.3
Provides: bundled(crate(futures)) = 0.3.12
Provides: bundled(crate(futures-channel)) = 0.3.12
Provides: bundled(crate(futures-core)) = 0.3.12
Provides: bundled(crate(futures-executor)) = 0.3.12
Provides: bundled(crate(futures-io)) = 0.3.12
Provides: bundled(crate(futures-macro)) = 0.3.12
Provides: bundled(crate(futures-sink)) = 0.3.12
Provides: bundled(crate(futures-task)) = 0.3.12
Provides: bundled(crate(futures-util)) = 0.3.12
Provides: bundled(crate(hermit-abi)) = 0.1.17
Provides: bundled(crate(humantime)) = 2.1.0
Provides: bundled(crate(itoa)) = 0.4.6
Provides: bundled(crate(libc)) = 0.2.93
Provides: bundled(crate(linked-hash-map)) = 0.5.3
Provides: bundled(crate(log)) = 0.4.14
Provides: bundled(crate(memchr)) = 2.3.4
Provides: bundled(crate(mio)) = 0.7.7
Provides: bundled(crate(miow)) = 0.3.6
Provides: bundled(crate(netlink-packet-core)) = 0.2.4
Provides: bundled(crate(netlink-packet-route)) = 0.7.0
Provides: bundled(crate(netlink-packet-utils)) = 0.4.0
Provides: bundled(crate(netlink-proto)) = 0.6.0
Provides: bundled(crate(netlink-sys)) = 0.6.0
Provides: bundled(crate(nix)) = 0.19.1
Provides: bundled(crate(ntapi)) = 0.3.6
Provides: bundled(crate(num_cpus)) = 1.13.0
Provides: bundled(crate(once_cell)) = 1.4.1
Provides: bundled(crate(output_vt100)) = 0.1.2
Provides: bundled(crate(paste)) = 1.0.2
Provides: bundled(crate(pin-project-lite)) = 0.1.12
Provides: bundled(crate(pin-project-lite)) = 0.2.4
Provides: bundled(crate(pin-utils)) = 0.1.0
Provides: bundled(crate(pretty_assertions)) = 0.6.1
Provides: bundled(crate(proc-macro2)) = 1.0.26
Provides: bundled(crate(proc-macro-hack)) = 0.5.19
Provides: bundled(crate(proc-macro-nested)) = 0.1.6
Provides: bundled(crate(quote)) = 1.0.7
Provides: bundled(crate(regex)) = 1.4.6
Provides: bundled(crate(regex-syntax)) = 0.6.23
Provides: bundled(crate(rtnetlink)) = 0.7.0
Provides: bundled(crate(ryu)) = 1.0.5
Provides: bundled(crate(serde)) = 1.0.117
Provides: bundled(crate(serde_derive)) = 1.0.117
Provides: bundled(crate(serde_json)) = 1.0.59
Provides: bundled(crate(serde_yaml)) = 0.8.14
Provides: bundled(crate(slab)) = 0.4.2
Provides: bundled(crate(socket2)) = 0.3.19
Provides: bundled(crate(strsim)) = 0.8.0
Provides: bundled(crate(syn)) = 1.0.69
Provides: bundled(crate(termcolor)) = 1.1.2
Provides: bundled(crate(textwrap)) = 0.11.0
Provides: bundled(crate(thiserror)) = 1.0.22
Provides: bundled(crate(thiserror-impl)) = 1.0.22
Provides: bundled(crate(tokio)) = 0.2.25
Provides: bundled(crate(tokio)) = 1.1.1
Provides: bundled(crate(tokio-macros)) = 1.0.0
Provides: bundled(crate(tokio-util)) = 0.2.0
Provides: bundled(crate(unicode-width)) = 0.1.8
Provides: bundled(crate(unicode-xid)) = 0.2.1
Provides: bundled(crate(vec_map)) = 0.8.2
Provides: bundled(crate(winapi)) = 0.3.9
Provides: bundled(crate(winapi-i686-pc-windows-gnu)) = 0.4.0
Provides: bundled(crate(winapi-util)) = 0.1.5
Provides: bundled(crate(winapi-x86_64-pc-windows-gnu)) = 0.4.0
Provides: bundled(crate(yaml-rust)) = 0.4.4
%description
Unified interface for Linux network state querying.
@ -83,6 +164,18 @@ popd
%{_libdir}/pkgconfig/nispor.pc
%changelog
* Sat Jun 19 2021 Gris Ge <fge@redhat.com> - 1.1.1-1
- Upgrade to 1.1.1. RHBZ#1942459
* Fri Jun 18 2021 Gris Ge <fge@redhat.com> - 1.1.0-3
- Include SPEC information for bundled rust crates. RHBZ#1927789
* Tue Jun 08 2021 Gris Ge <fge@redhat.com> - 1.1.0-2
- Fix cli output, loopback interface and ethtool features.
* Tue May 25 2021 Wen Liang <wenliang@redhat.com> - 1.1.0-1
- Upgrade to 1.1.0. RHBZ#1942459
* Thu Feb 18 2021 Fernando Fernandez Mancera <ferferna@redhat.com> - 1.0.2-4
- Remove the varlink support. RHBZ#1926941