Page MenuHomeFreeBSD

D40160.diff
No OneTemporary

D40160.diff

diff --git a/sbin/ifconfig/af_inet.c b/sbin/ifconfig/af_inet.c
--- a/sbin/ifconfig/af_inet.c
+++ b/sbin/ifconfig/af_inet.c
@@ -285,6 +285,13 @@
warn("SIOCSIFPHYADDR");
}
+static void
+in_set_vhid(int vhid)
+{
+ in_addreq.ifra_vhid = vhid;
+}
+
+
static struct afswtch af_inet = {
.af_name = "inet",
.af_af = AF_INET,
@@ -297,6 +304,7 @@
.af_postproc = in_postproc,
.af_status_tunnel = in_status_tunnel,
.af_settunnel = in_set_tunnel,
+ .af_setvhid = in_set_vhid,
.af_difaddr = SIOCDIFADDR,
.af_aifaddr = SIOCAIFADDR,
.af_ridreq = &in_ridreq,
diff --git a/sbin/ifconfig/af_inet6.c b/sbin/ifconfig/af_inet6.c
--- a/sbin/ifconfig/af_inet6.c
+++ b/sbin/ifconfig/af_inet6.c
@@ -555,6 +555,12 @@
warn("SIOCSIFPHYADDR_IN6");
}
+static void
+in6_set_vhid(int vhid)
+{
+ in6_addreq.ifra_vhid = vhid;
+}
+
static struct cmd inet6_cmds[] = {
DEF_CMD_ARG("prefixlen", setifprefixlen),
DEF_CMD("anycast", IN6_IFF_ANYCAST, setip6flags),
@@ -605,6 +611,7 @@
.af_postproc = in6_postproc,
.af_status_tunnel = in6_status_tunnel,
.af_settunnel = in6_set_tunnel,
+ .af_setvhid = in6_set_vhid,
.af_difaddr = SIOCDIFADDR_IN6,
.af_aifaddr = SIOCAIFADDR_IN6,
.af_ridreq = &in6_addreq,
diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c
--- a/sbin/ifconfig/carp.c
+++ b/sbin/ifconfig/carp.c
@@ -111,31 +111,9 @@
errx(1, "vhid must be greater than 0 and less than %u",
CARP_MAXVHID);
- switch (afp->af_af) {
-#ifdef INET
- case AF_INET:
- {
- struct in_aliasreq *ifra;
-
- ifra = (struct in_aliasreq *)afp->af_addreq;
- ifra->ifra_vhid = carpr_vhid;
- break;
- }
-#endif
-#ifdef INET6
- case AF_INET6:
- {
- struct in6_aliasreq *ifra;
-
- ifra = (struct in6_aliasreq *)afp->af_addreq;
- ifra->ifra_vhid = carpr_vhid;
- break;
- }
-#endif
- default:
+ if (afp->af_setvhid == NULL)
errx(1, "%s doesn't support carp(4)", afp->af_name);
- }
-
+ afp->af_setvhid(carpr_vhid);
callback_register(setcarp_callback, NULL);
}
diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h
--- a/sbin/ifconfig/ifconfig.h
+++ b/sbin/ifconfig/ifconfig.h
@@ -161,6 +161,7 @@
struct snl_state *ss; /* NETLINK_ROUTE snl(3) socket */
};
+typedef void af_setvhid_f(int vhid);
typedef void af_status_nl_f(struct ifconfig_args *args, struct io_handler *h,
if_link_t *link, if_addr_t *ifa);
@@ -188,6 +189,7 @@
void (*af_getprefix)(const char *, int);
void (*af_postproc)(int s, const struct afswtch *,
int newaddr, int ifflags);
+ af_setvhid_f *af_setvhid; /* Set CARP vhid for an address */
u_long af_difaddr; /* set dst if address ioctl */
u_long af_aifaddr; /* set if address ioctl */
void *af_ridreq; /* */

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 12:26 PM (21 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14738385
Default Alt Text
D40160.diff (2 KB)

Event Timeline