From: "Charles Coffing" Subject: [PATCH] safer checks in network-bridge script Date: Thu, 09 Mar 2006 18:27:33 -0500 Message-ID: <44105763.D169.003C.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part705529F5.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=__Part705529F5.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline The network-bridge script is fragile because of how grep is used. As one example, if I already have "xenbridge", I can't create "xenbr". (It's actually worse than that, because it's even grepping the header output by brctl show.) Assuming dom0 is on Linux with /sys mounted (is that a safe assumption?) we can check for the existence of a bridge, and check if a device is on the bridge, by looking in /sys. The attached patch does that. If that's not a safe assumption, at least add "-w" to the two instances of grep. Not perfect, but better. --=__Part705529F5.0__= Content-Type: application/octet-stream; name="xen-network-bridge.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="xen-network-bridge.diff" SW5kZXg6IHhlbi11bnN0YWJsZS90b29scy9leGFtcGxlcy9uZXR3b3JrLWJyaWRnZQo9PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09Ci0tLSB4ZW4tdW5zdGFibGUub3JpZy90b29scy9leGFtcGxlcy9uZXR3b3JrLWJyaWRnZQor KysgeGVuLXVuc3RhYmxlL3Rvb2xzL2V4YW1wbGVzL25ldHdvcmstYnJpZGdlCkBAIC0xNTcsNyAr MTU3LDcgQEAgY3JlYXRlX2JyaWRnZSAoKSB7CiAgICAgbG9jYWwgYnJpZGdlPSQxCiAKICAgICAj IERvbid0IGNyZWF0ZSB0aGUgYnJpZGdlIGlmIGl0IGFscmVhZHkgZXhpc3RzLgotICAgIGlmICEg YnJjdGwgc2hvdyB8IGdyZXAgLXEgJHticmlkZ2V9IDsgdGhlbgorICAgIGlmIFsgISAtZSAiL3N5 cy9jbGFzcy9uZXQvJHticmlkZ2V9L2JyaWRnZSIgXTsgdGhlbgogCWJyY3RsIGFkZGJyICR7YnJp ZGdlfQogCWJyY3RsIHN0cCAke2JyaWRnZX0gb2ZmCiAJYnJjdGwgc2V0ZmQgJHticmlkZ2V9IDAK QEAgLTE3MCw3ICsxNzAsNyBAQCBhZGRfdG9fYnJpZGdlICgpIHsKICAgICBsb2NhbCBicmlkZ2U9 JDEKICAgICBsb2NhbCBkZXY9JDIKICAgICAjIERvbid0IGFkZCAkZGV2IHRvICRicmlkZ2UgaWYg aXQncyBhbHJlYWR5IG9uIGEgYnJpZGdlLgotICAgIGlmICEgYnJjdGwgc2hvdyB8IGdyZXAgLXEg JHtkZXZ9IDsgdGhlbgorICAgIGlmIFsgISAtZSAiL3N5cy9jbGFzcy9uZXQvKi9icmlmLyR7ZGV2 fSIgXTsgdGhlbgogCWJyY3RsIGFkZGlmICR7YnJpZGdlfSAke2Rldn0KICAgICBmaQogfQo= --=__Part705529F5.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part705529F5.0__=--