ifmetric: add initial recipe based on Debian packaging and patches

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Gianfranco Costamagna 2019-08-28 15:53:37 +02:00 committed by Khem Raj
parent 23adcea495
commit f2487da394
5 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,15 @@
Description: Correct typo: s/ommited/omitted/
Author: Michael Shuler <michael@pbandjelly.org>
Index: ifmetric/man/ifmetric.8
===================================================================
--- ifmetric.orig/man/ifmetric.8
+++ ifmetric/man/ifmetric.8
@@ -9,7 +9,7 @@ ifmetric is a Linux tool for setting the
ifmetric uses the Linux NETLINK interface to manipulate the routes. Because of that it is compatible with routes created with the new iproute2 utility.
.SH OPTIONS
-You should specify the interface name as first parameter. The second parameter should be the new metric. If ommited the metric 0 (highest) is used.
+You should specify the interface name as first parameter. The second parameter should be the new metric. If omitted the metric 0 (highest) is used.
.SH RETURN VALUES
\fI0\f1 Success

View File

@ -0,0 +1,16 @@
Description: Fix "NETLINK: Error: Invalid argument" for links that are down, in kernel 4.4+
Author: Jim Paris <jim@jtan.com>
Bug-Debian: http://bugs.debian.org/864889
Index: ifmetric/src/nlrequest.c
===================================================================
--- a/src/ifmetric.c
+++ b/src/ifmetric.c
@@ -97,6 +97,8 @@
l = NLMSG_PAYLOAD(n, sizeof(struct rtmsg));
a = RTM_RTA(r);
+ r->rtm_flags &= ~(RTNH_F_DEAD | RTNH_F_LINKDOWN);
+
while(RTA_OK(a, l)) {
switch(a->rta_type) {
case RTA_PRIORITY:

View File

@ -0,0 +1,24 @@
Description: Correct spelling-error-in-binary s/Recieved/Received/
Author: Michael Shuler <michael@pbandjelly.org>
Index: ifmetric/src/ifmetric.c
===================================================================
--- ifmetric.orig/src/ifmetric.c 2013-09-04 18:37:59.000000000 -0500
+++ ifmetric/src/ifmetric.c 2013-09-04 19:08:38.539750778 -0500
@@ -38,7 +38,7 @@
case RTA_OIF:
if (RTA_PAYLOAD(a) != sizeof(int)) {
- fprintf(stderr, "NETLINK: Recieved corrupt RTA_OIF payload.\n");
+ fprintf(stderr, "NETLINK: Received corrupt RTA_OIF payload.\n");
return -1;
}
@@ -102,7 +102,7 @@
case RTA_PRIORITY:
if (RTA_PAYLOAD(a) != sizeof(int)) {
- fprintf(stderr, "NETLINK: Recieved corrupt RTA_PRIORITY payload.\n");
+ fprintf(stderr, "NETLINK: Received corrupt RTA_PRIORITY payload.\n");
return NULL;
}

View File

@ -0,0 +1,16 @@
Description: Fix "NETLINK: Packet too small or truncated!" error.
Author: Benedek László <benedekl@gmail.com>
Bug-Debian: http://bugs.debian.org/514197
Index: ifmetric/src/nlrequest.c
===================================================================
--- ifmetric.orig/src/nlrequest.c 2013-09-05 14:10:42.000000000 -0500
+++ ifmetric/src/nlrequest.c 2013-09-05 14:19:06.573420862 -0500
@@ -44,7 +44,7 @@
for (;;) {
int bytes;
- char replybuf[2048];
+ char replybuf[4096];
struct nlmsghdr *p = (struct nlmsghdr *) replybuf;
if ((bytes = recv(s, &replybuf, sizeof(replybuf), 0)) < 0) {

View File

@ -0,0 +1,17 @@
DESCRIPTION = "Set routing metrics for a network interface"
LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=94d55d512a9ba36caa9b7df079bae19f"
SRC_URI = "http://0pointer.de/lennart/projects/ifmetric/ifmetric-${PV}.tar.gz \
file://ifmetric.8_typo.patch \
file://ifmetric.c_netlink-invalid-arg.patch \
file://ifmetric.c_typo.patch \
file://nlrequest.c_packet-too-small_fix.patch"
SRC_URI[md5sum] = "74aa3f5ee8aca16a87e124ddcc64fa36"
SRC_URI[sha256sum] = "0fa8510a4e34e555f136f9df81d26618313f2d69a4880c0fb5967f19502f1aec"
inherit autotools
# disable lynx support for now
EXTRA_OECONF = "--disable-lynx"