chiark / gitweb /
net-util: don't use libudev
authorTom Gundersen <teg@jklm.no>
Tue, 5 Nov 2013 00:35:26 +0000 (01:35 +0100)
committerTom Gundersen <teg@jklm.no>
Tue, 5 Nov 2013 00:39:46 +0000 (01:39 +0100)
Should fix linking with old toolchain.

src/shared/net-util.c
src/shared/net-util.h
src/udev/net/link-config.c

index c4cb3337ae7efe852cee9da1a304e74ed85bdc39..f853add1ec159cdf480b1f8e7133a6e33849c40d 100644 (file)
@@ -33,52 +33,48 @@ bool net_match_config(const struct ether_addr *match_mac,
                       const char *match_driver,
                       const char *match_type,
                       const char *match_name,
-                      struct udev_device *device) {
-        const char *property;
-
-        assert(device);
+                      const char *dev_mac,
+                      const char *dev_path,
+                      const char *dev_driver,
+                      const char *dev_type,
+                      const char *dev_name) {
 
         if (match_mac) {
-                property = udev_device_get_sysattr_value(device, "address");
-                if (!property || memcmp(match_mac, ether_aton(property), ETH_ALEN)) {
+                if (!dev_mac || memcmp(match_mac, ether_aton(dev_mac), ETH_ALEN)) {
                         log_debug("Interface MAC address (%s) did not match MACAddress=%s",
-                                  property, ether_ntoa(match_mac));
+                                  dev_mac, ether_ntoa(match_mac));
                         return 0;
                 }
         }
 
         if (match_path) {
-                property = udev_device_get_property_value(device, "ID_PATH");
-                if (!streq_ptr(match_path, property)) {
+                if (!streq_ptr(match_path, dev_path)) {
                         log_debug("Interface persistent path (%s) did not match Path=%s",
-                                  property, match_path);
+                                  dev_path, match_path);
                         return 0;
                 }
         }
 
         if (match_driver) {
-                property = udev_device_get_driver(device);
-                if (!streq_ptr(match_driver, property)) {
+                if (!streq_ptr(match_driver, dev_driver)) {
                         log_debug("Interface device driver (%s) did not match Driver=%s",
-                                  property, match_driver);
+                                  dev_driver, match_driver);
                         return 0;
                 }
         }
 
         if (match_type) {
-                property = udev_device_get_devtype(device);
-                if (!streq_ptr(match_type, property)) {
+                if (!streq_ptr(match_type, dev_type)) {
                         log_debug("Interface type (%s) did not match Type=%s",
-                                  property, match_type);
+                                  dev_type, match_type);
                         return 0;
                 }
         }
 
         if (match_name) {
-                property = udev_device_get_sysname(device);
-                if (!streq_ptr(match_name, property)) {
+                if (!streq_ptr(match_name, dev_name)) {
                         log_debug("Interface name (%s) did not match Name=%s",
-                                  property, match_name);
+                                  dev_name, match_name);
                         return 0;
                 }
         }
index 6b79a9cf801e0240e948e1b94789a645aad85c9f..54981725b0cf596b3d16701bcc3fc274891fd19c 100644 (file)
 #pragma once
 
 #include <netinet/ether.h>
-
-#include "udev.h"
+#include <stdbool.h>
 
 bool net_match_config(const struct ether_addr *match_mac,
                       const char *match_path,
                       const char *match_driver,
                       const char *match_type,
                       const char *match_name,
-                      struct udev_device *device);
+                      const char *dev_mac,
+                      const char *dev_path,
+                      const char *dev_driver,
+                      const char *dev_type,
+                      const char *dev_name);
 
 int config_parse_hwaddr(const char *unit, const char *filename, unsigned line,
                         const char *section, const char *lvalue, int ltype,
index d930afcc0753295e0b4650f841be0ac4cb86ec0b..9d0f23694c3d2039cb075f9f28294849dab2ecb3 100644 (file)
@@ -245,9 +245,14 @@ int link_config_get(link_config_ctx *ctx, struct udev_device *device, link_confi
         link_config *link;
 
         LIST_FOREACH(links, link, ctx->links) {
+
                 if (net_match_config(link->match_mac, link->match_path,
-                                     link->match_driver, link->match_type,
-                                     NULL, device)) {
+                                     link->match_driver, link->match_type, NULL,
+                                     udev_device_get_sysattr_value(device, "address"),
+                                     udev_device_get_property_value(device, "ID_PATH"),
+                                     udev_device_get_driver(device),
+                                     udev_device_get_devtype(device),
+                                     NULL)) {
                         log_debug("Config file %s applies to device %s",
                                   link->filename,
                                   udev_device_get_sysname(device));