be consistent on naming advanced API functions; use ip6_XXXpktopt(s).

Submitted by:	Keiichi SHIMA <keiichi__at__iijlab.net>
Obtained from:	KAME
This commit is contained in:
Hajimu UMEMOTO 2005-07-21 15:06:32 +00:00
parent 8507acb169
commit d5e3406d06
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148242
5 changed files with 19 additions and 20 deletions

View File

@ -127,7 +127,7 @@ static int ip6_pcbopt __P((int, u_char *, int, struct ip6_pktopts **,
static int ip6_pcbopts __P((struct ip6_pktopts **, struct mbuf *,
struct socket *, struct sockopt *));
static int ip6_getpcbopt __P((struct ip6_pktopts *, int, struct sockopt *));
static int ip6_setpktoption __P((int, u_char *, int, struct ip6_pktopts *, int,
static int ip6_setpktopt __P((int, u_char *, int, struct ip6_pktopts *, int,
int, int, int));
static int ip6_setmoptions __P((int, struct ip6_moptions **, struct mbuf *));
@ -2358,7 +2358,7 @@ ip6_pcbopts(pktopt, m, so, sopt)
/* set options specified by user. */
if (td && !suser(td))
priv = 1;
if ((error = ip6_setpktoptions(m, opt, NULL, priv, 1,
if ((error = ip6_setpktopts(m, opt, NULL, priv, 1,
so->so_proto->pr_protocol)) != 0) {
ip6_clearpktopts(opt, -1); /* XXX: discard all options */
free(opt, M_IP6OPT);
@ -2373,7 +2373,7 @@ ip6_pcbopts(pktopt, m, so, sopt)
* the struct.
*/
void
init_ip6pktopts(opt)
ip6_initpktopts(opt)
struct ip6_pktopts *opt;
{
@ -2396,12 +2396,12 @@ ip6_pcbopt(optname, buf, len, pktopt, priv, uproto)
if (*pktopt == NULL) {
*pktopt = malloc(sizeof(struct ip6_pktopts), M_IP6OPT,
M_WAITOK);
init_ip6pktopts(*pktopt);
ip6_initpktopts(*pktopt);
(*pktopt)->needfree = 1;
}
opt = *pktopt;
return (ip6_setpktoption(optname, buf, len, opt, priv, 1, 0, uproto));
return (ip6_setpktopt(optname, buf, len, opt, priv, 1, 0, uproto));
}
static int
@ -2998,7 +2998,7 @@ ip6_freemoptions(im6o)
* Set IPv6 outgoing packet options based on advanced API.
*/
int
ip6_setpktoptions(control, opt, stickyopt, priv, needcopy, uproto)
ip6_setpktopts(control, opt, stickyopt, priv, needcopy, uproto)
struct mbuf *control;
struct ip6_pktopts *opt, *stickyopt;
int priv, needcopy, uproto;
@ -3023,7 +3023,7 @@ ip6_setpktoptions(control, opt, stickyopt, priv, needcopy, uproto)
RT_UNLOCK(opt->ip6po_nextroute.ro_rt);
}
} else
init_ip6pktopts(opt);
ip6_initpktopts(opt);
opt->needfree = needcopy;
/*
@ -3046,7 +3046,7 @@ ip6_setpktoptions(control, opt, stickyopt, priv, needcopy, uproto)
if (cm->cmsg_level != IPPROTO_IPV6)
continue;
error = ip6_setpktoption(cm->cmsg_type, CMSG_DATA(cm),
error = ip6_setpktopt(cm->cmsg_type, CMSG_DATA(cm),
cm->cmsg_len - CMSG_LEN(0), opt, priv, needcopy, 1, uproto);
if (error)
return (error);
@ -3065,7 +3065,7 @@ ip6_setpktoptions(control, opt, stickyopt, priv, needcopy, uproto)
* "sticky=1, cmsg=1": RFC2292 socket option
*/
static int
ip6_setpktoption(optname, buf, len, opt, priv, sticky, cmsg, uproto)
ip6_setpktopt(optname, buf, len, opt, priv, sticky, cmsg, uproto)
int optname, len, priv, sticky, cmsg, uproto;
u_char *buf;
struct ip6_pktopts *opt;
@ -3074,7 +3074,7 @@ ip6_setpktoption(optname, buf, len, opt, priv, sticky, cmsg, uproto)
if (!sticky && !cmsg) {
#ifdef DIAGNOSTIC
printf("ip6_setpktoption: impossible case\n");
printf("ip6_setpktopt: impossible case\n");
#endif
return (EINVAL);
}

View File

@ -366,9 +366,9 @@ int ip6_output __P((struct mbuf *, struct ip6_pktopts *,
struct inpcb *));
int ip6_ctloutput __P((struct socket *, struct sockopt *));
int ip6_raw_ctloutput __P((struct socket *, struct sockopt *));
void init_ip6pktopts __P((struct ip6_pktopts *));
int ip6_setpktoptions __P((struct mbuf *, struct ip6_pktopts *,
struct ip6_pktopts *, int, int, int));
void ip6_initpktopts __P((struct ip6_pktopts *));
int ip6_setpktopts __P((struct mbuf *, struct ip6_pktopts *,
struct ip6_pktopts *, int, int, int));
void ip6_clearpktopts __P((struct ip6_pktopts *, int));
struct ip6_pktopts *ip6_copypktopts __P((struct ip6_pktopts *, int));
int ip6_optlen __P((struct inpcb *));

View File

@ -126,7 +126,7 @@ mld6_init()
hbh_buf[5] = IP6OPT_RTALERT_LEN - 2;
bcopy((caddr_t)&rtalert_code, &hbh_buf[6], sizeof(u_int16_t));
init_ip6pktopts(&ip6_opts);
ip6_initpktopts(&ip6_opts);
ip6_opts.ip6po_hbh = hbh;
}

View File

@ -346,9 +346,8 @@ rip6_output(m, va_alist)
priv = 1;
dst = &dstsock->sin6_addr;
if (control) {
if ((error = ip6_setpktoptions(control, &opt,
stickyopt, priv, 0,
so->so_proto->pr_protocol))
if ((error = ip6_setpktopts(control, &opt,
stickyopt, priv, 0, so->so_proto->pr_protocol))
!= 0) {
goto bad;
}
@ -394,7 +393,7 @@ rip6_output(m, va_alist)
/*
* XXX Boundary check is assumed to be already done in
* ip6_setpktoptions().
* ip6_setpktopts().
*/
if (in6p->in6p_outputopts &&
(pi = in6p->in6p_outputopts->ip6po_pktinfo) &&

View File

@ -140,8 +140,8 @@ udp6_output(in6p, m, addr6, control, td)
if (td && !suser(td))
priv = 1;
if (control) {
if ((error = ip6_setpktoptions(control, &opt, stickyopt, priv,
0, IPPROTO_UDP)) != 0)
if ((error = ip6_setpktopts(control, &opt,
stickyopt, priv, 0, IPPROTO_UDP)) != 0)
goto release;
in6p->in6p_outputopts = &opt;
}