tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: eliminate struct protosw::pr_output
Hi,
On 2016/01/17 8:57, Taylor R Campbell wrote:
> The ip_output function must be called as
>
> ip_output(m, opt, ro, flags, mopt, so)
>
> where the arguments have the types
>
> struct mbuf *m;
> struct mbuf *opt;
> struct route *ro;
> int flags;
> struct ip_moptions *mopt;
> struct socket *so;
>
> However, the prototype for ip_output is variadic:
>
> int ip_output(struct mbuf *, ...);
>
> This is silly. The only reason it is like this is that it is put in
> the pr_output member of a struct protosw somewhere -- and then never
> used via that path. There's no way you could use it if you didn't
> know the protocol you were using, so this pr_output member can't be
> used anyway unless you know a priori that you're in netinet. The same
> is true of every other pr_output routine.
>
> The only pr_output members that are ever actually used are (net/route)
> rtsock's and (netipsec) keysock's, via raw_send.
>
> The attached patch eliminates the pr_output member of struct protosw
> (and struct ip6protosw), and adds an explicit (fully typed) callback
> to raw_send for use by rtsock and keysock.
>
> A subsequent patch may give ip_output &c. fully typed prototypes and
> avoid varargs altogether, but I'll defer that for now. I would like
> to apply similar treatment to pr_input, but again in another (somewhat
> more involved) patch.
>
> Thoughts? Objections?
I agree. The patch looks good to me.
I think you could commit it.
Thanks,
--
//////////////////////////////////////////////////////////////////////
Internet Initiative Japan Inc.
Device Engineering Section,
Core Product Development Department,
Product Division,
Technology Unit
Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>
Home |
Main Index |
Thread Index |
Old Index