From: Michal Novotny <minovotn@redhat.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] Disallow bogus MAC addresses when creating new VIF devices
Date: Mon, 23 Mar 2009 11:46:24 +0100 [thread overview]
Message-ID: <49C76880.9040903@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 538 bytes --]
Hello everybody,
I have created a patch to disallow bogus MAC addresses when attaching
new network interface. This checks the device type in device_create()
function and when it's 'vif' interface, it finds mac address and tries
to match it using regular expression. If the expression can't be matched
(ie. no valid MAC address has been provided), the error is returned and
entry about attempt to create a virtual network device with bogus MAC
address is written to the log file.
Signed-off-by: Michal Novotny <minovotn@redhat.com>
[-- Attachment #2: xen-disallow-bogus-mac-addr.patch --]
[-- Type: text/plain, Size: 933 bytes --]
diff -r 0477f9061c8a tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Fri Mar 20 17:42:46 2009 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Mon Mar 23 11:39:53 2009 +0100
@@ -723,6 +723,13 @@
dev_config_dict = self.info['devices'][dev_uuid][1]
log.debug("XendDomainInfo.device_create: %s" % scrub_password(dev_config_dict))
+ if dev_type == 'vif':
+ for x in dev_config:
+ if x != 'vif' and x[0] == 'mac':
+ if not re.match('^([0-9a-f]{2}:){5}[0-9a-f]{2}$', x[1], re.I):
+ log.error("Virtual network interface creation error - invalid MAC Address entered: %s", x[1])
+ raise VmError("Cannot create a new virtual network interface - MAC address is not valid!");
+
if self.domid is not None:
try:
dev_config_dict['devid'] = devid = \
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2009-03-23 10:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=49C76880.9040903@redhat.com \
--to=minovotn@redhat.com \
--cc=xen-devel@lists.xensource.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.