summaryrefslogtreecommitdiffstats
path: root/if.h
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-07-18 10:53:45 +0000
committerRoy Marples <roy@marples.name>2016-07-18 10:53:45 +0000
commitb277b424d0daa25cb3a75cd14131754635004603 (patch)
tree15b9b395fdce6e57c7ae6dc18108a2f3756cc1ee /if.h
parent6e2bd183a75a0cbf81173cbca04ab4be70b31b6f (diff)
downloaddhcpcd-b277b424d0daa25cb3a75cd14131754635004603.tar.xz
Add if_nametospec helper to decode and interface name such as bge1:2 into
device name, lun, ppa and driver name. Use this function when discovering addresesses and when they arrive via the kernel listening socket so they can be assigned to the correct physical interface. This change does also stop `dhcpcd eth0:1` working on Linux, but is needed for basic Solaris support.
Diffstat (limited to 'if.h')
-rw-r--r--if.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/if.h b/if.h
index 249dd2e4..a6a9c4fa 100644
--- a/if.h
+++ b/if.h
@@ -105,6 +105,20 @@ int if_domtu(const struct interface *, short int);
#define if_setmtu(ifp, mtu) if_domtu((ifp), (mtu))
int if_carrier(struct interface *);
+/*
+ * Helper to decode an interface name of bge0:1 to
+ * devname = bge0, drvname = bge0, ppa = 0, lun = 1.
+ * If ppa or lun are invalid they are set to -1.
+ */
+struct if_spec {
+ char ifname[IF_NAMESIZE];
+ char devname[IF_NAMESIZE];
+ char drvname[IF_NAMESIZE];
+ int ppa;
+ int lun;
+};
+int if_nametospec(const char *, struct if_spec *);
+
/* The below functions are provided by if-KERNEL.c */
int if_conf(struct interface *);
int if_init(struct interface *);