Index: src/NpgsqlTypes/NpgsqlDbType.cs
===================================================================
RCS file: /cvsroot/npgsql/Npgsql2/src/NpgsqlTypes/NpgsqlDbType.cs,v
retrieving revision 1.15
diff -u -r1.15 NpgsqlDbType.cs
--- src/NpgsqlTypes/NpgsqlDbType.cs	15 Feb 2010 21:08:34 -0000	1.15
+++ src/NpgsqlTypes/NpgsqlDbType.cs	28 Mar 2011 12:48:22 -0000
@@ -59,7 +59,7 @@
 		Timestamp,
 		Varchar,
 		Refcursor,
-		Inet,
+        Inet,
 		Bit,
 		TimestampTZ,
 		Uuid,
@@ -68,6 +68,7 @@
 		Interval,
 		TimeTZ,
         Name,
-        Abstime
+        Abstime,
+        MacAddr
 	}
 }
Index: src/NpgsqlTypes/NpgsqlTypeConverters.cs
===================================================================
RCS file: /cvsroot/npgsql/Npgsql2/src/NpgsqlTypes/NpgsqlTypeConverters.cs,v
retrieving revision 1.20
diff -u -r1.20 NpgsqlTypeConverters.cs
--- src/NpgsqlTypes/NpgsqlTypeConverters.cs	24 Oct 2010 19:32:58 -0000	1.20
+++ src/NpgsqlTypes/NpgsqlTypeConverters.cs	28 Mar 2011 14:26:27 -0000
@@ -249,7 +249,7 @@
 
 		/// <summary>
 		/// Convert to a postgresql boolean.
