ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] openvz arp
Date: Sun, 26 Nov 2006 16:51:54 +0300
Message-ID: <20061126135154.GA14873@nomad.office.altlinux.org> (raw)
In-Reply-To: <20060921103334.GA6823@basalt.office.altlinux.org>

[-- Attachment #1: Type: text/plain, Size: 2455 bytes --]

On Thu, Sep 21, 2006 at 02:33:34PM +0400, Dmitry V. Levin wrote:
> On Thu, Sep 21, 2006 at 10:07:37AM +0400, Alexey I. Froloff wrote:
> > * Dmitry V. Levin <ldv@> [060920 20:37]:
> > > Можно, конечно, но на месте upstream'а я бы завёл список ip-адресов,
> > > которые не нужно проверять vzarpipdetect'ом, и список ip-адресов, которые
> > > не нужно анонсировать vzarpipset'ом и vzarp'ом.
> > А где держать этот список и в каком виде?  Что-то типа
> > ARP_SKIP_DETECT/ARP_SKIP_ANNOUNCE со списком подсетей в
> > /etc/sysconfig/vz ?
> 
> Да, я думаю предложить им такое.

Я передумал и теперь предполагаю сделать так:

vzarp: When adding ip, do not announce it on those ifaces where it is not local.
vzarpipdetect: Do not request arp on those ifaces where given ip is not local.
vzarpipset: Do not send arp on those ifaces where given ip is not local.
--- a/etc/vps-functions
+++ b/etc/vps-functions
@@ -119,6 +119,9 @@ vzarp()
 
 	[ -n "${NETDEVICES}" ] || vzwarning "Device list is empty"
 	for DEV in ${NETDEVICES}; do
+		[ "$1" = del ] ||
+		! ${IP_CMD} route get ${2} oif ${DEV} |grep -qs ' via .* src ' ||
+			continue
 		${IP_CMD} neigh ${1} proxy ${2} dev ${DEV} > /dev/null 2>&1
 	done
 }
@@ -130,14 +133,16 @@ vzarpipdetect()
 	local ip
 	local cmd
 
-	[ -z "${1}" ] && return
+	[ -n "$1" ] || return
 	[ "${SKIP_ARPDETECT}" = "yes" ] && return
 
-	for ip in ${1}; do
-		cmd="$cmd -e $ip"
-	done
-
 	for DEV in ${NETDEVICES}; do
+		for ip in ${1}; do
+			! ${IP_CMD} route get ${ip} oif ${DEV} |grep -qs ' via .* src ' ||
+				continue
+			cmd="$cmd -e $ip"
+		done
+		[ -n "$cmd" ] || continue
 		${ARPSEND_CMD} -D ${cmd} ${DEV} ||
 			vzwarning "${ARPSEND_CMD} -D ${cmd} ${DEV} FAILED"
 	done
@@ -148,15 +153,17 @@ vzarpipset()
 {
 	local DEV
 	local ip
-	local dev
+	local cmd
 
-	[ -z "$1" ] && return
+	[ -n "$1" ] || return
 
-	for dev in ${NETDEVICES}; do
+	for DEV in ${NETDEVICES}; do
 		for ip in ${1}; do
-			opt="-i ${ip} -e ${ip}"
-			${ARPSEND_CMD} -U ${opt} ${dev} ||
-				vzwarning "${ARPSEND_CMD} -U ${opt} ${dev} FAILED"
+			! ${IP_CMD} route get ${ip} oif ${DEV} |grep -qs ' via .* src ' ||
+				continue
+			cmd="-i ${ip} -e ${ip}"
+			${ARPSEND_CMD} -U ${cmd} ${DEV} ||
+				vzwarning "${ARPSEND_CMD} -U ${cmd} ${DEV} FAILED"
 		done
 	done
 }

Идея возникла в результате прочтения
https://bugzilla.altlinux.org/show_bug.cgi?id=10324


-- 
ldv

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

       reply	other threads:[~2006-11-26 13:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-26 13:51           ` Dmitry V. Levin [this message]
2006-11-27  5:55             ` Dmitry Lebkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061126135154.GA14873@nomad.office.altlinux.org \
    --to=ldv@altlinux.org \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git