diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-08-01 13:02:53 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-08-01 13:02:53 +0000 |
commit | 33077a2b7a0dc60f2d3c2aa9f0911d2bcd699802 (patch) | |
tree | 72deea9f0b3c0b9125288db790ade7a407145194 /main | |
parent | 57dc825956f864a6eefb2a0d1f93322af81020dd (diff) | |
download | aports-33077a2b7a0dc60f2d3c2aa9f0911d2bcd699802.tar.bz2 aports-33077a2b7a0dc60f2d3c2aa9f0911d2bcd699802.tar.xz |
main/pingu: fix load-balance of ppp devices
They might not have a default gw address
Diffstat (limited to 'main')
-rw-r--r-- | main/pingu/0001-pingu_route-allow-default-routes-that-has-no-via-add.patch | 60 | ||||
-rw-r--r-- | main/pingu/APKBUILD | 4 |
2 files changed, 63 insertions, 1 deletions
diff --git a/main/pingu/0001-pingu_route-allow-default-routes-that-has-no-via-add.patch b/main/pingu/0001-pingu_route-allow-default-routes-that-has-no-via-add.patch new file mode 100644 index 0000000000..013fae46cc --- /dev/null +++ b/main/pingu/0001-pingu_route-allow-default-routes-that-has-no-via-add.patch @@ -0,0 +1,60 @@ +From f63ef90aefd8142c7b2ea2e3cd1abae375fc46b5 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Wed, 1 Aug 2012 12:03:05 +0000 +Subject: [PATCH] pingu_route: allow default routes that has no via address + +This fixes load-balancing with ppp0 + +We also make the via address family (ipv4/ipv6) agnostic. +--- + pingu_netlink.c | 10 ++++++---- + pingu_route.c | 3 +-- + 2 files changed, 7 insertions(+), 6 deletions(-) + +diff --git a/pingu_netlink.c b/pingu_netlink.c +index e3afbf6..dc4a2ed 100644 +--- a/pingu_netlink.c ++++ b/pingu_netlink.c +@@ -138,7 +138,7 @@ static int netlink_add_subrtattr_l(struct rtattr *rta, int maxlen, int type, + subrta->rta_len = len; + memcpy(RTA_DATA(subrta), data, alen); + rta->rta_len = NLMSG_ALIGN(rta->rta_len) + RTA_ALIGN(len); +- return TRUE; ++ return alen; + } + + static int netlink_add_subrtattr_addr_any(struct rtattr *rta, int maxlen, +@@ -346,11 +346,13 @@ static int add_one_nh(struct rtattr *rta, struct rtnexthop *rtnh, + struct pingu_iface *iface, + struct pingu_route *route) + { ++ int addr_size; + if (route == NULL) + return 0; +- netlink_add_subrtattr_addr_any(rta, 1024, RTA_GATEWAY, +- &route->gw_addr); +- rtnh->rtnh_len += sizeof(struct rtattr) + 4; // TODO: support ipv6 ++ addr_size = netlink_add_subrtattr_addr_any(rta, 1024, RTA_GATEWAY, ++ &route->gw_addr); ++ if (addr_size > 0) ++ rtnh->rtnh_len += sizeof(struct rtattr) + addr_size; + if (iface->balance_weight) + rtnh->rtnh_hops = iface->balance_weight - 1; + rtnh->rtnh_ifindex = iface->index; +diff --git a/pingu_route.c b/pingu_route.c +index 3a82f70..a2462c1 100644 +--- a/pingu_route.c ++++ b/pingu_route.c +@@ -126,8 +126,7 @@ int is_default_gw(struct pingu_route *route) + { + switch (route->dest.sa.sa_family) { + case AF_INET: +- return ((route->dest.sin.sin_addr.s_addr == 0) +- && (route->gw_addr.sin.sin_addr.s_addr != 0)); ++ return (route->dest.sin.sin_addr.s_addr == 0); + break; + case AF_INET6: + log_debug("TODO: ipv6"); +-- +1.7.11.2 + diff --git a/main/pingu/APKBUILD b/main/pingu/APKBUILD index 7b3118941d..6ccad9a8c9 100644 --- a/main/pingu/APKBUILD +++ b/main/pingu/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=pingu pkgver=1.2 -pkgrel=0 +pkgrel=1 pkgdesc="Small daemon that pings hosts and executes a script when status change" url="http://git.alpinelinux.org/cgit/pingu" arch="all" @@ -11,6 +11,7 @@ makedepends="libev-dev lua-dev" depends= subpackages="$pkgname-doc lua-pingu:_lua mtu" source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2 + 0001-pingu_route-allow-default-routes-that-has-no-via-add.patch pingu.initd " @@ -41,4 +42,5 @@ _lua() { } md5sums="a874d852ae0d8e10f8c22e0008d1b529 pingu-1.2.tar.bz2 +dbd6e66d4c9c694fd0436e91555bf750 0001-pingu_route-allow-default-routes-that-has-no-via-add.patch 70f56b0f506e1c2e725d0ec062667c32 pingu.initd" |