-		/// </summary>
+		/// </summary>
         internal static String ToBoolean(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			return ((bool)NativeData) ? "TRUE" : "FALSE";
@@ -257,7 +257,7 @@
 
 		/// <summary>
 		/// Convert to a postgresql bit.
-		/// </summary>
+		/// </summary>
         internal static String ToBit(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 		    if(NativeData is bool)
@@ -283,7 +283,7 @@
 
 		/// <summary>
 		/// Convert to a postgresql timestamp.
-		/// </summary>
+		/// </summary>
         internal static String ToDateTime(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			if (!(NativeData is DateTime))
@@ -303,7 +303,7 @@
 
 		/// <summary>
 		/// Convert to a postgresql date.
-		/// </summary>
+		/// </summary>
         internal static String ToDate(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			if (!(NativeData is DateTime))
@@ -315,7 +315,7 @@
 
 		/// <summary>
 		/// Convert to a postgresql time.
-		/// </summary>
+		/// </summary>
         internal static String ToTime(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			if (!(NativeData is DateTime))
@@ -330,16 +330,16 @@
 
 		/// <summary>
 		/// Convert to a postgres money.
-		/// </summary>
+		/// </summary>
         internal static String ToMoney(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 		    //Formats accepted vary according to locale, but it always accepts a plain number (no currency or
 		    //grouping symbols) passed as a string (with the appropriate cast appended, as UseCast will cause
 		    //to happen.
 			return ((IFormattable)NativeData).ToString(null, CultureInfo.InvariantCulture.NumberFormat);
-		}
-
-
+		}
+
+
         internal static string ToBasicType<T>(NpgsqlNativeTypeInfo TypeInfo, object NativeData, Boolean ForExtendedQuery)
         {
             // This double cast is needed in order to get the enum type handled correctly (IConvertible)
@@ -503,6 +503,14 @@
 		{
 			return new NpgsqlInet(BackendData);
 		}
+
+        /// <summary>
+        /// MAC Address.
+        /// </summary>
+        internal static Object ToMacAddress(NpgsqlBackendTypeInfo TypeInfo, String BackendData, Int16 TypeSize, Int32 TypeModifier)
+        {
+            return new NpgsqlMacAddress(BackendData);
+        }
 		
         internal static Object ToGuid(NpgsqlBackendTypeInfo TypeInfo, String BackendData, Int16 TypeSize, Int32 TypeModifier)
         {
@@ -554,7 +562,7 @@
 	{
 		/// <summary>
 		/// Point.
-		/// </summary>
+		/// </summary>
         internal static String ToPoint(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			if (NativeData is NpgsqlPoint)
@@ -570,7 +578,7 @@
 
 		/// <summary>
 		/// Box.
-		/// </summary>
+		/// </summary>
         internal static String ToBox(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			/*if (NativeData.GetType() == typeof(Rectangle)) {
@@ -595,7 +603,7 @@
 
 		/// <summary>
 		/// LSeg.
-		/// </summary>
+		/// </summary>
         internal static String ToLSeg(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			NpgsqlLSeg S = (NpgsqlLSeg)NativeData;
@@ -604,7 +612,7 @@
 
 		/// <summary>
 		/// Open path.
-		/// </summary>
+		/// </summary>
         internal static String ToPath(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			StringBuilder B = null;
@@ -629,7 +637,7 @@
 
 		/// <summary>
 		/// Polygon.
-		/// </summary>
+		/// </summary>
         internal static String ToPolygon(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			StringBuilder B = new StringBuilder();
@@ -644,7 +652,7 @@
 
 		/// <summary>
 		/// Circle.
-		/// </summary>
+		/// </summary>
         internal static String ToCircle(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			NpgsqlCircle C = (NpgsqlCircle)NativeData;
@@ -653,7 +661,7 @@
 
 		/// <summary>
 		/// Convert to a postgres inet.
-		/// </summary>
+		/// </summary>
         internal static String ToIPAddress(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			if (NativeData is NpgsqlInet)
@@ -661,20 +669,31 @@
 				return ((NpgsqlInet)NativeData).ToString();
 			}
 			return NativeData.ToString();
-
 		}
 
+        /// <summary>
+        /// Convert to a postgres MAC Address.
+        /// </summary>
+        internal static String ToMacAddress(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
+        {
+            if (NativeData is NpgsqlMacAddress)
+            {
+                return ((NpgsqlMacAddress)NativeData).ToString();
+            }
+            return NativeData.ToString();
+        }
+
 		/// <summary>
 		/// Convert to a postgres interval
-		/// </summary>
+		/// </summary>
         internal static String ToInterval(NpgsqlNativeTypeInfo TypeInfo, Object NativeData, Boolean ForExtendedQuery)
 		{
 			return
 				((NativeData is TimeSpan)
 					? ((NpgsqlInterval)(TimeSpan)NativeData).ToString()
 					: ((NpgsqlInterval)NativeData).ToString());
-		}
-
+		}
+
         internal static string ToTime(NpgsqlNativeTypeInfo typeInfo, object nativeData, Boolean ForExtendedQuery)
 		{
 			if (nativeData is DateTime)
@@ -691,8 +710,8 @@
 				time = (NpgsqlTime)nativeData;
 			}
 			return time.ToString();
-		}
-
+		}
+
         internal static string ToTimeTZ(NpgsqlNativeTypeInfo typeInfo, object nativeData, Boolean ForExtendedQuery)
 		{
 			if (nativeData is DateTime)
@@ -709,8 +728,8 @@
 				time = (NpgsqlTimeTZ)nativeData;
 			}
 			return time.ToString();
-		}
-
+		}
+
         internal static string ToDate(NpgsqlNativeTypeInfo typeInfo, object nativeData, Boolean ForExtendedQuery)
 		{
 			if (nativeData is DateTime)
@@ -721,8 +740,8 @@
 			{
 				return nativeData.ToString();
 			}
-		}
-
+		}
+
         internal static string ToTimeStamp(NpgsqlNativeTypeInfo typeInfo, object nativeData, Boolean ForExtendedQuery)
 		{
 			if (nativeData is DateTime)
Index: src/NpgsqlTypes/NpgsqlTypes.cs
===================================================================
RCS file: /cvsroot/npgsql/Npgsql2/src/NpgsqlTypes/NpgsqlTypes.cs,v
retrieving revision 1.14
diff -u -r1.14 NpgsqlTypes.cs
--- src/NpgsqlTypes/NpgsqlTypes.cs	18 Aug 2010 03:19:58 -0000	1.14
+++ src/NpgsqlTypes/NpgsqlTypes.cs	28 Mar 2011 14:51:41 -0000
@@ -31,6 +31,7 @@
 using System.Collections;
 using System.Collections.Generic;
 using System.Net;
+using System.Net.NetworkInformation;
 using Npgsql;
 
 namespace NpgsqlTypes
@@ -688,4 +689,84 @@
             return !(x == y);
         }
     }
+
+    /// <summary>
+    /// Represents a PostgreSQL MacAddress type.
+    /// </summary>
+    public struct NpgsqlMacAddress : IEquatable<NpgsqlMacAddress>
+    {
+        public PhysicalAddress macAddr;
+
+        public NpgsqlMacAddress(PhysicalAddress macAddr)
+        {
+            this.macAddr = macAddr;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="macAddr">The macAddr parameter must contain a string that can only consist of numbers
+        /// and upper-case letters as hexadecimal digits. (See PhysicalAddress.Parse method on MSDN)</param>
+        public NpgsqlMacAddress(string macAddr)
+        {
+            if (!string.IsNullOrEmpty(macAddr))
+            {
+                string lowerMacAddr = macAddr.ToUpper();
+                System.Text.StringBuilder sb = new System.Text.StringBuilder();
+                foreach (char c in lowerMacAddr)
+                {
+                    if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F'))
+                    {
+                        sb.Append(c);
+                    }
+                }
+                this.macAddr = PhysicalAddress.Parse(sb.ToString());
+            }
+            else
+            {
+                this.macAddr = PhysicalAddress.None;
+            }
+        }
+
+        public override String ToString()
+        {
+            return macAddr.ToString();
+        }
+
+        public static explicit operator PhysicalAddress(NpgsqlMacAddress x)
+        {
+            return x.macAddr;
+        }
+
+        public static implicit operator NpgsqlMacAddress(PhysicalAddress macAddr)
+        {
+            return new NpgsqlMacAddress(macAddr);
+        }
+
+        public bool Equals(NpgsqlMacAddress other)
+        {
+            return macAddr.Equals(other.macAddr);
+        }
+
+        public override bool Equals(object obj)
+        {
+            return obj != null && obj is NpgsqlMacAddress && Equals((NpgsqlMacAddress)obj);
+        }
+
+        public override int GetHashCode()
+        {
+            int ret = 266370105;  //seed with something other than zero to make paths of all zeros hash differently.
+            return PGUtil.RotateShift(macAddr.GetHashCode(), ret);
+        }
+
+        public static bool operator ==(NpgsqlMacAddress x, NpgsqlMacAddress y)
+        {
+            return x.Equals(y);
+        }
+
+        public static bool operator !=(NpgsqlMacAddress x, NpgsqlMacAddress y)
+        {
+            return !(x == y);
+        }
+    }
 }
Index: src/NpgsqlTypes/NpgsqlTypesHelper.cs
===================================================================
RCS file: /cvsroot/npgsql/Npgsql2/src/NpgsqlTypes/NpgsqlTypesHelper.cs,v
retrieving revision 1.37
diff -u -r1.37 NpgsqlTypesHelper.cs
--- src/NpgsqlTypes/NpgsqlTypesHelper.cs	18 Aug 2010 03:19:58 -0000	1.37
+++ src/NpgsqlTypes/NpgsqlTypesHelper.cs	28 Mar 2011 13:19:48 -0000
@@ -29,6 +29,7 @@
 using System.Data;
 using System.Globalization;
 using System.Net;
+using System.Net.NetworkInformation;
 using System.Reflection;
 using System.Resources;
 using System.Text;
@@ -426,6 +427,12 @@
 			nativeTypeMapping.AddTypeAlias("inet", typeof (IPAddress));
 			nativeTypeMapping.AddTypeAlias("inet", typeof (NpgsqlInet));
 
+            nativeTypeMapping.AddType("macaddr", NpgsqlDbType.MacAddr, DbType.Object, true,
+                                      new ConvertNativeToBackendHandler(ExtendedNativeToBackendTypeConverter.ToMacAddress));
+
+            nativeTypeMapping.AddTypeAlias("macaddr", typeof(PhysicalAddress));
+            nativeTypeMapping.AddTypeAlias("macaddr", typeof(NpgsqlMacAddress));
+
 			nativeTypeMapping.AddType("uuid", NpgsqlDbType.Uuid, DbType.Guid, true, null);
 			nativeTypeMapping.AddTypeAlias("uuid", typeof (Guid));
 
@@ -493,6 +500,12 @@
                                           typeof(IPAddress),
                                           ipaddress => (IPAddress)(NpgsqlInet)ipaddress, 
                                           npgsqlinet => (npgsqlinet is IPAddress ? (NpgsqlInet)(IPAddress) npgsqlinet : npgsqlinet));
+            yield return
+                new NpgsqlBackendTypeInfo(0, "macaddr", NpgsqlDbType.MacAddr, DbType.Object, typeof(NpgsqlMacAddress),
+                                          new ConvertBackendToNativeHandler(ExtendedBackendToNativeTypeConverter.ToMacAddress),
+                                          typeof(PhysicalAddress),
+                                          macAddress => (PhysicalAddress)(NpgsqlMacAddress)macAddress,
+                                          npgsqlmacaddr => (npgsqlmacaddr is PhysicalAddress ? (NpgsqlMacAddress)(PhysicalAddress)npgsqlmacaddr : npgsqlmacaddr));
 
 			yield return
 				new NpgsqlBackendTypeInfo(0, "money", NpgsqlDbType.Money, DbType.Currency, typeof (Decimal),
Index: src/Npgsql/NpgsqlConnector.cs
===================================================================
RCS file: /cvsroot/npgsql/Npgsql2/src/Npgsql/NpgsqlConnector.cs,v
retrieving revision 1.33
diff -u -r1.33 NpgsqlConnector.cs
--- src/Npgsql/NpgsqlConnector.cs	15 Mar 2011 01:06:20 -0000	1.33
+++ src/Npgsql/NpgsqlConnector.cs	28 Mar 2011 13:00:39 -0000
@@ -750,26 +750,26 @@
                 // This is using string concatenation because set search_path doesn't allow type casting. ::text    
                 NpgsqlCommand commandSearchPath = new NpgsqlCommand("SET SEARCH_PATH=" + settings.SearchPath, this);
                 commandSearchPath.ExecuteBlind();
-            }
-
+            }
+
             /*
              * Try to set SSL negotiation to 0. As of 2010-03-29, recent problems in SSL library implementations made
              * postgresql to add a parameter to set a value when to do this renegotiation or 0 to disable it.
              * Currently, Npgsql has a problem with renegotiation so, we are trying to disable it here.
              * This only works on postgresql servers where the ssl renegotiation settings is supported of course.
              * See http://lists.pgfoundry.org/pipermail/npgsql-devel/2010-February/001065.html for more information.
-             */
-
-            try
-            {
-                NpgsqlCommand commandSslrenegotiation = new NpgsqlCommand("SET ssl_renegotiation_limit=0", this);
-                commandSslrenegotiation.ExecuteBlind();
-
-            }
-            catch {}
-
-
-
+             */
+
+            try
+            {
+                NpgsqlCommand commandSslrenegotiation = new NpgsqlCommand("SET ssl_renegotiation_limit=0", this);
+                commandSslrenegotiation.ExecuteBlind();
+
+            }
+            catch {}
+
+
+
             // Make a shallow copy of the type mapping that the connector will own.
             // It is possible that the connector may add types to its private
             // mapping that will not be valid to another connector, even
Index: testsuite/noninteractive/NUnit20/TypesTests.cs
===================================================================
RCS file: /cvsroot/npgsql/Npgsql2/testsuite/noninteractive/NUnit20/TypesTests.cs,v
retrieving revision 1.9
diff -u -r1.9 TypesTests.cs
--- testsuite/noninteractive/NUnit20/TypesTests.cs	8 Jan 2010 02:32:58 -0000	1.9
+++ testsuite/noninteractive/NUnit20/TypesTests.cs	28 Mar 2011 15:32:52 -0000
@@ -608,5 +608,17 @@
             Assert.AreEqual(1, timetz.LocalTime.Milliseconds);
 
         }
+        
+        [Test]
+        public void NpgsqlMacAddress()
+        {
+            System.Net.NetworkInformation.PhysicalAddress local = System.Net.NetworkInformation.PhysicalAddress.Parse("012345ABCDEF");
+            NpgsqlMacAddress mac = new NpgsqlMacAddress(local);
+
+            NpgsqlMacAddress mac2 = new NpgsqlMacAddress("01:23-45-aB,cD.eF");
+
+            Assert.AreEqual(mac, mac2);
+            Assert.AreEqual(mac.ToString(), mac2.ToString());
+        }
 	}
 }

