packages: libdnet/libdnet.spec, libdnet/libdnet-ip6.patch (NEW), libdnet/li...
adwol
adwol at pld-linux.org
Sat Dec 3 23:45:40 CET 2011
Author: adwol Date: Sat Dec 3 22:45:40 2011 GMT
Module: packages Tag: HEAD
---- Log message:
- added support for 802.1Q tagging (vlans) and IPv6
- release 6
---- Files affected:
packages/libdnet:
libdnet.spec (1.18 -> 1.19) , libdnet-ip6.patch (NONE -> 1.1) (NEW), libdnet-vlan.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/libdnet/libdnet.spec
diff -u packages/libdnet/libdnet.spec:1.18 packages/libdnet/libdnet.spec:1.19
--- packages/libdnet/libdnet.spec:1.18 Fri Jul 9 12:09:42 2010
+++ packages/libdnet/libdnet.spec Sat Dec 3 23:45:35 2011
@@ -7,12 +7,14 @@
Summary(pl.UTF-8): Interfejs do niektórych niskopoziomowych funkcji sieciowych
Name: libdnet
Version: 1.11
-Release: 5
+Release: 6
License: BSD
Group: Libraries
Source0: http://dl.sourceforge.net/libdnet/%{name}-%{version}.tar.gz
# Source0-md5: 04c394ed8e1e7fc455456e79e908916d
Patch0: %{name}-python.patch
+Patch1: %{name}-vlan.patch
+Patch2: %{name}-ip6.patch
URL: http://libdnet.sourceforge.net/
BuildRequires: autoconf >= 2.53
BuildRequires: automake
@@ -91,6 +93,8 @@
%prep
%setup -q
%patch0 -p1
+%patch1 -p1
+%patch2 -p1
# invalid lvalues, force regeneration from .pyx
rm python/dnet.c
@@ -155,6 +159,10 @@
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log$
+Revision 1.19 2011/12/03 22:45:35 adwol
+- added support for 802.1Q tagging (vlans) and IPv6
+- release 6
+
Revision 1.18 2010/07/09 10:09:42 arekm
- release 5
================================================================
Index: packages/libdnet/libdnet-ip6.patch
diff -u /dev/null packages/libdnet/libdnet-ip6.patch:1.1
--- /dev/null Sat Dec 3 23:45:40 2011
+++ packages/libdnet/libdnet-ip6.patch Sat Dec 3 23:45:35 2011
@@ -0,0 +1,201 @@
+diff -ruN libdnet-1.11.orig/test/dnet/Makefile.am libdnet-1.11/test/dnet/Makefile.am
+--- libdnet-1.11.orig/test/dnet/Makefile.am 2004-05-04 23:20:11.000000000 +0200
++++ libdnet-1.11/test/dnet/Makefile.am 2011-12-03 23:05:24.898192382 +0100
+@@ -5,7 +5,7 @@
+ sbin_PROGRAMS = dnet
+
+ dnet_SOURCES = addr.c arp.c aton.c aton.h dnet.c eth.c fw.c hex.c \
+- icmp.c intf.c ip.c mod.h rand.c route.c send.c tcp.c udp.c
++ icmp.c intf.c ip.c ip6.c mod.h rand.c route.c send.c tcp.c udp.c
+
+ man_MANS = dnet.8
+
+diff -ruN libdnet-1.11.orig/test/dnet/Makefile.in libdnet-1.11/test/dnet/Makefile.in
+--- libdnet-1.11.orig/test/dnet/Makefile.in 2006-01-19 09:24:46.000000000 +0100
++++ libdnet-1.11/test/dnet/Makefile.in 2011-12-03 23:05:24.899192576 +0100
+@@ -106,7 +106,7 @@
+ sbin_PROGRAMS = dnet
+
+ dnet_SOURCES = addr.c arp.c aton.c aton.h dnet.c eth.c fw.c hex.c \
+- icmp.c intf.c ip.c mod.h rand.c route.c send.c tcp.c udp.c
++ icmp.c intf.c ip.c ip6.c mod.h rand.c route.c send.c tcp.c udp.c
+
+
+ man_MANS = dnet.8
+@@ -123,8 +123,9 @@
+
+ am_dnet_OBJECTS = addr.$(OBJEXT) arp.$(OBJEXT) aton.$(OBJEXT) \
+ dnet.$(OBJEXT) eth.$(OBJEXT) fw.$(OBJEXT) hex.$(OBJEXT) \
+- icmp.$(OBJEXT) intf.$(OBJEXT) ip.$(OBJEXT) rand.$(OBJEXT) \
+- route.$(OBJEXT) send.$(OBJEXT) tcp.$(OBJEXT) udp.$(OBJEXT)
++ icmp.$(OBJEXT) intf.$(OBJEXT) ip.$(OBJEXT) ip6.$(OBJEXT) \
++ rand.$(OBJEXT) route.$(OBJEXT) send.$(OBJEXT) tcp.$(OBJEXT) \
++ udp.$(OBJEXT)
+ dnet_OBJECTS = $(am_dnet_OBJECTS)
+ dnet_DEPENDENCIES = $(top_builddir)/src/libdnet.la
+ dnet_LDFLAGS =
+diff -ruN libdnet-1.11.orig/test/dnet/aton.c libdnet-1.11/test/dnet/aton.c
+--- libdnet-1.11.orig/test/dnet/aton.c 2002-10-14 17:42:10.000000000 +0200
++++ libdnet-1.11/test/dnet/aton.c 2011-12-03 23:06:18.852669377 +0100
+@@ -26,6 +26,8 @@
+
+ if (strcmp(string, "ip") == 0)
+ *type = htons(ETH_TYPE_IP);
++ else if (strcmp(string, "ip6") == 0 || strcmp(string, "ipv6") == 0)
++ *type = htons(ETH_TYPE_IPV6);
+ else if (strcmp(string, "arp") == 0)
+ *type = htons(ETH_TYPE_ARP);
+ else {
+diff -ruN libdnet-1.11.orig/test/dnet/dnet.8 libdnet-1.11/test/dnet/dnet.8
+--- libdnet-1.11.orig/test/dnet/dnet.8 2002-04-01 09:11:34.000000000 +0200
++++ libdnet-1.11/test/dnet/dnet.8 2011-12-03 23:05:24.899192576 +0100
+@@ -88,6 +88,21 @@
+ .Ar protocol
+ may be specified by name, or as a hex, octal, or decimal number.
+ .It Xo
++.Nm ip6
++.Op Nm tc Ar num
++.Op Nm flow Ar num
++.Op Nm next Ar protocol
++.Op Nm hlim Ar num
++.Op Nm src Ar host
++.Bk -words
++.Op Nm dst Ar dst
++.Ek
++.Xc
++Prepend the data read from standard input with an IPv6 header on
++standard output. The
++.Ar protocol
++may be specified by name, or as a hex, octal, or decimal number.
++.It Xo
+ .Nm icmp
+ .Op Nm type Ar num
+ .Op Nm code Ar num
+diff -ruN libdnet-1.11.orig/test/dnet/dnet.c libdnet-1.11/test/dnet/dnet.c
+--- libdnet-1.11.orig/test/dnet/dnet.c 2004-05-04 23:20:40.000000000 +0200
++++ libdnet-1.11/test/dnet/dnet.c 2011-12-03 23:05:24.899192576 +0100
+@@ -28,6 +28,7 @@
+ extern struct mod mod_eth;
+ extern struct mod mod_arp;
+ extern struct mod mod_ip;
++extern struct mod mod_ip6;
+ extern struct mod mod_icmp;
+ extern struct mod mod_tcp;
+ extern struct mod mod_udp;
+@@ -37,8 +38,9 @@
+ extern struct mod mod_route;
+
+ static struct mod *modules[] = {
+- &mod_addr, &mod_hex, &mod_rand, &mod_eth, &mod_arp, &mod_ip, &mod_icmp,
+- &mod_tcp, &mod_udp, &mod_send, &mod_fw, &mod_intf, &mod_route, NULL
++ &mod_addr, &mod_hex, &mod_rand, &mod_eth, &mod_arp, &mod_ip, &mod_ip6,
++ &mod_icmp, &mod_tcp, &mod_udp, &mod_send, &mod_fw, &mod_intf,
++ &mod_route, NULL
+ };
+
+ static void
+diff -ruN libdnet-1.11.orig/test/dnet/ip6.c libdnet-1.11/test/dnet/ip6.c
+--- libdnet-1.11.orig/test/dnet/ip6.c 1970-01-01 01:00:00.000000000 +0100
++++ libdnet-1.11/test/dnet/ip6.c 2011-12-03 23:05:24.900192770 +0100
+@@ -0,0 +1,101 @@
++/*
++ * ip6.c
++ *
++ */
++
++#include "config.h"
++
++#include <sys/types.h>
++
++#include <err.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <time.h>
++#include <unistd.h>
++
++#include "dnet.h"
++#include "aton.h"
++#include "mod.h"
++
++void
++ip6_usage(void)
++{
++ fprintf(stderr, "Usage: dnet ip6 [tc|flow|next|hlim|src|dst "
++ "<value>] ... \n");
++ exit(1);
++}
++
++int
++ip6_main(int argc, char *argv[])
++{
++ uint8_t tc = 0, next, hlim = IP6_HLIM_MAX;
++ uint32_t flow = 0;
++ struct addr addr;
++ struct ip6_addr src, dst;
++ u_char *p, buf[IP6_LEN_MAX]; /* XXX */
++ char *name, *value;
++ int c, len;
++
++ srand(time(NULL));
++
++ next = rand() & 0xff;
++ memset(buf, 0, sizeof buf);
++
++ for (c = 1; c + 1 < argc; c += 2) {
++ name = argv[c];
++ value = argv[c + 1];
++
++ if (strcmp(name, "tc") == 0)
++ tc = atoi(value);
++ else if (strcmp(name, "flow") == 0)
++ flow = atoi(value);
++ else if (strcmp(name, "hlim") == 0)
++ hlim = atoi(value);
++ else if (strcmp(name, "next") == 0) {
++ if (proto_aton(value, &next) < 0)
++ ip6_usage();
++ } else if (strcmp(name, "src") == 0) {
++ if (addr_aton(value, &addr) < 0 || addr.addr_type != ADDR_TYPE_IP6)
++ ip6_usage();
++ memcpy(&src, &addr.addr_ip6, IP6_ADDR_LEN);
++ } else if (strcmp(name, "dst") == 0) {
++ if (addr_aton(value, &addr) < 0 || addr.addr_type != ADDR_TYPE_IP6)
++ ip6_usage();
++ memcpy(&dst, &addr.addr_ip6, IP6_ADDR_LEN);
++ } else
++ ip_usage();
++ }
++ argc -= c;
++ argv += c;
++
++ if (argc != 0)
++ ip6_usage();
++
++ if (isatty(STDIN_FILENO))
++ errx(1, "can't read IPv6 payload from tty");
++
++ p = buf + IP6_HDR_LEN;
++ len = sizeof(buf) - (p - buf);
++
++ while ((c = read(STDIN_FILENO, p, len)) > 0) {
++ p += c;
++ len -= c;
++ }
++ len = p - buf;
++
++ ip6_pack_hdr(buf, tc, flow, len - IP6_HDR_LEN, next, hlim, src, dst);
++
++ ip6_checksum(buf, len);
++
++ if (write(STDOUT_FILENO, buf, len) != len)
++ err(1, "write");
++
++ return (0);
++}
++
++struct mod mod_ip6 = {
++ "ip6",
++ MOD_TYPE_ENCAP,
++ ip6_main
++};
================================================================
Index: packages/libdnet/libdnet-vlan.patch
diff -u /dev/null packages/libdnet/libdnet-vlan.patch:1.1
--- /dev/null Sat Dec 3 23:45:40 2011
+++ packages/libdnet/libdnet-vlan.patch Sat Dec 3 23:45:35 2011
@@ -0,0 +1,97 @@
+diff -ruN libdnet-1.11.orig/test/dnet/aton.c libdnet-1.11/test/dnet/aton.c
+--- libdnet-1.11.orig/test/dnet/aton.c 2002-10-14 17:42:10.000000000 +0200
++++ libdnet-1.11/test/dnet/aton.c 2011-12-03 23:15:33.472366712 +0100
+@@ -222,3 +222,15 @@
+ }
+ return (u - buf);
+ }
++
++int
++vid_aton(char *string, uint16_t *vid)
++{
++ u_int i;
++
++ /* XXX */
++ if (sscanf(string, "%i", &i) != 1 || i > 0xffff)
++ return (-1);
++ *vid = htons(i & 0xffff);
++ return (0);
++}
+diff -ruN libdnet-1.11.orig/test/dnet/dnet.8 libdnet-1.11/test/dnet/dnet.8
+--- libdnet-1.11.orig/test/dnet/dnet.8 2002-04-01 09:11:34.000000000 +0200
++++ libdnet-1.11/test/dnet/dnet.8 2011-12-03 23:10:04.055399746 +0100
+@@ -42,6 +42,7 @@
+ .Op Nm type Ar type
+ .Op Nm src Ar mac
+ .Op Nm dst Ar mac
++.Op Nm vid Ar vlan_id
+ .Xc
+ Prepend the data read from standard input with an Ethernet header on
+ standard output. The Ethernet
+diff -ruN libdnet-1.11.orig/test/dnet/eth.c libdnet-1.11/test/dnet/eth.c
+--- libdnet-1.11.orig/test/dnet/eth.c 2002-02-08 08:43:53.000000000 +0100
++++ libdnet-1.11/test/dnet/eth.c 2011-12-03 23:16:31.263588754 +0100
+@@ -23,7 +23,7 @@
+ void
+ eth_usage(void)
+ {
+- fprintf(stderr, "Usage: dnet eth [type|src|dst <value>] ... \n");
++ fprintf(stderr, "Usage: dnet eth [type|src|dst|vid <value>] ... \n");
+ exit(1);
+ }
+
+@@ -31,10 +31,11 @@
+ eth_main(int argc, char *argv[])
+ {
+ struct eth_hdr *eth;
++ uint16_t type, vid;
+ struct addr addr;
+- u_char *p, buf[ETH_LEN_MAX]; /* XXX */
++ u_char *p, buf[ETH_LEN_MAX + 4]; /* XXX */
+ char *name, *value;
+- int c, len;
++ int c, len, is_tagged = 0;
+
+ eth = (struct eth_hdr *)buf;
+ memset(eth, 0, sizeof(*eth));
+@@ -45,8 +46,13 @@
+ value = argv[c + 1];
+
+ if (strcmp(name, "type") == 0) {
+- if (type_aton(value, ð->eth_type) < 0)
++ if (type_aton(value, &type) < 0)
+ eth_usage();
++
++ if (is_tagged)
++ memmove(((uint8_t *)ð->eth_type) + 4, &type, sizeof(uint16_t));
++ else
++ eth->eth_type = type;
+ } else if (strcmp(name, "src") == 0) {
+ if (addr_aton(value, &addr) < 0)
+ eth_usage();
+@@ -55,6 +61,14 @@
+ if (addr_aton(value, &addr) < 0)
+ eth_usage();
+ memcpy(ð->eth_dst, &addr.addr_eth, ETH_ADDR_LEN);
++ } else if (strcmp(name, "vid") == 0) {
++ if (is_tagged)
++ eth_usage();
++ memmove(buf + ETH_HDR_LEN - ETH_TYPE_LEN + 4, buf + ETH_HDR_LEN - ETH_TYPE_LEN, ETH_LEN_MAX - ETH_HDR_LEN + ETH_TYPE_LEN);
++ eth->eth_type = htons(ETH_TYPE_8021Q);
++ vid_aton(value, &vid);
++ memmove(buf + ETH_HDR_LEN, &vid, sizeof(uint16_t));
++ is_tagged = 1;
+ } else
+ eth_usage();
+ }
+@@ -67,8 +81,8 @@
+ if (isatty(STDIN_FILENO))
+ errx(1, "can't read Ethernet payload from tty");
+
+- p = buf + ETH_HDR_LEN;
+- len = sizeof(buf) - (p - buf);
++ p = buf + ETH_HDR_LEN + (is_tagged ? 4 : 0);
++ len = sizeof(buf) - (p - buf) - (is_tagged ? 0 : 4);
+
+ while ((c = read(STDIN_FILENO, p, len)) > 0) {
+ p += c;
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/libdnet/libdnet.spec?r1=1.18&r2=1.19&f=u
More information about the pld-cvs-commit
mailing list