From: Claudio Jeker <[email protected]> Date: Wed, 13 Feb 2019 14:25:58 +0100
> On Wed, Feb 13, 2019 at 11:04:02AM +0900, Masato Asou wrote: >> Hi, >> >> When I execute `ifconfig media XX -mediaopt YY' command, it occured >> error as below. >> >> $ doas ifconfig em1 media 100baseTX -mediaopt full-duplex >> ifconfig: may not issue both `media' and `-mediaopt' >> $ echo $? >> 1 >> >> Does anyone knows this reason? > > This was done to prevent changing mediaopt while changing media at the > same time. Media and mediaopt are linked together and ifconfig fetches > the initial settings early on. Changing media and mediaopt at the same > time may end up with a results that puts the interface into an invalid > state. Thanks for your explanation. However, media and mediaopt (not `-') can specfy same time. Does this work valid? > Is there a particular reason why you need to use media and > -mediaopt at the same time? I have no particular reason. I just thiking that way. If specified media and -media same time, I only execute one command. >> I think following patch is works fine. >> >> $ cvs diff ifconfig.c >> Index: ifconfig.c >> =================================================================== >> RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v >> retrieving revision 1.379 >> diff -u -p -r1.379 ifconfig.c >> --- ifconfig.c 30 Sep 2018 18:19:24 -0000 1.379 >> +++ ifconfig.c 13 Feb 2019 01:58:18 -0000 >> @@ -2797,10 +2797,6 @@ unsetmediaopt(const char *val, int d) >> if (actions & A_MEDIAOPTCLR) >> errx(1, "only one `-mediaopt' command may be issued"); >> >> - /* May not issue `media' and `-mediaopt'. */ >> - if (actions & A_MEDIA) >> - errx(1, "may not issue both `media' and `-mediaopt'"); >> - >> /* >> * No need to check for A_MEDIAINST, since the test for A_MEDIA >> * implicitly checks for A_MEDIAINST. >> -- >> ASOU Masato >> > > -- > :wq Claudio -- ASOU Masato
