Page MenuHomeFreeBSD

Add support for protocol prefixes in rootpath
AbandonedPublic

Authored by kczekirda on May 22 2017, 12:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 14, 7:24 PM
Unknown Object (File)
Tue, Oct 14, 7:24 PM
Unknown Object (File)
Tue, Oct 14, 8:28 AM
Unknown Object (File)
Mon, Oct 13, 6:08 PM
Unknown Object (File)
Sun, Oct 12, 1:34 PM
Unknown Object (File)
Tue, Sep 30, 2:14 AM
Unknown Object (File)
Sun, Sep 21, 1:55 AM
Unknown Object (File)
Tue, Sep 16, 10:57 AM
Subscribers

Details

Summary

If rootpath starts with protocol prefix, then set them.

Sponsored by: Oktawave
Relnote: Yes

Test Plan

valid rootpaths:

"/tftproot"
"192.168.1.1:/tftproot"
"tftp:///tftproot"
"tftp://192.168.1.1:/tftproot"

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/boot/common/dev_net.c
395

I would suggest something a bit more generic;

struct root_path_prefix {

const char *rp_prefix;
int rp_netproto;

}

make an array of the values, and in the code just walk the array based on nitems().

rgrimes added a subscriber: rgrimes.

I have no problem with this code going in as it is here, it can be evolved with a table post commit.

sys/boot/common/dev_net.c
395

I like this idea of array of protocols, but I think we should only walk that if there is a :// in the string, then if we do not find a match in the table return an error that the protocol is not (yet) supported?

This revision is now accepted and ready to land.May 22 2017, 4:19 PM
sys/boot/common/dev_net.c
395

I'd just walk the table, then check ip:/path and then just fall back to tftp (as default). I mean, its not like we will get huge table and the rootpath is set only at the very beginning anyhow.

I don't like the current approach as it is not a valid URI parser

for example with that approach tftp://ip/something will not work
or tftp:/something will not work either.

tftp://192.168.1.1:/tftproot is weird

I would accept tftp://<ip>/path or tftp:/path

and only keep <ip>:/path for compatibility for nfs

In the futur with http we will want http://ip[:port]/path so the format