diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2011-04-02 11:52:45 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2011-04-02 11:52:45 +0000 |
commit | 0591db5a284e642ef83c413ac836604457c04e7d (patch) | |
tree | 7fd6086bb33362343d070c2a9177b899800b8771 /sys/net | |
parent | 65e0c33b1d21b4e1f2ac312e68ee8dfe74b3ca10 (diff) |
add a pipex ioctl that lets you specify a description on pppx interfaces by
session id.
ok claudio@ yasuoka@ as part of a larger diff
code from jonathan matthew
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_pppx.c | 24 | ||||
-rw-r--r-- | sys/net/pipex.h | 9 |
2 files changed, 31 insertions, 2 deletions
diff --git a/sys/net/if_pppx.c b/sys/net/if_pppx.c index 3cda2bfaf4c..347c22bbdf6 100644 --- a/sys/net/if_pppx.c +++ b/sys/net/if_pppx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pppx.c,v 1.5 2011/04/02 11:49:19 dlg Exp $ */ +/* $OpenBSD: if_pppx.c,v 1.6 2011/04/02 11:52:44 dlg Exp $ */ /* * Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org> @@ -166,6 +166,8 @@ int pppx_add_session(struct pppx_dev *, struct pipex_session_req *); int pppx_del_session(struct pppx_dev *, struct pipex_session_close_req *); +int pppx_set_session_descr(struct pppx_dev *, + struct pipex_session_descr_req *); void pppx_if_destroy(struct pppx_dev *, struct pppx_if *); void pppx_if_start(struct ifnet *); @@ -449,6 +451,11 @@ pppxioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) case PIPEXGCLOSED: error = pipex_get_closed((struct pipex_session_list_req *)addr); return (error); + + case PIPEXSIFDESCR: + error = pppx_set_session_descr(pxd, (struct pipex_session_descr_req *)addr); + return (error); + case FIONBIO: case FIOASYNC: case FIONREAD: @@ -918,6 +925,21 @@ pppx_del_session(struct pppx_dev *pxd, struct pipex_session_close_req *req) return (0); } +int +pppx_set_session_descr(struct pppx_dev *pxd, struct pipex_session_descr_req *req) +{ + struct pppx_if *pxi; + + pxi = pppx_if_find(pxd, req->pdr_session_id, req->pdr_protocol); + if (pxi == NULL) + return (EINVAL); + + (void)memset(pxi->pxi_if.if_description, 0, IFDESCRSIZE); + strlcpy(pxi->pxi_if.if_description, req->pdr_descr, IFDESCRSIZE); + + return (0); +} + void pppx_if_destroy(struct pppx_dev *pxd, struct pppx_if *pxi) { diff --git a/sys/net/pipex.h b/sys/net/pipex.h index dd16e476ec1..063ea59e596 100644 --- a/sys/net/pipex.h +++ b/sys/net/pipex.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pipex.h,v 1.7 2011/04/02 11:37:10 dlg Exp $ */ +/* $OpenBSD: pipex.h,v 1.8 2011/04/02 11:52:44 dlg Exp $ */ /* * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -145,6 +145,12 @@ struct pppx_hdr { u_int32_t pppx_id; }; +struct pipex_session_descr_req { + int pdr_protocol; /* tunnel protocol */ + uint16_t pdr_session_id; /* session-id */ + char pdr_descr[IFDESCRSIZE]; /* description */ +}; + /* PIPEX ioctls */ #define PIPEXSMODE _IOW ('p', 1, int) @@ -154,6 +160,7 @@ struct pppx_hdr { #define PIPEXCSESSION _IOW ('p', 5, struct pipex_session_config_req) #define PIPEXGSTAT _IOWR('p', 6, struct pipex_session_stat_req) #define PIPEXGCLOSED _IOR ('p', 7, struct pipex_session_list_req) +#define PIPEXSIFDESCR _IOW ('p', 8, struct pipex_session_descr_req) #ifdef _KERNEL |